Code: Select all
<?php
ob_start();
include("dbinfo.inc.php");
$tbl_name="users"; // Table name
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE user_email='$myusername' and user_pass='$mypassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
if($count==1){
session_register("myusername");
session_register("mypassword");
header("location:index.php");
}
else {
echo "Wrong Username or Password";
}
ob_end_flush();
?>
in the 'users' table i have a column that hold a user_type_id.
once someone logs in, i want to then identify what their user_type_id is and pass that variable along as long as the session is active.
in the above code, as you can see, it redirects to 'index.php'
once i get there i want to be able to say:
if user_type_id == X {
do this
}
but i need to have that user_type_id in memory somehow to use the if statement ...