timmah1 Posted December 2, 2007 Share Posted December 2, 2007 Hello, I have a login script, but when somebody don't enter in a username/password, or if the information is incorrect, it gives an error message, that works fine. The problem lies that it shifts my whole page to the right and cuts off the bottom and right side of the page. Am I putting my code in the wrong place? You can see what I mean by going here http://www.cheezyfries.net/bar and trying to log in <style type="text/css"> <!-- .style1 { color: #FF0000; font-weight: bold; font-size: large; } --> </style> <img src="./images/error.gif" /> <table width="584" border="0" cellspacing="5" cellpadding="5" background="./images/welcomebg.gif" class="text"> <tr> <td height="600" valign="top"> <? if ($_GET["op"] == "login") { if (!$_POST["email"] || !$_POST["password"]) { die("You need to provide an email and password.<br>You are being redirected..... <meta http-equiv=\"refresh\" content=\"2; url=index.php?cid=mlogin\" />" ); } include 'DB_config.php'; ?> </td> </tr> <tr> <td> <? // Create query $q = "SELECT * FROM `users` " ."WHERE `email`='".$_POST["email"]."' " ."AND `password`=PASSWORD('".$_POST["password"]."') " ."AND `active`=`y`" ."LIMIT 1"; // Run query $r = mysql_query($q); if ( $obj = @mysql_fetch_object($r) ) { // Login good, create session variables $_SESSION["valid_id"] = $obj->user_id; $_SESSION["valid_user"] = $_POST["email"]; $_SESSION["valid_time"] = time(); $ip = $REMOTE_ADDR; $query2="update users set ip='$ip' where email='".$_POST["email"]."'"; $result2 = MYSQL_QUERY($query2); // Redirect to member page Header("Location: main.php?cid=myaccount"); } else { // Login not successful die("Sorry, could not log you in. Wrong login information. Or your account has not been activated yet<br>You are being redirected..... <meta http-equiv=\"refresh\" content=\"2; url=index.php?cid=mlogin\" />"); } } else { //If all went right the Web form appears and users can log in echo "<form action=\"?cid=login&op=login\" method=\"POST\">"; echo "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">"; echo "<tr>"; echo "<td width=\"13%\">Email:</td>"; echo "<td width=\"87%\"><input name=\"email\" size=\"25\" value=\"$_POST[email]\"></td>"; echo "</tr>"; echo "<tr>"; echo "<td>Password:</td>"; echo "<td><input type=\"password\" name=\"password\" size=\"25\"></td>"; echo "</tr>"; echo "<tr>"; echo "<td> </td>"; echo "<td><input type=\"submit\" value=\"Login\"></td>"; echo "</tr>"; echo "</table>"; echo "</form>"; } ?> </td> </tr> </table> Thank you in advance for any help Link to comment https://forums.phpfreaks.com/topic/79849-page-shift-with-erro/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.