WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Authenticating against .htpasswd style files.
Categories : Authentication, PHP Update Picture
Christopher Curtis
Date : May 31st 1998
Grade : 2 of 5 (graded 12 times)
Viewed : 20438
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Christopher Curtis
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?
if( !($passwd = @fopen( "passwords", "r" )))
{ echo "Cannot open password file.";
exit;
}

if( !$PHP_AUTH_USER )
{ Header( "WWW-authenticate: basic realm=\"Realm\"" );
Header( "HTTP/1.0 401 Unauthorized" );
echo "Text to see if user hits 'Cancel'";
exit;
}

// file format => username:passwd{\n}
while( $pwent = fgets( $passwd, 100 ))
{ $part = split( ":", ereg_replace( "\n", "", $pwent ));
if( $part[0] != $PHP_AUTH_USER )
continue;

// Username was found - verify passwd
if( $part[1] !=
// The crypt salt is stored as chars 1&2 of passwd
crypt( $PHP_AUTH_PW, substr( $part[1], 0, 2 )))
break;

echo "Hello $PHP_AUTH_USER.<p>\n";
}

// This only has effect of no text was output previously, so
// it is ignored in all cases except authentication error.
@Header( "HTTP/1.0 401 Unauthorized" );
?>



Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate.
Categories : Authentication, PHP
Function to remember password
Categories : PHP, Authentication, Personalization and Membership
PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL
Authorize Me! An authentication script.
Categories : MySQL, Databases, Authentication, PHP
Authentication script to authenticate users in Active Directory through LDAP.
Categories : LDAP, Authentication, Cookies, PHP
MD5 secured login
Categories : PHP, Java Script, Authentication, Security
Import the yahoo address book.
Categories : PHP, CURL, Authentication
Simple and fast user authentication
Categories : PHP, PHP Classes, Authentication
Is there some possibility to link a database to an htaccess file, so that instead of having a passwd file you would have a database with DES-crypted password and username fields?
Categories : Authentication, PHP, General SQL, Databases
Authentication HTTP protocol POST
Categories : Authentication, HTTP, PHP
Full membership authentication system.
Categories : Authentication, MySQL, PHP, Databases
A simple PHP login script that you can modify to suite your needs. It use a session to store data in a session file submited by the page.
Categories : PHP, Sessions, Security, Authentication
Implementing a "Members ONLY" area
Categories : PHP, MySQL, Databases, Authentication
AUTH (.htaccess style) - a login system that uses PostgreSQL.
Categories : PHP, Authentication, Databases, PostgreSQL
Form Security - Match A Value For Success
Categories : PHP, Authentication, HTML and PHP, Sessions, Security