Beispiel #1
0
/*
 *@author: Vinit Pandey
 */
error_reporting(E_ALL);
ini_set('display_errors', '1');
session_start();
if (!isset($_SESSION['username'])) {
    header("Location:../index.php?id=4");
}
include '../server_constraints.php';
include '../function.php';
$con = mysqli_connect($host, $server_username, $server_password, $db);
if (isset($_GET['id'])) {
    $_SESSION['ques-name'] = url_to_string($_GET['id']);
    $f = fopen("../questions/" . url_to_string($_GET['id']) . ".txt", 'r');
    $_SESSION['ques-statement'] = fread($f, filesize("../questions/" . url_to_string($_GET['id']) . ".txt"));
    fclose($f);
}
?>
<html>
    <head>
        <script language="javascript" type="text/javascript" src="../js/editarea_0_8_2/edit_area/edit_area_full.js"></script>
        <script language="javascript" type="text/javascript">
        editAreaLoader.init({
                id : "area"		// textarea id
                ,syntax: "css"			// syntax to be uses for highgliting
                ,start_highlight: true		// to display with highlight mode on start-up
        });
        </script>
        <title>D-odge</title>
        <link href="../css/style.css" rel="stylesheet">
Beispiel #2
0
                        </li>
                    </ul>
                </div>
                <div >
                    <?php 
echo $_GET['id'];
?>
                <a style="color:white;" href = <?php 
echo "bestsolutions.php?id=" . string_to_url($_GET['id']);
?>
>Best Solutions</a>
                </div>
            </div>
        <textarea class = "normal" style="background-image:url('images/cream_pixels.png'); outline: none; border: none" cols = "80"  readonly>
<?php 
$problem_name = url_to_string($_GET['id']);
$file_name = "questions/" . $problem_name . ".txt";
$file = fopen($file_name, 'r');
$content = fread($file, filesize($file_name));
$j = 0;
$enter = 1;
echo $content;
/*while($j<strlen($content))
  {
      /*if($content[$j] == "\n")
      echo "<br>";
      else
      echo $content[$j];*/
/*    if($content[$j] == "\n")
          {
              $enter = 1;
Beispiel #3
0
                        <li ><a href = "userhome.php"><?php 
echo $_SESSION['username'];
?>
</a></li>
                        <li><a href = "logout.php">Logout</a></li>
                    </ul>
                </div>
            </div>
        </div>

<?php 
$code = $_POST['code-area'];
$user = $_SESSION['username'];
if (isset($_POST['whole-code-submit'])) {
    //create file
    $question_name = url_to_string($_GET['id']);
    $query = "select number from code_number where id = '1'";
    $code_num_obj = mysqli_query($con, $query);
    //echo mysqli_num_rows($code_num);
    $row = mysqli_fetch_array($code_num_obj);
    $code_num = $row['number'];
    // the numbe/name of file that will be created
    /*{
          header("Location: index.php?id=5");
      }*/
    $query = "update code_number set number='" . ($row['number'] + 1) . "' where id='1'";
    if (!mysqli_query($con, $query)) {
        echo mysqli_errno();
    }
    $query = "INSERT INTO code_submissions (`id`,`username`,`question`, `code_num`,`language`)\n                      values (NULL,'{$user}','{$question_name}','{$code_num}','" . $_POST['lang'] . "')";
    if (!mysqli_query($con, $query)) {
Beispiel #4
0
<?php

error_reporting(E_ALL);
ini_set('display_errors', '1');
session_start();
include '../function.php';
include '../server_constraints.php';
$con = mysqli_connect($host, $server_username, $server_password, $db);
echo $_GET['id'];
$ques = url_to_string($_GET['id']);
$query = "delete from questions where name = '{$ques}'";
if (!mysqli_query($con, $query)) {
    echo mysqli_error($con);
} else {
    unlink("../questions/" . $ques . ".txt");
    unlink("../input/" . $ques . ".txt");
    unlink("../input/" . $ques . ".txt");
    header("Location: adminhome.php?id=2");
}