<?php
$conn=<?php
$conn=mysql_connect("localhost","root","")
or die("could not connect:" . mysql_error() );
$sql=mysql_select_db('btche_db',$conn);
$studet="SELECT id,pass
                      FROM student2
					  WHERE id = '".$_REQUEST['stid']."' AND pass = '".$_REQUEST['stpass']."' ";
					  $result = mysql_query($studet);
while ($row=mysql_fetch_array($result))
{
session_start();
$_SESSION['id'] = $_POST['stid'];
$_SESSION['userpass'] = $_POST['stpass'];
$_SESSION['authuser'] = 0;
if(($_SESSION['id'] == $row['id']) and ($_SESSION['pass'] == $row['pass']))
{
$_SESSION['authuser'] = 1;

}
else {
echo "Sorry, but you don't have permission to view this page, you loser!";
exit();
}				  
?>

Well, line 2 should be eliminated...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.