Encrypting values
Moderator: General Moderators
Encrypting values
How can i encode and decode my values to be stored inside the Mysql database?? I get an error call to undefined function when i used AES_ENCRYPT or ENCODE().....
How is the code to be writter??
How is the code to be writter??
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Code: Select all
$query = "INSERT INTO song (songname) VALUES (ENCODE('$sn'))";
$result = @mysql_query ($query);thanks
- partiallynothing
- Forum Commoner
- Posts: 61
- Joined: Fri Nov 21, 2003 5:02 pm
- Location: connecticut, usa
I have not heard of an 'encode' function, although there may be, but one i do know of is 'password', but i would not recommend it. When you do it the way you are, you are sending the information unencrypted (or un-hashed) and then mySQL does the hashing. To encode the string before it is sent, use something like MD5 hashing. Here is an example:
Code: Select all
<?php
$my_hashed_string = md5($my_unhashed_string);
$query = "INSERT INTO song (songname) VALUES ('$my_hashed_string')";
?>-
malcolmboston
- DevNet Resident
- Posts: 1826
- Joined: Tue Nov 18, 2003 1:09 pm
- Location: Middlesbrough, UK
- dull1554
- Forum Regular
- Posts: 680
- Joined: Sat Nov 22, 2003 11:26 am
- Location: 42:21:35.359N, 76:02:20.688W
or you could make some crazy function to encrypt with
Code: Select all
function crypto($str)
{
$str = crypt($str);
$str = md5($str);
$str = md5($str);
$str = "9Fq5tG3".$str."GT9c8XkkwWal58p";
return $str;
}