jaku78 Posted April 1, 2007 Share Posted April 1, 2007 I have the case of the unexpected end blues... I've checked the code numerous times for the same amount of curly braces and still cannot find the error! Help is very well appreciated on this matter because I really can't seem to find it. Here is the file: <?php //USERNAME CHECK function usercheck($usercheckname) { if(!ereg("^[A-Za-z -]+$",$usercheckname)) { echo "Invalid Username. Try again."; die(); } else { echo "Username Success"; return $usercheckname; } } //PASSWORD CHECK function pwchecker($pwcheckname) { if(!ereg("^[A-Za-z -]+$",$pwcheckname)) { die("Parse error in your username, please press back and check"); } else { echo "Password Success"; return $pwcheckname; } } //GENDER CHECK function gencheck($gencheck) { if(!ereg("(male|female)",$gencheck)) { die("Parse error in your username, please press back and check again"); } else { echo "Gender Success"; return $gencheck; } //AGE CHECK function agecheck($agecheck) { if(!ereg("[0-9]+",$agecheck)) { die("Parse error in your DOB, please press back and check again"); } else { echo "Age Success"; return $agecheck; } } ?> Link to comment https://forums.phpfreaks.com/topic/45099-solved-unexpected-end/ Share on other sites More sharing options...
kenrbnsn Posted April 1, 2007 Share Posted April 1, 2007 You're missing the closing "}" on this funciton: <?php function gencheck($gencheck) { if(!ereg("(male|female)",$gencheck)) { die("Parse error in your username, please press back and check again"); } else { echo "Gender Success"; return $gencheck; } ?> If you had indented your code, it would have been obvious. Ken Link to comment https://forums.phpfreaks.com/topic/45099-solved-unexpected-end/#findComment-218935 Share on other sites More sharing options...
jaku78 Posted April 1, 2007 Author Share Posted April 1, 2007 Thank you! I'm now indenting like you said in every one of those situatiosn but now I have another problem, and I wouldn't want to cause alot of spam. Now that that part of the script is working, another part shot up, in the usercheck part, it always gives me a problem. function usercheck($usercheckname) { if(!ereg("^[A-Za-z -]+$",$usercheckname)) { echo "Invalid Username. Try again."; die(); } else { echo "Username Success"; return $usercheckname; } } everytime the function runs it will say the test does not equal the same ereg function format, and the login name I tried to create was "jaku78". I'm trying to make it so it can have all uppercase, lowercase, and numericals but it just isn't working. I know that it has something to do with the EREG statement, but I don't know what, if someone could point me into a tutorial that is centered on the EREG, that might even help. EDIT:I already tried looking at the php.net manual, I will keep searching until I do find it. EDIT2:Fixed it! Link to comment https://forums.phpfreaks.com/topic/45099-solved-unexpected-end/#findComment-218948 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.