I have posted the code there, please help me out as I am a newbie, I don't know much in terms of deprecation and stuff.
<?php
session_start();
include('settings.php');
$issub = $_POST['issub'];
if($issub == "yes") {
require('settings.php');
$dbcon = mysql_connect($dbhost, $dbuser, $dbpword);
if(!dbcon) {
die('Could not connect'.mysql_error());
}
$selectdb = mysql_select_db($db, $dbcon);
$formset = 'yes';
$val = 0;
$user = trim($_POST['username'], ' ');
$luser = mysql_real_escape_string($user);
$password = $_POST['password'];
$lpassword = mysql_real_escape_string($password);
$selectdb;
$userq = mysql_query("SELECT user FROM users WHERE user='".$luser."'");
$userresult = @mysql_result($userq, 0);
//echo $userresult;
if($userresult == $user) {
$val = $val + 1;
$usercorrect = 'yes';
}
else {
$usercorrect = 'no';
}
$dbselect;
$passwordq = mysql_query("SELECT password FROM users where user='".$luser."'");
$passresult = @mysql_result($passwordq, 0);
if($passresult == sha1($password)) {
$val = $val + 1;
$passcorrect = 'yes';
}
else {
$passcorrect = 'no';
}
if ($val == 2) {
$_SESSION['loggedin'] = 'yes';
$_SESSION['uloggedin'] = $user;
header('location: logged.php');
}
}?>
<?php
ini_set('display_errors', 1);
require('testinclude.php');
?>
<body>
<div id="loginform">
<form action="/login.php" method="post" >
<input type="hidden" name="issub" value="yes" />
<?php if($usercorrect == 'no') {
echo '<span class="required"><i><small>The email address or password you entered is incorrect, please try again.</a></small></i></span>';
}
?>
<br />
email:
<?php
if ($issub == 'yes') {
if($user == null){
echo '<br /><span class="required"><i><small>Please enter your email address</a></small></i></span>';
}
}
?>
<br /><input type="text" name="username" id="usename" />
<br />
password:
<br /><input type="password" name="password" id="password" />
<br />
<input type="submit" value="login" />
</form>
<div>
</body>