Jump to content

Help Me!!!!!


charlesberg

Recommended Posts

I created this script:
[code]
<?php
session_start();
include "/location/conn.inc.php";

if (isset($_POST['submit'])) {
  $query = "SELECT username, password FROM user_info " .
          "WHERE username = '" . $_POST['username'] . "' " .
          "AND password = (PASSWORD('" . $_POST['password'] . "'))";
  $result = mysql_query($query)
    or die(mysql_error());

  if (mysql_num_rows($result) == 1) {
    $_SESSION['user_logged'] = $_POST['username'];
    $_SESSION['user_password'] = $_POST['password'];
    header ("Refresh: 5; URL=" . $_POST['redirect'] . "");
    echo "You are being redirected to your original page request!<br>";
    echo "(If your browser doesn't support this, " .
        "<a href=\"" . $_POST['redirect']. "\">click here</a>)";
  } else {
?>
<html>
<head>
<title>Dropkicklove - Wrong Username/Password</title>
</head>
<body>
<p>
  Invalid Username and/or Password<br>
  Not registered?
  <a href="register.php">Click here</a> to register.<br>
  <form action="user_login.php" method="post">
    <input type="hidden" name="redirect"
      value="<?php echo $_POST['redirect']; ?>">
    Username: <input type="text" name="username"><br>
    Password: <input type="password" name="password"><br><br>
    <input type="submit" name="submit" value="Login">
  </form>
</p>
</body>
</html>
<?php
  }
} else {
  if (isset($_GET['redirect'])) {
    $redirect = $_GET['redirect'];
  } else {
    $redirect = "index.php";
  }
?>
<html>
<head>
<title>Dropkicklove - Login</title>
</head>
<body>
<p>
  Login below by supplying your username/password...<br>
  Or <a href="register.php">click here</a> to register.<br><br>
  <form action="user_login.php" method="post">
    <input type="hidden" name="redirect"
      value="<?php echo $redirect; ?>">
    Username: <input type="text" name="username"><br>
    Password: <input type="password" name="password"><br><br>
    <input type="submit" name="submit" value="Login">
  </form>
</p>
</body>
</html>
<?php
}
?>
[/code]
This is a login script. and it was working fine for ages, but then i didnt test it for a little while and it doesnt work, and neither does the admin login either. however i have created a new user and tried loggin in with that and it works fine. does anybody have a remedy for my situation?? please help!
Charlesberg

Mod edit - please use code tags
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.