<?
session_start();
include("functions/conexion.php");

$login = $_POST["login"];
$password = $_POST["password"];
$name = $_POST["name"];
$address = $_POST["address"];
$age = $_POST["age"];
echo $login;
$query = "SELECT * FROM User WHERE login ='".$login."'";
$result = mysql_query($query, $conexion);
if (mysql_affected_rows($conexion) > 0) {
	header("Location: /register.php?message=This login is already exist");
}
else{
$query = "insert into User(login, pass, name, address, age, cash) values ('".$login."','".$password."','".$name."','".$address."',".$age.",1000)";
$result = mysql_query($query, $conexion);
echo "que pasa";
//header("Location: /index.php");
}
?>
