samedi 29 août 2015

Information not being submitted into the database

I'm not quite sure what's going on, I've done almost everything I can think of to try and resolve this issue but I'm still stuck where I left off.

So the recovery questions are being submitted into the DB but when you are set to cancel them the cancel value doesn't change whatsoever.. I'm absolutely confused.

    <?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://ift.tt/kTyqzh">
<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> &nbsp; | &nbsp; <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>

As for this being commented out

 //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>.';

It's because if it is, when the page is loaded that's all that shows...nothing else, even if the recovery options are set in the database.

Any ideas? really stuck here.




Aucun commentaire:

Enregistrer un commentaire