Autenticazione

di il
1 risposte

Autenticazione

C'è qualcuno che sa come posso autenticare tramite pagine PHP gli utenti già definiti sul sistema (operativo) senza dover usare un dbms (mysql) per gestire gli utenti del sito?
uso linux mandrake 9.2 e vorrei che solo gli utenti della macchina possano accedere a parti di un sito
grazie...
Marco

1 Risposte

  • Re: Autenticazione

    <BLOCKQUOTE id=quote><!--<font size= face="" id=quote>-->quote:<hr height=1 noshade id=quote>
    C'è qualcuno che sa come posso autenticare tramite pagine PHP gli utenti già definiti sul sistema (operativo) senza dover usare un dbms (mysql) per gestire gli utenti del sito?
    uso linux mandrake 9.2 e vorrei che solo gli utenti della macchina possano accedere a parti di un sito
    grazie...
    Marco


    <hr height=1 noshade id=quote></BLOCKQUOTE id=quote><!--</font id=quote><font face="" size= id=quote>-->

    It's easy .

    To make work your script just make this :

    .htaccess is the most secure way to protect your directories from hackers or other unwanted individuals. It works by placing a '.htaccess' file in whatever directory that you would like to affect. Two files are needed to ensure that this works properly. A .htaccess file and a .htpasswd file. The .htaccess file tells the server which directories to protect and the .htpasswd file keeps all your login names and passwords securely.
    Now to start off. Say you have a directory that you dont want anyone to enter or see unless they know or have login details. Lets say this directory is htpt://www.yoursite.com/password Creating and placing a working .htaccess into this directory would affect all other sub-directories within this folder

    Here is the code for your .htaccess file, all this can be created using notepad. Save the file as ".htaccess"


    AuthName "Protected Area Name"
    AuthUserFile /servers/full/path/to/.htpasswd
    AuthType Basic

    <Limit GET>
    require valid-user
    </Limit>


    Auth name tells the server the name of the directory you would like to protect. You can change the name to anything. It does not really matter. AuthUserFile is the is your servers full path to the .htpasswd file which is where all your login details are kept. The full path is not a url. If you are unsure of your servers full path, just contact your web host.

    .htpasswd file
    There is no code for your .htpasswd file. Just remember that each login detail takes a new line and to type it into this format username:password
    One very important thing to remember is that the password you put in the .htpasswd file is coded. For example say you want to create a login for yourself using login name 'admin' and you want your password to be 'password' Simply put this line into your .htpasswd file


    admin:xZX3RQm9R4w3.
    Now when the server reads your password xZX3RQm9R4w3. it translates it to the word 'password'. To your generate your encrypted htaccess password. Use our online .htpasswd generator

    Now you're finished, save your files and upload them in ascii mode and test it out by going to the password protected directory. You will notice now that a login prompt comes up, login and good luck with how you use this.

    Another related tutorial you might find useful is custom error pages, which is also related to .htaccess



    Good Luck

    /dev/null
Devi accedere o registrarti per scrivere nel forum
1 risposte