|
Posted by "Mark Cain" on 08/02/05 06:44
I have coded this type of website for many years and have run the gamut of
trying different things -- originally, 8 years ago, I used perl with flat
files and physical folders but in the recent past I have used PHP, MySQL and
dynamic folders.
In my opinion the best way to build this site is with dynamic folders via
custom 404 error handling. Here how it works:
You build the pages for things like "contact us" "my store" "my stuff" or
whatever. Then you send someone to the site with an address like:
mydomain.com/joe which doesn't exist. A custom 404 error handler picks up
the error and parses the URL to identify "joe" as a unique ID. The 404
script pulls "joe's" info from a database and populates the pages with his
custom contact info then delivers the page. Joe's ID usually gets stuffed
into a cookie and then when the person comes back to the site at a later
date, they are delivered joe's info.
That's it in a nut shell. Be sure that you deliver 200 headers and not 404
headers when delivering the dynamic folder.
Now you can do the physical folders and every time someone "signs up" you
can take the template and populate their pages and store these pages in a
real folder named "joe." But, be aware using this method. Success (if
having lots of users is your goal) will be your downfall because this system
is not easily scalable. Just think what happens if you have 500 folders, or
5,000 or 50,000 folders with every folder having a copy of the files in
them.
Here is a 404 script I use:
<?header("HTTP/1.0 200 OK");
require('/home/pathToLookUp/getinfo.php');
?>
And here is the start of the getinfo.php script:
<?
list($blank, $site, $page) = split("\/", $REDIRECT_URL, 3);
$query = "select * from stores where stores.name = '$site' and stores.active
= 'Y' ";
.....
?>
Be sure to code the handling of an actual 404 just in case you don't have a
user named joe or the surfer miss types.
There's a ton of work in getting all of the bases covered - but it's sweet
when it's done and you will know a lot of how a server works.
Hope this helps.
Mark Cain
----- Original Message -----
From: <Esteamedpw@aol.com>
To: <php-general@lists.php.net>
Sent: Monday, August 01, 2005 8:44 PM
Subject: [PHP] very simple, yet can't think how.
> Hi everyone,
>
> Sorry for the n00bie question but I've been racking my brain, searching
> Google and yes, I have been "RTFM" for over 6 months :-)
>
> All I'm trying to do is set up a "User system" that allows a member to
> create their own personal site using an auto_increment type system? This
is my
> problem...
>
> I've been trying to look through other code trying to figure out where and
> how they do it - but for some reason I can't figure out how to Dynamically
> create something like this:
>
> User Joe comes in and creates an account... when he creates his account he
> can give his site a TITLE, DESCRIPTION, ABOUT US INFO (say /aboutus.php),
> CONTACT (./contactus.php), etc. after he clicks "Submit" the system
automatically
> creates a site such as _http://mydomain.com/0/joe/ _
> (http://mydomain.com/0/joe/ ) , Bob does the same thing and his is
_http://mydomain.com/0/bob_
> (http://mydomain.com/0/bob)
>
> I'm sure most of you know how this is done or you've seen it on sites such
> as Soundclick.com (although it's CF) - I've been checking out Jamroom to
see if
> I could figure it out there- but kinda got lost lol... I want to use PHP,
> Smarty and MySQL to do this - but I'm missing something... I'm not asking
> anybody to build this - I'm looking for a little guidance, tips, etc. -
that's all.
>
> Would this be done through auto_increment in MySQL or something?
>
> Thanks everyone :-)
>
Navigation:
[Reply to this message]
|