View Full Version : Resolved Login/Password redirect based on username
lrickyutah
03-11-2009, 08:56 PM
I'd like to have a password protected area of my site with one login button. when a user logs in they would be directed to the directory that corresponds with the user name.
So if user "a" logs in they would go to one directory, but user "b" would go to another and user "c" another.
Does that make sense? Does anyone have any experience with any particular script that they could recommend? Thanks!
bluewalrus
03-11-2009, 09:38 PM
Is each user going to have an actual directory on your site?
Lucky for you, I've recently - just yesterday - created a script like this.
http://www.dynamicdrive.com/forums/showthread.php?p=188727
lrickyutah
03-11-2009, 10:42 PM
bluewalrus: yes, each login will go to it's own directory.
nile: that works pretty slick. the only thing is I'm redirecting to an html page. so the protect.php isn't working for me. even if I make a .php file and put that protect code at the top it just goes back to the login. I'm sure I screwed something up somewhere, but the protect thing (while awesome) isn't a necessity for me. :)
thanks!!
bluewalrus
03-12-2009, 01:09 AM
Not sure if this will work or not more of a test code by me...
<form action="<?php $user = $_POST['user']; echo "http://www.yoursite.com/" . $user . "/index.php";?>" method="post">
<input type="text" name="user" />
<input type="password" name="pass" />
</form>
for eachuser/index.php:
<?php
$user = $_POST['user'];
$pass = $_POST['pass'];
if ($user == "user") {
if ($pass == "pass") {
content of page
}
}
else {
die ("You do not have permission to access this page.");
}
?>
Great! Glad to help you! Your welcome!
It seems your topic is solved... Please set the status to resolved.. To do this:
Go to your first post ->
Edit your first post ->
Click "Go Advanced" ->
Then in the drop down next to the title, select "RESOLVED"
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.