Cory94bailly Posted August 4, 2008 Share Posted August 4, 2008 I found this: http://www.ineedtutorials.com/articles/complete-advanced-login-member-system-php-tutorial and was trying to get it working.. (If anyone doesn't want to construct all that, I zipped it and uploaded it to: http://etsoldiers.com/simplelogin.zip) Well problems I have with it are: 1.) No matter what you put into the register fields, it will say "Registration failed! Please try again." 2.) It puts info into mysql but still says failed.. Also, if I try to login with it.. it won't let me. Any help? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 4, 2008 Share Posted August 4, 2008 can you post your registration code. Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 can you post your registration code. Register.php: <?php require_once "header.php"; if (isset($_POST['register'])){ if (registerNewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['email'])){ echo "Thank you for registering, an email has been sent to your inbox, Please activate your account. <a href='./index.php'>Click here to login.</a> "; }else { echo "Registration failed! Please try again."; show_registration_form(); } } else { // has not pressed the register button show_registration_form(); } require_once "footer.php"; ?> Validation.functions.inc.php: <?php #### Validation functions #### function valid_email($email) { // First, we check that there's one @ symbol, and that the lengths are right if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) { // Email invalid because wrong number of characters in one section, or wrong number of @ symbols. return false; } // Split it into sections to make life easier $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for ($i = 0; $i < sizeof($local_array); $i++) { if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { return false; } } if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; // Not enough parts to domain } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) { return false; } } } return true; } function valid_username($username, $minlength = 3, $maxlength = 30) { $username = trim($username); if (empty($username)) { return false; // it was empty } if (strlen($username) > $maxlength) { return false; // to long } if (strlen($username) < $minlength) { return false; //toshort } $result = ereg("^[A-Za-z0-9_\-]+$", $username); //only A-Z, a-z and 0-9 are allowed if ($result) { return true; // ok no invalid chars } else { return false; //invalid chars found } return false; } function valid_password($pass, $minlength = 6, $maxlength = 15) { $pass = trim($pass); if (empty($pass)) { return false; } if (strlen($pass) < $minlength) { return false; } if (strlen($pass) > $maxlength) { return false; } $result = ereg("^[A-Za-z0-9_\-]+$", $pass); if ($result) { return true; } else { return false; } return false; } ?> If you need anymore codes, ask me Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 4, 2008 Share Posted August 4, 2008 if (registerNewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['email'])){ that line is the problem Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 4, 2008 Share Posted August 4, 2008 Where is that function ? Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 if (registerNewUser($_POST['username'], $_POST['password'], $_POST['password2'], $_POST['email'])){ that line is the problem So what do I do to it? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 4, 2008 Share Posted August 4, 2008 Where is that function ? Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 Bump. Any help? Quote Link to comment Share on other sites More sharing options...
Stephen Posted August 4, 2008 Share Posted August 4, 2008 As Blade said... what is your registerNewUser function ;-;. Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 As Blade said... what is your registerNewUser function ;-;. I can't explain that. I just found the script.. Quote Link to comment Share on other sites More sharing options...
Stephen Posted August 4, 2008 Share Posted August 4, 2008 It has to be included somewhere in the script so why can't you post it? Probably in "header.php" or something... Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 4, 2008 Share Posted August 4, 2008 Why not write your own member login system? Most scripts like the one you found are hardly customizable without dissecting the whole of it anyway. Quote Link to comment Share on other sites More sharing options...
dezkit Posted August 4, 2008 Share Posted August 4, 2008 by looking at the website you gave us, function registerNewUser is assigned to function registerNewUser($username, $password, $password2, $email) { global $seed; if (!valid_username($username) || !valid_password($password) || !valid_email($email) || $password != $password2 || user_exists($username)) { return false; } Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 So what does all this mean? I don't want to make my own because this one has everything I want. If the function is included, why is there a problem? Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 4, 2008 Share Posted August 4, 2008 how can we tell if we cant see the code. Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 how can we tell if we cant see the code. Seriously.. Are you blind? I gave a link in the main post. http://www.ineedtutorials.com/articles/complete-advanced-login-member-system-php-tutorial Read next time please.. god Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 4, 2008 Share Posted August 4, 2008 We don't feel like searching in the dark for a solution to YOUR problem. Being a complete jerk will not get you far at all. Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 We don't feel like searching in the dark for a solution to YOUR problem. Being a complete jerk will not get you far at all. Well I'm sorry for asking.. How can I find the problem if idk what the code means? How am I being a jerk? I gave a url and that guy didn't read it. Quote Link to comment Share on other sites More sharing options...
DeanWhitehouse Posted August 4, 2008 Share Posted August 4, 2008 If your going to act like that , i don't think anyone will help you. Quote Link to comment Share on other sites More sharing options...
DarkWater Posted August 4, 2008 Share Posted August 4, 2008 "Seriously.. Are you blind?" That's jerky. Not the beef kind. Anyway, I honestly think that it would be easier to write your own system so that it works how YOU want it to. =/ And honestly, I didn't click the link yet either. I hate aimlessly reading (probably poorly designed, like most systems like that) code. Quote Link to comment Share on other sites More sharing options...
Cory94bailly Posted August 4, 2008 Author Share Posted August 4, 2008 Ok umm. Let's restart, shall we? I have a problem in my php code. The link to the code is: http://www.ineedtutorials.com/articles/complete-advanced-login-member-system-php-tutorial If anyone can suggest anything, it would help alot. Quote Link to comment Share on other sites More sharing options...
ohdang888 Posted August 4, 2008 Share Posted August 4, 2008 Here: 1) list your problems(about the php, not your life). Its like surgery: If the doctor doesn't know whats going wrong, they can't fix it. 2) Do not use scripts you find on the web. Use those as a resource, not an option. The worst possible thing you could do for your website is to use pre-made scripts. Here's why: a) when you come across errors(like now), you'll have no idea where to find them. b) when you come across errors, you'll have to post the code every time here, and have us fix it. Its a LOT faster and easier to learn PHP your self then to wait for a response each time c) If you don't know what they script is doing and where, its very unsafe. For all you know, it might have it set up to alert the script creator when its being used, and email passwords, etc. Or maybe they purposefully left a security hole so they can come back to get in your site. Sounds crazy, buts its possible and HAS happened before. 3)I'm taking some of my valuable time to read your post and try to help. When i could be working on my website and adding more features to it, increasing my revuenue. So you're probably flustered from reading this and ready to write a hate message back to me, but wait. Calm down, and realize that I am helping YOU... YOU need us to help you, WE don't HAVE to answer. We're not all going to get along, but either calm down, or stop expecting answers. Quote Link to comment 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.