black.horizons Posted January 18, 2007 Share Posted January 18, 2007 Can somebody show me a simple implementation of how to use these two methods in PHP, when inserting and selecting data from a table in MySQL? I'm a bit confused with the mysql.com page on it all...TIA! Link to comment https://forums.phpfreaks.com/topic/34740-solved-aes_encrypt-decrypt/ Share on other sites More sharing options...
fenway Posted January 19, 2007 Share Posted January 19, 2007 The complicated bit about these ones, if I have to right ones, is the use of the key. Link to comment https://forums.phpfreaks.com/topic/34740-solved-aes_encrypt-decrypt/#findComment-164174 Share on other sites More sharing options...
black.horizons Posted January 23, 2007 Author Share Posted January 23, 2007 i'm lost... Link to comment https://forums.phpfreaks.com/topic/34740-solved-aes_encrypt-decrypt/#findComment-167472 Share on other sites More sharing options...
fenway Posted January 23, 2007 Share Posted January 23, 2007 Sorry, I've mixed this up with the DES functions. Link to comment https://forums.phpfreaks.com/topic/34740-solved-aes_encrypt-decrypt/#findComment-167482 Share on other sites More sharing options...
black.horizons Posted January 23, 2007 Author Share Posted January 23, 2007 so...how would i use these on any of my tables. if i needed to encrypt and decrypt several fields. could you show me an insertion, update and selection statement of these?$insertinfo = mysql_query("INSERT INTO team_info VALUES ('NULL','$travel','$notes','$fixture,'$timestamp'')");NULL is a mysql auto_increment value$updateinfo = mysql_query("UPDATE team_info SET travel='$new_travel', notes='$new_notes', fixture='$new_fixture', TimeStamp='$timestamp' WHERE (team_id='$id')");$selectinfo = mysql_query("SELECT travel, notes, fixture, TimeStamp FROM team_info WHERE (team_id='$id')"); Link to comment https://forums.phpfreaks.com/topic/34740-solved-aes_encrypt-decrypt/#findComment-167567 Share on other sites More sharing options...
fenway Posted January 24, 2007 Share Posted January 24, 2007 Well, I believe that you would just wrap your value in AES_ENCRYPT( plaintext, key ). Link to comment https://forums.phpfreaks.com/topic/34740-solved-aes_encrypt-decrypt/#findComment-167983 Share on other sites More sharing options...
black.horizons Posted May 11, 2007 Author Share Posted May 11, 2007 thanks all, heres how i did it: (field names and key changed!)$user_info = mysql_query("SELECT AES_DECRYPT(address1, 'yugbfmdhkdfk8657698') as address1, AES_DECRYPT(townland, 'yugbfmdhkdfk8657698') as townland, AES_DECRYPT(postcode, 'yugbfmdhkdfk8657698') as postcode, AES_DECRYPT(homephone, 'yugbfmdhkdfk8657698') as homephone, AES_DECRYPT(mobilephone, 'yugbfmdhkdfk8657698') as mobilephone FROM userinfo WHERE (id='$id')");works super! Link to comment https://forums.phpfreaks.com/topic/34740-solved-aes_encrypt-decrypt/#findComment-250923 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.