Jump to content

Login errors or redirect errors??


Skipjackrick

Recommended Posts

I can't figure out why my login.php does not work with my friends host.  Its very simple code and works with my host.

 

It won't work on my buddies website.

 

It just continually redirects me back to the login.php page AGAIN and AGAIN and AGAIN....

 

HELP ME PLEASE!!!

 

 

At the top of each web page I put the following code.

 

<?php
include 'auth.inc.php';
?>

 

 

This is the auth.inc.php file

 

<?php
session_start();
if ($_SESSION['logged'] != 1)
{
$redirect = $_SERVER['PHP_SELF'];
header("Refresh: 5; URL=login.php?redirect=$redirect");
echo "Please wait while the server processes your login request......<br>";
echo "(If your browser does not support this, <a
href=\"login.php?redirect=$redirect\">click here</a>)";
die();
}
?>

 

 

This is the login.php file (I hid the username and password, but I have checked that for sure)

 

<?php
session_start();
$_SESSION['logged'] = 0;
if (isset($_POST['submit']))
{
if ($_POST['username'] == "********" && $_POST['password'] == "********")
{
$_SESSION['logged'] = 1;
header ("Refresh: 5; URL=" . $_POST['redirect'] . "");
echo "Please wait while the server processes your login request......<br>";
echo "(If your browser doesn't support this, <a href=\"" .
$_POST['redirect']. "\">click here</a>)";
}
else
{
?>
<html>
<head>
<title>Kayak Wars Captain's Login Page</title>
</head>
<body>
<div align="center">
<div align="center"><img src="http://www.extremecoast.com/Kayak_Wars/layout/header.png" width="1057" height="125"></div>
Please Enter your Username and Password (Case Sensitive)<br><br>
<form action="login.php" method="post">
<input type="hidden" name="redirect" value="<?php echo $_POST['redirect'];
?>">
<table width="340" border="0">
  <tr>
    <td>Username: </td>
    <td><input type="text" name="username2"></td>
  </tr>
  <tr>
    <td>Password: </td>
    <td><input type="password" name="password2"></td>
  </tr>
</table>
<br>
<input type="submit" name="submit" value="Login">
</form>
</div>
<?php
}
}
else
{
?>
<html>
<head>
<title>Kayak Wars Captain's Login Page</title>
</head>
<body>
<div align="center">
<div align="center"><img src="http://www.extremecoast.com/Kayak_Wars/layout/header.png" width="1057" height="125"></div>
Please Enter your Username and Password (Case Sensitive)<br><br>
<form action="login.php" method="post">
<input type="hidden" name="redirect" value="<?php echo $_GET['redirect']; ?>">
<table width="340" border="0">
  <tr>
    <td>Username: </td>
    <td><input type="text" name="username"></td>
  </tr>
  <tr>
    <td>Password: </td>
    <td><input type="password" name="password"></td>
  </tr>
</table>
<br>
<br>
<input type="submit" name="submit" value="Login">
</form>
<?php
}
?>
</div>
</body>
</html>

Link to comment
Share on other sites

Check your friends php.ini for the session save path, it may be wrong.

 

 

What should the session save path be set to?

 

Currently this is what it is set to,

 

session.save_path = /var/php_sessions

 

 

 

 

Is there anything else that it might be???

 

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.