Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

decryption issues

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
I am getting data encrypted fine using:

Code:
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = "blah blah blah";
$text = $pword;

$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);

but I can not seem to get it decrypted. I get the following error:

Parse error: parse error, unexpected T_VARIABLE in ... on line 645

I have simply copied the code from php.net. Line 645 is in red

Code:
$EFquery = mysql_query("SELECT * FROM table where field = '$variable'");
$resultEF = mysql_fetch_array($EFquery);

[COLOR=#ff0000]$text = $resultEF[pword];[/color]
$key = "blah blah blah";
$iv_size = mcrypt_get_iv_size(MCRYPT_XTEA, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$enc = mcrypt_encrypt(MCRYPT_XTEA, $key, $text, MCRYPT_MODE_ECB, $iv);
						
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = "blah blah blah";
$text = $resultEF[pword];
						
$crypttext = mcrypt_decrypt(MCRYPT_XTEA, $key, $enc, MCRYPT_MODE_ECB, $iv);

[conehead]
 
Shouldn't the index be in quotes?
Code:
$text = $resultEF['pword'];

Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top