i want to make comfirmation popup (yes/no button) in php if session already limit. If the user click yes button in popup it stay in the website or refresh session, if click no, session terminated. How can i do this?.. below is my php code :
if (isset($_SESSION['LAST_ACTIVITY1']) && (time() - $_SESSION['LAST_ACTIVITY1'] > 7200)) {
if (isset($_SESSION['member_id'])) {
***<script>comfirmation popup code in here</script>***
session_unset(); // unset $_SESSION variable for the run-time
session_destroy(); // destroy session data in storage
header('Location: '.AT_BASE_HREF.'login.php?loginexpired=true');
exit;
}
//echo "awa";
} else {
//echo "aba" . $_SESSION['LAST_ACTIVITY1'];
}
my problems i cannot put javascript code inside the php. how to put javascript of jquery inside php?
this is my code i want :
<script type='text/javascript'>
var answer = confirm ("Are you having fun?")
if (answer)
alert ("Woo Hoo! So am I.")
else
alert ("Darn. Well, keep trying then.")
session_unset(); // unset $_SESSION variable for the run-time
session_destroy(); // destroy session data in storage
//header('Location: '.AT_BASE_HREF.'login.php?loginexpired=true');
window.location.href="<?php AT_BASE_HREF.'login.php?loginexpired=true'; ?>";
// -->
</script>