PDA

View Full Version : Wth ?



Mr Macro
03-07-2007, 07:16 PM
I quickly put together a register script for my clan site, but when i register the email inputs as 0 but no error ?



<?PHP
session_start();
require('includes/config.php');

if(!$_POST[register]){
echo('
<form method="POST">
Username: <input type="text" size="15" maxlength="25" name="username"><br />
Password: <input type="password" size="15" maxlength="25" name="pass"><br />
Confirm Password: <input type="password" size="15" maxlength="25" name="cpass"><br />
Email: <input type="text" size="15" maxlength="25" name="emai1"><br />
Age: <input type="text" size="15" maxlength="25" name="age"><br />
Location: <input type="text" size="15" maxlength="25" name="location"><br />
Gamertag: <input type="text" size="15" maxlength="25" name="gt"><br />

<input name="register" type="submit" value="Register">
</form>');

}else{

$username = $_POST[username];
$password = $_POST[pass];
$cpassword = $_POST[cpass];
$email = $_POST[emai1];
$age = $_POST[age];
$location = $_POST[location];
$gt = $_POST[gt];

if($username == NULL | $password == NULL | $cpassword == NULL | $email = NULL | $age == NULL | $location == NULL | $gt == NULL){
echo('A field was left blank, please fill in all fields!');
}else{
if($password != $cpassword){
echo('Passowrds do not match!');
}else{
$password = md5($password);
$checkname = mysql_query("SELECT username FROM users WHERE username='$username'");
$checkname= mysql_num_rows($checkname);
$checkemail = mysql_query("SELECT email FROM users WHERE email='$email'");
$checkemail = mysql_num_rows($checkemail);

if ($checkemail>0|$checkname>0) {
echo('Someone already has that username, or email!');
}else{

$query = mysql_query("INSERT INTO users (username, password, email, age, location, gamertag) VALUES('$username','$password','$email', '$age', '$location', '$gt')");
echo('Successfully registerd!');
}
}
}
}

?>

Drompo
03-07-2007, 07:32 PM
Edit: I'm A Muppet!

Mr Macro
03-07-2007, 07:34 PM
Its meant to be like that, lol.Look at the form, muppet.xD Thanks anyway ash.

Luckyrare
03-07-2007, 08:00 PM
You need to add some more security before releasing that.

Eric30
03-07-2007, 08:02 PM
if($username == NULL | $password == NULL | $cpassword == NULL | $email = NULL | $age == NULL | $location == NULL | $gt == NULL){

you have a single = on the email part

Mashi
03-07-2007, 08:43 PM
True :) + Rep

CDLewis
03-07-2007, 09:13 PM
echo('Successfully registerd!');

Spelling lol

I see no problems with the script. Except for the single '='

Mr Macro
04-07-2007, 09:41 AM
Thanks, and its not going to be released.Just testing it really.

Want to hide these adverts? Register an account for free!