�������: $date - $time";
return true;}
// --�����������--
if (isset($_GET['image'])) {
// ������� � ������� ������
$st="R0lGODlhCgAMAIABAFNTU////yH5BAEAAAEALAAAAAAKAAwAAAI"; // ����� ����� ��� ���� ��������
function imgwr($st,$num){
if ($num=="0") {$len="63"; $number=$st."WjIFgi6e+QpMP0jin1bfv2nFaBlJaAQA7";}
if ($num=="1") {$len="61"; $number=$st."UjA1wG8noXlJsUnlrXhE/+DXb0RUAOw==";}
if ($num=="2") {$len="64"; $number=$st."XjIFgi6e+QpMPRlbjvFtnfFnchyVJUAAAOw==";}
if ($num=="3") {$len="64"; $number=$st."XjIFgi6e+Qovs0RkTzXbj+3yTJnUlVgAAOw==";}
if ($num=="4") {$len="64"; $number=$st."XjA9wG8mWFIty0amczbVJDVHg9oSlZxQAOw==";}
if ($num=="5") {$len="63"; $number=$st."WTIAJdsuPHovSKGoprhs67mzaJypMAQA7";}
if ($num=="6") {$len="63"; $number=$st."WjIFoB6vxmFw0pfpihI3jOW1at3FRAQA7";}
if ($num=="7") {$len="61"; $number=$st."UDI4Xy6vtAIzTyPpg1ndu9oEdNxUAOw==";}
if ($num=="8") {$len="63"; $number=$st."WjIFgi6e+QpMP2slSpJbn7mFeWDlYAQA7";}
if ($num=="9") {$len="64"; $number=$st."XjIFgi6e+QpMP0jinvbT2FGGPxmlkohUAOw==";}
header("Content-type: image/gif");
header("Content-length: $len");
echo base64_decode($number); }
// ����� ����������� �� ����� (��� ���������� - ����� �� ������)
if (array_key_exists("image", $_REQUEST)) { $num=$_REQUEST["image"];
for ($i=0; $i<10; $i++) {if (md5($i+$absrand)==$num) {imgwr($st,$i); die();}} }
exit;}
// ��������� - ���� ������: ��� 1
if ($_GET['event']=="repa") {
if (!isset($_GET['name'])) {exit("��� ������ ���������� $name.");}
if (!isset($_GET['who'])) {exit("��� ������ ���������� $who.");}
////!!!!!!!!!!! ���������� NAME �� ������!!!!!!!!!!!!!
$name=$_GET['name'];
$name=htmlspecialchars($name);
$name=stripslashes($name);
$name=str_replace("\r\n","
",$name);
$userpn=$_GET['who']; if (!ctype_digit($userpn) or strlen($userpn)>2) {exit("$back. ������� ������. ������� ����� �� �����.");}
print "��������� ��������� ���������: $name
"; exit;}
if ($msg=="") {print "$back �� �� ����� ���������!"; exit;}
$text="$name|$msg|$uname|$email|";
$text=htmlspecialchars($text);
$text=stripslashes($text);
$text=str_replace("\r\n","
",$text);
$exd=explode("|",$text); $name=$exd[0]; $msg=$exd[1]; $uname=$exd[2]; $email=$exd[3];
$headers=null; // ��������� ��� �������� �����
$headers.="Content-Type: text/html; charset=windows-1251\r\n";
$headers.="From: $name <".$email.">\r\n";
$headers.="X-Mailer: PHP/".phpversion()."\r\n";
// �������� ��� ���������� � ���� ������
$host=$_SERVER["HTTP_HOST"]; $self=$_SERVER["PHP_SELF"];
$furl="http://$host$self";
$furl=str_replace("tools.php", "", $furl);
$allmsg="
$uname, ��� ��������� ���������� ��� �� ���������� ������
$fname
��� | $name |
E-mail: | $email |
���������: | $msg
|
���� �������� ���������: | $time - $date �. |
������� �� ������� ��������: | $furl |
|
* ������ ������ ������������� � ���������� �������, �������� �� ���� �� �����.
";
mail("$uemail", "��������� �� ���������� ������ ($fname) �� $name ", $allmsg, $headers);
print "";
exit; }
// �������� �����/������ � ���� �� �����
if(isset($_GET['event'])) { if ($_GET['event']=="regenter") // if ($event =="regenter")
{
if (!isset($_POST['name']) & !isset($_POST['pass'])) {print"$back ������� ��� � ������!"; exit;}
$name=str_replace("|","I",$_POST['name']); $pass=str_replace("|","I",$_POST['pass']);
$text="$name|$pass|";
$text=trim($text); // �������� ���������� �������
if (strlen($text)<4) {print"$back �� �� ����� ��� ��� ������!"; exit;}
$text=str_replace(" ",' ',$text);
$text=str_replace("&",'&',$text);
$text=str_replace(">",'>',$text);
$text=str_replace("<",'<',$text);
$text=str_replace("\"",'"',$text);
$text=preg_replace("/\n\n/",'',$text);
$text=preg_replace("/\n/",'
',$text);
$text=preg_replace("/\\\$/",'$',$text);
$text=preg_replace("/\r/",'',$text);
$text=stripslashes($text);
$text=preg_replace("/\\\/",'\',$text);
$text=str_replace("\r\n","
",$text);
$text=str_replace("\n\n",'
',$text);
$text=str_replace("\n",'
',$text);
$text=str_replace("\t",'',$text);
$text=str_replace("\r",'',$text);
$text=str_replace(' ',' ',$text);
$exd=explode("|",$text); $name=strtolower($exd[0]); $pass=$exd[1];
// �������� �� ���� ������������� � ������� ������
$lines=file("$datadir/usersdat.php"); $i=count($lines);
do {$i--; $rdt=explode("|",$lines[$i]);
if (isset($rdt[1])) { // ���� ������� ���������� � ������� (������ ������) - �� ������ � �� �������
if ($name===strtolower($rdt[0]) & $pass===$rdt[1]) {
if (strlen($rdt[13])>1 and ctype_digit($rdt[13])) {print"$back. ���� ������� ������ �� ������������."; exit;}
$regenter="$i";
$tektime=time();
$wrfcookies="$rdt[0]|$rdt[1]|$tektime|$tektime|";
setcookie("wrfcookies", $wrfcookies, time()+1728000);
}} // if-�
} while($i > "1");
if (!isset($regenter)) {print "$back ��� ������ �� �����!"; exit;}
Header("Location: index.php");
}
}
// ����������� ����� ��� 2!! �������� �� ��� ������������� � ���������� � ��
if(isset($_GET['event'])) { if ($_GET['event']=="reg2")
{
if (!isset($_POST['name']) & !isset($_POST['pass'])) {print"$back ������� ��� � ������!"; exit;}
$name=str_replace("|","I",$_POST['name']); $pass=str_replace("|","I",$_POST['pass']); $dayreg=$date;
$name=trim($name); // �������� ���������� �������
if (isset($_POST['email'])) {$email=$_POST['email'];} else {$email="";} $email=strtolower($email);
//--�-�-�-�-�-�-�-�--�������� ����--
if ($antispam!="0") { $bada="$back �������� ���� ��� �� �����!";
if (isset($_POST['usernum'])) {$usernum=$_POST['usernum'];} else {print"$bada"; exit;}
if (isset($_POST['xkey'])) {$xkey=$_POST['xkey'];} else {print"$bada"; exit;}
$userkey=md5("$usernum+$absrand");
if ($userkey!=$xkey) {print"$bada"; exit;}}
//--�-�-�-�-�-�-�-�--�������� ����--
if ($name=="" or strlen($name)>$maxname) {print "$back ���� ��� ������, ��� ��������� $maxname ��������!"; exit;}
if ($pass=="" or strlen($pass)<1 or strlen($pass)>$maxname) {print "$back �� �� ����� ������. ������ �� ������ ���� ������."; exit;}
if(!preg_match("/^[a-z0-9\.\-_]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is", $email) or $email=="" or strlen($email)>40) {print "$back � ������� ���������� E-mail �����!"; exit;}
if (isset($_POST['pol'])) {$pol=$_POST['pol'];} else {$pol="";} if ($pol!="�������") {$pol="�������";}
$email=str_replace("|","I",$email);
// ������� ��������� ��� ���������
$z=1; do {$key=mt_rand(100000,999999); if (strlen($key)==6) {$z++;} } while ($z<1);
if ($useactkey!="1") {$key="";}
$regdat="$name|$pass|0|$email|$dayreg||$pol||||||noavatar.gif|$key|";
$text=$regdat;
$text=str_replace(" ",' ',$text);
$text=str_replace("&",'&',$text);
$text=str_replace(">",'>',$text);
$text=str_replace("<",'<',$text);
$text=str_replace("\"",'"',$text);
$text=preg_replace("/\n\n/",'
',$text);
$text=preg_replace("/\n/",'
',$text);
$text=preg_replace("/\\\$/",'$',$text);
$text=preg_replace("/\r/",'',$text);
$text=stripslashes($text);
$text=preg_replace("/\\\/",'\',$text);
$text=str_replace("\r\n","
",$text);
$text=str_replace("\n\n",'
',$text);
$text=str_replace("\n",'
',$text);
$text=str_replace("\t",'',$text);
$text=str_replace("\r",'',$text);
$text=str_replace(' ',' ',$text);
$text=str_replace(' ','',$text);
$regdat=$text;
$exd=explode("|",$regdat); $name=$exd[0]; $pass=$exd[1]; $email=$exd[3];
if ($name===$pass) {print"$back. � ����� ����� ������������, ��������� ��������� ����� � ������!"; exit;}
// ���� ����� � ����� ������� ��� �������
$loginsm=strtolower($name);
$lines=file("$datadir/usersdat.php"); $i=count($lines);
if ($i>"1") { do {$i--; $rdt=explode("|",$lines[$i]);
$rdt[0]=strtolower($rdt[0]);
if ($rdt[0]===$loginsm) {$bad="1"; $er="�������";}
if ($rdt[3]===$email) {$bad="1"; $er="�������";}
} while($i > 1);
if (isset($bad)) {print "$back. �������� � ����� $er ��� ��������������� �� ������!"; exit;}}
// �������� ������������ ���� ���������
$host=$_SERVER["HTTP_HOST"]; $self=$_SERVER["PHP_SELF"];
$furl="http://$host$self";
$headers=null; // ��������� ��� �������� �����
$headers.="Content-type: text/plain; charset=windows-1251\r\n";
$headers.="From: ".$name." <".$email.">\r\n";
$headers.="X-Mailer: PHP/".phpversion()."\r\n";
// �������� ��� ���������� � ���� ������
if ($useactkey=="1") {
$allmsg=$fname.' (������������� �����������)'.chr(13).chr(10).
'����������� ������������ �� ������, ��� ����� ��������� �� ������: '.$furl.'?event=reg3&email='.$email.'&key='.$key.chr(13).chr(10).
'���� ���: '.$name.chr(13).chr(10).
'��� ������: '.$pass.chr(13).chr(10).
'��� E-mail: '.$email.chr(13).chr(10).
'������������� ����: '.$key.chr(13).chr(10);
} else { $allmsg=$fname.' (������ �����������)'.chr(13).chr(10). '�� ������� ���������������� �� ������: '.$furl.chr(13).chr(10). '���� ���: '.$name.chr(13).chr(10). '��� ������: '.$pass.chr(13).chr(10). '��� E-mail: '.$email.chr(13).chr(10); }
// ���������� ������ ������� �� �������� ;-)
mail("$email", "=?windows-1251?B?" . base64_encode("$fname (������������� �����������)") . "?=", $allmsg, $headers);
if ($sendadmin=="1") {mail("$adminemail", "=?windows-1251?B?" . base64_encode("$fname (����� ��������)") . "?=", $allmsg, $headers);}
$file=file("$datadir/usersdat.php");
$fp=fopen("$datadir/usersdat.php","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$regdat\r\n");
fflush ($fp);//�������� ��������� ������
flock ($fp,LOCK_UN);
fclose($fp);
// ���������� ������� � ������ � ���� �� �����������
$file=file("$datadir/userstat.dat");
$fp=fopen("$datadir/userstat.dat","a+");
flock ($fp,LOCK_EX);
fputs($fp,"$name|0|0|||||\r\n");
fflush ($fp);//�������� ��������� ������
flock ($fp,LOCK_UN);
fclose($fp);
if ($useactkey!="1") { $tektime=time(); $wrfcookies="$name|$pass|$tektime|0|"; setcookie("wrfcookies", $wrfcookies, time()+1728000);
print"
"; exit;}
print"
$name, �� ��������� ���� ����� ��� ������ ��� �������������.
��� ���� ����� ������������������ - ������� ��� �� ��������, ���� ��������� �� ������ - ��������� � ������.
����� ��������� ������ �� ������ ������������� ���������� �� �������� ������������� �����������.
������� �����, ���� �� ������ ������ ����� |
|
";
exit;
}
}
// ����������� ��� 3 - ���� ����� ���� ������������� �� ������
if(isset($_GET['event'])) { if ($_GET['event']=="reg3") {
if (isset($_GET['email']) and isset($_GET['key'])) {$key=$_GET['key']; $email=$_GET['email'];} else {
$frname=""; $frtname=""; include("$fskin/top.html"); addtop(); // ���������� ����� ������
print"������������� �����������
"; exit; }
// ������ �� ������ �� ����� � ������
if (strlen($key)<6 or strlen($key)>6 or !ctype_digit($key)) {exit(" $back. �� �������� ��� ����� �����. ���� ����� ��������� ������ 6 ����.");}
$email=stripslashes($email); $email=htmlspecialchars($email);
$email=str_replace("|","I",$email); $email=str_replace("\r\n","
",$email);
if (strlen($key)>30) {print"������ ��� ����� ������"; exit;}
// ���� ����� � ����� ������� � ������. ���� ���� - ������ ������ �� ������ ����.
$email=strtolower($email); unset($fnomer); unset($ok);
$lines=file("$datadir/usersdat.php"); $ui=count($lines); $i=$ui;
do {$i--; $rdt=explode("|",$lines[$i]);
$rdt[3]=strtolower($rdt[3]);
if ($rdt[3]===$email and $rdt[13]===$key) {$name=$rdt[0]; $pass=$rdt[1]; $fnomer=$i;}
if ($rdt[3]===$email and $rdt[13]==="") {$ok="1";}
} while($i > 1);
if (isset($fnomer)) {
// ���������� ������ ����� � ��
$i=$ui; $dt=explode("|", $lines[$fnomer]);
$txtdat="$dt[0]|$dt[1]|$dt[2]|$dt[3]|$dt[4]|$dt[5]|$dt[6]|$dt[7]|$dt[8]|$dt[9]|$dt[10]|$dt[11]|$dt[12]||";
$fp=fopen("$datadir/usersdat.php","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);//������� ���������� �����
for ($i=0;$i<=(sizeof($lines)-1);$i++) {if ($i==$fnomer) {fputs($fp,"$txtdat\r\n");} else {fputs($fp,$lines[$i]);}}
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
// ������������� ����
$tektime=time(); $wrfcookies="$name|$pass|$tektime|0|";
setcookie("wrfcookies", $wrfcookies, time()+1728000);
}
if (!isset($fnomer) and !isset($ok)) {print "$back. �� �������� � ���� �������������� ����� ��� ������."; exit;}
if (isset($ok)) {$add="���� ������ ��� ������������";} else {$add="$name, �� ������� ����������������";}
print"
";
exit;
}
}
// ��������� ������ ����������� - ���������� ������
if(isset($_GET['event'])) { if ($_GET['event']=="reregist") // if ($event =="reregist")
{
if (!isset($_POST['name'])) {print"$back ������� ���� ���!"; exit;}
$name=str_replace("|","I",$_POST['name']);
if ($name=="" or strlen($name)>$maxname) {print "$back ���� ��� ������, ��� ��������� $maxname ��������!"; exit;}
$name=trim($name); // �������� ���������� �������
if (!isset($_POST['pass'])) {print"$back �� �� ����� ������!"; exit;}
$pass=str_replace("|","I",$_POST['pass']);
$oldpass=$_POST['oldpass']; // ������ ������
if (strlen($pass)<1 or strlen($pass)>20) {print "$back �� �� ����� ������. ������ �� ������ ���� ������."; exit;}
if (isset($_POST['email'])) {$email=$_POST['email'];} else {$email="";} $email=strtolower($email);
if(!preg_match("/^[a-z0-9\.\-_]+@[a-z0-9\-_]+\.([a-z0-9\-_]+\.)*?[a-z]+$/is", $email) or $email=="" or strlen($email)>40) {print "$back � ������� ���������� E-mail �����!"; exit;}
if (isset($_POST['dayx'])) {$dayx=$_POST['dayx'];} else {$dayx="";}
if (isset($_POST['pol'])) {$pol=$_POST['pol'];} else {$pol="";} if ($pol!="�������") {$pol="�������";}
if (isset($_POST['icq'])) {$icq=$_POST['icq'];} else {$icq="";}
if (isset($_POST['www'])) {$www=$_POST['www'];} else {$www="";}
if (isset($_POST['about'])) {$about=$_POST['about'];} else {$about="";}
if (isset($_POST['work'])) {$work=$_POST['work'];} else {$work="";}
if (isset($_POST['write'])) {$write=$_POST['write'];} else {$write="";}
if (isset($_POST['avatar'])) {$avatar=$_POST['avatar'];} else {$avatar="";}
$notgood="$back ������� ������� �������� ���������� ";
if (strlen($dayx)>20) {$notgood.="���� ��������!"; print"$notgood"; exit;}
if (strlen($icq)>10) {$notgood.="ICQ!"; print"$notgood"; exit;}
if (strlen($www)>40) {$notgood.="URL �����!"; print"$notgood"; exit;}
if (strlen($about)>100) {$notgood.="������!"; print"$notgood"; exit;}
if (strlen($work)>40) {$notgood.="��������!"; print"$notgood"; exit;}
if (strlen($write)>80) {$notgood.="�������!"; print"$notgood"; exit;}
$email=str_replace("|","I",$email);
$dayx=str_replace("|","I",$dayx);
$icq=str_replace("|","I",$icq);
$www=str_replace("|","I",$www);
$about=str_replace("|","I",$about);
$work=str_replace("|","I",$work);
$write=str_replace("|","I",$write);
$avatar=str_replace("|","I",$avatar);
// �������� ������/������� ������
$lines=file("$datadir/usersdat.php"); $i=count($lines);
do {$i--; $rdt=explode("|", $lines[$i]);
if (strtolower($name)===strtolower($rdt[0]) & $oldpass===$rdt[1]) {$ok="$i";} // ���� ����� �����/������
else { if ($email===$rdt[3]) {$bademail="1"; } } // ����� � ������ ��� ���� ����� �����?
} while($i > "1");
if (isset($bademail)) {print "$back. �������� � ������� $email ��� ��������������� �� ������!"; exit;}
if (!isset($ok)) {setcookie("wrfcookies","",time());
print "$back ��� ����� ����� /������ / ����� �� ��������� �� � ����� �� ��.
����� ������������ ������ ���������
������ ������� ��� ������� ������ - ���������� � ��������������!"; exit;}
$udt=explode("|",$lines[$ok]); $dayreg=$udt[4]; $kolvomsg=$udt[2]; $status=$udt[13];
// ���� �������� �������
if ($_FILES['file']['name']!="") {
$fotoname = $_FILES['file']['name']; // ���������� ��� �����
$avatar=$fotoname;
$fotosize=$_FILES['file']['size']; // ���������� ������ �����
// ��������� ����������
$ext = strtolower(substr($fotoname, 1 + strrpos($fotoname, ".")));
if (!in_array($ext, $valid_types)) {echo '���� �� ��������. ��������� �������:
- ��������� �������� ������ ������ � ������ ������������: gif, jpg, jpeg, png
- �� ��������� ��������� �� ����������� ����;
- ������� ����� ����� ��� ������ ����;
'; exit;}
}
$regdat="$name|$pass|$kolvomsg|$email|$dayreg|$dayx|$pol|$icq|$www|$about|$work|$write|$avatar|$status|";
$text=$regdat;
$text=str_replace(" ",' ',$text);
$text=str_replace("&",'&',$text);
$text=str_replace(">",'>',$text);
$text=str_replace("<",'<',$text);
$text=str_replace("\"",'"',$text);
$text=preg_replace("/\n\n/",'',$text);
$text=preg_replace("/\n/",'
',$text);
$text=preg_replace("/\\\$/",'$',$text);
$text=preg_replace("/\r/",'',$text);
$text=stripslashes($text);
$text=preg_replace("/\\\/",'\',$text);
$text=str_replace("\r\n","
",$text);
$text=str_replace("\n\n",'
',$text);
$text=str_replace("\n",'
',$text);
$text=str_replace("\t",'',$text);
$text=str_replace("\r",'',$text);
$text=str_replace(' ',' ',$text);
$regdat=$text;
$exd=explode("|",$regdat); $name=$exd[0]; $pass=$exd[1]; $email=$exd[3];
// ������ ���� �����
$tektime=time(); $wrfcookies="$name|$pass|$tektime|$tektime|";
setcookie("wrfcookies", $wrfcookies, time()+1728000);
if ($_FILES['file']['name']!="") {
// ������ �� ������
// 1. ������� ���-�� ����� � ��������� - ���� ������� ����� - ��������!
$findtchka=substr_count($fotoname, "."); if ($findtchka>1) {echo "����� ����������� � ����� ����� $findtchka ���(�). ��� ���������!
\r\n"; exit;}
// 2. ���� � ����� ���� .php, .html, .htm - ��������!
$bago="��������. � ����� ����� ��������� ������������ .php, .html, .htm";
if (preg_match("/\.php/i",$fotoname)) {echo "��������� \".php\" �������. $bago"; exit;}
if (preg_match("/\.html/i",$fotoname)) {echo "��������� \".html\" �������. $bago"; exit;}
if (preg_match("/\.htm/i",$fotoname)) {echo "��������� \".htm\" �������. $bago"; exit;}
// 3. �������� �� ������� ���� � ����� ����� � ��������� ���������� �����
if (!preg_match("/^[a-z0-9\.\-_]+\.(jpg|gif|png|jpeg)+$/is",$fotoname)) {print "��������� ������������ ������� ����� � ����� �����!"; exit;}
// 4. ���������, ����� ���� ���� � ����� ������ ��� ���� �� �������
if (file_exists("$avatardir/$fotoname")) {print "���� � ����� ������ ��� ���������� �� �������! �������� ��� �� ������!"; exit;}
// ����� ����� �� ����� �����
// 5. ������ � ��. < �����������
$fotoksize=round($fotosize/10.24)/100; // ������ ������������ ���� � ��.
$fotomax=round($max_file_size/10.24)/100; // ������������ ������ ���� � ��.
if ($fotoksize>$fotomax) {print"�� ��������� ���������� ������ ����!
����������� ���������� ������ ����: $fotomax ��.
�� ��������� ��������� �����������: $fotoksize ��!"; exit;}
// 6. "��������" ������� > 150 � 150 - �� ��������! :-)
$size=getimagesize($_FILES['file']['tmp_name']);
if ($size[0]>150 or $size[1]>150) {print "�� ���������� �������� �������. ��������� ���� 150 � 150 px!"; exit;}
if ($fotosize>"0" and $fotosize<$max_file_size) {
copy($_FILES['file']['tmp_name'], $avatardir."/".$fotoname);
print "
���� ������� ���������: $fotoname (������: $fotosize ����)";}
else { print "���� �� �������� - ������ �������! ���������� � ��������������!"; exit;}
} // ����� ����� �������� �������
$file=file("$datadir/usersdat.php");
$fp=fopen("$datadir/usersdat.php","a+");
flock ($fp,LOCK_EX);
ftruncate ($fp,0);//������� ���������� �����
for ($i=0;$i< sizeof($file);$i++) {if ($ok!=$i) {fputs($fp,$file[$i]);} else {fputs($fp,"$regdat\r\n");}}
fflush ($fp);//�������� ��������� ������
flock ($fp,LOCK_UN);
fclose($fp);
//@chmod("usersdat.php",$chmodval);
print"
";
exit;
}
if ($_GET['event'] =="givmepassword") { // �������� �������� ������ �� ����
// ��������������� ����� � ������ �������
$myemail=strtolower($_POST['myemail']);
$lines=file("$datadir/usersdat.php");
$i=count($lines); $regenter=""; $myname="";
// �������� �� ���� ������������� � ������� ������
do {$i--; $rdt=explode("|", $lines[$i]);
if (isset($rdt[1])) { // ���� ������� ���������� � ������� (������ ������) - �� ������ � �� �������
$rdt[3]=strtolower($rdt[3]);
if ($myemail==$rdt[3]) {$myname=$rdt[0]; $mypassword=$rdt[1];}
} //if
} while($i > "1");
// �������� ������������ ��� ����� � ������ �� ����
if ($myname!="") {
$headers=null; // ��������� ��� �������� �����
$headers.="Content-Type: text/plain; charset=windows-1251\r\n";
$headers.="From: <".$adminemail.">\r\n";
$headers.="X-Mailer: PHP/".phpversion()."\r\n";
$host=$_SERVER["HTTP_HOST"]; $self=$_SERVER["PHP_SELF"];
$furl="http://$host$self";
$furl=str_replace("tools.php", "index.php", $furl);
// �������� ��� ���������� � ���� ������
$allmsg=$fname.' (������ �����������)'.chr(13).chr(10).
'�� ��������� ��� � ������ ������� � ������ �� ������: '.$furl.chr(13).chr(10).chr(13).chr(10).
'���� ���: '.$myname.chr(13).chr(10).
'��� ������: '.$mypassword.chr(13).chr(10).chr(13).chr(10).chr(13).chr(10).
'* ��� ������ ������������� �������, �������� �� ���� �� �����.'.chr(13).chr(10);
// ���������� ������ ������� �� �������� ;-)
mail("$myemail", "=?windows-1251?B?" . base64_encode("$fname (��������������� ������)") . "?=", $allmsg, $headers);
// ���� ���� �������� � �������� �������
$msgtoopr="$myname, �� ��� ����������� ����� ������� ��������� � ������ � ������� ������� � ������.";
}
// ���� ��� ������ ������ � ��
else {$msgtoopr="��������� � ����� �������
�� ������ �� ����������������!";}
print "
$msgtoopr ����� ��������� ������ �� ������ ������������� ���������� �� ������� ��������.
���� ����� �� ����������, ������� �����. |
";
exit;
}
}
if (isset($_GET['event']))
{
if ($_GET['event']=="moresmiles") { // ���������� ���� ������� �� ���������� SMILE
if (!is_dir("smile/")) {print"����� smile �� ����������."; exit;}
$i=0; if ($handle = opendir("smile/")) {
while (($file = readdir($handle)) !== false)
if (!is_dir($file)) {$lines[$i]=$file; $i++;}
closedir($handle);
}
if (!isset($lines)) {print '� ����� smile ��� �������! ���������� � ������ - ����� ������.'; exit;}
$itogo=count($lines); $k=0; $text=null;
$host=$_SERVER["HTTP_HOST"]; $self=$_SERVER["PHP_SELF"];
$forurl="http://$host$self";
$forurl=str_replace("/tools.php", "", $forurl);
print"
�������������� ������
";
do {
$rdt=explode(".",$lines[$k]);
if ($rdt[1]=="jpg" or $rdt[1]=="gif") {print"
";}
$k++;
} while ($k<$itogo);
print"
������� ����";
exit; }
// ----- ����� ��� ���� ������� ������
if (isset($_COOKIE['wrfcookies'])) {
$wrfc=$_COOKIE['wrfcookies']; $wrfc=htmlspecialchars($wrfc); $wrfc=stripslashes($wrfc);
$wrfc = explode("|", $wrfc);
$wrfname=$wrfc[0];$wrfpass=$wrfc[1];$wrftime1=$wrfc[2];$wrftime2=$wrfc[3];
if (time()>($wrftime1+50)) {$tektime=time();$wrfcookies="$wrfc[0]|$wrfc[1]|$tektime|$wrftime1";setcookie("wrfcookies", $wrfcookies, time()+1728000);}}
else {unset($wrfname); unset($wrfpass);}
// -----
$frname=""; $frtname=""; include("$fskin/top.html"); addtop(); // ���������� ����� ������
// ��������� ��� ���������� ���������������������
$userlines=file("$datadir/usersdat.php");
$ui=count($userlines)-1;
$tdt=explode("|", $userlines[$ui]);
if ($_GET['event']=="who") { // �������� ���� ���������� ������
$t1="row1";
$lines=file("$datadir/usersdat.php");
$maxi=count($lines)-1;
print"";
if ($ui=="0") {print"";
} else {
// ��������� ������ ������ �������������� ��������
if (!isset($_GET['page'])) {$page=1;} else {$page=$_GET['page']; if (!ctype_digit($page)) {$page=1;} if ($page<1) $page=1;}
$maxpage=ceil(($maxi+1)/$uq); if ($page>$maxpage) {$page=$maxpage;}
$fm=$uq*($page-1); if ($fm>$maxi) {$fm=$maxi-$uq;}
$lm=$fm+$uq; if ($lm>$maxi) {$lm=$maxi+1;}
do {$dt=explode("|", $lines[$fm]);
$fm++; $num=$fm-1;
if (isset($dt[1])) { // ���� ������� ���������� � ������� (������ ������) - �� ������ � �� �������
$codename=urlencode($dt[0]); // �������� ��� � ����������, ��� ��������� ���������� �������� ����� ����� GET-������.
if (isset($wrfname)) {$wfn="$dt[0]";} else {$wfn="$dt[0]";}
if (strlen($dt[13])=="6" and ctype_digit($dt[13])) {$dt[13]="�������� ���������";}
if (strlen($dt[13])<2) {$dt[13]=$users;}
if ($dt[6]=="�������") {$add="polm.gif";} else {$add="polg.gif";}
print"";
if ($t1=="row1") {$t1="row2";} else {$t1="row1";}
} // ���� ������� ����������
} while($fm < $lm);
} // ����� ���� ���� userdat.php ����
print "
� |
��� |
������ |
�� �� �-���� |
��������������� |
���� �������� |
���� |
������ |
���������� �� ���������������� |
$num |
$wfn |
$dt[13] |
 |
$dt[4] |
$dt[5] |
$dt[8] |
$dt[9] |
��������: "; // ������� ������ ������� �����
if ($page>=4 and $maxpage>5) print "1 ... ";
$f1=$page+2; $f2=$page-2;
if ($page==1) { $f1=$page+4; $f2=$page; }
if ($page==2) { $f1=$page+3; $f2=$page-1; }
if ($page==$maxpage) { $f1=$page; $f2=$page-4; }
if ($page==$maxpage-1) { $f1=$page+1; $f2=$page-3; }
if ($maxpage<4) {$f1=$maxpage; $f2=1;}
for($i=$f2; $i<=$f1; $i++) {if ($page==$i) {print "$i ";} else {print "$i ";}}
if ($page<=$maxpage-3 and $maxpage>5) print "... $maxpage";
print " | ����� ���������������� ���������� - $ui |
";}
if ($_GET['event'] =="profile") {
if (!isset($_GET['pname'])) {exit(" ������� ������.");}
$pname=urldecode($_GET['pname']); // ����������� ��� ������������, ��������� �� GET-�������.
$lines=file("$datadir/usersdat.php");
$i = count($lines); $use="0";
do {$i--; $rdt=explode("|", $lines[$i]);
if (isset($rdt[1])) { // ���� ������� ���������� � ������� (������ ������) - �� ������ � �� �������
if (strlen($rdt[13])=="6" and ctype_digit($rdt[13])) {$rdt[13]="�������� ���������";}
if ($pname===$rdt[0]) {
if (isset($wrfname) & isset($wrfpass)) {
if ($wrfname===$rdt[0] & $wrfpass===$rdt[1]) {
print "��������������� ������
"; $use="1"; }
if ($use!="1") {
if (strlen($rdt[13])<2) {$rdt[13]=$users;}
if (is_file("avatars/$rdt[12]")) {$avpr="$rdt[12]";} else {$avpr="noavatar.gif";}
print "������� ���������
��������������� ���������� |
��� ���������: | $rdt[0] |
����� e-mail:
| $rdt[3] |
���� �����������: | $rdt[4] |
������: | $rdt[13] |
���: | $rdt[6] |
���� �������:
| $rdt[5] |
����� � ICQ:
| $rdt[7] |
�������� ���������: | $rdt[8] |
������ (����� ����������, �����, ������.): | $rdt[9] |
��������: | $rdt[10] |
�������: | $rdt[11] |
������: |  |
"; $use="1";}
}
}
} // if
} while($i > "1");
if (!isset($wrfname)) {print"
������ ������������������ ��������� ������ ����� ������������� ������ �������!"; exit;}
// �� ������ ����� ��� - ��� ����� ������
if ($use!="1") {
print"
��������� ����������!
��������, �� �������� � ����� - ������� �� ������ �� ���������������.
������ �����, ��� ������ �������������.
������� �� ������� �������� ������ ����� �� ���� ������
"; }
}
if(isset($_GET['event'])) {
if ($_GET['event'] =="reg") {
if (!isset($_POST['rules'])) {
print"
������� � ������� �����������
";
} else {
print"����������� �� ������
";
}
}
if ($_GET['event']=="find") { // �����
$minfindme="3"; //����������� ���-�� �������� � ����� ��� ������
print"