<?php require_once 'config.inc.php'; #------------------------------------------------------------------------------- # Prints the problem version (used by AJAX) session_start(); cookie_check(); if (!auth_logged_in()) { error1("No user logged in."); } # Setup the database connection $db =& DB::connect($cfg["db"]); if (PEAR::isError($db)) { error($db->toString()); } $db->setFetchMode(DB_FETCHMODE_ASSOC); $res =& db_query('problem_by_id', array($_POST['prob_id'], $_POST['contest_id'])); if ($res->fetchInto($row)) { echo "ver" . $row['version']; exit; } else { echo "invalid " . $_POST['contest_id'] . " and " . $_POST['prob_id']; }
Problem: <?php echo $draft['prob_id']; ?> ]</i> ?<br /> <b><a onclick="discardDraft()" href="#solution">Yes, discard that draft</a> | <a href="index.php?view=explorer&task=<?php echo $task; ?> &id=<?php echo $draft['contest_id']; ?> &prob_id=<?php echo $draft['prob_id']; ?> #solution"> No, resume editing that solution</a></b> <?php exit; } } $draft['user_id'] = $_SESSION['user_id']; $draft['source'] = stripslashes($_POST['source']); $draft['language'] = $_POST['language']; $draft['contest_id'] = $_POST['contest_id']; $draft['prob_id'] = $_POST['prob_id']; $res =& $db->autoExecute('drafts', $draft, DB_AUTOQUERY_INSERT); if (PEAR::isError($res)) { error1($res->toString()); } db_query('update_draft', $_SESSION['user_id']); echo "saved"; exit;