CodeIgniter Forums
Help with Encryption... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Help with Encryption... (/showthread.php?tid=10196)



Help with Encryption... - El Forum - 07-22-2008

[eluser]drbigfresh[/eluser]
I am trying to help someone get some data out of a system that was designed using codeigniter. The originaly developer is long gone, and I am only somewhat familiar with codeigniter. For some reason the developer encrypted almost everything that went into the database, and I am now trying to decrypt one of the tables.
I know he was calling $this->load->library('encrypt'); and I have the encryption_key. My question is, how can I create a php page that will get all the info from my table (member_info) and display it unencrypted? Any help anyone can provide is greatly appreciated.

Thanks!


Help with Encryption... - El Forum - 07-22-2008

[eluser]meigwilym[/eluser]
Try...

Code:
$this->load->library('encrypt');
$this->load->library('database');

$sql = "SELECT * FROM member_info ;";
$query = $this->db->query($sql);

$table = '<table>';

foreach ($query->result() as $row)
{
   $table .= '<tr>';
   $table .= $this->encrypt->decode($row->title);
   $table .= $this->encrypt->decode($row->name);
   $table .= $this->encrypt->decode($row->email);
   $table .= $this->encrypt->decode($row->etc);
   $table .= $this->encrypt->decode($row->etc);
   // replace with the fieldnames
   $table .= '</tr>';
}

$table .= '</table>';

echo $table;