ttmt Posted July 17, 2009 Share Posted July 17, 2009 Hi all I have this simple login script that works fine in Safari, Firefox, Chrome but freezes in IE browsers. I know it could be some other aspects of the site that is causing this but is there anything wrong with this code that would stop it working in IE browsers index() is a function that redirects to the index page. <?php require_once("includes/session.php"); require_once("includes/connection.php"); require_once("includes/functions.php"); ?> <?php if(isset($_POST['submit'])){ $errors = array(); $required_fields = array('username', 'password'); foreach($required_fields as $fieldname){ if(!isset($_POST[$fieldname]) || empty($_POST[$fieldname])){ $errors[] = $fieldname; } } $username = mysql_prep($_POST['username']); $password = mysql_prep($_POST['password']); if(empty($errors)){ $query = "SELECT user_id, username FROM users WHERE username = '{$username}' AND hash_password = '{$password}'"; $result = mysql_query($query); confirm_query($result); if(mysql_num_rows($result) == 1){ $found_user = mysql_fetch_array($result); $_SESSION['user_id'] = $found_user['user_id']; $_SESSION['username'] = $found_user['username']; redirect_to("imgSelect.php"); }else{ index(); } }else{ index(); } }else{ if(isset($_GET['logout']) && $_GET['logout'] == 1){ $message = "You are now logged out"; } $username = ""; $password = ""; } ?> <?php include("includes/header.php"); ?> <?php include("includes/footer.php"); ?> HTML <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title></title> <meta name="generator" content="TextMate http://macromates.com/"> <link rel="stylesheet" href="css/site.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/mootools.js"></script> <script type="text/javascript" src="js/admin.js"></script> <script type="text/javascript" src="js/lightbox.js"></script> </head> <body> <div id="wrapper"> <div id="page"> <div id="header"> <div id="headImg"> <img src="assets/logo.gif" /> </div><!--headImg--> <div id="headerNav"> <a href="index.php" id="home">home</a> <a href="contact.php" id="contactIn">contact</a> <a href="#" id="adminIn">admin</a> </div> </div><!--header--> <div id= "adminbox"> <form action="login.php" name="login" method="post"> <ul> <li><label>Username </label></li> <li id="username"><input type="text" name="username" size="15" class="text" /></li> <li><label>Password </label></li> <li id="password"><input type="password" name="password" size="15" class="text" /></li> <li id="login"><input type="image" src="assets/login_btn.gif" name="submit" value="Login"/></li> <li><input type="image" src="assets/close.gif" name="close" value="Close" id="adminOut"/></li> </ul> </form> </div><!--adminbox--> Quote Link to comment https://forums.phpfreaks.com/topic/166325-login-script-not-working-in-ie-browsers/ Share on other sites More sharing options...
zq29 Posted July 18, 2009 Share Posted July 18, 2009 IE handles image buttons differently than every other browser. It sends the coordinates of your mouse click, rather than the name of the button in the request. Try this instead: if(isset($_POST['submit_x'])) By the way, the other browsers also send the coordinates as well. Quote Link to comment https://forums.phpfreaks.com/topic/166325-login-script-not-working-in-ie-browsers/#findComment-877689 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.