Mr P!nk Posted October 3, 2007 Share Posted October 3, 2007 <?php include('includes/db_inc.php'); if(isset($submit)) // name of submit button { $sql = "SELECT * FROM merc_users WHERE username='$username' AND password='$password'"; $result = mysql_query($sql); $isAuth = false; while ($row = mysql_fetch_array($result)) { if($row['username'] == $username) { $isAuth = true; @session_start(); session_register('username'); } } } ?> </head> <body topmargin="0" leftmargin="0"> <table width="800" height="489" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="19%" rowspan="3" bgcolor="#B7CA33" scope="col"><img src="images/global_nav_bg.gif" width="152" height="600" hspace="0" vspace="0" /></td> <th width="81%" height="56" nowrap="nowrap" scope="col"><div id="Layer4"><img src="login/images/login_header.gif" width="648" height="316" /></div></th> </tr> <tr> <td height="80"><p> </p> <p> </p> <p> </p></td> </tr> <tr> <td height="79"><form action="index.php" method="post" enctype="multipart/form-data"> <p> <?php if ($isAuth && isset($submit)) { printf("<div id=\"system\" align=\"center\">You have logged in successfully. <a href=\"layout.php\">Go to Layout selection</a></div>"); } else if (!$isAuth && isset($submit)) { printf("<div id=\"system\" align=\"center\">Login unsuccessful. Check your details and <a href=\"index.php\">try again</a></div>"); } if (!isset($submit)) { echo("<table width=\"33%\" height=\"101\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\"> <tr> <td height=\"58\" scope=\"col\"><p align=\"center\">Username <input name=\"username\" type=\"text\" class=\"loginText\" id=\"username\" size=\"15\" maxlength=\"15\" /> <br /> <br /> Password <input name=\"password\" type=\"password\" class=\"loginText\" id=\"password\" size=\"15\" maxlength=\"15\" /> </p></td> </tr> <tr> <td scope=\"col\"><div align=\"center\" ><input type=\"image\" src=\"login/images/login_btn.gif\" alt=\"Submit\" name=\"submit\" type=\"submit\" id=\"submit\" value=\"login\"></div></td> </tr> </table>" } ?> does anyone know why this works perfectly in Firefox, But in IE it just reloads the index.php when submit is clicked? thanks P!nk Quote Link to comment https://forums.phpfreaks.com/topic/71692-works-in-firefox-but-not-ie/ Share on other sites More sharing options...
trq Posted October 3, 2007 Share Posted October 3, 2007 It probably shouldn't work in either. This... if(isset($submit)) // name of submit button should be.... if(isset($_POST['submit'])) // name of submit button All your other posted variables need to be grabbed via the $_POST[] array as well. Quote Link to comment https://forums.phpfreaks.com/topic/71692-works-in-firefox-but-not-ie/#findComment-360901 Share on other sites More sharing options...
MadTechie Posted October 3, 2007 Share Posted October 3, 2007 probably the pesky global reg's.. <?php include('includes/db_inc.php'); if(isset($_POST['submit'])) // name of submit button { //Need to filter this.......... $username = $_POST['username']; $password = $_POST['password']; //SQL injection detected here.. Filter the above $sql = "SELECT * FROM merc_users WHERE username='$username' AND password='$password'"; $result = mysql_query($sql); $isAuth = false; while ($row = mysql_fetch_array($result)) { if($row['username'] == $username) { $isAuth = true; @session_start(); session_register('username'); } } } ?> </head> <body topmargin="0" leftmargin="0"> <table width="800" height="489" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="19%" rowspan="3" bgcolor="#B7CA33" scope="col"><img src="images/global_nav_bg.gif" width="152" height="600" hspace="0" vspace="0" /></td> <th width="81%" height="56" nowrap="nowrap" scope="col"><div id="Layer4"><img src="login/images/login_header.gif" width="648" height="316" /></div></th> </tr> <tr> <td height="80"><p> </p> <p> </p> <p> </p></td> </tr> <tr> <td height="79"><form action="index.php" method="post" enctype="multipart/form-data"> <p> <?php if ($isAuth && isset($_POST['submit'])) { printf("<div id=\"system\" align=\"center\">You have logged in successfully. <a href=\"layout.php\">Go to Layout selection</a></div>"); } else if (!$isAuth && isset($_POST['submit'])) { printf("<div id=\"system\" align=\"center\">Login unsuccessful. Check your details and <a href=\"index.php\">try again</a></div>"); } if (!isset($_POST['submit'])) { echo("<table width=\"33%\" height=\"101\" border=\"0\" align=\"center\" cellpadding=\"2\" cellspacing=\"2\"> <tr> <td height=\"58\" scope=\"col\"><p align=\"center\">Username <input name=\"username\" type=\"text\" class=\"loginText\" size=\"15\" maxlength=\"15\" /> <br /> <br /> Password <input name=\"password\" type=\"password\" class=\"loginText\" size=\"15\" maxlength=\"15\" /> </p></td> </tr> <tr> <td scope=\"col\"><div align=\"center\" ><input type=\"image\" src=\"login/images/login_btn.gif\" alt=\"Submit\" name=\"submit\" type=\"submit\" value=\"login\"></div></td> </tr> </table>" } ?> Quote Link to comment https://forums.phpfreaks.com/topic/71692-works-in-firefox-but-not-ie/#findComment-360944 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.