OmgPwnt Posted August 10, 2008 Share Posted August 10, 2008 Hi, I am trying to create a Register form, which submits data to a MySQL database and allows the user to log in. But the problem is, it also verifies the password so i need to have 4 variables going inside the register() (register($email, $uname, $password1, $password2)) But this does not work, however if i remove one of the variables it does...So i am guessing register() can only handle 3 parameters. Is there a way to change this? Here is the function. } function register($uname, $email, $password1, $password2) { global $db; if (($uname == '') || ($email == '') || ($password1 == '') || ($password2 == '')) { registerpage("Please fill in all fields."); } else if ($password1 != $password2) { $errtext = "Your password and verification password do not match.<br />"; $errtext .= "Please try entering your password again."; registerpage($errtext); } else { $uname = htmlentities($uname); $db->query("SELECT user_id FROM rdorg_userdata WHERE user_name='" . $uname . "' LIMIT 1"); if ($db->num_rows() == 1) { $errtext = "The username you had selected is already in use.<br />"; $errtext .= "Please try a different username."; registerpage($errtext); } else { $email = htmlentities($email); $db->query("SELECT user_id FROM rdorg_userdata WHERE user_email='" . $email . "' LIMIT 1"); if ($db->num_rows() == 1) { $errtext = "The E-Mail you had selected is already in use.<br />"; $errtext .= "Please try a different E-Mail."; registerpage($errtext); return; } } $username = $uname; $uemail = $email; if (!check_md5_format($password1)) { $errtext = "An error occured during the registration process.<br />"; $errtext .= "Please make sure your browser supports JavaScript and has it enabled."; registerpage($errtext); return; } $salt = rand_str(12); $password = md5($password1 . $salt); $db->query("INSERT INTO rdorg_userdata (user_name, user_email, user_password, user_salt) VALUES ('" . $username . "','" . $uemail . "', '" . $password . "', '" . $salt . "')"); $message = "Your account has been created successfully.<br />"; $message .= 'You can now <a href="./index.php">login</a>. Use the Profile page to set up character data.'; prnmessage($message); } } Thanks Link to comment https://forums.phpfreaks.com/topic/118984-function-register-problems/ Share on other sites More sharing options...
Fadion Posted August 10, 2008 Share Posted August 10, 2008 Register() is a custom function of yours (most probably of someones else), not a core one, so it can have as many parameters u like. U are calling it in a wrong way or there must be smth in the code which breaks it. Link to comment https://forums.phpfreaks.com/topic/118984-function-register-problems/#findComment-612679 Share on other sites More sharing options...
OmgPwnt Posted August 10, 2008 Author Share Posted August 10, 2008 Yeah, a friend told me to use it. Only problem is, he has just gone on holiday and isn't avaliable for 10 days. So i a pretty much on my own. How would i go about calling it properly? There isn't anything in the code to break it, so it has to be the calling. Link to comment https://forums.phpfreaks.com/topic/118984-function-register-problems/#findComment-612682 Share on other sites More sharing options...
genericnumber1 Posted August 10, 2008 Share Posted August 10, 2008 I'm looking at it function register($uname, $email, $password1, $password2) it takes 4 parameters... a proper call would be something like register('john', '[email protected]', 'omgbatman123', 'omgbatman123'); or with variables... register($username, $email, $pass1, $pass2); ps. if your password is omgbatman123, I'm sorry for blowing your cover.. but really.. that's a terrible password Link to comment https://forums.phpfreaks.com/topic/118984-function-register-problems/#findComment-612747 Share on other sites More sharing options...
captaintyson Posted August 10, 2008 Share Posted August 10, 2008 wait is it this? $errtext = "Your password and verification password do not match.<br />"; $errtext [color=red].[/color]= "Please try entering your password again."; Link to comment https://forums.phpfreaks.com/topic/118984-function-register-problems/#findComment-612752 Share on other sites More sharing options...
dannyb785 Posted August 10, 2008 Share Posted August 10, 2008 when you say it doesn't work, what's it not doing that it should? and where is the code where you first call the function? Link to comment https://forums.phpfreaks.com/topic/118984-function-register-problems/#findComment-612760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.