Просмотр файла piram/say.php

Размер файла: 3Kb
<?php

$title='Пирамида ссылок';
require"../system/config.php";
require"../system/functions.php";
require"../system/head.php";
require"../system/error.php";
echo'<div class="i">'.$title.'</div>';
echo $_COOKIE['cooklogineds']; echo $_COOKIE['cookpasseds'];






session_start();
//$_SESSION['close_door']='';
if (empty($_POST['link']) or empty($_POST['text']) or $_POST['link']=='http://') {
list($generic_msec,$generic_sec)=explode(chr('32'),microtime());
$generic_time=$generic_sec+$generic_msec;




echo'<div class="header"><center>Форма ввода<br /></center></div>
<div class="row_easy">
<form method="post">
Адрес сайта:<br />
<input class="button" type="text" name="link" value="http://"
/><br />
Описание:<br />
<textarea class="button" cols="25" rows="2" name="text"></textarea><br />
<input class="form_go" type="submit" value="Добавить" />
</form></div>
';
echo '<p>
 <img src="'.$dirsite.'/design/default/act.gif" alt="-"> <a href="index.php">К ссылкам</a><br />

</p>
';
list($generic_newmsec,$generic_newsec)=explode(chr('32'),microtime());
echo '<!-- // end body -->
<br />
</body></html>';
} elseif (empty($_SESSION['close_door'])) {
$file=@file('base.txt');
$count=count($file);
$text=trim($_POST['text']);
$link=trim($_POST['link']);
$text=substr($text,0,255);
$link=substr($link,0,255);
$text=str_replace('|','I',$text);
$link=str_replace('|','I',$link);
$link=htmlspecialchars($link);
$text=htmlspecialchars($text);
$text=str_replace(array("\r\n","\n","
"),'<br />',$text);
$link=str_replace(array("\r\n","\n","
"," "),'',$link);
$link=str_ireplace('http://','',$link);
$text=preg_replace('|\:\-\)|','<img src="ab.gif" alt=":-)"/>',$text,1);
$text=preg_replace('|\:\)|','<img src="ab.gif" alt=":)"/>',$text,1);
$text=preg_replace('|\=\)|','<img src="ab.gif" alt="=)"/>',$text,1);
$text=preg_replace('|\:\-\(|','<img src="ac.gif" alt=":-("/>',$text,1);
$text=preg_replace('|\:\(|','<img src="ac.gif" alt=":("/>',$text,1);
$text=preg_replace('|\;\(|','<img src="ac.gif" alt=";("/>',$text,1);
$text=preg_replace('|\;\-\)|','<img src="ad.gif" alt=";-)"/>',$text,1);
$text=preg_replace('|\;\)|','<img src="ad.gif" alt=";)"/>',$text,1);
$text=preg_replace('|\:\-D|','<img src="ag.gif" alt=":-D"/>',$text,1);
$text=preg_replace('|\:D|','<img src="ag.gif" alt=":D"/>',$text,1);
if ($count>5) {
unset($file[0]);
file_put_contents('base.txt',$file);
$count=$count-1;
}
$prov=3;
$error=0;
if ($count>0) {
for($i=0; $i<$prov; $i++) {
$count--;
$str=trim($file[$count]);
$arr=explode("|",$str);
if ($link==$arr[0]) {
$error=1;
$_SESSION['text']='Гражданин, Вы спаммер!<br />';
break;
}
if ($count==0) { break; }
}}
if ($fopen=fopen('base.txt','a') and empty($error)) {
fputs($fopen,"$link|$text\r\n");
fclose($fopen);
$_SESSION['text']='Ссылка добавлена!<br />';
$_SESSION['close_door']=1;
}
header ("location: index.php");
} else {
$_SESSION['text']='Пишите ссылку один раз!<br />';
header ("location: index.php");
}


require"../system/foot.php";
?>