Page 1 of 1

Redirect to URL after LOGIN

Posted: Mon Jan 19, 2004 3:36 pm
by caitanya
Hi

I would like to make something i have no idea of. Since my Host has a Mysql Database and PHP installed i have to do it with PHP & SQL.

I have one PASSWORD Field - if the user enters i.e. CAR than he is redirected to http://www.mywebsite.com/car.htm and if he enters SOUND he is redirected to http://www.mywebsite.com/car_1.htm, ...

I would like to have PASSWORDs and URLs stored in mySql Database and whenever user starts the first file (ie. index.php) it should connect to the database and wait for him to type in the PASS - then it should redirect to the URL that is stored in the database and connected to the Password.

Is this possible? Any hint would be great help.

Thanks

Posted: Mon Jan 19, 2004 4:38 pm
by DuFF
Yes create a form with a password field. In the form you will want something like this:

Code: Select all

<form method="post" action="checkpass.php">
Then in the page that the form is pointing to, check if the variable is equal to any number of passwords stored in an array. The array should be set up like this:

Code: Select all

1 => levelonepassword
2 => leveltwopassword
3 => Vncodn1dniZnh
With the level number being the number and the value being the password. Then if the user's password is equal to any of them, just use:

Code: Select all

header (Location: somewhere.php);
to send them there.