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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to have 2 scripts that login, but are stored as diff logins?

Status
Not open for further replies.

TerryJones

Programmer
Jul 19, 2000
15
AU
Dear all,<br><br>I have 2 scripts (1 for Admin & 1 for authorised users). Currently both of these scripts store the Login username & password in the same location (in cache I think it is).<br><br>This is a problem as the Admin has to close the browser & start up a new one (to remove login in cache I presume) to be able to login as a User.<br><br>If anyone knows how to remove the login in cache, or preferrable how to set diff locations, please inform ... my code is:<br><br>FOR ADMIN:<br>&lt;?php<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!isset($PHP_AUTH_USER)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Header(&quot; Basic realm=\&quot;Admin\&quot;&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Header(&quot;HTTP/1.0 401 Unauthorized&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Text to send if user hits Cancel button\n&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Hello $PHP_AUTH_USER.&lt;P&gt;&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;You&nbsp;&nbsp;entered $PHP_AUTH_PW as your password.&lt;P&gt;&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;?&gt;<br><br>FOR USER:<br><br>&lt;?php<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!isset($PHP_AUTH_USER)) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Header(&quot; realm=\&quot;User Details\&quot;&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Header(&quot;HTTP/1.0 401 Unauthorized&quot;);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Text to send if user hits Cancel button\n&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit;<br>&nbsp;&nbsp;&nbsp;&nbsp;} else {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;Hello $PHP_AUTH_USER.&lt;P&gt;&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo &quot;You&nbsp;&nbsp;entered $PHP_AUTH_PW as your password.&lt;P&gt;&quot;;<br>&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;?&gt;<br><br>Thank you ... please advice!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top