Click to See Complete Forum and Search --> : Personal Links


docpepper
06-25-2007, 06:45 AM
Hi,

Ok I have created a simple interface login system for my clients to view there files under a secure section of my website. I have got connection to the database and set up a DB and Table which inludes IDs, Username and Password fields.

What i am struggling with is setting my page up so once a user has logged in it takes them through to a specific area of the website that is unique to them.

so for example.

File structure:

index.php > login_success.php > link to user1/index.php

my index.php page has the login form on it. Once logged in correctly it goes to login_success.php and says Welcome $myusername blah blah blah...follow this link to view your homepage.

How can I link the html path on the link button to match the user? eg user 1s path on the link would = user1/index.php,
user 2s path on the link would = user2/index.php.

Hope this makes sense! If anyone cud help that would be great! I can link my code etc if it will help...

MrCoder
06-25-2007, 06:59 AM
Since you provided no code I am assuming that you are pulling the users ID from a database?

Please note the following is not copy & paste code, it is just an example of how you would do it if $mysql_result was populated with the users ID.


<a href="user<?php echo (int)$mysql_result["users_id"]; ?>/index.php">link</a>

docpepper
06-25-2007, 07:02 AM
Aah very nice little bit of code thankyou very much! And yes I am pulling it from DB so thankyou again :)

bokeh
06-25-2007, 07:03 AM
You don't have a separate path and index.php for each user. You use the same file and have your script deliver different content based on the query string.

MrCoder
06-25-2007, 07:08 AM
You don't have a separate path and index.php for each user. You use the same file and have your script deliver different content based on the query string.

Why walk when you can run huh?

:)

bokeh
06-25-2007, 07:14 AM
Why walk when you can run huh?

:)Are you saying you believe having a lot of static paths and files is easier than one dynamic setup.

docpepper
06-25-2007, 07:22 AM
I think what he is saying is I dont know how to do that yet!! Which is true! But i learning so when I can run ill do that!

MrCoder
06-25-2007, 07:26 AM
Are you saying you believe having a lot of static paths and files is easier than one dynamic setup.

Dynamic pages, Easier to manage, yes.. Easier to implement, maybe not..

It all depends on the posters skill and time allowance for the task.

I 100% agree that a dynamic set-up would be much better, but it may not be possible within external restrictions unknown to us.

That is why I focused on addressing the question instead of advising the poster how to redevelop his application, even thou his logic may be incorrect.