[ Поиск ] - [ Пользователи ] - [ Календарь ]
Полная Версия: Проблема с Регистрацией
shinydo
проблема с формой регистрации , никак не могу понять в чём косяк , но пользователь не регистрируется в БД . Ниже собственно код , прошу помочь .



<?php

if ($_GET['ac']=="exit")
{
$_SESSION['user_id']=0;
header('Location: /');
die();
}

if ($_POST['ac']=="login")
{
$mail=$_POST['mail'];
$password=$_POST['password'];

// if (!check_email($mail)) $error_login="E-mail invalid.<br /> ";

if (empty($error_login))
{
//$pass=encrypt($password);

$query="select `id`,`title_ru`,`com` from `users` where `title_ru`='$mail' and `password_ru`='$password' and `id`<>'0'";

$res=mysql_fetch_row(mysql_query($query));
if ($res[0]>0)
{

// print_r($res);

// die();


$_SESSION['user_id']=$res[0];
$_SESSION['name']=$res[1];
$_SESSION['user_cat']=$res[2];

$r=$_GET['redirect'];
$l=l();
if ($r=="") $r="/".$l."/show_bask";
?>
<script type="text/javascript">
window.location = "/";
</
script>
<?php
//header("Location: $r");
}
else $error_login=get_var2(42,l());
}
$mail="";
$password="";
}


if ($_POST['ac']=="register")
{
$mail=$_POST['mail'];
$password=$_POST['password'];
$phone=$_POST['phone']; $phone=strip_tags($phone) ; $phone=str_replace('"',""",$phone); $phone=htmlspecialchars($phone);
$password_2=$_POST['password_2'];
$name=$_POST['name']; $name=strip_tags($name) ; $name=str_replace('"',""",$name); $name=htmlspecialchars($name);


if (empty($mail) || empty($password) || empty($password_2) || empty($name) || empty($phone))
$error=get_var2(43,l());

//if (!check_email($mail) || check_mail($mail)) $error.="E-mail invalid.<br /> ";

if ($password <> $password_2) $error.=get_var2(44,l());


if (empty($error))
{
//$pass=encrypt($password);

$query="INSERT INTO '
users' ( 'mail', 'password' , 'name', 'phone' ) VALUES ('$mail', '$password', '$name','$phone')";
$res=mysql_query($query);

$succes=get_var2(45,l());

$name="";
$phone="";
$mail="";
}

}
?>
<table style="margin-top:15px; margin-left:20px;" class=table_login cellpadding="10" cellspacing="10" >
<tbody><tr valign="top">
<td width="250px"><h3 style="text-align:left"><?=get_var(31,l())?></h3><br>
<?php if (!empty($error_login)) echo "<div class=\"error\"> $error_login </div>"; ?>
<form action="" method="post" id="form1">
<table width="100%">
<tbody><tr>
<td><?=get_var(32,l())?></td>
<td><input type="text" style="padding-left:5px; width:150px" class="field" name="mail"></td>
</tr>
<tr>
<td><?=get_var(33,l())?></td>
<td><input type="password" style="padding-left:5px; width:150px" class="field" name="password"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="but" value="Intrare" name="Submit">
<input type="hidden" value="login" name="ac"></td>
</tr>
</tbody></table>
</form>


</td>

<td width="300px"><h3 style="text-align:left"><?=get_var(34,l())?></h3><br>
<?php if (!empty($error)) echo "<div class=\"error\"> $error </div>"; ?>
<?php if (!empty($succes)) echo "<div class=\"succes\"> $succes </div>"; ?>
<form action="" method="post" id="form1">
<table width="100%">

<tbody><tr>
<td><small style="color:red">*</small> <?=get_var(35,l())?></td>
<td><input type="text" value="" style="padding-left:5px; width:150px" class="field" name="name"></td>
</tr>

<tr>
<td><small style="color:red">*</small> <?=get_var(36,l())?></td>
<td><input type="text" value="" style="padding-left:5px; width:150px" class="field" name="phone"></td>
</tr>

<tr>
<td><small style="color:red">*</small> <?=get_var(32,l())?></td>
<td><input type="text" value="" style="padding-left:5px; width:150px" class="field" name="mail"></td>
</tr>
<tr>
<td><small style="color:red">*</small> <?=get_var(33,l())?></td>
<td><input type="password" style="padding-left:5px; width:150px" class="field" name="password"></td>
</tr>
<tr>
<td><small style="color:red">*</small> <?=get_var(37,l())?> </td>
<td><input type="password" style="padding-left:5px; width:150px" class="field" name="password_2"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" class="but" value="Registrare" name="Submit2"><input type="hidden" value="register" name="ac"></td>
</tr>


</tbody></table>
<small style="color:red">*</small> <?=get_var(38,l())?>
</form>
</td>

</tr>
</tbody></table>

Быстрый ответ:

 Графические смайлики |  Показывать подпись
Здесь расположена полная версия этой страницы.
Invision Power Board © 2001-2024 Invision Power Services, Inc.