Current location: Hot Scripts Forums » Programming Languages » PHP » Encrypting a password


Encrypting a password

Reply
  #1 (permalink)  
Old 10-27-11, 10:26 AM
ThatBenderGuy ThatBenderGuy is offline
New Member
 
Join Date: Oct 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Encrypting a password

Ok I have a register form on one page named signup.php and I have a form on there that's action is set to register.php.

Now how do I ensure that the password when sent to the database is encrpyted?

I heard of a thing called md5 is that it?

would it be something like this

signup.php
HTML Code:
<html><body><font face=Arial size=2> 
 <form method="post" action="register.php"> 
 <table bgcolor=#CCCCFF align=right> 
 <tr><td colspan=2><strong>Registration:</strong></td></tr>
 <tr><td>Username:</td><td><input size=25 name="desired_name"></td></tr> 
 <tr><td>Password:</td><td><input type=password size=25 name="desired_password"></td></tr>
 <tr><td>Confirm Password:</td><td><input type=password size=25 name="desired_password2"></td></tr>
 <tr><td>Email:</td><td><input size=25 name="email"></td></tr>    
 <tr><td>Gender:<br /> 
<input type="radio" name="gender" value="Male">Male<br />
<input type="radio" name="gender" value="Female">Female<br />
<input type="radio" name="gender" value="NA" checked=true>No Answer
</td></tr>
 <tr><td colspan=2 align=right><input type=submit name="send" value="Submit"></td></tr>
 </table> 
 </form> 
 </body> 
 </html>
register.php
PHP Code:

<?php

$pass1
=$_REQUEST['desired_password'];
$finalpw md5($pass1);
?>
Then when inserting it to the database send $finalpw?
Reply With Quote
  #2 (permalink)  
Old 10-27-11, 11:29 AM
titanit titanit is offline
New Member
 
Join Date: Oct 2011
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Old way of doing it

Hello,

That method has depreciated. See the documentation at:

PHP: crypt - Manual

Example use:

Using the PHP Crypt Function - PHP

Good luck
Reply With Quote
  #3 (permalink)  
Old 11-01-11, 06:06 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
What...? The md5() function is not deprecated. It's perfectly safe to use. Although I suggest using it with a unique salt for each user.
Reply With Quote
  #4 (permalink)  
Old 11-04-11, 07:41 AM
Shamrocks Shamrocks is offline
Newbie Coder
 
Join Date: Oct 2011
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
I personally use md5 function with no problem, it will work it out perfeclly for you.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
password() not working karthikanov24 PHP 2 10-13-09 12:04 AM
forgot password help please macintosh PHP 1 05-10-09 06:47 PM
Password Problems in VB6 iceiceady Visual Basic 6 03-28-06 03:17 PM


All times are GMT -5. The time now is 08:52 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.