note 6374 modified in crypt by ronabop
| From: | ronabop@php.net | Date: | Fri, 11 Aug 2000 17:31:23 +0000 |
| Subject: | note 6374 modified in crypt by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-1322@lists.php.net to get a copy of this message | ||
i really needed an encrypt/decrypt under windoze98 php4, and i ran across the encode/decode for
mySQL. So i decided to use that... i hope that helps some of u guys.
// encode(string encode_str, password_str);
// decode(string decode_str, password_str);
// my own personal encode/decode functions using MySQL
// a MySQL connection MUST be already open to use it!
/////// encryption functions (MySQL)
function encode($encode_str, $pass_str) {
$data = mysql_query("select encode('$encode_str', '$pass_str')");
$row = mysql_fetch_row($data);
return $row[0];
}
function decode($decode_str, $pass_str) {
$data = mysql_query("select decode('$decode_str', '$pass_str')");
$row = mysql_fetch_row($data);
return $row[0];
}
function password($string) {
$data = mysql_query("select password('$string')");
$row = mysql_fetch_row($data);
return $row[0];
}
Chao Xiong
http://www.php.net/manual/function.crypt.php