WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
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 Resources
Web Development Content
Internet Security Software
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
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

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 Stockl
Date : Oct 23rd 1998
Grade : 2 of 5 (graded 3 times)
Viewed : 10491
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Anton Stockl
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  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
PHP4 AND MySQL Authentication
Categories : PHP, MySQL, Authentication, Databases
Basic WWW-Authentication example
Categories : PHP, Authentication
AUTH (.htaccess style) - a login system that uses PostgreSQL.
Categories : PHP, Authentication, Databases, PostgreSQL
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
Form Security - Match A Value For Success
Categories : PHP, Authentication, HTML and PHP, Sessions, Security
Timer - a class that uses microtime() to provide easy calculation of elapsed times
Categories : Algorithms, PHP, PHP Classes
Boolean Keyword Interpreter
Categories : PHP, Algorithms, Search Engines
Dollar Serial Number Validator
Categories : PHP, Security, Algorithms
Function to remember password
Categories : PHP, Authentication, Personalization and Membership
Validation function for LUHNMod10 and variant. Can discriminate credit card numbers of varying lengths. Uses [Double >> Sum-of-Digits] transform.
Categories : Credit Cards, Authentication, Ecommerce, PHP
Prime number finder (Sieve of Erastothenes)
Categories : PHP, Algorithms, Math.
quick sort for associative arrays
Categories : Algorithms, Arrays, PHP
PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL
The Porter Word Stemming Algorithm in PHP Reduces words to their base stem for search engines and indexing
Categories : Algorithms, PHP, Strings
 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