1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Website coding help (redirecting, automatically creating new URLs)

Discussion in 'Link Building' started by jagaman34, Apr 26, 2012.

  1. jagaman34

    jagaman34 Newbie

    Joined:
    Dec 14, 2011
    Messages:
    20
    Likes Received:
    1
    hi,

    I need some help coding a website. The process is listed below:

    I direct a user to a URL to download a file e.g ##.##/download1 (Page1)

    This page will automatically redirect the user to a newly created page based on the users unique code/ ip. The user can then download the file on this new URL e.g. ##.##/download1/user1 (Page2)

    Once a user has been on this page and downloaded the file I don't want anyone else to be able to access that link. So if another user visits 'page2' they cant access the page.

    Whats the best way to do this??

    And how would I set up a system where a new URL is created based on the users ID??


    I was thinking of having a script that takes the ip address / creates a cookie from 'page1'. When the user goes to 'page2' it looks for this ip/cookie and if it matches the user stays on this page. If its not correct they cant access the page. Is that the correct way of doing it?

    please get intouch if you could help :)
     
  2. artizhay

    artizhay BANNED BANNED

    Joined:
    Nov 21, 2010
    Messages:
    1,867
    Likes Received:
    1,335
    Can I ask what the purpose is of redirecting the user to their own page? If anyone visits ##.##/download1, they can download the file anyway right? So why create their own page?

    Once I understand the purpose, I will try to help you.

    However, I think a more reliable method than a cookie is storing the user ID and IP pair in a database and running a check to ensure they match when a user visits ##.##/download1/user1. Or you can create a hash from the IP and ensure the hash matches every time the page is accessed; this may be the best and fastest way to do it.