- Forums
- MySQL
- How To Insert Encoded Passwords Into MYSQL Database PHP Code Script Sample
This Page Contains information about How To Insert Encoded Passwords Into MYSQL Database PHP Code Script Sample By wallpaperama in category MySQL with 1 Replies. [871], Last Updated: Sat May 18, 2024
wallpaperama
Tue Mar 06, 2007
1 Comments
4973 Visits
the other day i was trying to get a password for a user, i went to phpmyadmin and when i pulled up the user, i noticed that the password has a long code-like is was like this:
69206c6971528ae2e0c32ddeb21653dfI was thinking, how can I do that. How can you put secured passwords like that. Well that answer is simple. Thanks to the support team at www.webune.com for their PHP/MYSQL Hosting services they provide us so we can get the answers to these questions. If you ever need web hosting for your website, check them out, they are great services.
anyway, to encrypt or encode a password into mysql all you need to do is use the md5 function in php. for example, lets say i have a variable called $password and the value of $password is equals to mypass, this is how it would like:
$password = "mypassword";
so to encypt this so you can insert it into your sql database, just use the md5 function in php like this:
$password = "mypassword";
$password = md5($password );
now the value of $password is encoded and you can insert it into your databe. if you want a little snippet you can use try this:
CODE:
<?
$password = "mypassword";
$password = md5($password );
echo $password;
?>
just copy and save the above code and save it with your notepad as md5.php and open it with your browser and it will display or show you the encrypted or encoded value of $password, it will not display "mypass" but no bumbers. The only thing you need is to make sure you have a PHP website, if you don't have php on your website, you can visit our friends at www.webune.com and signup with a PHP/MYSQL webhosting plan.