Jump to content

[SOLVED] Redirecitng Issue


timmah1

Recommended Posts

This is my login code, the problem I'm having is that I get an error, only sometimes.

 

here is the login code

<?php
session_start();
header("Location: members.php?cid=account");				
?>
<!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>My God Journal :: Chrisitan Blogging Site</title>
<link href="text.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas",
theme : "advanced"
});
</script>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000099;
}
a:link {
color: #00FFFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #00CCFF;
}
a:hover {
text-decoration: underline;
color: #00CCFF;
}
a:active {
text-decoration: none;
color: #00CCFF;
}
.style1 {color: #FFFFFF}
.style2 {font-size: smaller}
.fieldset {
border:solid 1px #c6c6c6; 
margin:0px;
padding:5px;
}
-->
</style></head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%"  border="0" cellpadding="0" cellspacing="0" background="img/headerbg.png">
      <tr>
        <td><img src="img/header.png" /></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td bgcolor="#006699"><table width="100%"  border="0" cellspacing="0" cellpadding="3">
      <tr>
        <td> </td>
        <td align="right"><span class="style1"><?php echo $row['members']; ?> - Active Members </span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" height="500"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td width="1%" valign="top"></td>
        <td width="98%" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td>
		<?
		require_once('db.php');
include('functions.php');

if(isset($_POST['Login']))
{
	if($_POST['username']!='' && $_POST['password']!='')
	{
		//Use the input username and password and check against 'users' table
		$query = mysql_query('SELECT ID, Username, Active FROM users WHERE Username = "'.mysql_real_escape_string($_POST['username']).'" AND Password = "'.mysql_real_escape_string(md5($_POST['password'])).'"');

		if(mysql_num_rows($query) == 1)
		{
			$row = mysql_fetch_assoc($query);
			if($row['Active'] == 1)
			{

				$_SESSION['user_id'] = $row['ID'];
				$_SESSION['logged_in'] = TRUE;

			}
	  else {
				$error = 'Your membership was not activated. Please open the email that we sent and click on the activation link';
			}
		}
		else {		
			$error = 'Login failed !';		
		}
	}
	else {
		$error = 'Please enter both your username and password to access your account';
	}
}
?>

<?php if(isset($error)){ echo $error;}?>
<form action="" method="post">
<table width="100%"  border="0" cellspacing="0" cellpadding="5">
  <tr>
    <td>Username:</td>
    <td><input type="text" id="username" name="username" size="32" value="" /></td>
  </tr>
  <tr>
    <td>Password:</td>
    <td><input type="password" id="password2" name="password" size="32" value="" /></td>
  </tr>
  <tr>
    <td> </td>
    <td><input type="submit" name="Login" value="Login" /></td>
  </tr>
</table>
</form></td>
          </tr>
        </table></td>
        <td width="1%" valign="top"> </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle"><table width="100%"  border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td bgcolor="#006699"> <table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr align="center" valign="middle">
            <td><a href="?cid=about">About</a></td>
            <td><a href="?cid=guidlines">Guidelines</a></td>
            <td><a href="?cid=tos">Terms of Service</a> </td>
            <td><a href="?cid=contacts">Contact Us</a> </td>
          </tr>
        </table>  </td>
      </tr>
      <tr>
        <td align="center" class="style2"> <strong>Disclaimer</strong>: MyGodJournal.com does not endorse any blogger or profile listed on this site.<br> 
          These  profiles, blogs  and blog entries  are provided here as a resource only. MyGodJournal.com takes no<br>responsibility for the content in these profiles, that are written by the members of this community. <br />
© 2007 MyGodJournal.com. All Rights Reserved </td>
      </tr>
    </table></td>
  </tr>
</table>

</body>
</html>

 

Here is the error I get

The page isn't redirecting properly


Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
*   This problem can sometimes be caused by disabling or refusing to accept cookies.

 

Can anyone tell me what I'm doing wrong?

 

Thanks in advance

Link to comment
Share on other sites

I can do that.

But, if I put in the wrong password, or don't type the password, I should receive an error telling me that, but I'm getting the same error I do when trying to login with the correct information.

 

This does have my baffled because it works "sometimes" and others, it don't

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.