How do I login users to view a file with PHP? Actually I'm logging user's history and I want to preserve it. It's nothing important, just like searching for things, so a simple login / pass is good.
Besides, on my server, I want to add this file to user history. So I should be able to write this file.
Youl is a basic authentication that for most http server examples: < / P>
ifset ($ _SERVER ['PHP_AUTH_USER']) {header ('WWW-authentication: basic prime = "my area"'); Header ('http / 1.0 401 unauthorized'); Repeat 'Text To Read If User Cancel Cancel Button'; Go out; } Else {echo " Hello {$ _SERVER ['PHP_AUTH_USER']}. & Lt; / p & gt;"; Echo "& lt; p & gt; You entered {$ _SERVER ['PHP_AUTH_PW']} as your password. & Lt; / p & gt;"; }
See more:
Comments
Post a Comment