-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontoarc.php
executable file
·63 lines (50 loc) · 1.34 KB
/
contoarc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
session_start();
require_once "config.php";
if (!isset($_SESSION['un'])) {
header("Location:login.php");
}
if (isset($_SESSION['un'])) {
$username = $_SESSION['un'];
}
$mysql = "SELECT status from user WHERE name='$username'";
$snd = mysqli_query($con, $mysql);
$arrow = mysqli_fetch_array($snd);
$st = $arrow['status'];
$access = 0;
if (isset($_POST['up'])) {
$pbid = $_POST['pbid'];
$cid = $_POST['cid'];
$pn = $_POST['pn'];
// $pd = $_POST['pd'];
// $author = $_POST['author'];
// $tc = $_POST['tc'];
// $ac = $_POST['ac'];
// $ptl = $_POST['ptl'];
//echo $cname;
$cc = "SELECT * FROM contestproblems WHERE pbid = '$pbid'";
$cc2 = mysqli_query($con, $cc);
$row = mysqli_fetch_array($cc2);
$pd = $row[pbdes];
$pd = str_replace("'", "''", $pd);
$pd = str_replace('\\', '\\\\', str_replace('\\\\', '\\', $pd));
$author = $row[pbauthor];
$tc = $row[tc];
$ac = $row[output];
$ptl = $row[tlimit];
} else {
header("Location:home.php");
}
if ($st == "Teacher" || $st == "Developer") {
$access = 1;
} else {
header("Location:home.php");
}
if ($access == 1) {
$sss = "UPDATE `contestproblems` SET `sts`='1' WHERE pbid ='$pbid' ";
$hhh = mysqli_query($con, $sss);
$sql = "INSERT INTO archieve VALUES(NULL,'$pn','$pd','$author','$tc','$ac','','$ptl')";
$sq = mysqli_query($con, $sql);
header("Location:contestproblem.php?id=$cid");
}
?>