BillyBoB Posted July 15, 2006 Author Share Posted July 15, 2006 because i like to waste my time typing all that stuff on my script lol kiding idk Quote Link to comment https://forums.phpfreaks.com/topic/14648-i-cant-find-my-error-in-my-registerphp-in-notepad/page/2/#findComment-58406 Share on other sites More sharing options...
trq Posted July 15, 2006 Share Posted July 15, 2006 [quote]ok if u guys think its such a great idea to put an action in tell the exact code to put in plz[/quote]I was not telling you you NEED to define the action. I told you what happens by default if you dont.Read the answers you are given. Quote Link to comment https://forums.phpfreaks.com/topic/14648-i-cant-find-my-error-in-my-registerphp-in-notepad/page/2/#findComment-58417 Share on other sites More sharing options...
AndyB Posted July 15, 2006 Share Posted July 15, 2006 [quote author=BillyBoB link=topic=100640.msg397569#msg397569 date=1152942605]ok though all ur i dont like this section of coding i have found the error since most of this coding wasnt updated for the new databases i hadnt made the script check the emails in the profile srry for the big mess and will someone plz tell me why my karma is bad plz[/quote]Possibly because your questions are poorly phrased; fully of irritating stuff like plz, ur, srry; often appear to have mostly ignored any constructive suggestions about solving your problem; and are poorly thought out.If you want people to help you, put some effort into it. Otherwise, people will simply move on to help someone else.Use whole sentences. Use whole words. Use punctuation. Use thought before posting. Read replies. Quote Link to comment https://forums.phpfreaks.com/topic/14648-i-cant-find-my-error-in-my-registerphp-in-notepad/page/2/#findComment-58490 Share on other sites More sharing options...
tomfmason Posted July 15, 2006 Share Posted July 15, 2006 [quote author=redarrow link=topic=100640.msg397521#msg397521 date=1152935219]//anotherif($_POST['submit']){code}about a 30 of them lol............[/quote]There have been alot of posts about [code=php:0]if($_POST['submit']){[/code] Maybe one of the moderators can make a sticky reguarding this issue. Quote Link to comment https://forums.phpfreaks.com/topic/14648-i-cant-find-my-error-in-my-registerphp-in-notepad/page/2/#findComment-58493 Share on other sites More sharing options...
pixy Posted July 15, 2006 Share Posted July 15, 2006 ^ Wouldn't that do nothing? I'd think you'd need to do something like if (isset($_POST['submit'])) { ... but why?What I do personally is create a hidden field and check if that has been submitted--that way, they can't mess it up since it's in the HTML...Here, i'm just going to write it for you...Please ask questions if they're something that just seems out there--because they're a reson for everything. :)[code]<?phpif (isset($_POST['submitted'])) { $errors = array(); if (empty($_POST['username'])) { $errors[] = 'You did not enter a username.'; } else { $username = $_POST['username']; } if (empty($_POST['password'])) { $errors = 'You did not enter a password.'; } else { $pw = $_POST['password']; } if (empty($_POST['password2'])) { $errors[] = 'You did not confirm your password.'; } else { $pw2 = $_POST['password']; } if ($pw != $pw2) { $errors[] = 'Your password and confirmed password do not match.'; } if (empty($errors)) { // No errors, so continue with script... // First, make sure the username doesn't already exist $query = "SELECT username FROM users WHERE username='$username'"; $result = mysql_query($query); if (mysql_num_rows($query) == 0) { // No results come back, so can register $query = "INSERT INTO users (username, password) VALUES ('$username', SHA('$pw'))"; // SHA() encrypts it, always incrypt passwords! :) $result = mysql_query($query); if ($result) { echo $username.', you have been sucessfully registered.'; // Send an email if you wanna } else { echo mysql_error(); } } else { echo 'Someone with that username has already registered.'; } } else { foreach ($errors as $msg) { echo '<li> '.$msg.'</li>'; } }}else { echo '<form action="register.php" method="post"> <B>Username:</b> <input type="text" name="username" value="'; if (isset($_POST['username'])) { echo stripslashes($_POST['username']); } echo '"><br> <b>Password:</b> <input type="password" name="password"><br> <b>Confirm Password:</b> <input type="password" name="password2"><br> <input type="submit" name="submit" value="Register"> <input type="hidden" name="submitted" value="TRUE"> </form>';}?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/14648-i-cant-find-my-error-in-my-registerphp-in-notepad/page/2/#findComment-58515 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.