<?php
include 'config.php';

$email = $_POST['email'];
$login = $_POST['login'];
$pass = $_POST['pass'];


if ($email == "") { $err = "{$lng['signup-err-email']}";}
if ($login == "") { $err = "{$lng['signup-err-login']}";}
if ($pass == "") { $err = "{$lng['signup-err-pass']}";}

$form = <<<HTML

<h1> {$lng['signup']}</h1>
<br/>
<div class="actions">
<i>{$lng['signup-msg']}</i>
</div>
<br /><br />
<form action="" method="post">
  <table border="0">
<tr>
 <td><b>{$lng['signup-login']}</b></td>
 <td><input name="login" value="$login" size="25"><span class="help-block">
							{$lng['signup-logins']}
						  </span></td>
</tr>
<tr>
 <td><b>{$lng['signup-email']}</b></td>
 <td><input name="email" value="$email" size="25"><span class="help-block">
							{$lng['signup-emails']}
						  </span></td>
</tr>
<tr>
 <td><b>{$lng['signup-pass']}</b></td>
 <td> <input name="pass" value="$pass" type="password" size="25"><span class="help-block">
							             {$lng['signup-passs']}
						                 </span></td>
</tr>
                              
								
					
				
				
				
 </table>
  <div class="actions">
.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <button class="btn orange" type="submit"  name="send">{$lng['signup']}</button>
 </div>
 </form>

HTML;

$succes = "{$lng['signup-succes']} <meta http-equiv=\"refresh\" content=\"0; url=http://{$SERVERu}/user\">"; 
$ip = $_SERVER["REMOTE_ADDR"];
$regdate= date("j-n-Y");

if ($err == "") {
setcookie("login", $login);
setcookie("pass", "f3".md5($pass)."3bd");
include "sus.php";
//////////////////////////////
$link = mysql_connect($baza['host'], $baza['user'], $baza['pass'])
or die("Could not connect : " . mysql_error());
mysql_select_db($baza['nume']) or die("Erorr! Data base name icrorect!");
mysql_query("INSERT INTO utiliz (id, date, email, login, pass, ip, sondaje) VALUES ('', '$regdate', '$email', '$login', '$pass', '$ip', '0')");
//////////////////////////////
echo $succes;    
} else {
include "sus.php";
if ($_POST['send'] == "") {echo $form;} else {echo $err.$form;}
}
include "jos.php";
?>