Автор Тема: Как вставить PHP  (Прочитано 8255 раз)

Оффлайн delasker

  • Пользователь
  • **
  • Сообщений: 73
    • Просмотр профиля
Re: Как вставить PHP
« Ответ #15 : Мая 21, 2013, 09:29:16 am »
Видимо личные сообщения не проходят. Прошу помощи и личного вмешательства у Юрия и Сергея. Сам сделать явно не могу. Вот лог
[16.05.13 14:11] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:11] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:11] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:11] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:11] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:11] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:14] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:14] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:14] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:14] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:16] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[16.05.13 14:18] Error require_once(/home/o/overalru/spec/public_html./linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:18] Error require_once(/home/o/overalru/spec/public_html./linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:18] Error require_once(/home/o/overalru/spec/public_html./linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:18] Error require_once(/home/o/overalru/spec/public_html./linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:18] Error require_once(/home/o/overalru/spec/public_html./linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:18] Error require_once(/home/o/overalru/spec/public_html./linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:19] Error require_once(/home/o/overalru/spec/public_html../linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:19] Error require_once(/home/o/overalru/spec/public_html../linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:19] Error require_once(/home/o/overalru/spec/public_html../linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:19] Error require_once(/home/o/overalru/spec/public_html../linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:41] Error require_once(spp37.ru/linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:41] Error require_once(spp37.ru/linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:41] Error require_once(spp37.ru/linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:41] Error require_once(spp37.ru/linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:41] Error require_once(spp37.ru/linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[16.05.13 14:41] Error require_once(spp37.ru/linksbase/advert.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 2)
[20.05.13 15:35] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)
[20.05.13 15:35] Error filemtime() [<a href='function.filemtime'>function.filemtime</a>]: stat failed for /home/o/overalru/spec/public_html/css/css_spec/includes/advert.db (code: 2) in /home/o/overalru/spec/public_html/css/css_spec/includes/advert.php (line: 54)

Оффлайн Юрий

  • Старожил
  • ****
  • Сообщений: 322
    • Просмотр профиля
    • Во-Сток
Re: Как вставить PHP
« Ответ #16 : Мая 21, 2013, 04:06:13 pm »
<?php

function GetContent$url )
{
$server strtolowerpreg_replace ("~^(?:http://|//)?(?:[a-z0-9\-_]+\.)*([a-z0-9\-_]+\.[a-z0-9\-_]+).*?$~is""$1"$url ) );
$host strtolowerpreg_replace ("~^(?:http://|//)?((?:[a-z0-9\-_]+\.)+[a-z0-9\-_]+).*?$~is""$1"$url ) );
$ruri preg_replace ("~^(?:http://)?(?:[a-z0-9\-_]+\.)+[a-z0-9\-_]+(.*)$~is""$1"$url );

$socket = @fsockopen$server80$errno$errstr) or $socket false;

if (!$socket)
return @file_get_contents ($url);

$request "GET " $ruri " HTTP/1.0\r\n";
$request .= "Host: " $host "\r\n";
$request .= "Accept: text/html, application/xml;q=0.9, */*;q=0.1\r\n";
$request .= "Accept-Charset: windows-1251, utf-8;q=0.6, *;q=0.1\r\n";
$request .= "Accept-Encoding: deflate, identity, *;q=0\r\n";
$request .= "Accept-Language: ru\r\n";
$request .= "Connection: close\r\n";
$request .= "Keep-Alive: 300\r\n";
$request .= "Expires: Thu, 01 Jan 1970 00:00:01 GMT\r\n";
$request .= "Cache-Control: no-store, no-cache, must-revalidate\r\n";
$request .= "Pragma: no-cache\r\n";
$request .= "Cookie: income=1\r\n";
//$request .= "Referer: http://" . $ref . "/\r\n";
$request .= "User-Agent: Mozilla/5.0 (compatible; MSIE 6.0; Windows 98)\r\n";
$request .= "\r\n";
fputs($socket$request);

$fcont "";
while ($line = @fgets ($socket1024))
$fcont .= $line;

fclose($socket);

$pos strpos $fcont"\r\n\r\n" );
if ($pos !== false)
$fcont substr $fcont$pos );

if (!$fcont)
$fcont = @file_get_contents ($url);

return $fcont;
}

function 
GetAdvert()
{
$m_host $_SERVER['HTTP_HOST'];
$m_ruri $_SERVER['REQUEST_URI'];

$dbfile dirname(__FILE__)."/advert.db";
if (isset($_GET['cleardbfile'])) @unlink ($dbfile);
$ftime = (file_exists($dbfile) ? filemtime$dbfile ):0);
$elapsed time() - $ftime 3600;

//Если данные устарели, обновляем
if ($elapsed)
{
$fcont = @GetContent("http://linksbase.ru/links/".$m_host) or $fcont "";
//@file_put_contents( $dbfile, $fcont );


$fptr fopen($dbfile"w");
@fwrite($fptr$fcont);
@fclose($fptr);
}
else
$fcont = @file_get_contents$dbfile );

$links "<!--linksbase-->";

$uricell "#uri:#always#lnk:#";
$pos strpos $fcont$uricell );
if ($pos !== false)
{
$pos += strlen $uricell );
$end strpos $fcont"#uri:#"$pos );
$end = ($end !== false) ? $end strlen ($fcont);
$links substr $fcont$pos$end-$pos );
}

$uricell "#uri:#".$m_ruri."#lnk:#";
$pos strpos $fcont$uricell );
if ($pos !== false)
{
$pos += strlen $uricell );
$end strpos $fcont"#uri:#"$pos );
$end = ($end !== false) ? $end strlen ($fcont);
$links substr $fcont$pos$end-$pos );
}

//Выводим текст
return $links;
}


$smarty->assign("GetAdvert",GetAdvert()); 

?>
Попробуйте так. Но честно говоря скрипт  не совсем понятный...