View Full Version : Need to pick your brain...
dColumbus
November 22nd, 2006, 02:04 AM
How would I go about developing a system (in PHP) that would use one website GUI (in my case, Flash) that depending on the username (url example: http://www.somewebsite/username) would be able to pull its distict variables that would affect the FUI according to the usernames preferences (how those variables would be stored isn't important)... the point is to be able to basically replicate the website when requested at the example url above.
Multi-level marketing websites do this... they all use the same site, but a distributor can sign up and get his own url (ie /john) that is obviously displaying his personal information...
As I said, how those variables are stored isn't important, I just wanted to pick some brains to find out how it's possible for a subdirectory to be able to contain the very same website that's located at the public root... and yes I know there are systems out there to by, but I want to play around with developing my own replicating system.
Thanks so much in advance!
bwh2
November 22nd, 2006, 07:23 AM
it's not really a subdirectory. it's htaccess making you thinking it's a subdirectory. so in reality, that folder doesn't exist. but htaccess directs you to the correct display page without changing the url.
dColumbus
November 22nd, 2006, 05:19 PM
Interesting... so .htaccess also is able to pass specific variables pertaining to that "fake" url? Or, how would I go about incorporating the .htaccess so I can accomplish what I'm talking about above... Where would I go to learn about .htaccess?
dColumbus
November 23rd, 2006, 05:16 AM
Apparently, one of my business associates says that his system doesn't use .htaccess at all... how else would this be accomplished?
dColumbus
November 23rd, 2006, 05:41 AM
http://www.kirupa.com/forum/showthread.php?t=208348&highlight=%22mod_rewrite%22
that thread talks about exactly what I'm trying to describe... but how WOULD a mypace.com be able to have thousands of /username's without it getting so bloated? And, how are the variables associates with that username being read accross from the database?
mod_rewrite?
bwh2
November 23rd, 2006, 10:29 AM
i would read through this: http://en.wikipedia.org/wiki/Mod_rewrite
and then some of the external links at the bottom.
dColumbus
November 23rd, 2006, 03:51 PM
Thanks for that link... now I understand a little what mod_rewrite is and does. Also that there are verisons of it for IIS.
What I'm still trying to figure out is how (perhaps using mod_rewrite) can take the "/username" portion of the url and use that username to determine what table, or set of variables to grab from a database... does PHP grab the "username" string from the url and use that in it's code... or is there some other way of accomplishing this?
dColumbus
December 4th, 2006, 05:27 PM
anyone?
dColumbus
May 24th, 2008, 09:19 PM
I'm revisiting this. Can anyone help me out?
djheru
May 24th, 2008, 10:15 PM
I'm only familiar with LAMP setups, but in PHP/Apache, there's the $PATH_INFO environment variables.
Instead of:
http://www.yourdomain.com/script.php?var1=val1&var2=val2
you can structure your URL like so:
http://www.yourdomain.com/script.php/value1/value2
Then, the $PATH_INFO variable would contain "/value1/value2". You can simply use
$vals = explode('/', $PATH_INFO);
$var1=$vals[0];
$var2=$vals[1];
Then, you can use those variables to run database queries to get profile settings, pass them to flash via flashVars or whatever else you need to do.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.