Location: PHPKode > projects > phpSC > core/login.php
<?PHP
session_start();
require_once('../config.php');
$conn = _MYSQL_CONNECT;
mysql_select_db(_MYSQL_DB,$conn);
$password = sha1($_POST['password']);
$username = $_POST['username'];
$sql = "SELECT * FROM users WHERE username = '$username' LIMIT 1";
$result = mysql_query($sql,$conn);
if(mysql_num_rows($result) == 0) {
$_SESSION['error'] = "Username Incorrect!";
}
else
{
$data = mysql_fetch_array($result);
if ($data['password'] == $password) {
unset($_SESSION['error']);
unset($_GET['module']);
include_once("setsess.php");
}
else
{
$_SESSION['error'] = "Password Incorrect!";
}
}
header("Location:../index.php");
?>
Return current item: phpSC