Hello,
I got a problem with my register script
Script:
This is the script somehow it says registration succes but it doesn't put anything in the database
Config file:
Tables in the accounts are called:
AccountID, Password, Status, Character, Email, SecretNumber
Got more info needed tell me then :3
Thx in advance x3
I got a problem with my register script
Script:
PHP Code:
<?php
if(isset($_POST['retpass']) && isset($_POST['id']) && isset($_POST['pass'])) {
if(!Empty($_POST['retpass']) && !Empty($_POST['id']) && !Empty($_POST['pass'])) {
$ok=false;
if ($requireCAPTCHA) { if (PhpCaptcha::Validate($_POST['CheckCode'])) $ok=true; }
else $ok=true;
if($ok) {
mysql_select_db($accdb);
$userid = trim($_POST['id']);
$password=trim($_POST['pass']);
$passretype=trim($_POST['retpass']);
$hash=$_POST['hash'];
if (!Empty($mail)) if (!ereg("^[0-9a-zA-Z]{4,128}$", (strtr($mail, Array('@'=>'','.'=>''))))) {
$mail='';
echo 'mail > Only letters a to z and special chars @ . are allowed';
}
if(!ereg("^[0-9a-z]{4,12}$",$userid)) {
echo 'login > Only letters from "a" to "z" and numbers, lenght of 4 to 12 characters';
}
else {
if($password == $passretype) {
if(!ereg("^[0-9a-zA-Z]{4,22}$",$password)) {
echo 'password > Only letters or numbers, lenght of 4 to 22 characters';
}
else {
$res = mysql_query('SELECT * FROM accounts WHERE AccountID = "'.$userid.'" ORDER BY AccountID DESC');
if(mysql_num_rows($res) == 0) {
mysql_query('INSERT INTO accounts(AccountID,Password) VALUES ("'
.$userid.'","'.($passhash ? $hash : $password).'","'
.$_SERVER['REMOTE_ADDR'].'", "'.'255.255.255.0")');
echo 'Success > Account registered successfully.';
}
else echo 'Error > Account Already exists.';
}
}
else echo 'Passwords did not match.';
}
}
else echo 'Check Code is Wrong.';
}
else echo ' umm why there is empty <b>required</b> areas in register form????';
}
?>
Config file:
Code:
<?php $myhost='localhost'; // MySQL database address $mypass='lol'; // MySQL server login $myuser='root'; // MySQL server pass $accdb='accounts'; //your server account database $gamedb='coserver';
AccountID, Password, Status, Character, Email, SecretNumber
Got more info needed tell me then :3
Thx in advance x3