personal url

Discussion in 'PHP' started by tirso, May 6, 2009.

  1. #1
    hi to all

    I want to create a personal url for every user registered. Once the user registered then I will dynamically create a folder respectively. My goal of this is, if every user I will create their own folder so they could upload and download their files.

    example

    user register : john_cruz

    his personal url is
    www.example.com/john_cruz

    any suggestions would greatly appreciated.

    thanks in advance


    Tirso
     
    tirso, May 6, 2009 IP
  2. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
  3. JDevereux

    JDevereux Peon

    Messages:
    50
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    JDevereux, May 6, 2009 IP
  4. zac439

    zac439 Notable Member

    Messages:
    3,074
    Likes Received:
    214
    Best Answers:
    0
    Trophy Points:
    260
    #4
    And what, pray tell, is the benefit of that? He wants the shorter URL for a reason. In addition, using GET is a security risk in some cases.

    If he needs to worry about getting a variable from a URL, he can simply use the current URL to single out the directory that is already there. But in all honesty, it would be easier to use cookies with encryption applied.
     
    zac439, May 6, 2009 IP
  5. Aaron Sustar

    Aaron Sustar Peon

    Messages:
    38
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Zac439, JDevereux was talking about mapping one URL to the other with the help of ModRewrite. User visits the short URL, but the code at the more convenient URL is executed. This is generally how it's done.

    However, if Tirso wants to actually create those directories for users to store their files in, it will take a little bit more .htaccess magic. First he needs to map the directory name to the index.php script the way JDevereux suggested, but he needs to make sure that the *contents* of that directory do not get rewritten to some useless URL and that they actually show up when users want to fetch them.

    However, I must confess that the specification of this problem wasn't clear enough for me to actually provide a 100% solution. And yes, I am just being nice, the specification really isn't clear enough, haha. ;)
     
    Aaron Sustar, May 7, 2009 IP
  6. Progg

    Progg Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You could even use mod_rewrite to write every request to index.php and set it up as virtual subdomains, handled completely outside apache. For example, if your user was john it could be john.example.com and you parse out the name with PHP. Deviantart employs a similar method. Just a thought. I've used it and it's very effective
     
    Progg, May 7, 2009 IP