Problem with errors
Posted: Tue Oct 22, 2013 2:31 pm
Ok, im trying to make a script to let people register for an account. However the script runs without errors. The only problem Im having is i have error coding in it and it refuses to show if there is any error from the user input... or it goes straight to the error about passwords not matching instead of running the rest of the script.
Code is Below
Code is Below
Code: Select all
<?php
$name = $_POST['name'];
$pass = $_POST['password'];
$pass2 = $_POST['password2'];
$email = $_POST['email'];
$fname =$_POST['fname'];
$sname = $_POST['sname'];
$tos = $_POST['tos'];
$domain_name = 'mymesage.org.uk';
// Error Reporting
include ('conn.php');
$md5 = md5($pass);
//check inputted data
$fullemail = $name.'@'.domain;
$checkemail = "SELECT * FROM hm_accounts WHERE accountaddress = '$fullemail'";
if (mysql_num_rows($checkemail) == 1) {
echo 'username already exists<br>';
echo 'Please hit <a href="index.php">back</a> to try again';
}
else if ($pass != $pass) {
echo'Please enter a password<br> ';
echo 'Please hit <a href="index.php">back</a> to try again';
}
else if ($pass != $pass2) {
echo'The passwords do not match<br> ';
echo 'Please hit <a href="index.php">back</a> to try again';
}
else if ($fname == '') {
echo "Please enter your Firstname<br>";
echo 'Please hit <a href="index.php">back</a> to try again';
}
else if ($sname == '') {
echo "Please enter your Surname<br>";
echo 'Please hit <a href="index.php">back</a> to try again';
}
else if ($tos == 0) {
echo "You Must Agree To the Terms of Service<br>";
echo 'Please hit <a href="index.php">back</a> to try again';
}/*
$insertdetails = "INSERT INTO `hm_accounts`(`accountdomainid`, `accountadminlevel`, `accountaddress`, `accountpassword`, `accountactive`, `accountisad`, `accountaddomain`, `accountadusername`, `accountmaxsize`, `accountvacationmessageon`, `accountvacationmessage`, `accountvacationsubject`, `accountpwencryption`, `accountforwardenabled`, `accountforwardaddress`, `accountforwardkeeporiginal`, `accountenablesignature`, `accountsignatureplaintext`, `accountsignaturehtml`, `accountlastlogontime`, `accountvacationexpires`, `accountvacationexpiredate`, `accountpersonfirstname`, `accountpersonlastname`)
VALUES ('2','0','$fullemail','$pass','1','0','','',100,'0','','','2','0','','0','0','','','2013-10-22 19:07:28','0','2013-10-22 19:07:28','$fname','$lname')";
mysql_query($insertdetails);
mysql_error();
mysql_close();
include ('conn.php');
$checkid = mysql_query("SELECT * FROM hm_accounts WHERE accountaddress = $fullemail ");
while ($row = mysql_fetch_array($checkid)) {
$id = $row['accountid'];
$insertfolders = "INSERT INTO `hm_imapfolders`(`folderaccountid`, `folderparentid`, `foldername`, `folderissubscribed`, `foldercreationtime`, `foldercurrentuid`)
VALUES ('$id','-1','INBOX','1','2013-10-22 19:07:28','0')";
mysql_query($insertfolders);
mysql_error();
mysql_close();
}
echo 'Account Created';
echo 'You may now log into your email via the following link';
echo '<a href="http://www.mymessage.org.uk/webmail">Webmail Login</a>';
*/
?>