<?php
include('../inc/conf.php');
ini_set('session.use_cookies', 'On');
ini_set('session.use_trans_sid', 'Off');
session_set_cookie_params(604800000, "/", SITE, false, false);
session_start();
if (isset($_SESSION["uid"])){
echo "error";
exit;
}
function is_email($email) {return preg_match("/^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-]+)*\.([a-zA-Z]{2,6})$/", $email);} @header("Status: 404 Not Found"); function esend($e_mail, $e_sbj, $e_top, $e_mid) { $message = '<html><head><title>'.SITENAME.'</title></head><body><font "style="font-family:arial; font-size:14px; color:#555;">'.$e_top.'</font><hr><br /><br /><center><b>'.$e_mid.'</b></center><br /><br /><hr>Не сообщайте свой пароль третьим лицам.</body></html>'; $headers  = "Content-type: text/html; charset=utf-8 \r\n"; $headers .= "From: ".SITENAME." <noreply@mailed.ru>\r\n"; mail($e_mail, $e_sbj, $message, $headers); }
if(isset($_POST['login']) && isset($_POST['pass']) && isset($_POST['mail'])){
if ($_POST['oferta'] == 'true') {
$login = mysqli_real_escape_string($connect_db, trim($_POST['login']));
if(strlen($login) < '3') { echo 'lsmall'; exit; }
if(strlen($login) > '10') { echo 'lbig'; exit; }
$ulq = mysqli_query($connect_db, "SELECT log FROM t_users WHERE log LIKE '$login'");
if(mysqli_num_rows($ulq)>0){ echo 'regged'; exit; }
$pass = mysqli_real_escape_string($connect_db, $_POST['pass']);
if(strlen($pass) < '3'){ echo 'psmall'; exit; }
$mail = mysqli_real_escape_string($connect_db, trim($_POST['mail']));
if (!is_email($mail)) { echo 'mail' ; exit; }
$ref = intval($_COOKIE['referer']);
if ($ref == '') { $ref = 0; }
$dt = time();
$ip = mysqli_real_escape_string($connect_db, trim($_SERVER['REMOTE_ADDR']));
mysqli_query($connect_db, "INSERT INTO t_users (log,pas,ref,dt,ip,em) VALUES ('$login','$pass','$ref','$dt','$ip','$mail')");
echo '1';
} else { echo 'offer'; }
} else { echo 'error'; }
?>