Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, Okay, here's the problem.

Status
Not open for further replies.

skottieb

Programmer
Jun 26, 2002
118
0
0
AU
Hi,
Okay, here's the problem.
the /admin of the site im greating asks for Authentication
thats fine, all authenticates, if I refresh I dont get asked to re-authenticate myself, I have also pot a logout submit button on the page im testing witw, when the button calls "logout.php" I want it to wipe the data in $PHP_AUTH_USER, how can I do this, all attmepts so far have been to no avail and the documentation isnt helping me.

On the first note how could I get php to wipe $PHP_AUTH_* on a browser refresh. Shuting down and reloading the browser does ask for (re)-authentication.

here is the code I have so far:


------------------>logout.php

<?php
$user = include(&quot;admin.php&quot;); #refrence returned from auth.php
unset($user);
$user = FALSE;
?>

------------------>admin.php

<?php
require(&quot;auth.php&quot;);
$user =& $PHP_AUTH_USER; #create a refrence to $PHP_AUTH_USER
$conf = (auth($PHP_AUTH_USER, $PHP_AUTH_PW));
if($conf == 1)
{
?>


<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot;>
<html>
<head>
<title>Search for Participant</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<meta name=&quot;GENERATOR&quot; content=&quot;Quanta Plus&quot;>
</head>
<body bgcolor=&quot;darkBlue&quot; text=&quot;white&quot; link=&quot;red&quot; alink=&quot;yellow&quot; vlink=&quot;lightGray&quot;>
<table width=&quot;100%&quot; cellspacing=0 border=2 cellpadding=0 align=&quot;center&quot; bgcolor=&quot;darkBlue&quot;>
<tr>
<td><h1><i><u>Enter a email of Participant to search</u></i></h1></td>
</tr><tr>
<td><hr><form action=&quot;usearch.php&quot; method=&quot;POST&quot; target=&quot;_self&quot;>
<input type=&quot;text&quot; name=&quot;user&quot; value=&quot;Enter Name Here&quot; size=30 maxlength=50>
<br><input type=&quot;submit&quot; name=&quot;search&quot; value=&quot;Search&quot; size=10 maxlength=10>
<hr>
</td><td width=&quot;20%&quot; colspan=1 rowspan=1 align=&quot;middle&quot; valign=&quot;center&quot; bgcolor=&quot;white&quot;>
<?php

print(&quot;<form action=\&quot;logout.php\&quot; method=\&quot;GET\&quot; target=\&quot;_self\&quot;>&quot;);
?>
<input type=&quot;submit&quot; name=&quot;logout&quot; value=&quot;logout&quot; size=10 maxlength=10 alt=&quot;logout&quot; align=&quot;middle&quot;>
</form>
</td>

</form></td>
</tr>
</table>
</body>
</html>
<?php
}
return $user; #RETURN THE REFRENCE TO $PHP_AUTH_USER to logout.php when it calls &quot;include(&quot;admin.php&quot;);
?>

skottieb:)
 
I think this could help you:

Header( &quot;HTTP/1.0 401 Unauthorized&quot;);

Send this header to the browser when you want to logout user. The response code 401 will clear the browser cache for the current realm. Don't forget, that headers must be send before any output to the browser (before any HTML code).

Hope this will help you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top