473,386 Members | 1,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

help encrypting field with MySQL AES_encrypt before Adodb query

I encrypted a database field using MySQL AES_ENCRYPT() from a mysql command
prompt. But I need to encrypt and decrypt at will in the php code as
records are added and viewed.

I can easily decrypt it because the code specifies a Query. But the INSERT
is an ADODB insert:

$_POST['is_here'] = 83;
....
runQuery($db ->GetInsertSQL($rs, $_POST, true));

I need to use MySQL AES_ENCRYPT() one of the $POST fields before it goes
into this but I don't see how? Mcrypt is not installed on server so MySQL
functions are what I need to use. Is there a way to have something like :
$_POST['field'] = "AES_ENCRYPT('text', 'password')";

It is a live system and I am hesitent to make changes without researching
it.

Any ideas?
Apr 13 '07 #1
2 4573
Hi,

You could generate the encrypted value:

$_POST['field'] = $db->GetOne(
'select AES_ENCRYPT(?, ?)',
array($_POST['field'], 'password'));
On Apr 13, 10:24 am, "Paul" <l...@invalid.comwrote:
I encrypted a database field using MySQL AES_ENCRYPT() from a mysql command
prompt. But I need to encrypt and decrypt at will in the php code as
records are added and viewed.

I can easily decrypt it because the code specifies a Query. But the INSERT
is an ADODB insert:

$_POST['is_here'] = 83;
....
runQuery($db ->GetInsertSQL($rs, $_POST, true));

I need to use MySQL AES_ENCRYPT() one of the $POST fields before it goes
into this but I don't see how? Mcrypt is not installed on server so MySQL
functions are what I need to use. Is there a way to have something like :
$_POST['field'] = "AES_ENCRYPT('text', 'password')";

It is a live system and I am hesitent to make changes without researching
it.

Any ideas?

Apr 14 '07 #2
beautiful - thanks!
"petersprc" <pe*******@gmail.comwrote in message
news:11**********************@d57g2000hsg.googlegr oups.com...
Hi,

You could generate the encrypted value:

$_POST['field'] = $db->GetOne(
'select AES_ENCRYPT(?, ?)',
array($_POST['field'], 'password'));
On Apr 13, 10:24 am, "Paul" <l...@invalid.comwrote:
>I encrypted a database field using MySQL AES_ENCRYPT() from a mysql
command
prompt. But I need to encrypt and decrypt at will in the php code as
records are added and viewed.

I can easily decrypt it because the code specifies a Query. But the
INSERT
is an ADODB insert:

$_POST['is_here'] = 83;
....
runQuery($db ->GetInsertSQL($rs, $_POST, true));

I need to use MySQL AES_ENCRYPT() one of the $POST fields before it goes
into this but I don't see how? Mcrypt is not installed on server so MySQL
functions are what I need to use. Is there a way to have something like
:
$_POST['field'] = "AES_ENCRYPT('text', 'password')";

It is a live system and I am hesitent to make changes without researching
it.

Any ideas?


Apr 16 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ian.H | last post by:
Hi all, I've taken on a massive project for a client recently and now I've hit some bug fixes that are required (3rd party code). and was just wondering about peoples opinions / personal...
1
by: Gordan | last post by:
mysql> select aes_encrypt('gordan', 'abc'); +------------------------------+ | aes_encrypt('gordan', 'abc') | +------------------------------+ | p§Èb9??_é?0ö?LIÝ |...
7
by: Munzilla | last post by:
Ok, I have an ASP page that I use to add several pieces of information to a database and also display that information in an edit mode. The problem is, when I use the page for edit, not all of the...
0
by: Jim S. | last post by:
I'm having a horrible time simply inserting the date in a MySQL database through a Visual Basic program. I have a table, called "ORDERS"; "ID" is the primary key. I'm trying the insert the date,...
11
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time...
4
by: Chris Travers | last post by:
Hi all; A few years ago, I set about porting a PHP application from MySQL to PostgreSQL, after realizing that MySQL wasn't going to be able to handle it. In order to do this, I built a light,...
0
by: Daniel Crespo | last post by:
Hi to all, I'm using adodb for accessing mysql and postgres. My problem relies on the mysql access. Sometimes, when I try to execute a query (using ExecTrans method below), I get this error:...
3
by: janetopps | last post by:
I have a news website, with asp pages, which was on Access, and i upgraded to MySQL, i used Bullzip to transfer the data. It had about 1000 pages, which im now able to pull up on the public side. Im...
0
by: timber910 | last post by:
Ok, I have a button on a form that I'm using to create another table I will need later in my form. I have created a reference table called Ref_Table (holds my table names - using this as the tables...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.