jakatu Posted February 29, 2008 Share Posted February 29, 2008 I am pretty new to web programming and I am experiencing a weird problem. I (or any user) can login to the site fine when using firefox or safari, but when I try using Internet Explorer, it doesn't work. It gives me an error message when I type in a bad access code but when it is right the page just refreshes and nothing happens. I am inserting the code for the part that is goofy. if(isset($_POST['submit'])) { //Form has been submitted $errors = array(); //perform validations on the form data $required_fields = array('access'); $errors = array_merge($errors, check_required_fields($required_fields, $_POST)); $fields_with_lengths = array('access' => 30); $errors = array_merge($errors, check_max_field_lengths($required_fields, $_POST)); $access = $_POST['access']; if ( empty($errors)) { // Check database to see if the company and hashed password exist there. $query = "SELECT users_id, id FROM subjects WHERE access = '{$access}' "; $result_set = mysql_query($query); confirm_query($result_set); if (mysql_num_rows($result_set) == 1) { //company/password authenticated // and only one match $found_client = mysql_fetch_array($result_set); redirect_to("public.php?user=" . $found_client['users_id'] . "&subj=" . $found_client['id']); } else { // company/password combo was not found in the database $message = "Company and password combination incorrect.<br> Please make sure your caps lock is off and try again."; } } else { if (count($errors) == 1) { $message = "There was 1 error in the form."; } else { $message = "There were ". count($errors) . " errors in the form."; } } } else {//Form has not been submitted. $company = ""; $access = ""; } [/Code] I know that the functions that i created work i just cant figure it out. I am pretty sure its not the sql portion either. I have taken that out and just put the access code in the script just to check. It still didn't work. If anybody has ever experienced this let me know I am not alone and moreover those who have overcome this issue please share your knowledge with me. Thank you for your help Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/ Share on other sites More sharing options...
jakatu Posted February 29, 2008 Author Share Posted February 29, 2008 I have also taken out the redirect_to part and just listed a positive message to be displayed if the access code is correct. That wont show up either. If I type in a bad access code it will however display the negative message Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480367 Share on other sites More sharing options...
rhodesa Posted February 29, 2008 Share Posted February 29, 2008 Well...PHP won't produce different results between browsers because it is a server side language. Either something is funky in your form when submitting the data, or the redirect_to() function is doing something funky. After this line: if(isset($_POST['submit'])) { //Form has been submitted put this: print_r($_POST);exit; And make sure the data being submitted looks identical in FF and IE. Also, what is the code for redirect_to()? Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480369 Share on other sites More sharing options...
ignace Posted February 29, 2008 Share Posted February 29, 2008 where do you print the $message to the screen, or do you print it at all? and same question as rhodesa, whats the code for redirect_to()? Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480372 Share on other sites More sharing options...
jakatu Posted February 29, 2008 Author Share Posted February 29, 2008 this is in the body section of my page <table id="structure"> <tr> <td valign="top" id="navigation"> <h2>Login</h2> <br> <form action="user_login.php" method="post"> <?php if (!empty($message)) { echo "<p class=\"message\">" . $message . "</p>";} ?> and the redirect_to function is as follows function redirect_to( $location = NULL ) { if ($location != NULL) { header("Location: {$location}"); exit; } } Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480389 Share on other sites More sharing options...
jakatu Posted February 29, 2008 Author Share Posted February 29, 2008 have put in the print_r thing and result in firefox is a blank page with this message; "Array ( [access] => password [submit] => Login )." Explorer still just does the refresh thing. Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480395 Share on other sites More sharing options...
rhodesa Posted February 29, 2008 Share Posted February 29, 2008 What does your submit button look like? If IE is not showing that data on a blank page, then this line is returning false: if(isset($_POST['submit'])) { //Form has been submitted you may want to try and use this instead: if($_SERVER['REQUEST_METHOD'] == 'POST') { //Form has been submitted Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480402 Share on other sites More sharing options...
ignace Posted February 29, 2008 Share Posted February 29, 2008 i would use a strcmp() to check wether a HTTP POST header was sent <?php if (strcmp(strtolower($_SERVER['REQUEST_METHOD']), 'post') === 0) { // form has been submitted ?> Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480404 Share on other sites More sharing options...
jakatu Posted February 29, 2008 Author Share Posted February 29, 2008 oooooHHHHHHH RHODESA I COULD KISS YOU!!!!!!!!!!!!!!!!!!!! you made me a very happy man. and saved my bacon thank you soo much the "if($_SERVER['REQUEST_METHOD'] == 'POST') " did the trick. thank thank thank you Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480408 Share on other sites More sharing options...
revraz Posted February 29, 2008 Share Posted February 29, 2008 If you post your FORM, we could probably show you how to fix it. Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480410 Share on other sites More sharing options...
PFMaBiSmAd Posted February 29, 2008 Share Posted February 29, 2008 I'll take a wild guess that the submit button is an image (there seems to be a lot of that going on lately.) Quote Link to comment https://forums.phpfreaks.com/topic/93746-login-error-with-internet-explorer-but-not-firefox/#findComment-480526 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.