Jump to content

login error with Internet Explorer but not Firefox


jakatu

Recommended Posts

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

 

 

 

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()?

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;
	}

}

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.