Ejemplo n.º 1
0
function resumeAndCheckSession()
{
    //resumes and checks session that is needed in run mode, causes script to die if session check fails
    session_start();
    if (!isset($_SESSION['ejfdsh8jkj2'])) {
        //if not accessed after session properly started by this script before
        dieIncorrectAccess();
    } elseif (isset($_SESSION['user_ip'])) {
        if ($_SESSION['user_ip'] != $_SERVER['REMOTE_ADDR']) {
            //prevent hijacking
            dieIncorrectAccess();
        }
        //if
    }
    //elseif
}
Ejemplo n.º 2
0
            if ($db_con->getErrorMessage() !== '') {
                $error = true;
                $error_msg = 'The following error has occurred while deleting the test: ' . $db_con->getErrorMessage();
            } else {
                $deleted_successfully = true;
            }
            //else
            include INCLUDE_PATH . 'index.php';
        } else {
            if (isset($_GET['check_test'])) {
                $temp_solution = $_GET['check_test'];
                $db_con = new Db_Connection();
                $test_items = $db_con->selectEntries(false, 'dragdrop_items', array("where" => "item_test_ID = " . $_GET['check_test_id']));
                $checked_items = array("correct" => 0);
                foreach ($test_items as $item) {
                    if (isset($temp_solution[$item['item_ID']]) && $item['item_container_ID'] == $temp_solution[$item['item_ID']]) {
                        $checked_items[$item['item_ID']] = 1;
                        $checked_items["correct"]++;
                    } else {
                        $checked_items[$item['item_ID']] = 0;
                    }
                }
                //foreach
                print json_encode($checked_items);
            } else {
                dieIncorrectAccess();
            }
        }
    }
}
//else