TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   User login directed to specific page (http://www.talkphp.com/general/4435-user-login-directed-specific-page.html)

Kay1021 05-25-2009 06:04 PM

User login directed to specific page
 
Hi

I was wondering if anyone knew of any site that could help me. I am looking to create a secure site where at the beginning the user is prompted to enter a username and password there is 1 admin and then say 8 users. When each user has entered the correct information they are taken to a page specifically for them...and they are not allowed access into any of the other 7 users' pages. However the one admin can view all 8 pages.

I'm just wondering if anyone could guide me. Even if you've got a tutorial that does this sort thing or how i could modify one....i'm just kinda stuck.

Thanks

Normo 05-27-2009 09:06 AM

Thats not really the most efficient way of creating a user based site, think if you had 100 users, would you like all of them to have a page each. You would have one page for the users, in which the content would change dynamically depending on the user.

However to do what you asked, one solution might be:
PHP Code:

$con mysql_connect(localhost,username,password) or die (mysql_error());
mysql_select_db("my_db"$con);
$result mysql_query("SELECT * FROM Persons");

while(
$row mysql_fetch_array($result)){
   
$userPage $row['UserPage'];
}

header('Location: $userPage'); 

This is part of the login code. When the user signs up, you would need to create a new page with the appropriate content then put the url to that page in the database along with the username and password. That way when a user logs in you can retrieve the url and redirect them to their own page.

Like I said, a single page with dynamic content would be better for a site with multiple users. :)


All times are GMT. The time now is 07:41 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0