Click to See Complete Forum and Search --> : $php_auth_user


Fandelem
03-22-2001, 01:12 AM
does anyone have any good links on how to use this?

i understand to make it appear using the header() feature.. but i would like to have it set using a form -- this way i can have one login screen for users and administrators (but the $php_auth_user is set only on administrators (denoted by a field in a mysql database that is checked at login).

if not, i can just continue to use the header() to have it pop-up login style.. was just curious -- the book i have doesn't cover $php_auth_user hardly at all (aside giving examples of using it).

~kyle

Sweede
03-22-2001, 02:38 PM
http://www.php.net/manual/en/features.http-auth.php

when all else fails, read the manual.

the php manual is the most well written document ive ever read.

Fandelem
03-22-2001, 02:58 PM
actually i looked there first, suprisingly enough.. i looked through almost every example supplied by usercomments and all of them deal with using the header() feature to authenticate. it seems this is the only way i can set $php_auth_user/pw. it's fine =) thanks for the linkage.

ok now i have another quick question though.. about mysql_free_results..

here is a snippet of my code:


(lines 71-82)
$sql = "UPDATE {$DB_CONF["table_account"]}
set msgtitle = '$previous_msgtitle <p> {$HTTP_POST_VARS['sendmsg_subject']}'
where id='{$HTTP_POST_VARS['username']}' ";
$sql_result = mysql_query($sql) or die ("Couldn't execute query. (senTmsg_user_user()) ".mysql_error());
mysql_free_result($sql_result);
$sql = "UPDATE {$DB_CONF["table_account"]}
set msgbody = '$previous_msgbody <p> {$HTTP_POST_VARS['sendmsg_message']}'
where id='{$HTTP_POST_VARS['username']}' ";
$sql_result = mysql_query($sql) or die ("Couldn't execute query. (senTmsg_user_user()) ".mysql_error());
while ($row = mysql_fetch_array($sql_result)) {
$username = $row['username'];
}


but now i get this warning/error:


Warning: Supplied argument is not a valid MySQL result resource in /home/kdavis/www/admin/index.php on line 75


basically.. how do i fix this?

thanks,

~kyle

Sweede
03-22-2001, 08:19 PM
remove the mysql_free_result($sql_result); line