im brand new to this guys and really struggling with logging in a member to their particular account as opposed to a general members section.
it should be easy but i cant for the life of me figure it out.
pls HELP!!
below is the dreamweaver generated code from its basic login application.
im using it in a dreamweaver template so im not sure if thats the issue but bascially im using 2 tables to achieve this-
1.) tblaccesslevel
intLevelID (unsigned + auto increment + primary key)
txtAccess
(ive allocated various numerical access levels into txtAccess. ie. 1-7
and
2.) tblplayeraccount
intUserID (unsigned + auto increment + primary key)
txtFirstName
txtLastName
txtEmailAddress
txtPassword
intAccessLevel
(ive generated 2 users in the above table tp test)
in dreameavers server behaviors the recordset generated by the login server behavior simply says Log In User
obviously i need a session variable somewhere to get the intUserId....
also a relationship needs to be generated in the sql statement to connect the intAccessLevel but i think i can manage that (i think..)
below is the code this application generated -
if somecan generated the required code it would be a huge help!! i dont know what im doing wrong!!!
<?php require_once('../Connections/Rugby.php'); ?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $SERVER['PHP_SELF'];
if (isset($GET['accesscheck'])) {
$SESSION['PrevUrl'] = $GET['accesscheck'];
}
if (isset($POST['emailaddress'])) {
$loginUsername=$POST['emailaddress'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "intAccessLevel";
$MM_redirectLoginSuccess = "../player_home.php";
$MM_redirectLoginFailed = "../failed.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_Rugby, $Rugby);
$LoginRS__query=sprintf("SELECT txtEmailAddress, txtPassword, intAccessLevel FROM tblplayeraccount WHERE txtEmailAddress='%s' AND txtPassword='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $Rugby) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'intAccessLevel');
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
}
?>