Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can the following be done? Link and password question

    Hey Guys,

    I have two questions and I am hoping they can be done.

    1st - On my site I have a lot of links for software downloads (exe, sometimes a rar or zip file). Is there a way to make it so those links can only work (start download) if clicked on my site? If the link was posted on another forum and was clicked on, the link won't work. Only if clicked on my site? I'm hoping that is possible..

    2nd - How do I password protect a page and have it so I can create different user names and passwords for each member I only want to allowed to view that page?

    Thanks guys in advanced.

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Posts
    235
    Thanks
    6
    Thanked 21 Times in 20 Posts
    As it seems like you are doing some kind of school/uni/college assignment and show no instigation to research into solutions I will only provide you with the basics. Should you then present code I'll happily help you debug.

    You need to look into form posting and parsing using $_POST, I would suggest using md5 or sha1 for password encryption.

    for the files, yes its quite easy to do this, you will need .htaccess, and combined with that a file which forwards people to the file so they don't get the true path. This file mustn't work without $_SESSION which you will need to set when someone logs in succesfully.

    In short:

    1. use $_POST when someone tries to login
    2. set $_SESSION with session_start() after succesful login
    3. You will need if statements in the second php file to check if the user is logged in when requesting a file.
    4. .htaccess to restrict direct access to a directory containing your files.

    Hope that helps!
    Andrew Sharman
    Web designer, developer and programmer.

    If you found my post helpful, why not give thanks! :)

  • #3
    Regular Coder
    Join Date
    Mar 2008
    Posts
    235
    Thanks
    6
    Thanked 21 Times in 20 Posts
    Perhaps instead of mailing me telling me that what I just said was wrong, you could provide some code you have done?
    Andrew Sharman
    Web designer, developer and programmer.

    If you found my post helpful, why not give thanks! :)


  •  

    Posting Permissions

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