
Originally Posted by
sadnbj <?php
session_start();
if(!empty($_SESSION['userID'])) {
$msg="<strong><span class=MainContent><font size=2>You are already logged in! <br> Use the menu on the left to go to your desired Member Only location.</font></span></strong>";
}
else
{
//if the session is empty but te user is attempting login...
// if(empty($_SESSION['userID'])) {
if(!empty($_POST['txtUSERNAME'])){
$conn = mysql_connect("localhost","admin","mABjXhy1") or die(mysql_error());
mysql_select_db("admin_nma",$conn);
$user_name = $_POST['txtUSERNAME'];
$password = $_POST['txtPASSWORD'];
$user_name = stripslashes($user_name);
$password = stripslashes($password);
//checks to see if user is already a member
$sql_spw_check = mysql_query("SELECT Session FROM tblRealTimeJoinData WHERE username='$user_name' AND password='$password'",$conn);
$result = mysql_result($sql_upw_check, 0);
if(!$result){
die('Could not query:' . mysql_error());
}
echo mysql_result($result,0);
//$userID=mysql_result($result,0);
$upw_check = mysql_num_rows($sql_upw_check) or die(mysql_error());
echo $sql_upw_check;
if($upw_check > 0) {
//$_SESSION['SessionID'] = $sessionID;
$msg = "<strong><span class=MainContent>You are now logged in!</span>";
}
else
{
$msg = "<strong><span class=MainContent><font=red>That Username and password is not found in our database.Please try again.</font></span>";
unset($username);
unset($password);
}
} //username not empty
//session empty
?>