Legaci Posted September 26, 2013 Posted September 26, 2013 I currently working on a game i am building... Notice: Undefined offset: 1 in C:\Users\AJ\Downloads\USBWebserver v8.5\USBWebserver v8.5\8.5\root\global_reg.php on line 68 Notice: Undefined offset: 1 in C:\Users\AJ\Downloads\USBWebserver v8.5\USBWebserver v8.5\8.5\root\global_reg.php on line 74 else { $email = explode("@", $_GET['string']); $check_for_the_dot = explode(".", $email[1]); if(substr_count($_GET['string'], "@") > '1') { echo "<font color='white'><b>No more than one \"@\".</b></font>"; exit(); } if(!$check_for_the_dot[1]) { echo "<font color='white'><b>Email address will be verified.</b></font>"; exit(); } Line 68 is : $check_for_the_dot = explode(".", $email[1]); Line 74 is :if(!check_for_the_dot[1]) Would this work for Line 74 if (isset(!check_for_the_dot[1])) !check_for_the_dot = substr(!check_for_the_dot[1]); Quote
KyleMassacre Posted September 26, 2013 Posted September 26, 2013 or you can just use filter_var() or filter_input() which is a whole lot easier Quote
SRB Posted September 26, 2013 Posted September 26, 2013 I currently working on a game i am building... Notice: Undefined offset: 1 in C:\Users\AJ\Downloads\USBWebserver v8.5\USBWebserver v8.5\8.5\root\global_reg.php on line 68 Notice: Undefined offset: 1 in C:\Users\AJ\Downloads\USBWebserver v8.5\USBWebserver v8.5\8.5\root\global_reg.php on line 74 else { $email = explode("@", $_GET['string']); $check_for_the_dot = explode(".", $email[1]); if(substr_count($_GET['string'], "@") > '1') { echo "<font color='white'><b>No more than one \"@\".</b></font>"; exit(); } if(!$check_for_the_dot[1]) { echo "<font color='white'><b>Email address will be verified.</b></font>"; exit(); } Line 68 is : $check_for_the_dot = explode(".", $email[1]); Line 74 is :if(!check_for_the_dot[1]) Would this work for Line 74 if (isset(!check_for_the_dot[1])) !check_for_the_dot = substr(!check_for_the_dot[1]); You said it yourself - undefined offset. If there is only 1 result, given arrays start at 0, you need $check_for_the_dot[0] With that said, you could also just use a function that google could return using a search term like "php email validation" Quote
Legaci Posted September 26, 2013 Author Posted September 26, 2013 ok i removed the 1 and added 0 and works now thank you Quote
Seker Posted September 26, 2013 Posted September 26, 2013 ok i removed the 1 and added 0 and works now thank you [ATTACH=CONFIG]1158[/ATTACH] /2short Quote
KyleMassacre Posted September 26, 2013 Posted September 26, 2013 now that you got that figured out you should validate correct characters Quote
SRB Posted September 26, 2013 Posted September 26, 2013 or you can just use filter_var() or filter_input() which is a whole lot easier now that you got that figured out you should validate correct characters With false positives from filter_var? Quote
KyleMassacre Posted September 27, 2013 Posted September 27, 2013 With false positives from filter_var? Not necessarily no. But with filter var that would have checked for the @ and the '.' he was seeking right? Now I'm sure you can do some other high tech regex pattern because the filter_validate_email type does allow a range of chars that you would not normally see in an email address or a super long prefix to the email domain. Quote
Legaci Posted September 28, 2013 Author Posted September 28, 2013 [ATTACH=CONFIG]1158[/ATTACH] /2short so are you saying if(!isset(check_for_the_dot[0])) Quote
Guest Posted September 28, 2013 Posted September 28, 2013 http://stackoverflow.com/questions/5855811/how-to-validate-an-email-in-php ? Use google maybe? Millions of results. Quote
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.