Login.php
<?php
if(isset($_POST['Login']))
{
$username=$_POST['username'];
$password= md5($salt . $_POST['password']);
if(!$username || !$password)
{
echo "<font color='#464646'>[ERROR]: Please fill in all the fields!</font color>";
}
else
{
$check = mssql_query("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE account='$username' AND password='$password'");
if(mssql_num_rows($check) >=1)
{
$_SESSION['Username'] == $username;
$_SESSION['MD5Password'] == $password;
header('Location: index.php');
}
else
{
echo "<font color='#464646'>[ERROR]: Incorrect Login Credentials!</font color>";
}
}
echo "<BR><BR>";
}elseif($_POST['register']){
header('Location: index.php?p=Register');
}
?>
Check Session:
<div id="left_side_top">ยป User CP</div>
<div id="left_side_mid"><?php if(!$_SESSION['Username']){ ?>
<?php include('login.php'); ?>
<form method="POST">
Username: <br /><input id="input" type="text" name="username" />
Password: <input id="input" type="password" name="password" />
<input id="button" type="submit" name="Login" value="Login" />
OR <input id="button" type="submit" name="register" value="Register" />
</form>
<?php }else{ echo "Welcome back, {$_SESSION['Username']}. Click <a href='index.php?p=Panel'>here</a> to be redirected to the User Control Panel.<BR><a href='index.php?p=Logout'>Logout</a>"; } ?>
</div>
<div id="left_side_bot"></div>
Config.inc.php:
<?php
//Server Configuration
$myServer = "\SQLEXPRESS";
$myUser = "sa";
$myPass = "Password";
$salt = "kikugalanet";
$servername = "SuspiciousFlyFF";
//MsSQL Connecting
mssql_connect($myServer,$myUser,$myPass) or die("Unable to connect to database.");
ob_start();
session_start();
?>
When I login using the correct credentials, it won't say "Welcome back, ", it'll just go back to the login form
Any help please?