1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Restricted Pages?

Discussion in 'HTML & Website Design' started by Primary, May 4, 2004.

  1. #1
    Hi there,
    This is a newbie question I know. :)

    Most of my experience in designing web pages extends to basic HTML, and a few things from Dreamweaver, so I don't know how to restrict people from viewing some of my web pages.

    I'd really like to develop a login screen that accepts a username and password, and if they check out, then they are allowed to go to the next page, if not, they get access denied.

    Currently my website in question is hosted on a Linux box, but I'm not hosting it myself.
    SEMrush
    I don't particularly need the exact code on how to do something like this, I'm just looking to be pointed in the right direction. Can this be done with some sort of script? If so what scripting language should I use? Are there any resources that would help me out?

    Thanks for any info!
     
    Primary, May 4, 2004 IP
    SEMrush
  2. compar

    compar Peon

    Messages:
    2,705
    Likes Received:
    169
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I don't know exactly how to do this and I'm sure others will tell you. But why do you want restrict access like this? If you don't want your stuff to be seen don't put it on the web?????
     
    compar, May 4, 2004 IP
  3. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,277
    Likes Received:
    2,597
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #3
    You can do it with the .htaccess file (I'll assuming you are running Apache since it's on Linux).

    - Shawn
     
    digitalpoint, May 4, 2004 IP
  4. hans

    hans Well-Known Member

    Messages:
    2,924
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #4
    on linux AND FreeBSD running apache

    EASY to follow step by step procedure:

    1. create file
    .htaccess

    content of .htaccess:

    AuthName "Restricted"
    AuthType Basic
    AuthType Basic AuthUserFile /serverpath/to/your/restricted/dir/.users
    require valid-user

    2. then via telnet - login to your server and execute the following commandline

    htpasswd -c .users [user to add]

    --->> replace "[user to add]" by actual user name WITHOUT [] - then prompt for password will appear twice !
    this for FIRST user, then ...

    3. to add NEW additional users proceed as follows:

    each ADDITIONAL user execute the following (slightly different commandline)
    IF for any reason the file .user is NOT created by the first htpasswd -c .users [user to add] command,
    then create it by using

    touch .user

    or any other means you know

    to ADD additional users - execute the following commandline via telnet

    htpasswd .users [user to add]

    --->> replace "[user to add]" by actual user name - then prompt for password will appear twice !

    PLEASE note
    all passwords are ONE-way encrypted
    YOU have to remember the passwords
    else if password LOST
    ftp to your server - open .user-file in editor - and delete the one user you forgot password and re-enter same user again ...

    the .users - file then has a content per user similar to

    iamachildofgod:xf7WsoM/cqV8Y

    first part being username - second part encrypted password


    why to restrict access

    1. ask shawn - the site access to Keyword tracker is restricted
    2. i have it on my download page

    i offer free download ( sometimes free and sometimes for honest donation )
    1 most frequent downloaded file has some 14+ MB
    i get MANY hundreds of downloads/months IF i offer that file for free - but even more hundreds of ABORTED downloads each months ..
    with zero restriction i could easily exceed my monthly limits of 25 GB - all would be out of control.

    people love to grab whatever is free even if they have no use for it ... just for GREED ...
    and as soon as they realize that it would cost them some cents for their own download time charged by their own ISP
    - they abort
    leaving nothing but serverload for nothing - wasted resources - aborted download sometimes makes up to some 90% of download volume on THAT file's total volume.

    3. in forum etc restricted access keeps people who have OTHER than honest intentions most of the time out as they fear submitting
    name or email address

    hence i restrict access to a few sections to keep all as clean as possible and fully focus on productivity.
    it works since many years.
     
    hans, May 5, 2004 IP
  5. sarahk

    sarahk iTamer Staff

    Messages:
    25,020
    Likes Received:
    3,404
    Best Answers:
    99
    Trophy Points:
    615
    #5
    sarahk, May 5, 2004 IP
  6. Smyrl

    Smyrl Tomato Republic Staff

    Messages:
    13,461
    Likes Received:
    1,503
    Best Answers:
    76
    Trophy Points:
    510
    #6
    My control panel for unix server allow for easy set up of password protected directory.

    S
     
    Smyrl, May 5, 2004 IP
  7. Primary

    Primary Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks very much for the help guys! I will be trying these things soon. In my particular case, there are just some things on my site that I'd like friends family and clients to see, but not the world at large, though most of the site will be public.

    Thanks again.
     
    Primary, May 5, 2004 IP