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

Can any one tell me how i can make a folder in my website private? i.e users need login

Discussion in 'Web Design' started by mrxinbollywood, Feb 10, 2010.

  1. mrxinbollywood

    mrxinbollywood Elite Member

    Joined:
    Sep 15, 2008
    Messages:
    1,738
    Likes Received:
    2,759
    Location:
    100 feet under symetry
    Hi Friends

    I want to protect all contains in http://www.rajpromotions.com/download/

    For that i need to done it in php code, where user needs login & password.

    Can any one give me some tutorial or php code requires for this.
     
  2. makinbuckz

    makinbuckz Junior Member

    Joined:
    Sep 21, 2009
    Messages:
    152
    Likes Received:
    32
  3. showboytridin

    showboytridin Regular Member

    Joined:
    Sep 5, 2009
    Messages:
    348
    Likes Received:
    714
    Location:
    127.0.0.1
    Probably you will want to protect that using .htaccess. You don 't need php.

    Code:
    http://www.reallylinux.com/docs/htaccess.shtml
     
  4. fatboy

    fatboy Elite Member

    Joined:
    Aug 13, 2008
    Messages:
    1,618
    Likes Received:
    3,227
    Occupation:
    Retired
    Location:
    Old Peoples Home
  5. noober

    noober Junior Member

    Joined:
    Jul 18, 2008
    Messages:
    131
    Likes Received:
    35
    Here's a simple password script in Pearl:


    #!/usr/bin/perl

    use CGI qw(param);
    use CGI::Carp qw(fatalsToBrowser);

    $user = param("user");
    $pass = param("pass");

    $file = "userpass.txt";

    open(DATA,"$file"); @data = <DATA>; close(DATA);
    foreach (@data) {
    ($username, $password) = split(/\t/, $_);
    if (($user eq $username) && (crypt($pass, length($pass)) eq $password)) {
    $logged = "true";
    }
    }


    You could also use Matt Wrights Cookies Archive.
    that would help you to increase the user base.

    You can also se .htaccess to protect a website folder. There are many tutorials on Google.
     
  6. Dappy

    Dappy BANNED BANNED

    Joined:
    Jun 28, 2009
    Messages:
    37
    Likes Received:
    157
    lol easiest way

    if u use cpanel.. there is a part... "password protected directories"

    just password protect the folder u dont want public to see... n create a user for that.
     
  7. noober

    noober Junior Member

    Joined:
    Jul 18, 2008
    Messages:
    131
    Likes Received:
    35
    Use this to save the member's info to a txt file after they register so they can login when they visit.

    print qq~
    <table border=1 BORDERCOLOR="#000000" width=100% cellspacing=0 bgcolor="#ffffff">
    <tr>
    <td bgColor="ffffff" BORDERCOLOR="#ffffff"> <center>
    <form action="/cgi-bin/mysitegoeshere/login.cgi" method="POST">
    User name: <input type="text" name="r_name">
    </form>
    <form action="/cgi-bin/mysitegoeshere/login.cgi" method="POST">
    <input type="hidden" name="_send_email" value="email.txt">
    Your email address: <input type="text" name="re_email">
    </form>
    <form action="/cgi-bin/mysitegoeshere/login.cgi" method="POST">
    <input type="hidden" name="_password" value="password.txt">
    Choose Password: <input type="text" name="re_password">
    </form>
    <form action="/cgi-bin/mysitegoeshere/login.cgi" method="POST">
    <input type="hidden" name="_password" value="password.txt">
    Confirm Password: <input type="text" name="re_password">
    </form>
    <form action="/cgi-bin/mysitegoeshere/login.cgi"
    method="GET">
    <input type="submit" value="Submit">
    </form>
    </center>
    </td>
    </tr>
    </table>~;
     
    Last edited: Feb 11, 2010
  8. mrxinbollywood

    mrxinbollywood Elite Member

    Joined:
    Sep 15, 2008
    Messages:
    1,738
    Likes Received:
    2,759
    Location:
    100 feet under symetry
    I also need the user name and password will be saved in a database.

    I will manually put all user name and password into that database.