Jump to content

Passing through UserID


jarv

Recommended Posts

here is my login functions:

function checkPass($login, $password) {
/*
Password checking function:
This is a simple function that takes the $login name and
$password that a user submits in a form and checks that a
row exists in the database where:

the value of the 'login' column is the same as the value in $login
and
the value of the 'password' column is the same as the value in $password

If exactly one row is returned, then that row of data is returned.
If no row is found, the function returns 'false'.
*/
global $link;

$query="SELECT rsUser, rsPass FROM members WHERE rsUser='$login' and rsPass='$password'";
$result=mysql_query($query, $link)
	or die("checkPass fatal error: ".mysql_error());

// Check exactly one row is found:
if(mysql_num_rows($result)==1) {
	$row=mysql_fetch_array($result);
	return $row;
}
//Bad Login:
return false;
} // end func checkPass($login, $password)


/******************************************************\
* Function Name : cleanMemberSession($login, $pass)
*
* Task : populate a session variable
*
* Arguments : string $login, string $pass
			taken from users table in db.
*
* Returns : none
*
\******************************************************/
function cleanMemberSession($login, $password) {
/*
Member session initialization function:
This function initializes 3 session variables:
  $login, $password and $loggedIn.

$login and $password are used on member pages (where you
could allow the user to change their password for example).

$loggedIn is a simple boolean variable which indicates
whether or not the user is currently logged in.
*/

$_SESSION["rsUser"]=$login;
$_SESSION["rsPass"]=$password;
$_SESSION["loggedIn"]=true;
} // end func cleanMemberSession($login, $pass)

i think the session variable stores alphanumeric data...

 

CHANGE:::

$data = "SELECT * FROM members_copy WHERE RSUSER = ".$_SESSION["rsUser"];

$info = mysql_fetch_array($data); 

 

DO THIS:::

//note that i have added quites befire and after your session variable...
$data = "SELECT * FROM members_copy WHERE RSUSER = ' ".$_SESSION["rsUser"]." ' ";
$info = mysql_fetch_array($data);
//say if user_id is the user id column in your table then
echo $info['usr_id'];

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.