PHP:
<?
$username="xxx";
$password="xxxx";
$database="xxxx";
$localhost="mysql4.freehostia.com";
mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$user=$_POST['username'];
$pass=$_POST['password'];
$pass=sha1(pass);
$email=$_POST['email'];
$check="SELECT id from user where email = '$email' or username = '$user'";
$resultcheck=mysql_query($check) or die ("could not check emails");
$matches=mysql_num_rows($resultcheck);
if (strlen($user)<3)
{
print "username has to be at least 4 characters long!.";
}
else if ($matches>0)
{
print "there is already another player with that email adress or username!";
}
else
{
$reg="INSERT INTO user (username, password, email VALUES ('$user','$pass','$email')" or die ("could not insert register data into database");
mysql_query($reg);
mysql_close();
print("you have been registerd");
}
?>
wat gaat er fout?? ik krijg het you have been registerd bericht
oplossing:
PHP:
<?
$username="xxx";
$password="xxxx";
$database="xxxx";
$localhost="mysql4.freehostia.com";
mysql_connect($localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$user=$_POST['username'];
$pass=$_POST['password'];
$pass=sha1(pass);
$email=$_POST['email'];
$check="SELECT id from user where email = '$email' or username = '$user'";
$resultcheck=mysql_query($check) or die ("could not check emails");
$matches=mysql_num_rows($resultcheck);
if (strlen($user)<3)
{
print "username has to be at least 4 characters long!.";
}
else if ($matches>0)
{
print "there is already another player with that email adress or username!";
}
else
{
$reg="INSERT INTO user (username, password, email) VALUES ('$user','$pass','$email')" or die ("could not insert register data into database");
mysql_query($reg);
mysql_close();
print("you have been registerd");
}
?>
Laatst bewerkt: