Yes authenticateUser is a function I made to check if a user is authenticated or not
function authenticateUser($user, $password)
{
global $server, $HTTP__HOST, $db_user, $pass, $DB, $DOCROOT ;
// Open a persistent connection with the MySQl server
if (!($link = mysql_pconnect ($server,$db_user, $pass))) {
// DisplayErrMsg(sprintf("internal error %d:%s\n",
// mysql_errno(), mysql_error()));
DisplayErrMsg(sprintf("internal error %s %s %s %d:%s\n",$server, $db_user, $pass,
mysql_errno(), mysql_error()));
return 0 ;
}
// Do the user/password authentication
if (!($result = mysql_db_query("$DB", "select * from user_profile where
user_id='$user'"))) {
DisplayErrMsg(sprintf("internal error %d:%s\n",
mysql_errno(), mysql_error()));
return 0 ;
}
if (($row = mysql_fetch_array($result)) && ($password == $row["password"]
&& $password != ""))
return 1 ;
else
return 0 ;
}
I use this on top of each page to see if the user is authenticated so I guess I could do the same to echo the results accordingly
if this is not a good way how els can I do this
TIA