我不太确定发生了什么,我几乎完成了我能想到的一切,试图解决这个问题,但我还是停留在我离开的地方。
因此,恢复问题正在提交到数据库中,但是当您设置取消它们时,取消值不会发生任何变化。我绝对感到困惑。
<?php
/*
* @CANCEL
* ~~~~~~~~~~~~
* @FILE DESCRIPTION: Cancels set recovery questions
* @LAST MODIFIED: August 29, 2015
*/
require('../includes/config.php');
require('../structure/database.php');
require('../structure/base.php');
require('../structure/user.php');
$database = new database($db_host, $db_name, $db_user, $db_password);
$base = new base($database);
$user = new user($database);
//get config settings from db
$config = $base->loadConfig();
//set some basic vars
$username = $user->getUsername($_COOKIE['user'], 2);
$rank = $user->getRank($username);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns:IE>
<head>
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta name="MSSmartTagsPreventParsing" content="TRUE">
<title><?php
echo $data['wb_title'];
?></title>
<link href="../css/basic-3.css" rel="stylesheet" type="text/css" media="all">
<link href="../css/main/title-5.css" rel="stylesheet" type="text/css" media="all">
<link href="../css/kbase-2.css" rel="stylesheet" type="text/css" media="all" />
<link rel="shortcut icon" href="../img/favicon.ico" />
<?php
include('../includes/google_analytics.html');
?>
<style>
fieldset {
text-align: left;
border: 2px solid #625437;
width: 95%;
position: relative;
margin: 10px;
padding-left: 10px;
background-color:transparent;
}
legend {
color: #625437;
font-weight: bold;
font-size: 15px;
}
</style>
<script type="text/javascript">
function goBack()
{
window.history.back();
}
</script>
</head>
<div id="body">
<?php
$base->getNavBar($username, $path, $rank);
?><br/><br/>
<br/><br/>
<div style="text-align: center; background: none;">
<div class="titleframe e">
<b>Cancel recovery questions</b><br />
<a href="../index.php">Main Menu</a>
</div>
</div>
<img class="widescroll-top" src="../img/scroll/backdrop_765_top.gif" alt="" width="765" height="50" />
<div class="widescroll">
<div class="widescroll-bgimg">
<div class="widescroll-content">
<?php
if (!$user->isLoggedIn()) {
echo 'You must be logged in to access this content.';
} else {
$info = $database->processQuery("SELECT `cancel` FROM `recoveries` WHERE `userid` = ?", array($user->getUserId($_COOKIE['user'])), true);
//if ($database->getRowCount() == 1) {
//echo 'You need to have recovery questions in order to cancel them. You can <a href="set_recov.php">set them here</a> or <a href="../index.php">return to the homepage</a>.';
if ($info[0]['cancel'] >= 1) {
echo 'Your recovery questions have already been set to cancel.';
} elseif (isset($_GET['confirm'])) {
//cancel the recovery questions
$database->processQuery("UPDATE `recoveries` SET `cancel` = ? WHERE `userid` = ?", array(
time(),
$user->getUserId($_COOKIE['user'])
), false);
echo '<center>Your recovery questions have successfully been set to cancel.<br><center><a href="../index.php">Main page</a></center>';
} else {
?>
<b>Are you sure you wish to cancel your recovery questions?</b> Once you confirm this action your recovery questions will be active
for another two weeks, after that they will be deleted.<br><br> This action can be reversed by clicking the "Set recovery questions" link on the website homepage.
<br/><br/>
<center><a href="cancel.php?confirm=1">I wish to continue</a> | <a href="../index.php">I wish to go back</a></center>
<?php
}
}
?>
<center><img src="../img/kbase/scroll_spacer.gif" ></center>
<div style="clear: both;"></div>
</div>
</div>
</div>
<img class="widescroll-bottom" src="../img/scroll/backdrop_765_bottom.gif" alt="" width="765" height="50" />
<div class="tandc"><?php
echo $data['wb_foot'];
?></div>
</div>
</body>
</html>
至于这被评论出来
//if ($database->getRowCount() == 1) {
//echo 'You need to have recovery questions in order to cancel them. You can <a href="set_recov.php">set them here</a> or <a href="../index.php">return to the homepage</a>.';
这是因为如果是,那么当页面被加载时,即使在数据库中设置了恢复选项,所有其他内容都没有显示。
有什么想法吗?真的卡在这里。