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
https://forums.phpfreaks.com/topic/93771-login-errors-or-redirect-errors/
Share on other sites

Or maybe you guys have a login system that might be a little better than the one I am currently using.

 

I'd be willing to change if it works.

 

 

EDIT:  Sorry....I forgot about the bump rule. Accident..And I can't delete it.

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???

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.