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 : what salt do I have to feed the crypt function with to make it work like the htpasswd command of apache?
Categories : Algorithms, PHP, Authentication Update Picture
Anton Stöckl
Date : Oct 23rd 1998
Grade : 2 of 5 (graded 3 times)
Viewed : 7768
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Anton Stöckl
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

you use one that you make up. maybe like this:


$salt = substr(0, 2, md5(Date());
$encrypted = crypt($string, $salt);


The salt merely ensures that if 2 people have the same password, their
"crypted" representations are not the same (unless they use the same
salt). When you want to compare a password, you first find the already
encrypted one, grab the salt (the first 2 chars), and then encrypt the
password and compare it.



PHP Function to Encrypt/Decrypt a string without a known key. The string itself has his own different key for every character.
Categories : PHP, Algorithms, Security, Authentication, Encryption
Using $PHP_AUTH_USER and $PHP_AUTH_PW to authenticate.
Categories : Authentication, PHP
Basic Authentication with sessions
Categories : PHP, Beginner Guides, Authentication, Form Processing, Sessions
A very simple and efficient split bar the B-Z bar , for mysql and php ... Tired of obfuscated code try this one ...
Categories : PHP, Databases, MySQL, Algorithms
Password Creator: This PHP code exmaple shows how to use bitwise operations on a single variable and using it as a flagged variable. The class generates passwords of a given length using specified characters and the flags.
Categories : PHP, PHP Classes, Algorithms, Security
Simple Password example
Categories : PHP, Authentication, Security, HTTP
IPhider Obscure Any URL Anonymity connection lores obfuscation corporate survival.
Categories : PHP, Algorithms, Security, URLs
Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database.
Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication
Library of math functions to expand the functionality of PHP3. Version 1.2.1 fixes a major problem with the gcd function.
Categories : Algorithms, PHP, Math.
Credit Card Identification and Validation Class - The credit_card class provides methods for cleaning, validating and identifying the type of credit card numbers.
Categories : PHP, PHP Classes, Credit Cards, Ecommerce, Algorithms
Function to remember password
Categories : PHP, Authentication, Personalization and Membership
PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL
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
Check parameters validity. Paranoia was designed to check the validity of the parameters that a php page will receive after a form submission. It can be used to check the variables sent by POST or GET
Categories : Algorithms, HTML and PHP, PHP, Variables
Authorize Me! An authentication script.
Categories : MySQL, Databases, Authentication, PHP
 Teeranai Thamshutiporn wrote : 199
I try to use your salt but It said :
Warning: Wrong parameter count for date() 
in /home/internet/public_html/admin/passwd.php3 

What`s wrong ?

I wanna To Check and Change Password on Linux vai PHP3 
code [My Server use MD5]. Do you have same code ?

Regards,
Teeranai Thamshutiporn
 
 Matt Szubrycht wrote :392
Hi,

You need to provide the format of the date ... 
I would use the number of seconds since the epoch, 
therefore, it should looks somewhat like this:

$salt = substr(0, 2, md5(Date("U"))); 
    $encrypted = crypt($string, $salt);

That should do the trick, at least it works on my Cobalt 
RAQ3 running Linux.

Regards,
Matt