forked from vipinkhushu/Xunbao
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-logs.php
151 lines (117 loc) · 3.28 KB
/
admin-logs.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
// Start the session
session_start();
if($_SESSION['user_check']){
if($_SESSION['user_check']=='vipinkhushu@hotmail.com'){
}
else{
header("location: index.php");
}
}
else{
header("location: index.php");
}
if(isset($_POST["question"])&&isset($_POST["answer"])&&isset($_POST["level"])){
include('login/credentials.php');
$statement=$_POST['question'];
$level=$_POST['level'];;
//echo $statement;
$ans=$_POST['answer'];
//echo $ans;
//create comnnection
$conn=new mysqli ($DB_SERVER , $DB_USERNAME ,$DB_PASSWORD , $DB_DATABASE);
//check connection
if($conn->connect_error)
{
die("Connection faiiled: " . $conn->connect_error);
}
$sql="INSERT INTO `question` (questionstatement , answer,level)
VALUES ('$statement' , '$ans','$level')";
if($conn->query($sql) === TRUE)
{
//echo "created";
header('vkvyst.php?action=done');
}
else
{
//echo "Error :".$sql."<br>".$conn->error;
header('vkvyst.php?action=failed');
}
$conn->close();
}
?>
<!DOCTYPE html>
<html>
<head>
<!--Import Google Icon Font-->
<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<!--Import materialize.css-->
<link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/>
<!--Let browser know website is optimized for mobile-->
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/css/materialize.min.css">
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.5/js/materialize.min.js"></script>
<style>
body {
display: flex;
min-height: 100vh;
flex-direction: column;
}
main {
flex: 1 0 auto;
}
</style>
</head>
<body>
<header>
<div class="navbar-fixed">
<nav>
<div class="nav-wrapper teal lighten-2">
<a href="#!" class="brand-logo center">Xunbao</a>
</div>
</nav>
</div>
</header>
<main class="yellow lighten-4">
<div class="container-fluid">
<div class="row" id="info">
<br><br>
</div>
<div class="row">
<form class="col s12" action="" method="post">
<div class="row">
<label>Question statement</label> <br/>
<script src="ckeditor/ckeditor.js"></script>
<textarea id="editor1" name="question" required>
Your Question Here.....
</textarea>
<script>
CKEDITOR.replace('editor1');
</script>
</div>
<div class="row">
<div class="input-field col s6">
<label for="answer">Answer</label>
<input placeholder="answer here" name="answer" id="answerofproblem" type="text" class="form-control" required>
</div>
</div>
<div class="input-field col s6">
<label for="answer">level</label>
<input placeholder="level here" name="level" id="level" type="text" class="form-control" required>
</div>
</div>
<div class="row">
<div class="col s7 offset-s5">
<br>
<input type='submit' value='Create' id='Create'>
</div>
</div>
</form>
</div>
</div>
</main>
</body>
</html>