SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    creating member pages

    What i want to do is allow members to have their own page on a website. If my site url is www.myhost.com then their page address would be www.myhost.com/somepage

    I want everything to be done automatically after a form submit. Form would contain usual details (name, e-mail etc) along with a text form field to enter text what they want on their page, contact details and 2 image uploads.. I know how to put all the info into a mysql database and upload the images and create a new folder on my server (in the above example folder name would be 'somepage') and also create an image folder inside this one using mkdir.

    What i can't work out is how to auto create the index page inside the 'somepage' folder. This page will be a template with include statements for head - body - footer (showing member details in the body part from database entry of a given member).

    Hope someone can understand what i'm trying to do and help me out with a solution. Thanks

  2. #2
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could use function mkdir() to create the directory, and then use the copy() function to create your index file in that directory.
    John

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply John. But what i need to know is how i go about personalizing the new index page for 'someone' before it gets copied to 'someone' folder. I'm trying to avoid having to pass the db table unique id number in the members url as they may want to put their site address on stationary (letterheads, business cards etc) and www.myhost.com/someone.php?id=2345 would look ugly. I'm trying to avoid any human intervention in having to edit the sql select statement in each index page for each new member that wants an home page on my server and need everything to be done automatically as soon as the submit button has been pressed.

    I'm finding it hard to explain exactly what it is i'm trying to do but hope someone can understand this and help. Thanks again.

  4. #4
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could do it based on the subdirectory, and a database call.

    By this I mean, the index file could be generic, but it tests for the directory it is in, and because each member directory is unique it can take that information and make a call to the database and retrieve all the personal settings, and "fill in the holes" of the index page, so to speak. This way you don't have to use values passed through the url, or depend upon cookies to personalize that index page.

    Does that make any sense?
    John

  5. #5
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again john. What you say actually makes perfect sence. Just if i can be a pain and ask if you could point me in the right direction by explaining how i would have a php file check what directory it is in. Sorry not been learning php long. I'm fine with getting info in and out of databases and manipulating it to my needs but when it comes to more advanced stuff like this then i'm very much still on the novice shelf. Thanks again for your time and effort.

  6. #6
    if($awake){code();} PHP John's Avatar
    Join Date
    Jul 2002
    Location
    Along the Wasatch Fault line.
    Posts
    1,771
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use $_SERVER['PHP_SELF'] and explode(); to get the subdirectory name.
    John


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •