Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Databasing
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 07-25-2008, 04:04 PM
  #1
jgray805
Adept (Level 5)
 
Join Date: Jul 2008
Posts: 49
iTrader: (0)
jgray805 is an unknown quantity at this point
How do I make each registered user on my site have its own personal webpage?

Hi,

So i have finally figured out how to add a login section to my website thanks to easykiss123.com, but now im trying to figure out how to make it so every person that registers has their own personal page.

not only that, but also i want to make sure that only that person can view that page...(like how myspace works...AND NO IM NOT TRYING TO MAKE A SITE LIKE MYSPACE)

links for help would be good, preferrably ones with good details.. i like to learn the stuff but as of right now, im kind of a begginner to all this.
Also anything you know would help too.


My website is http://www.mytodostuff.com

Thanks in advance to anyone who replies.
jgray805 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 07-25-2008, 08:14 PM
  #2
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 16,213
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
well... what kind of things are you wanting to do on that page...


if you only want the currently logged in user to view the page, then you can just use the SESSION data that you set when that person logged in order to display a personalised page attached to their user id...

simple example - you have a page user.php
PHP Code:
session_start();

if (isset(
$_SESSION['user_id'])) {

  
$userinfo get_user_from_db($_SESSION['user_id']));

  echo 
"<h1>User Page For " $userinfo['username'] . "</h1>";

} else {

  
// redirect to login since the SESSION isn't set
  
header('Location: /login.php');


Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-03-2008, 06:03 PM
  #3
jgray805
Adept (Level 5)
 
Join Date: Jul 2008
Posts: 49
iTrader: (0)
jgray805 is an unknown quantity at this point
i just want it so when users log in, they add links to their page, and i want to make sure when they log out it saves what they have done, so when they log back on, those links they added are still there.

i want each person on my website to have their own personal page that they can view when they log on..
on their page each person will have differnt links that they can goto.

Last edited by jgray805 : 08-03-2008 at 07:42 PM.
jgray805 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-03-2008, 11:56 PM
  #4
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 16,213
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
I wouldn't save on log out - that's actually a difficult thing to detect for a site, because of the nature of HTTP connections - save when they click save.

Simplest thing to do is then update a file attached to their user id, and then when they login, read that file and display it on the page.
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-05-2008, 06:23 PM
  #5
jgray805
Adept (Level 5)
 
Join Date: Jul 2008
Posts: 49
iTrader: (0)
jgray805 is an unknown quantity at this point
thanks Horus_Kol,

question though about the code u provided...

can you explain it a little?

im confused on where it creating a specific page for each registered user for them to view? can u explain where it does this?\

also, what part of my file manager do i put this in? the www. directory? or the login folder?

Last edited by jgray805 : 08-05-2008 at 06:25 PM.
jgray805 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-05-2008, 07:11 PM
  #6
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 16,213
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
when they log in, and you check the username/password against the database, you save their user id as a SESSION variable ($_SESSION['user_id']).

Then, when they go to the "user" page (user.php or whatever), then your script detects the SESSION variable and then gets the relevant information from the database to make the individual page.
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-05-2008, 08:36 PM
  #7
jgray805
Adept (Level 5)
 
Join Date: Jul 2008
Posts: 49
iTrader: (0)
jgray805 is an unknown quantity at this point
okay that sorta makes sense, but now how do i actually direct them to their own page when they log in?

i dont need to make a new database do i?
jgray805 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-05-2008, 10:06 PM
  #8
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 16,213
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
okay... so what do you mean by "their own page"?
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-05-2008, 10:28 PM
  #9
jgray805
Adept (Level 5)
 
Join Date: Jul 2008
Posts: 49
iTrader: (0)
jgray805 is an unknown quantity at this point
well like, i want each registered user on my site to have their own homepage.. that only they can go to..

so if i have 100 registered users, there will be 100 differnt pages on my site. Each registered user can only view his page.. each registered user will have their own page. what i mean by own page is just that only that person can view that page,
jgray805 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-12-2008, 06:42 PM
  #10
bradenkeithcom
Paladin (Level 15)
 
bradenkeithcom's Avatar
 
Join Date: Jan 2008
Location: In front of a flippin fast computer.
Posts: 443
iTrader: (2)
bradenkeithcom will become famous soon enough
Horus, like on myspace how you can have a myspace.com/userchoosenaddress
I think that's what he's going for.
__________________
My Blog / Website

If someone's helped you... the thanks button is always a nice surprise, it's the justice symbol on the left under their name.
bradenkeithcom is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-12-2008, 08:44 PM
  #11
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 16,213
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
ah, I see...

well, that's done with an extra thing in Apache servers called "mod_rewrite"...

what happens is, the Apache server runs the request URL through a pattern match (regular expressions), and then changes the request internally. this is done in the .htaccess file which can be in your document root for your site.

for example:
Code:
RewriteEngine On
RewriteRule     ^/([A-Za-z0-9\_]+)/?$         index.php?page_name=$1    [QSA,L]
so, the user requests "http://www.example.com/username"
and the index.php script is run, with 'username' available as $_GET['page_name']

a better solution is to include some kind of 'type' in the URL - for example, here at HF you have URLs with the 'page' starting with a 't' or and 'f' or a 'p' (or other) - these are used by the HF system to tell the scripts that it is requesting a thread, or a forum, or a post...

Code:
RewriteEngine On
RewriteRule     ^/([a-z]{1})\-([A-Za-z0-9\_\-]+)/?$         index.php?page_type=$1&page_name=$2    [QSA,L]
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-12-2008, 11:36 PM
  #12
jgray805
Adept (Level 5)
 
Join Date: Jul 2008
Posts: 49
iTrader: (0)
jgray805 is an unknown quantity at this point
is there someplace that i can read more about what u are talking about?

thank you soo much for your help but i think it is all over my head..

it doesnt really make sense to me..

i already have a section on my site where users can register and log in; however, when a user logs in, no matter who the user is, they are all directed to one specific page.. and the page each user is directed to is the same...

the code u wrote, will that make it so when a user logs in, he will go to his own specific page, and another user when he logs in, he will go to his own specific page rather than both users going to the same page when they log on?
jgray805 is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 08-13-2008, 01:38 AM
  #13
Horus_Kol
Mod of the Underlay
 
Horus_Kol's Avatar
 
Join Date: Jun 2002
Location: At a desk, hooked up and ready to rock
Posts: 16,213
iTrader: (0)
Horus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the roughHorus_Kol is a jewel in the rough
you want to google for things like "seo friendly url"
Horus_Kol is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 06:15 AM.