-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakeWin.php
More file actions
80 lines (55 loc) · 2.2 KB
/
Copy pathmakeWin.php
File metadata and controls
80 lines (55 loc) · 2.2 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
include "config/conn.php";
include "lib/Database.php";
include "helpers/Format.php";
include "classes/WinMat.php";
session_start();
$db = new Database();
$format = new Format();
$winmat = new WinMat();
//for makeWinning
echo "id ". $_SESSION['ins_id'];
if(isset($_SESSION['ins_id'])){
if(isset($_REQUEST["user_name"])){
$user = $format->Stext($_REQUEST["user_name"]);
$cat = $format->Stext($_REQUEST['cat']);
$querycheck = "SELECT * FROM answere WHERE user_unique_id='$user'";
$name = $db->select($querycheck)->fetch_assoc();
$Winnerid = $name['user_unique_id'];
$WinnerProblemId = $name['ans_linkid'];
$winnerMakerID = $_SESSION['ins_id'];
$Check = $winmat->MakeWinner($Winnerid, $WinnerProblemId, $winnerMakerID, $cat);
if($Check){
echo "<span class='alert alert-danger'>X Not Successfully Set Winner</span>";
}
else{
header("Location: instructor-panel.php?msg=".urlencode('Winner declare Successfully.'));
echo "<span class='alert alert-success'>Successfully Set Winner</span>";
}
}else{
echo "Something went wrong";
}
//for cancel winning
if(isset($_REQUEST["user_name_can"]) && isset($_REQUEST["can"]) ){
$user = $format->Stext($_REQUEST["user_name_can"]);
$cat = $format->Stext($_REQUEST['cat']);
$querycheck = "SELECT * FROM answere WHERE user_unique_id='$user'";
$name = $db->select($querycheck)->fetch_assoc();
$Winnerid = $name['user_unique_id'];
$WinnerProblemId = $name['ans_linkid'];
$winnerMakerID = $_SESSION['ins_id'];
$Check = $winmat->MakeLooser($Winnerid, $WinnerProblemId, $cat);
if($Check){
echo "<span class='alert alert-danger'>X Not Successfully Set Winner</span>";
}
else{
header("Location: instructor-panel.php?msg=".urlencode('Winner declare Successfully.'));
echo "<span class='alert alert-success'>Successfully Set Winner</span>";
}
} else{
echo "Something went wrong";
}
}else {
echo "You have to be instructor for declare winning!";
}
?>