note 83067 modified in function.convert-uuencode by felipe
| From: | felipe@php.net | Date: | Fri, 09 May 2008 02:11:24 +0000 |
| Subject: | note 83067 modified in function.convert-uuencode by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-139199@lists.php.net to get a copy of this message | ||
Code snippet for Encoding passwords using convert_uuencode and store in mysql database .
Consider a file named "test.php" consisting of an input form as given below:
<html>
<body>
<form action="test.php" method="post">
<input type="text" name="fname" id="fname" />
<input type="password" name="password" id="password" />
<input type="submit" name="submit" value="submit" />
</form>
<?
/*
below php code takes input field values , encode the password and then store the values in a
database .
Create a table named test with fields id,name,password where id is auto incremented..
*/
if(isset($_post['submit']))
{
$fname=$_POST['fname'];
$pass=$_POST['password'];
$encoded_pass=convert_uuencode($pass);
$con=mysql_connect("your hostname","your username","your password");
//connecting to the database
$db=mysql_select_db("your_database_name",$con);
$sql="INSERT INTO test (id,name,password) VALUES('','$fname',
'$encoded_pass' )";
$result=mysql_query($sql)or die("unable to insert");
}
?>
</body>
</html>
--was--
Code snippet for Encoding passwords using convert_uuencode and store in mysql database .
Consider a file named "test.php" consisting of an input form as given below:
<html>
<body>
<form action="test.php" method="post">
<input type="text" name="fname" id="fname" />
<input type="password" name="password" id="password" />
<input type="submit" name="submit" value="submit" />
</form>
<?
/*
below php code takes input field values , encode the password and then store the values in a
database .
Create a table named test with fields id,name,password where id is auto incremented..
*/
if(isset($_post['submit']))
{
$fname=$_POST['fname'];
$pass=$_POST['password'];
$encoded_pass=convert_uuencode($pass);
$con=mysql_connect("your hostname","your username","your password");
//connecting to the database
$db=mysql_select_db("your_database_name",$con);
$sql="INSERT INTO test (id,name,age) VALUES('','$fname',
'$encoded_pass' )";
$result=mysql_query($sql)or die("unable to insert");
}
?>
</body>
</html>
http://php.net/manual/en/function.convert-uuencode.php