php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45504 aes_decrypt will not work in my php page
Submitted: 2008-07-13 23:07 UTC Modified: 2008-07-13 23:16 UTC
From: james at jpsgraphics dot co dot uk Assigned:
Status: Not a bug Package: *Encryption and hash functions
PHP Version: 5.2.6 OS: ubuntu
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: james at jpsgraphics dot co dot uk
New email:
PHP Version: OS:

 

 [2008-07-13 23:07 UTC] james at jpsgraphics dot co dot uk
Description:
------------
in my php pages i am using aes_encrypt which works fine. The issue i am having is with aes_decrypt. I have been searching for days to try and resolve this problem but need more help. The following string in my php will not bring any results back at all. I know it does work because running it in mysql direct works.

simple sql string:
SELECT AES_DECRYPT(password, 'keyhere') FROM accounts where id = '11';


Reproduce code:
---------------
$sql = "SELECT userId, name, email, aes_decrypt(password,'keyhere'), country FROM accounts where id='". $_SESSION['member_ID'] ."'";

$result = mysql_query($sql);

if (!$result) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();
    exit;
}

if (mysql_num_rows($result) == 0) {
    echo "No rows found, nothing to print so am exiting";
    exit;
}
	while ($row = mysql_fetch_array($result))

{
     echo $row["userId"];
     echo $row["name"];
     echo $row["email"];
	 echo $row["password"];
	 echo $row["country"];
}

mysql_free_result($result);
mysql_close($conn);

Expected result:
----------------
123456 john john@email.com 'password should be here' UK

Actual result:
--------------
123456johnjohn@email.comUK

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-13 23:16 UTC] felipe@php.net
Not PHP bug.

See about 'aliases':
http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Feb 16 01:01:26 2019 UTC