Jump to content

Page shift with erro


timmah1

Recommended Posts

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.