ccrevcypsys Posted December 21, 2007 Share Posted December 21, 2007 so i have this login page and i was wondering why it isnt working. Nothing is parsing. Can someone look at this and let me know whats going on? <?php if($_POST['submit']){ $errors = array(); if(empty($_POST['email'])){ $errors[]= 'You forgot the email addres...'; }else{ $e = escape_data($_POST['email']; } if(empty($_POST['password'])){ $errors[] = 'You didn′t put in a password'; }else{ $p = escape_data($_POST['password']); } if(empty($errors)) { $query = "SELECT customer_id, firstName FROM `customer` WHERE email = '".$e."' AND password=SHA('".$p."')"; $result = @mysql_query($query); $row = mysql_fetch_array($result, MYSQL_NUM); if($row){ setcookie('customer_id', $row[0]); setcookie('firstName', $row[1]); $url= 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); if((substr($url, -1) == '/') || (substr($url, -1)=='\\') ) { $url = substr ($url, 0 , -1); } $url = '/loggedin.php'; header("Location: $url"); exit(); }else{ $errors[] = 'The Email Address And Password You Entered Do Not Match Those On File.'; $errors[] = mysql_error().'<br /><br /> Qury:'.$query; } mysql_close(); }else{ $errors = NULL; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/ Share on other sites More sharing options...
p2grace Posted December 21, 2007 Share Posted December 21, 2007 First problem would be the syntax error here: <?php if($_POST['submit']){ $errors = array(); if(empty($_POST['email'])){ $errors[]= 'You forgot the email addres...'; }else{ $e = escape_data($_POST['email']; } you need to have <?php if($_POST['submit']){ $errors = array(); if(empty($_POST['email'])){ $errors[]= 'You forgot the email addres...'; }else{ $e = escape_data($_POST['email']); } You were missing the closing ")" with the escape_data. That might not be the only issue. Once you fix that let me know and I'll continue looking. Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420692 Share on other sites More sharing options...
ccrevcypsys Posted December 21, 2007 Author Share Posted December 21, 2007 it still isnt loading anything even if i get rid of those it still wont load anything so now i just have this if($_POST['submit']){ $errors = array(); if(empty($errors)) { $query = "SELECT customer_id, firstName FROM customer WHERE email = '$e' AND password=SHA('$p')"; $result = @mysql_query($query); $row = mysql_fetch_array($result, MYSQL_NUM); if($row){ setcookie('customer_id', $row[0]); setcookie('firstName', $row[1]); $url= 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); if((substr($url, -1) == '/') || (substr($url, -1)=='\\') ) { $url = substr ($url, 0 , -1); } $url .= '/loggedin.php'; header("Location: $url"); exit(); }else{ $errors[] = 'The Email Address And Password You Entered Do Not Match Those On File.'; $errors[] = mysql_error().'<br /><br /> Qury:'.$query; } mysql_close(); }else{ $errors = NULL; } Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420705 Share on other sites More sharing options...
kenrbnsn Posted December 21, 2007 Share Posted December 21, 2007 What do you mean by "it still isnt loading anything". Please explain your problem better. Ken Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420713 Share on other sites More sharing options...
ccrevcypsys Posted December 21, 2007 Author Share Posted December 21, 2007 when i say that i mean the page is completly blank... you know not loading anything Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420723 Share on other sites More sharing options...
PHP_PhREEEk Posted December 21, 2007 Share Posted December 21, 2007 if($_POST['submit']){ If this doesn't turn out TRUE, then your else clause just nullifies $errors, and nothing would be output. Is there more to this script? If not, then $_POST['submit'] isn't being submitted with a value. Try a print_r($_POST) at the top of the script to see what is being POSTed. PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420731 Share on other sites More sharing options...
ccrevcypsys Posted December 21, 2007 Author Share Posted December 21, 2007 nothing is being posted. I havent even been able to press submit because when that page loads nothing shows up... Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420733 Share on other sites More sharing options...
kenrbnsn Posted December 21, 2007 Share Posted December 21, 2007 Please show us your form. Ken Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420735 Share on other sites More sharing options...
p2grace Posted December 21, 2007 Share Posted December 21, 2007 When he says it's blank, as in just a white page, most likely cause would be a syntax issue. Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420753 Share on other sites More sharing options...
PHP_PhREEEk Posted December 21, 2007 Share Posted December 21, 2007 When he says it's blank, as in just a white page, most likely cause would be a syntax issue. We've established why the page is blank... thanks tho PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/82709-whats-wrong-login-problems/#findComment-420761 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.