2012-05-11 66 views
0

嗨,我有一個預訂系統,它從AES加密數據庫中提取數據。在數據庫中,郵編和目的地是加密的,過去有一個帶有列表輸入的舊腳本,所以用戶可以在列表中選擇他們的目的地,因爲目的地列表越來越大,我想做一個表單,用戶輸入在幾個字母和目標出現使用ajax自動填充。我遇到的問題是,它的數據爲加密。加密數據檢索預訂表

第一預訂劇本有這條線來解密

$areafro = mysql_query("select AREA_NO, AES_DECRYPT(POSTCODE, 'qsi') as POSTCODE, AES_DECRYPT(AREA_NM, 'qsi') as AREA_NM from area_mst where AES_DECRYPT(POSTCODE, 'qsi') LIKE '$char%' group by POSTCODE"); 

這是新的預訂腳本代碼

if(isset($_GET['areas']) && isset($_GET['letters'])){ 
$letters = $_GET['letters']; 
$letters = preg_replace("/[^a-z0-9 ]/si","",$letters); 
$res = mysql_query("select POSTCODE,AREA_NM from area_mst where (POSTCODE like '".$letters."1' or AREA_NM like '".$letters."1') order by AREATYPE") or die(mysql_error(); 

while($inf = mysql_fetch_array($res)){ 
    if($inf["POSTCODE"]!='') 
    { 
    echo $inf["POSTCODE"]."-".$inf["AREA_NM"]."|"; 
    } 
    else 
    { 
    echo $inf["AREA_NM"]."|"; 
    } 
}  

能有人幫我如何獲得解密的數據?

回答

0

您在後面的代碼中的查詢不解密。在舊代碼的通知,你有

$areafro = mysql_query("select AREA_NO, AES_DECRYPT(POSTCODE, 'qsi') as POSTCODE, 
AES_DECRYPT(AREA_NM, 'qsi') as AREA_NM from area_mst 
where AES_DECRYPT(POSTCODE, 'qsi') LIKE '$char%' group by POSTCODE"); 

但在新的代碼,你只是不解密提取數據。

$res = mysql_query("select POSTCODE,AREA_NM from area_mst 
where (POSTCODE like '".$letters."1' or AREA_NM like '".$letters."1') 
order by AREATYPE") 

更改您的新代碼有查詢完全作爲一個在舊代碼,