Zero767 Posted March 30, 2007 Share Posted March 30, 2007 Ok, here is my page: http://www.naruto-chronicles.com/index.php Basically the login only works in firefox, and it works perfectly I might add. But when I go into IE, it doesnt even seem to check the session that was made. Just ask and I will post my code. Thanks! Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/ Share on other sites More sharing options...
rajmohan Posted March 30, 2007 Share Posted March 30, 2007 what coding Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-217914 Share on other sites More sharing options...
Lytheum Posted March 30, 2007 Share Posted March 30, 2007 Perhaps a test login/password? Do post your code, but wrap it in code tags. Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-217916 Share on other sites More sharing options...
Zero767 Posted March 30, 2007 Author Share Posted March 30, 2007 <?php // process the script only if the form has been submitted if (array_key_exists('login', $_POST)) { include('includes/corefuncs.php'); include('includes/connection.inc.php'); // clean the $_POST array and assign to shorter variables nukeMagicQuotes(); $username = trim($_POST['username']); $pwd = trim($_POST['pwd']); // connect to the database as a restricted user $conn = dbConnect('query'); // prepare username for use in SQL query $username = mysql_real_escape_string($username); // get the username's details from the database $sql = "SELECT * FROM users WHERE username = '$username'"; $result = mysql_query($sql); $row = mysql_fetch_assoc($result); // use the salt to encrypt the password entered in the form // and compare it with the stored version of the password // if they match, set the authenticated session variable if (sha1($pwd.$row['salt']) == $row['pwd']) { $_SESSION['authenticated'] = 'Dufe Zero'; } // if no match, destroy the session and prepare error message else { $_SESSION = array(); session_destroy(); $error = 'Invalid username or password'; } // if the session variable has been set, redirect if (isset($_SESSION['authenticated'])) { // get the time the session started $_SESSION['start'] = time(); $_SESSION['name'] = $_POST['username']; echo "<meta http-equiv=\"refresh\" content=\"1; url=http://www.naruto-chronicles.com/index.php\" /> "; exit; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Login</title> </head> <body> <?php if (isset($error)) { echo "<p>$error</p>"; } elseif (isset($_GET['expired'])) { ?> <p>Your session has expired. Please log in again.</p> <p> <?php } ?> <?php if (!isset($_SESSION['authenticated'])) { echo "<form id=\"form1\" name=\"form1\" method=\"post\" action=\"\"> Register | Lost Password?</a> <input name=\"username\" type=\"text\" class=\"userpassfield\" value=\"Username\" size=\"18\" maxlength=\"20\" id=\"username\" /> <input name=\"pwd\" type=\"password\" class=\"userpassfield\" value=\"Password\" size=\"18\" maxlength=\"20\" id=\"pwd\" /> <input name=\"login\" type=\"image\" class=\"loginbutton\" value=\"Login\" src=\"images/login_button.jpg\" /> </form>"; } else { echo 'Hey, welcome back '.$_SESSION['name'].'! <form id="logoutForm" name="logoutForm" method="post" action=""> <input name="logout" type="submit" id="logout" value="Log out" /> </form>'; } ?> There is the script, it is setup as an include file. Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-218129 Share on other sites More sharing options...
Zero767 Posted March 31, 2007 Author Share Posted March 31, 2007 Can anyone help me with this? Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-218713 Share on other sites More sharing options...
MadTechie Posted March 31, 2007 Share Posted March 31, 2007 I don't see session_start(); that maybe the problem Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-218739 Share on other sites More sharing options...
Zero767 Posted April 1, 2007 Author Share Posted April 1, 2007 Nah, we are using an include type system. So on index.php I have session_start(); Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-218922 Share on other sites More sharing options...
kenrbnsn Posted April 1, 2007 Share Posted April 1, 2007 At the top of the script put in this line: <?php echo '<pre>' . print_r($_POST,true) . '</pre>'; ?> this will tell you what is being POSTed from the from to your script. I have a feeling your problem is the image button you're using. FF will return the name of the button as being set along with the x/y position as name_x & name_y, MSIE will only return the x/y position. Ken Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-218934 Share on other sites More sharing options...
Zero767 Posted April 1, 2007 Author Share Posted April 1, 2007 Hey, yea I put the code in and it didnt work. But I just changed the image to the submit button and it works. I guess I will just live without the image. Thanks for the help Link to comment https://forums.phpfreaks.com/topic/44878-login-only-works-in-firefox/#findComment-218937 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.