Jump to content

User system error


rofl90

Recommended Posts

I have a login and a validation, but it always returns as 0 but I can guarantee it doesn't...:

 

validation:

<?php
session_start();
ini_set('display_errors', 1);
error_reporting(E_ALL); 
include "config.php";
    $username = $_POST["username"];
    $password = md5($_POST["password"]);
    $get_username = mysql_query("SELECT * FROM users WHERE user='$username' AND password='$password'");
    $get_username_n = mysql_num_rows($get_username);
$get_username_a = mysql_fetch_array($get_username);
if ($get_username_a['banned'] == '1') {
        header("Location: index.php?index_message=You have been banned, to appeal, please contact your administrator.");
        exit ();
    }
    if ($get_username_n == '1') {
        header("Location: index.php?index_message=Your username or password has not been recognized, please try again, if you are trying to hack/guess somebodys password, your ip and location is being logged right now.");
        exit ();
    } else {
        $get_username_a = mysql_fetch_array($get_username);
        $uid = $get_username_a['id'];
        $date = time();
        $session_id = session_id();
        $ip = $_SERVER ["REMOTE_ADDR"];
        mysql_query("DELETE FROM session WHERE session_id='$session_id'");
        mysql_query("DELETE FROM session WHERE userid='$uid'");
        mysql_query("INSERT INTO session (session_id, ip, date, userid) VALUES('$session_id', '$ip', '$date', '$uid')");
        header("location: index2.php");
        exit ();
    }
?>

 

login form:

 

<form action="validate.php" method="post">
<fieldset><label>Warning:</label>
Your IP is <?php echo $_SERVER['REMOTE_ADDR']; ?>, and has been logged, unauthorised attempts to access will be logged, and steps will be taken. Currently the backend timeout is placed at <?php echo floor($row['timeout'] / 60); ?> minutes. (May be rounded) 
</fieldset>
<fieldset><legend>Name</legend>
<input type="text" name="username" id="user" value="" />
<br />
(not case sensitive eg cHaRLiE becomes 'Charlie') 
</fieldset>
<fieldset>
<legend> Password</legend>
<input type="password" name="password" id="password" />
<br />
(cAsE sEnSiTiVe)
</fieldset>
<fieldset><legend>Login</legend>
<input type="submit" id="submit" name="login" value="Login" />
<br />
</fieldset>
</form>

Link to comment
https://forums.phpfreaks.com/topic/97295-user-system-error/
Share on other sites

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.