2
目前我正在學習一點Coldfusion編碼,並將我的整個舊PHP網站轉換爲流暢的Coldfusion代碼,但我堅持使用PHP的幾行代碼,而且我確實不知道我應該怎麼這行代碼轉換成適當的ColdFusion代碼:將PHP代碼轉換爲Coldfusion
function access()
{
$accesscode = $_GET["accesscode"];
$time = (int)$_GET["time"];
$ip = $_GET["ip"];
// Time variable must be identical
if(time() < $time)
{
die("Locale time is ". (time()-$time) ."sec. is not correct.");
}
// Check client IP
if($ip <> $_SERVER["REMOTE_ADDR"])
{
die("Client IP ".$_SERVER["REMOTE_ADDR"]." is not identical as ".$ip." used.");
}
// Time > 10 minutes is no access
for ($c=0;$c<=3;$c++)
{
$t = substr(strftime("%Y%m%d%H%M", time()-($c*600)),0,11);
$hash = md5($ip. "9709f31be0". $t);
if($hash == $accesscode) return true;
}
return false;
}
if (!access())
{
die ("Access denied..");
}
Echo "Access approved.";
如果有人可以幫助給我如何的這幾行代碼轉換的一些技巧,我會非常greatfull。
非常感謝提前,
什麼困擾你?日期格式化? – LarZuK
你需要更具體,很多這是非常基本的代碼,你可以很容易谷歌「PHP時間()Coldfusion」,並拿出Now()等 – Busches
幾乎所有的,但我會谷歌php time()coldfusion。謝謝。 – Yannick