Jump to content

Background image won't load first time


nex1234

Recommended Posts

My background image won't load until i refresh the page.  This happens in Firefox and Internet Explorer.  Heres the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MPS Project Tracking</title>
</head>
<body background="ripple.jpg">
<?php
mysql_connect('localhost', '----', '----') or die(mysql_error());
mysql_select_db('mps') or die(mysql_error());

if (isset($_POST['login'])) {
if (!$_POST['username'] | !$_POST['password']) {
	print('You must complete all input fields.');
}

$check_one = mysql_query("SELECT * FROM mps_login WHERE username = '".$_POST['username']."'") or die(mysql_error());
$check_two = mysql_num_rows($check_one);

if ($check_two == 0) {
	print('The username "'.$_POST['username'].'" does not exist.');
}
while ($check_three = mysql_fetch_array($check_one)) {
	$_POST['password'] = stripslashes($_POST['password']);
	$check_three['password'] = stripslashes($check_three['password']);
	$_POST['password'] = md5($_POST['password']);

	if ($_POST['password'] != $check_three['password']) {
		print('The password you entered is not valid.');
	} else {
		setcookie('username', $_POST['username'], time()+3600);
		setcookie('password', $_POST['password'], time()+3600);

		header('Location: home.php');
	}
}
}
?>
<body>
<b><u>MPS PROJECT TRACKING</u></b><br /><br />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
  <tr>
    <td>Login:</td>
  </tr>
  <tr>
    <td>Username:</td>
<td><input type="text" name="username" /></td>
  </tr>
  <tr>
    <td>Password:</td>
<td><input type="password" name="password" /></td>
  </tr>
  <tr>
    <td><input type="submit" name="login" value="Login" /></td>
  </tr>
</table>
</form>
</body>
</html>

Link to comment
Share on other sites

Also, I just noticed if I change the location of the background tag it seems to load fine.  Could this be the cause?  Heres the updated code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MPS Project Tracking</title>
</head>
<?php
mysql_connect('localhost', '----', '----') or die(mysql_error());
mysql_select_db('mps') or die(mysql_error());

if (isset($_POST['login'])) {
if (!$_POST['username'] | !$_POST['password']) {
	print('You must complete all input fields.');
}

$check_one = mysql_query("SELECT * FROM mps_login WHERE username = '".$_POST['username']."'") or die(mysql_error());
$check_two = mysql_num_rows($check_one);

if ($check_two == 0) {
	print('The username "'.$_POST['username'].'" does not exist.');
}
while ($check_three = mysql_fetch_array($check_one)) {
	$_POST['password'] = stripslashes($_POST['password']);
	$check_three['password'] = stripslashes($check_three['password']);
	$_POST['password'] = md5($_POST['password']);

	if ($_POST['password'] != $check_three['password']) {
		print('The password you entered is not valid.');
	} else {
		setcookie('username', $_POST['username'], time()+3600);
		setcookie('password', $_POST['password'], time()+3600);

		header('Location: home.php');
	}
}
}
?>
<body background="ripple.jpg">>
<b><u>MPS PROJECT TRACKING</u></b><br /><br />
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
  <tr>
    <td>Login:</td>
  </tr>
  <tr>
    <td>Username:</td>
<td><input type="text" name="username" /></td>
  </tr>
  <tr>
    <td>Password:</td>
<td><input type="password" name="password" /></td>
  </tr>
  <tr>
    <td><input type="submit" name="login" value="Login" /></td>
  </tr>
</table>
</form>
</body>
</html>

Link to comment
Share on other sites

First - you have to give us the output of the php code, not the php code. No one is going to go through your php to figure out what the output is.

 

Second - you would be better off giving us a link (google free hosting if you don't have a server) so we can see it live.

 

If you do nothing, you almost definitely won't get an answer to your problem.

If you do the first thing, you may get an answer to your problem.

If you do the second thing, you will probably get an answer to your problem.

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.