Jump to content

How does facebook create users page?


shortysbest

Recommended Posts

I dont believe facebook or any big social networking site like that would create a whole new php page for every user that signs up. Right now i have to create a new php file but include the template with that page (in order to create the URL path)

 

How else could this be done, i have had some ideas as to how to do this but any advice would be nice

Link to comment
Share on other sites

You create one page and just retrieve the info you want to display on that page for a particular user.

 

I have this set up, just if i didnt have another php file for every user i wouldnt be able to link the users page to everyone.

Now my url is

index.php?node=(usersname)&section=users

Link to comment
Share on other sites

You create one page and just retrieve the info you want to display on that page for a particular user.

 

I have this set up, just if i didnt have another php file for every user i wouldnt be able to link the users page to everyone.

Now my url is

index.php?node=(usersname)&section=users

 

hey, you will most likely want to replace the "node=username" with a user id from the primary key of the database you are using to store that information.  Each user has their unique data in the database. You will query for this info and populate your user-index.php page with it.

 

You are using a database right? if not, there is no way to do what you want.

Link to comment
Share on other sites

You are using a database right? if not, there is no way to do what you want.

 

You want me to prove you wrong? :P Unless by database you mean 'data stored somehow'. ;)

 

It would probably be fun & entertaining....

 

 

You create one page and just retrieve the info you want to display on that page for a particular user.

 

I have this set up, just if i didnt have another php file for every user i wouldnt be able to link the users page to everyone.

Now my url is

index.php?node=(usersname)&section=users

Look up dynamic pages, I think this is what you are confused on. You create a master or main page that changes based on who's logged in, what they clicked... etc...    thus one page that creates a template. That is changed with the script everytime it's loaded specifically. So instead of storing an entire page you store one page and a few lines in a file or database someplace that mark the customization for that page. So yes and no they create a new page for every user but it is done on the fly made up of one master file (one on the server not per user mind you, so instead of 100 page for 100 users you have 1 page and store 100 bits of information elsewhere.) and components from a database to make it appear as it should to a particular user. So the php script would go

 

 

Link to comment
Share on other sites

You are using a database right? if not, there is no way to do what you want.

 

You want me to prove you wrong? :P Unless by database you mean 'data stored somehow'. ;)

 

It would probably be fun & entertaining....

 

 

You create one page and just retrieve the info you want to display on that page for a particular user.

 

I have this set up, just if i didnt have another php file for every user i wouldnt be able to link the users page to everyone.

Now my url is

index.php?node=(usersname)&section=users

Look up dynamic pages, I think this is what you are confused on. You create a master or main page that changes based on who's logged in, what they clicked... etc...    thus one page that creates a template. That is changed with the script everytime it's loaded specifically. So instead of storing an entire page you store one page and a few lines in a file or database someplace that mark the customization for that page. So yes and no they create a new page for every user but it is done on the fly made up of one master file and components from a database to make it appear as it should to a particular user.

 

Yeah, the way i am doing it right now is when a user creates an account on my website, i take their name they input into their name field and i use that to automatically create a php inside the users folder and it automatically writes the <?php include('usertemplate.php'); ?> inside each file. In the usertemplate.php file each variable changes upon the specified usersname that is input into my url which is, index.php?node=(user's name)&section=users, users being the folder in which it is stored. 

 

What i have been trying to do is to get it to get the user's name from my database and add that to the url so i wouldnt have to have many php files. like for facebook they would have to have over 500million files inside of a folder, which just doesn't seem like the best way to deal with this.

Link to comment
Share on other sites

You are using a database right? if not, there is no way to do what you want.

 

You want me to prove you wrong? :P Unless by database you mean 'data stored somehow'. ;)

 

Well i didn't mean ABSOLUTELY no way...just not a way that he would WANT to do it ... EG: storing files -  the mysql db is just a tad quicker...

 

Anyway SortysBest::

I'd suggest grabbing a Newbee friendly book for php & mysql like Head First PHP& Mysql. They explain how to do what you are doing in one of the chapters.

Link to comment
Share on other sites

 

Yeah, the way i am doing it right now is when a user creates an account on my website, i take their name they input into their name field and i use that to automatically create a php inside the users folder and it automatically writes the <?php include('usertemplate.php'); ?> inside each file.

 

Does that mean you create a php script for each person? Why are you doing that?

If you are that's the problem right there, do not create a php file for each user. That is not necessary. It's like having a duplicate of the same file over and over just with different names attached to it.

 

What they do is this.... one file... Uno... no more is used by everyone. What you store for a user is this, say we have a table in a database called users.  This table would be like so:

USER TABLE
[userID]    [Name]          [Page color]    [user pic]
bobo01     Bob                  Red               dfsd.gif
Jake34     Jake Thomas     blue              sdfs.jpg

 

For a simple page you'd store just the color, name, image & user id

 

So when someone comes to the site they get a log in page this page runs a script that after they are logged in goes to the user table and says ok this page should display Bob background color Red and display dfsd.gif

 

But if Jake is logged in displays Jake Thomas blue background & displays sdfs.jpg

 

They used the same page & everyone user there will use the same page, just the stuff in the table triggers the script to display it differently depending on who is logged in. You don't store separate php pages

Link to comment
Share on other sites

 

Yeah, the way i am doing it right now is when a user creates an account on my website, i take their name they input into their name field and i use that to automatically create a php inside the users folder and it automatically writes the <?php include('usertemplate.php'); ?> inside each file.

 

Does that mean you create a php script for each person? Why are you doing that?

If you are that's the problem right there, do not create a php file for each user. That is not necessary. It's like having a duplicate of the same file over and over just with different names attached to it.

 

What they do is this.... one file... Uno... no more is used by everyone. What you store for a user is this, say we have a table in a database called users.  This table would be like so:

USER TABLE
[userID]    [Name]          [Page color]    [user pic]
bobo01     Bob                  Red               dfsd.gif
Jake34     Jake Thomas     blue              sdfs.jpg

 

For a simple page you'd store just the color, name, image & user id

 

So when someone comes to the site they get a log in page this page runs a script that after they are logged in goes to the user table and says ok this page should display Bob background color Red and display dfsd.gif

 

But if Jake is logged in displays Jake Thomas blue background & displays sdfs.jpg

 

They used the same page & everyone user there will use the same page, just the stuff in the table triggers the script to display it differently depending on who is logged in. You don't store separate php pages

 

I only create a new php file to get the url so other people can see the page, it is only to get the users id, i do not know how to do this, or i cant get it to work anyways. however i do have it so in the edit your profile section it only changes upon who's logged in, using only one file for all users.

my url is like so:

www.mysite.com/index.php?node=shortysbest&section=users

 

in this case the php file would be called shortysbest stored in a folder called users. What i cant quite figure out how to do is to instead replace shortysbest(invisible '.php) with the 'name' field in my database.

Link to comment
Share on other sites

I only create a new php file to get the url so other people can see the page, it is only to get the users id, i do not know how to do this, or i cant get it to work anyways. however i do have it so in the edit your profile section it only changes upon who's logged in, using only one file for all users.

my url is like so:

www.mysite.com/index.php?node=shortysbest&section=users

 

in this case the php file would be called shortysbest stored in a folder called users. What i cant quite figure out how to do is to instead replace shortysbest(invisible '.php) with the 'name' field in my database.

Oh ok, you can do this a number of ways then. $_GET is probably best way. For other people to see the page, you can create a script that runs openly so say they enter http://mysite.php/?name=Bobo

then the script runs a non-logged in script for public viewing, and does same thing as you did with the log in portion, just it takes the Bobo as value and then use that variable to pull info from the database. Take a look at the link  Mchl sent yah

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.