Hi,
I am trying to create a webpage which can only be accessed if a cookie containing the username and password is on the users system. If the cookie is not present the user is taken to another url. The way the cookie is placed on the users system is done by another webpage which writes the cookies and redirects the user to my page.
The way I would like it all to work is as follows
1) I create a button on my personal webpage saying click here to view secret files.
2) The link on the button takes user to 'temp.php' which writes a cookie to the users temp folder then redirects the user to my secret page called e.g. mypage.com
3) mypage.com checks if the cookie containing the username and password is present if not user is taken to google.com if is user is shown content.
Please let me know how to achieve this.
Cookie Login
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Cookie Login
1. Hyperlink is probably best (for this example)tazdaman wrote: 1) I create a button on my personal webpage saying click here to view secret files.
2) The link on the button takes user to 'temp.php' which writes a cookie to the users temp folder then redirects the user to my secret page called e.g. mypage.com
3) mypage.com checks if the cookie containing the username and password is present if not user is taken to google.com if is user is shown content.
2. Use 'setcookie()' to create the cookie / s
3. On mypage.com :
Code: Select all
<? if (!isset($_COOKIE['cookie_name']) // redirect user)
else { // other code
} ?> “Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering