我正在處理的這段代碼是檢查數據庫中是否有結束編輯的日期(說今天的日期是12/30/11編輯的最後日期是或是12/12/10 =鎖定或今天的日期是12/30/11編輯的最後日期是或是12/12/13 =解鎖&轉發到編輯網站)檢查數據庫中的當前日期與日期
所以記住這個問題:代碼我一直說您的帳戶被鎖定,無論鎖定日期和我在一個失去了一個解決方案:(。
順便說一句,請記住,頭已經被這點發送。
<?php
$id = $_GET['id'];
// Define MySQL Information.
$mysqlhost="***************"; // Host name of MySQL server.
$mysqlusername="**********"; // Username of MySQL database.
$mysqlpassword="*********"; // Password of the above MySQL username.
$mysqldatabase="*************"; // Name of database where the table resides.
// Connect to MySQL.
mysql_connect("$mysqlhost", "$mysqlusername", "$mysqlpassword")or die("Could not connect to MySQL.");
mysql_select_db("$mysqldatabase")or die("Could not connect to selected MySQL database.");
$infosql = "SELECT * FROM premiersounds_users WHERE customer_id = $id";
$inforesult = mysql_query($infosql) or die(mysql_error());
$info = mysql_fetch_array($inforesult);
$l_date=$info['lockout_date'];
//Get current date from server
$format="%m/%d/%y";
$c_date=strftime($format);
//set sessions
$_SESSION['current_date'] = $c_date;
$_SESSION['lockout_date'] = $l_date;
//Check is Current date = lockout date
if ($c_date <= $l_date) { header("location:/planner_scripts/documnet_editors /edit_weddingplanner.php?id=$id"); } else {echo 'Whoops! Were sorry your account has been locked to edits because your event is less than 48 hours from now or your event has passed. To make changes to your event please contact your DJ.'; echo'<br/>'; echo ' Todays Date: ';echo $c_date; echo ','; echo ' Last Date for edits: '; echo $l_date;}
?>
<?php
//Destroy Session for Lockout Date to prevent by passes
unset($_SESSION['lockout_date']);
?>
首先,因爲它存在於您的代碼是大規模開放** SQL注入** – rdlowrey 2011-12-31 04:42:59
如果你在談論,我們把有ID的網址是什麼?它並不是一個真正值得關注的問題,因爲編輯頁面會檢查cookie對應的Cookie和會話數據,這些數據在他們登錄時設置,而不會在這裏看到。 – 2011-12-31 04:48:28
總是有人擔心......無論如何,回答即將討論這一點。 – rdlowrey 2011-12-31 04:49:08