Re: what's the best way to handle this?
| From: | CPT John W. Holmes | Date: | Tue, 18 Mar 2003 16:48:35 +0000 |
| Subject: | Re: what's the best way to handle this? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140137@lists.php.net to get a copy of this message | ||
> When a user 'registers' with our site, I want to generate their personal
> webpage for them. Currently, I have a webpage where the contents are
> generated from their personal info in the db and I have a drop down to
view
> client pages but it is just the same page but I pass in the clientid so it
> will display their data. This is fine but I want the users to be able to
> tell others.."Visit my home page at www.eddiessite.com/Johnny or
something
> like that...I don't want them to have to say visit my page
> www.eddissite/client_pages?clientid=43 does that make sense? Should I
just
> generate a folder for them with an index page that redirects then to the
> clientpage with their id?
If you really wanted to write the file and not use some fancy rewrite rule
or Apache trick, you could do this:
$fp = fopen("http://www.eddissite.com/client_pages.php?clientid=43",'r');
while(!feof($fp))
{ $data = fread($fp,10000); }
fclose($fp);
mkdir("/home/path/to/your/www/$client_name",0777);
$fp2 = fopen("/home/path/to/your/www/$client_name/index.html",'w');
fwrite($fp2,$data);
fclose($fp2);
Just make sure all of your paths for images and links are still correctly
created by client_pages.php
You could use output buffering for the first part, too...
---John Holmes...