Exemplo n.º 1
0
?>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<?php 
// Create connection
use foundationphp\OCI;
require_once 'src/foundationphp/OCI.php';
$oci = new OCI();
session_start();
if (isset($_SESSION['myusername'])) {
    $id = $_SESSION['myusername'];
    $idmd5 = encrypt($id, $id);
    $row = $oci->fetchArray("T1_1", "T5_3", "T5", "T1", "T1_1", "T5", "T5_1", $idmd5);
    while ($row) {
        echo "id: " . decrypt($row["T1_1"], $id) . "  Name: " . decrypt($row["T1_2"], $id) . "Last name: " . decrypt($row["T1_3"], $id) . "Email:" . decrypt($row["T5_3"], $id) . "<br>";
    }
}
function encrypt($data, $secret)
{
    //Generate a key from a hash
    $key = md5(utf8_encode($secret), true);
    //Take first 8 bytes of $key and append them to the end of $key.
    $key .= substr($key, 0, 8);
    //Pad for PKCS7
    $blockSize = mcrypt_get_block_size('tripledes', 'ecb');
    $len = strlen($data);
    $pad = $blockSize - $len % $blockSize;
    $data .= str_repeat(chr($pad), $pad);