Hi Steve, excellent answer, as usualy!!
my Cryptkey is stored in session var in this way:
- Code: Select all
if (md5($_POST["psw"])=="111111111111111111111111")
{
$_SESSION["PWDCRYPT"]=$_POST["psw"];
}
and I using those functions:
- Code: Select all
function __sql__()
{
$sql="select * from anagrafica";
if( isset($_SESSION["PWDCRYPT"]) )
{
$sql= "select m.*, aes_decrypt(cognome,'".$_SESSION["PWDCRYPT"]."') decryptCognome from anagrafica m";
}
return $sql;
}
function decryptCognome__permissions(&$record)
{
return Dataface_PermissionsTool::NO_ACCESS();
}
in index.php
I have add this functions:
- Code: Select all
function CryptOrder()
{
if( !isset($_SESSION["CryptOrder"]) )
{
$_SESSION["CryptOrder"]=1;
}
if ( strpos($_REQUEST['-sort'],'cognome')>=0 and @$_REQUEST['-table'] == 'anagrafica' and isset($_SESSION["PWDCRYPT"]) )
{
if($_SESSION["CryptOrder"]==1)
{
$_REQUEST['-sort'] = $_GET['-sort'] = " decryptCognome asc";
$_SESSION["CryptOrder"]=0;
}
else
{
$_REQUEST['-sort'] = $_GET['-sort'] = " decryptCognome desc";
$_SESSION["CryptOrder"]=1;
}
}
}
and call it before xataface block in this way:
- Code: Select all
session_start();
CryptOrder();
$dataface="xataface-1.2.1";
require_once '..\\'.$dataface.'\\dataface-public-api.php';
df_init(__FILE__, "http://$_SERVER[HTTP_HOST]/".$dataface);
$app =& Dataface_Application::getInstance();
$app->display();
Now It's working very good!! I hope there isn't problem for calling session_start() before xataface application!