Red Blaze
12-07-2005, 01:12 PM
// *** 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 = "usergroup";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "denied.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_prophot, $prophot);
$LoginRS__query=sprintf("SELECT userID, username, password, usergroup FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $prophot) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'usergroup');
$userid = mysql_result($LoginRS,0,'userID'); //I added this code.
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
$_SESSION['MM_UserID'] = $userid; //I added this code
I made a login action, but one thing I'm stumped on. I want to call the userID. The codes I added didn't help, I still get nothing. This code was all generated by Dreamweaver, so I'm not sure how it all works. I got bits and peices, and put the two lines of code that I added, but still nothing. Please help.
EDIT: Nevermind, I figured it out. Sorry about this and thank you for your attempt. :)
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 = "usergroup";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "denied.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_prophot, $prophot);
$LoginRS__query=sprintf("SELECT userID, username, password, usergroup FROM users WHERE username='%s' AND password='%s'",
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
$LoginRS = mysql_query($LoginRS__query, $prophot) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'usergroup');
$userid = mysql_result($LoginRS,0,'userID'); //I added this code.
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
$_SESSION['MM_UserID'] = $userid; //I added this code
I made a login action, but one thing I'm stumped on. I want to call the userID. The codes I added didn't help, I still get nothing. This code was all generated by Dreamweaver, so I'm not sure how it all works. I got bits and peices, and put the two lines of code that I added, but still nothing. Please help.
EDIT: Nevermind, I figured it out. Sorry about this and thank you for your attempt. :)