note 6374 deleted from function.crypt by jimw
| From: | jimw@php.net | Date: | Sat, 03 Nov 2001 18:16:48 +0000 |
| Subject: | note 6374 deleted from function.crypt by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20367@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