File size: 1.88Kb
<?
error_reporting(0);include "config.php";include "head.php";if ($infa=="config"){$rega="on";$status="admin";}else{$rega=$regs;$status="user";}if ($rega=="on"){if(!$act){echo '<b>Регистрация</b><br/>Не забудте сделать закладку после входа!<br/>';$rand=rand(111,999);echo "<form action=\"regs.php\" method=\"post\"><input type=\"hidden\" name=\"act\" value=\"send\"/><input type=\"hidden\" name=\"infa\" value=\"$infa\"/><input type=\"hidden\" name=\"rand\" value=\"$rand\"/>Имя:<br/><input type=\"text\" name=\"nick\" maxlength=\"450\" value=\"$nick\"/><br/>Пароль (буквы A-Z,a-z,0-9)<br/><input type=\"text\" name=\"uspass\" maxlength=\"450\" value=\"$uspass\"/><input type=\"submit\" value=\"готово\"/></form>";echo "<a href=\"index.php\">Назад</a><br/>";}if ($act=="send"){$spacefile=file("users.dat");$spacestr=explode("||", $spacefile[0]);if ($rand==$spacestr[2]){$error=$error."rand_error";}if (empty($uspass)){$error = $error."unknown_password";}if (empty($nick)){$error = $error."nick_unknown";}$spacecount=count("users.dat");$i=-1;while($i<$spacecount){$i++;
$usf=file("users.dat");
$usstr=explode("||", $usf[$i]);if ($nick==$usstr[1]){$error=$error."name_error";}}if (empty($error)){$us=file("users.dat");
$us=explode("||", $us[0]);$usernumb=$us[0];$usernumb2=$usernumb+1;$back2=file_get_contents("users.dat");$file2=fopen("users.dat","w");fputs($file2,"$usernumb2||$nick||$rand||"."\r\n"."$back2");flock ($file2,LOCK_UN);fclose($file2);$back=file_get_contents("users/$usernumb2.$antihack.dat");$file=fopen("users/$usernumb2.$antihack.dat","w");fputs($file,"$usernumb2\r\n$nick\r\n$uspass\r\n$status\r\n".time()."\r\n"."$back");flock ($file,LOCK_UN);fclose($file);header ("Location: index.php?n=$usernumb2&pass=$uspass&rum=1");}else{header ("Location: index.php?infa=$error");}}}else{echo 'Регистрация закрыта!<br/>';}echo $end;
?>