Размер файла: 5.5Kb
<?php
/*\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
// Sitchi CMS - Mobile Content Management System //
// The author: Nikoloz Sitchinava [sitchi] //
// Link: http://sitchicms.num.ge //
// Skype: SitchiCMS //
// License: LICENSE.txt (see attached file) //
// Version: VERSION.txt (see attached file) //
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
define('_SITCHICMS', 1);
$root_path='../';
require $root_path.'includes/db_connect.php';
require $root_path.'includes/start.php';
require $root_path.'includes/header.php';
require $root_path.'includes/functions.php';
require $root_path.'includes/head.php'; // თავი
$lng_reg = load_lng('reg');
if (!isset($_GET['act']))$_GET['act']='';
$act=htmlspecialchars(trim($_GET['act']));
if($set['permission_reg']==0) // თუ რეგისტრაცია გამორთულია
{
head(''.$lng['1_2'].' | '.$lng_reg['1_1'].'');
echo'<div class="errmenu">'.$lng['1_2'].' '.$lng_reg['1_1'].'.</div>';
require $root_path.'includes/end.php'; // დასასრული
}
switch ($act)
{
/**წესების გამოტანა**/
default:
head(''.$lng['1_2'].'');
echo'<div class="hdr"><b>'.$lng['1_2'].'</b></div>';
aut_on_off();
$lng_rules = load_lng('rules');
echo'<div class="menu">
'.$lng_rules['1_1'].'</div>
'.$lng_rules['1_2'].'?';
echo'<form action="?" method="GET">';
echo'<button type="submit" value="yes" name="act">'.$lng['1_62'].'</button>';
echo'<button type="submit" value="no" name="act">'.$lng['1_63'].'</button>';
echo'</form>';
break;
/**რეგისტრაცია**/
case 'no':
header("Location: /");
case 'yes':
head(''.$lng['1_2'].'');
aut_on_off();
if (isset($_POST['login']) && isset($_POST['pass1']) && isset($_POST['pass2']))
{
$login = stripslashes(htmlspecialchars($_POST['login']));
$pass1 = stripslashes(htmlspecialchars($_POST['pass1']));
$pass2 = stripslashes(htmlspecialchars($_POST['pass2']));
// პაროლის შემოწმება
if(mb_strlen($pass1)<4)
{
$err[] = '<div class="errmenu">'.$lng_reg['1_8'].' (min 4)</div>';
}
if(mb_strlen($pass1)>20)
{
$err[] = '<div class="errmenu">'.$lng_reg['1_9'].' (max 20)</div>';
}
if($_POST['code']!=$_SESSION['rand'])
{
$err[] = '<div class="errmenu">'.$lng_reg['1_10'].'</div>';
}
if ($pass1!=$pass2)
{
$err[] = '<div class="errmenu">'.$lng_reg['1_11'].'</div>';
}
if (!isset($_POST['email']) || $_POST['email']==NULL)
{
$err[] = '<div class="errmenu">'.$lng_reg['1_12'].'</div>';
}
if (!preg_match('#^[A-z0-9-\._]+@[A-z0-9]{2,}\.[A-z]{2,4}$#ui',$_POST['email']))
{
$err[] = '<div class="errmenu">'.$lng_reg['1_13'].'</div>';
}
if($set['email_reg']==1)
{
if(mysql_num_rows(mysql_query('SELECT * FROM `users` WHERE `email`="'.mres($_POST['email']).'" LIMIT 1')))
{
$err[] = '<div class="errmenu">'.$lng_reg['1_14'].'.</div>';
}
}
if(mb_strlen($login)<3)
{
$err[] = '<div class="errmenu">'.$lng_reg['1_15'].'(min 3)</div>';
}
if(mb_strlen($login)>20)
{
$err[] = '<div class="errmenu">'.$lng_reg['1_16'].' (max 20)</div>';
}
if (!preg_match("#^[a-zა-ჰ0-9\-\_\ ]+$#ui", $login))
{
$err[] = '<div class="errmenu">'.$lng_reg['1_17'].'</div>';
}
if (preg_match("#[a-z]+#ui", $login) && preg_match("#[ა-ჰ]+#ui", $login))
{
$err[] = '<div class="errmenu">'.$lng_reg['1_18'].'</div>';
}
if (preg_match("#(^\ )|(\ $)#ui", $login))
{
$err[] = '<div class="errmenu">'.$lng_reg['1_19'].'</div>';
}
if(mysql_num_rows(mysql_query('SELECT * FROM `users` WHERE `login`="'.mres($login).'" LIMIT 1')))
{
$err[] = '<div class="errmenu">'.$lng_reg['1_20'].'</div>';
}
if (!isset($err))
{
mysql_query("INSERT INTO `users` SET `login`='".mres($login)."', `pass`='".md5($pass1.$login)."', `regtime`='".$time."', `lastvisit`='".$time."', `sqe`='".intval($_POST['sqe'])."', `set_them`='Default', `timing`='0', `email`='".mres($_POST['email'])."'");
$users['id']=mysql_insert_id();
$users=mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = '$users[id]' LIMIT 1"));
echo'<div class="hdr"><b>'.$lng['1_2'].'</b></div>';
msg('<div class="menu">'.$lng_reg['1_7'].'</div>');
echo'<div class="menu">'.$lng['1_42'].': <b>'.$users['login'].'</b><br/>'.$lng['1_43'].': <b>'.$pass1.'</b><br/>' .
'<form action="login.php?" method="post" />' .
'<input type="hidden" name="login" value="'.$login.'"/>' .
'<input type="hidden" name="pass" value="'.$pass1.'"/>' .
'<input type="submit" value="'.$lng['1_44'].'" /></form></div>';
require $root_path.'includes/end.php'; // დასასრული
}
err();
}
echo'<div class="hdr"><b>'.$lng['1_2'].'</b></div>';
echo'<div class="egmenu"><form action="?act=yes" method="post" />' .
''.$lng['1_42'].'(max 20):<br/>' .
'<input type="text" name="login" maxlength="20" /><br/>' .
''.$lng_reg['1_3'].':<br/><select name="sqe"><option value="1">'.$lng_reg['1_4'].'</option><option value="0">'.$lng_reg['1_5'].'</option></select><br/>' .
'E-mail:<br/><input type="text" name="email" maxlength="50" /><br/>' .
''.$lng['1_43'].'(max 20):<br/>' .
'<input type="password" name="pass1" maxlength="20" /><br/>' .
''.$lng_reg['1_2'].':<br/>' .
'<input type="password" name="pass2" maxlength="20" /><br/>' .
'<img src="captcha.php" alt=""/><br/>' .
'<input type="text" name="code" maxlength="4" size="2" /><br/>' .
'<input type="submit" value="'.$lng['1_2'].'" /></form></div>';
echo'<div class="hdr"><small>*'.$lng_reg['1_6'].'</small></div>';
break;
}
require $root_path.'includes/end.php'; // დასასრული
?>