Dville Posted July 19, 2006 Share Posted July 19, 2006 So i've been coding a clone of digg.com with much help from you guys here at phpfreaks.com. This can be located at http://digg.sytes.net/diggI have noticed that I can not login to an account in IE. I only use FF, so all of my testing has been done on FF. I came across this issue before, but thought it was due to the dynamic host and the cookie that was used. But apparently that was since it was IE, not the dynamic host at all.Here is the code for my login.php I have no idea what conflicts each other.[code=php:0]<?phpob_start();/*+ ----------------------------------------------------------------------------+| Web Article System - Beta 1.2|| ©Robert Lynch 2006| Website URL| dlynch027@gmail.com|| Released under the terms and conditions of the| GNU General Public License (http://gnu.org).|| # Source: /login.php, #| # Revision: 1.03 #| # Date: 07/11/2006 01:19 PM #| # Author: Robert Lynch #+----------------------------------------------------------------------------+*/?><html><head><title>Web Article System - BETA 1.2</title><body><style>all.clsMenuItemNS, .clsMenuItemIE{text-decoration: none; font: bold 12px Arial; color: white; cursor: hand; z-index:100}#MainTable A:hover {color: yellow;}</style><link rel="stylesheet" type="text/css" href="menu/chrometheme/chromestyle.css" /><script type="text/javascript" src="menu/chromejs/chrome.js"></script></head><style type="text/css">table.sample { border-width: 1px 1px 1px 1px; border-spacing: 2px; border-style: none none none none; border-color: black black black black; border-collapse: collapse; background-color: white;}table.sample th { border-width: 1px 1px 1px 1px; padding: 5px 5px 5px 5px; border-style: outset outset outset outset; border-color: gray gray gray gray; background-color: white; -moz-border-radius: 0px 0px 0px 0px;}table.sample td { border-width: 1px 1px 1px 1px; padding: 5px 5px 5px 5px; border-style: outset outset outset outset; border-color: gray gray gray gray; background-color: white; -moz-border-radius: 0px 0px 0px 0px;}</style><center><?phpinclude('include/menu.php');?><script type="text/javascript">cssdropdown.startchrome("chromemenu")</script><?php// Some line breaksecho "<br>";echo "<br>";// Connects to your Databasemysql_connect("localhost", "XXX", "XXX") or die(mysql_error());mysql_select_db("digg") or die(mysql_error());//Checks if there is a login cookieif(isset($_COOKIE['ID_my_site']))//if there is, it logs you in and directes you to the members page{ $username = $_COOKIE['ID_my_site']; $pass = $_COOKIE['Key_my_site']; $check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error()); while($info = mysql_fetch_array( $check )) { if ($pass != $info['password']) { } else { header("Location: /digg/index.php"); } }}//if the login form is submittedif (isset($_POST['submit'])) { // if form has been submitted// makes sure they filled it in if(!$_POST['username'] | !$_POST['pass']) { die('You did not fill in a required field.'); } // checks it against the database if (!get_magic_quotes_gpc()) { $_POST['email'] = addslashes($_POST['email']); } $check = mysql_query("SELECT * FROM users WHERE username = '".$_POST['username']."'")or die(mysql_error());//Gives error if user dosen't exist$check2 = mysql_num_rows($check);if ($check2 == 0) { die('That user does not exist in our database. <a href=add.php>Click Here to Register</a>'); }while($info = mysql_fetch_array( $check )){$_POST['pass'] = stripslashes($_POST['pass']); $info['password'] = stripslashes($info['password']); $_POST['pass'] = md5($_POST['pass']);//gives error if the password is wrong if ($_POST['pass'] != $info['password']) { die('Incorrect password, please try again.'); }else{// if login is ok then we add a cookie$_POST['username'] = stripslashes($_POST['username']);$hour = time() + 3600;setcookie(ID_my_site, $_POST['username'], $hour);setcookie(Key_my_site, $_POST['pass'], $hour);//then redirect them to the members areaheader("Location: /digg/index.php");}}}else {// if they are not logged in?><form action="<?php echo $_SERVER['PHP_SELF']?>" method="post"><table border="0"><tr><td colspan=2><font size="4"><b><center>Login Here</font></center></b></td></tr><tr><td>Username:</td><td><input type="text" name="username" maxlength="40"></td></tr><tr><td>Password:</td><td><input type="password" name="pass" maxlength="50"></td></tr><tr><td colspan="2" align="right"><font size="2"><a href="/digg/pass_reset.php">Forget Password?</font></a></td><td></td></tr><tr><td colspan="2" align="right"><input type="image" src="/digg/images/login.png" name="submit" value="Login"></td></tr></table></form><?php}include('include/footer.php');ob_end_flush();?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/15009-cross-browser-compatiblity-issues/ Share on other sites More sharing options...
redarrow Posted July 19, 2006 Share Posted July 19, 2006 Dont know what wrong there, i trie to register and i can not,it's like it dont like me lol............. Quote Link to comment https://forums.phpfreaks.com/topic/15009-cross-browser-compatiblity-issues/#findComment-60355 Share on other sites More sharing options...
Dville Posted July 19, 2006 Author Share Posted July 19, 2006 so it's effecting the register.php as well?i can paste that file as well if needed.i assume you tried in IE? Quote Link to comment https://forums.phpfreaks.com/topic/15009-cross-browser-compatiblity-issues/#findComment-60357 Share on other sites More sharing options...
AndyB Posted July 19, 2006 Share Posted July 19, 2006 If you think this is a client-side browser issue, it can't be a server-side php problem :)The 'problem' is actually that a form submit using images does not send the NAME of the clicked button, it sends the x and y co-ordinates of where the button was clicked (referenced to the upper corner). Instead of checking for $_POST['submit'], check for $_POST['submit_x'] and you'll get a value ... and your cross-browser issue will be solved. Quote Link to comment https://forums.phpfreaks.com/topic/15009-cross-browser-compatiblity-issues/#findComment-60417 Share on other sites More sharing options...
Dville Posted July 20, 2006 Author Share Posted July 20, 2006 I thought it was code related. Like IE wasn't reading the code now FF did(and should).However this worked beautifuly, thanks alot Andy. I have added a special thanks at the bottom of my changelog, that you can view athttp://digg.sytes.net/digg/changelog.txt Quote Link to comment https://forums.phpfreaks.com/topic/15009-cross-browser-compatiblity-issues/#findComment-61002 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.