Furr
Can't get enough of FH
- Joined
- Dec 22, 2003
- Messages
- 1,067
evening all
ok i have this slightly altered login in user from dreamweaver
<?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['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "secure/secureindex.php";
$MM_redirectLoginFailed = "fail.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_gemtraveldatabase, $gemtraveldatabase);
$loginUsername = get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername); $password = get_magic_quotes_gpc() ? $password : addslashes($password);
$LoginRS__query="SELECT EMAIL, PASSWORD FROM user_details WHERE EMAIL='$loginUsername' AND PASSWORD='".md5($password)."'";
$LoginRS = mysql_query($LoginRS__query, $gemtraveldatabase) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//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 );
}
}
?>
Ok this is what i want to do but have no idea how to do it, from the login page i want to pull the unique ID of the users entry and set it as a session vaiable so that this
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
will look something like this
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserID'] = $UserID;
so that for a session variable i would get
MM_Username = joebloggs@email.com
MM_UserID = 12
how do i do it..... cheers you brainy people
ok i have this slightly altered login in user from dreamweaver
<?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['username'])) {
$loginUsername=$_POST['username'];
$password=$_POST['password'];
$MM_fldUserAuthorization = "";
$MM_redirectLoginSuccess = "secure/secureindex.php";
$MM_redirectLoginFailed = "fail.php";
$MM_redirecttoReferrer = false;
mysql_select_db($database_gemtraveldatabase, $gemtraveldatabase);
$loginUsername = get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername); $password = get_magic_quotes_gpc() ? $password : addslashes($password);
$LoginRS__query="SELECT EMAIL, PASSWORD FROM user_details WHERE EMAIL='$loginUsername' AND PASSWORD='".md5($password)."'";
$LoginRS = mysql_query($LoginRS__query, $gemtraveldatabase) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = "";
//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 );
}
}
?>
Ok this is what i want to do but have no idea how to do it, from the login page i want to pull the unique ID of the users entry and set it as a session vaiable so that this
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
will look something like this
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserID'] = $UserID;
so that for a session variable i would get
MM_Username = joebloggs@email.com
MM_UserID = 12
how do i do it..... cheers you brainy people