Re: very simple, yet can't think how.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
Thanks Mark and Sonu... as much as I've learned over the last few months I  
think I'm still a little confused about some of this stuff. I appreciate the  
Help you've given me :-)
 
Would any of you know about any tutorials on something like this? books  with 
tutorials, etc? If I knew what it was called I would google it - I'm just  
not sure exactly what it might be called lol
 
Thanks again fellas :-D
 
 
In a message dated 8/1/2005 10:45:14 P.M. Central Standard Time,  
mark@xxxxxxxxxxxx writes:

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


 

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux