Jump to content

[SOLVED] AES_ENCRYPT / DECRYPT


black.horizons

Recommended Posts

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
Share on other sites

  • 3 months later...
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.