
September 18th, 2003, 09:31 PM
|
|
Contributing User
|
|
Join Date: Dec 2002
Location: Melbourne, Australia
Posts: 97
Time spent in forums: 23 m 33 sec
Reputation Power: 6
|
|
|
getting userdata at page start.?
Hi, im trying to get some user details from the database if they have a cookie set. I have the foollowing piece of code, but i dont understand what certain lines do or if it is a good way to get user info?
Heres what i have
PHP Code:
function check_user_session($cuser, $cpass){
global $db;
$sql = "SELECT * FROM user_users WHERE username='$cuser' AND password='$cpass' AND activated='1'";
if ( !($result = $db->sql_query($sql)) ) <-- WHAT DOES THIS DO?
{
message_die('Error doing DB query userdata row fetch', $sql);
}
$userdata = $db->sql_fetchrow($result); <-- WHAT DOES THIS DO?
return ($userdata);
}
How would i use such a function?
__________________
regards,
Fulton
|