我有一個確認電子郵件帳戶進行驗證的php頁面。如何在php頁面內執行javascript
我想要做的是當頁面重定向我想清除所有本地存儲並在我的javascript中觸發我的單擊事件。
我的問題是我的腳本在我的PHP文件不執行。在我verify.php
<?php
include_once('database.php');
$db = new Connection();
$db = $db->dbConnect();
$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
$vemail = $_GET['vemail'];
$vhash = $_GET['vhash'];
$search = "SELECT user_email, user_hash, user_active FROM tbl_user WHERE user_email = :vemail AND user_hash = :vhash AND user_active = '0'";
$verify = $db->prepare($search);
$verify->bindParam(':vemail', $vemail, PDO::PARAM_STR);
$verify->bindParam(':vhash', $vhash, PDO::PARAM_STR);
$verify->execute();
$match = $verify->rowCount();
if($match > 0){
$qup = "UPDATE tbl_user SET user_active='1' WHERE user_email= :vemail AND user_hash = :vhash AND user_active='0'";
$query = $db->prepare($qup);
$query->bindParam(':vemail', $vemail, PDO::PARAM_STR);
$query->bindParam(':vhash', $vhash, PDO::PARAM_STR);
$query->execute();
header('Location: http://pro13.pnp.gov.ph/nup-application');
?>
<script>
$(document).ready(function(){
localStorage.clear();
$(".show-page[data-page=Email_verified]").trigger("click");
});
</script>
<?php
exit;
}else{
header('Location: http://pro13.pnp.gov.ph/nup-application');
?>
<script>
$(document).ready(function(){
localStorage.clear();
$(".show-page[data-page=Email_alreadyVerified]").trigger("click");
});
</script>
<?php
exit;
}
?>
請接受答案或添加自己的答案並接受答案。這樣做會阻止將此問題顯示爲未答覆。 @ user3986930 – 2016-02-01 19:58:08