I have a small elearning app and I want to check against the DB for the start and end dates (from mysql) and if they meet the criteria, good, else location.redirect to expired.php??
It doesn't redirect, any suggestions?
Here's an example below...
function Timebomb() {
var StartDate = <?php echo $row_product['startdate']; ?>;
var EndDate = <?php echo $row_product['enddate']; ?>;
var nowDate = new Date();
var day = nowDate.getUTCDate();
var month = nowDate.getUTCMonth();
var correctedMonth = month + 1;
/* Date Checker corrector */
if (correctedMonth < 10) {
correctedMonth = "0" + correctedMonth;
}
if (day < 10) {
day = "0" + day;
}
var year = nowDate.getYear();
if (year < 1900) {
year = year + 1900;
}
var GMTdate = year + "" + correctedMonth + "" + day;
/* End of Date Correcter */
if ((GMTdate <= EndDate) && (GMTdate >= StartDate)) {
document.redirect('expire.php')
}
}
Thanks,
Ted