// -------------------------------------------------------------
// File Members.html
// Desc : Displays the login page and the main menu of the
// members area.
// -------------------------------------------------------------
// Include the session settings and start the session
require_once("SessionSettings.php");
session_start();
require_once ("Admin/DatabaseConnection.php");
require_once ("Admin/Crypt.php");
require_once ("NavBar.php");
// CReate databse connection
$dbHandle=ConnectToMySql();
ConnectToDatabase("mrgamem_beegeesstory",$dbHandle);
$Command="";
$MSG="";
$Email="";
$Password="";
$LoggedIn=false;
// Fetch paramaters from Get and Post arrays
if (isset( $_POST['Command'])) $Command = trim( $_POST['Command'] );
if (isset( $_POST['Email'])) $Email = trim( $_POST['Email'] );
if (isset( $_POST['Password'])) $Password = trim( $_POST['Password'] );
// Lets just check the person is already logged in otherwise send them to the members page
if (isset($_SESSION['UserID']))
{
$UserID= $_SESSION['UserID'];
// A session ID is set so lets check it exists
$dbResult = mysql_query("select * from users where ID=".$UserID." limit 1", $dbHandle);
// If the id is valid then relocate to the members area
if ($dbResult && mysql_num_rows( $dbResult))
{
$LoggedIn=true;
}
}
// If this is a login command
if ($Command=="Login" && $LoggedIn==false)
{
if ( $Email=="" || strlen($Email)<3 ) $MSG="Error: The email fields were filled in incorrectly.";
else
if ( $Password=="" || strlen($Password)<3 ) $MSG="Error: The password fields were filled in incorrectly.";
// If MSG=="" then everything is still ok so we proceed with the database test
if ($MSG=="")
{
$CryptEmail = EncryptString( $Email , "Dallas" );
$CryptPassword = EncryptString( $Password , "Dallas" );
// Lets see if this sucker exists
$dbResult = mysql_query( "SELECT * FROM users WHERE Email='".$CryptEmail."' AND Password='".$CryptPassword."' LIMIT 1 ",$dbHandle);
// if not found then compse error message
if ( !mysql_num_rows( $dbResult ) ) $MSG="Error: Your login details are invalid";
else
{
$User = mysql_fetch_object($dbResult);
$LoggedIn = true;
$_SESSION ['UserID'] = $User->ID;
}
}
}
OpenPage("Members","","Jive Talkin Community Area");
?>
if ($LoggedIn==false)
{
?>

|
|
|
Not Yet a Member?
It's FREE to join and takes only a few seconds to register.
Click here to join now and become part of the Jive Talkin' community.
|
|
ClosePage();
}
// We are logged in so show the members area options
else
{
?>
ClosePage();
}
?>