looking for user registration script + file protection

Discussion in 'PHP' started by forumrating, Jun 23, 2006.

  1. #1
    im looking for a very simple user registration script (php script )

    feilds as below

    userid:
    pass:
    First name:
    Last name:
    Email Address:
    Yahoo email id
    Phone Number:
    Cell Number:
    additional feild:
    Country:

    once user registers he should be able to go to a landing page with download file option , and the file should be protected from direct download.



    would be glad if anyone can help me for this thanks
     
    forumrating, Jun 23, 2006 IP
  2. vishwaa

    vishwaa Well-Known Member

    Messages:
    271
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    138
    #2
    Just giving you a outline. You can easily code it.

    You need to have a database support to implement this idea.

    step1: create a normal form to collect the user data

    step2: on successful validation, generate a unique identifier like "7s7de2hd" and generate a link like http:// www .test.com/verify.php?id=7s7de2hd

    step3: store all the inputs along with the unique identifier in the database

    step4: send this url to the user's email address in order to verify his email address.

    step5: when the user clicks the link and verifies his email address, register a session variable and redirect him to a new url.

    step6: authenticate the session by verifying the session variable and allow the user to download the file with a link like download.php?id=X to download the actual file

    step7: use php header function to implement download functionality. by this way, direct download will not work.

    Thats it.

    You need to have 1 html file, 2 php scripts, 1 mysql table to do this.

    For step1 - normal html file

    step2, step3, step4 - php script to validate the input, generate a link, and mail the link to the user

    step5 - another php script to verify the user, registering a session variable, redirect the user to 3rd php script

    step6, step7 - 3rd script to authenticate the session and allow the user to download the file.

    Direct download shouldnt work with this method. Suppose the user directly visit the download url, he will be forbidden from download due to undefined session variable.

    visit http://in2.php.net/manual/en/function.header.php#65667 to get more idea about download via header function.

    hope it helps a little bit.
     
    vishwaa, Jun 23, 2006 IP
  3. smo

    smo Well-Known Member

    Messages:
    41
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #3
    I will start with last part.
    To protect the file from downloading you can create checking script without sending any header and then send ( after check ) the file to the browser. You can store the downloaded file any where and good idea is to keep it above the root directory. Check this.

    http://plus2net.com/php_tutorial/php_file_download.php

    If you are trying to learn a basic registration and login script then read this and download the zip file with the code.

    http://www.plus2net.com/php_tutorial/php_signup.php
     
    smo, Jun 23, 2006 IP