-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.php
More file actions
126 lines (111 loc) · 4.72 KB
/
forms.php
File metadata and controls
126 lines (111 loc) · 4.72 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
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
<?PHP
session_start();
if (!(isset($_SESSION['SESS_MEMBER_ID']) && $_SESSION['SESS_MEMBER_ID'] != '')) {
header("Location: login.php");
} else {
if ($_SESSION['SESS_MEMBER_ROLE'] != "admin") {
$role = 'admin';
}
}
// Need to validate with forms-validate.php first and get role.
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
Remove this if you use the .htaccess -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Forms Page</title>
<meta name="description" content="" />
<meta name="author" content="landuca" />
<meta name="viewport" content="width=device-width; initial-scale=1.0" />
<!-- Replace favicon.ico & apple-touch-icon.png in the root of your domain and delete these references -->
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link href="form.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#sortable" ).sortable({
revert: true
});
$( "#draggable" ).draggable({
connectToSortable: "#sortable",
helper: "clone",
revert: "invalid"
});
$( "ul, li" ).disableSelection();
} );
</script>
</head>
<body>
<header class="body">
<h1>Forms Page</h1>
</header>
<section class="body">
<?php
//Include database connection details
require_once ('config.php');
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if (!$link) {
die('Failed to connect to server: ' . mysql_error());
}
//Select database
$db = mysql_select_db(DB_DATABASE);
if (!$db) {
die("Unable to select database");
}
$qry = "SELECT member_id,role FROM members WHERE member_id = " . $_SESSION['SESS_MEMBER_ID'] . ";";
$result = mysql_query($qry);
if ($result) {
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$rowid = $row['member_id'];
$rowrole = $row['role'];
if ($row['member_id'] != $_SESSION['SESS_MEMBER_ID'] && $row['login'] != "admin") {
printf("<p>\n <span class=\"box\"><input type=\"radio\" name=\"row[]\" value=\"%s\"></span>\n", $rowid);
printf(" <span class=\"member_id\">%s </span>\n", $rowid);
printf(" <span class=\"role\">%s </span>\n", $rowrole);
}
}
}
@mysql_free_result($result);
} else {
die("Query failed");
}
?>
<form method="post" action="form1.php">
<input id="submit" name="submit" type="submit" value="Form 1">
</form>
<?php
if ( isset($_SESSION['SESS_MEMBER_ROLE']) && $_SESSION['SESS_MEMBER_ROLE'] == 'admin' ) {
printf("<form method=\"post\" action=\"form-create.php\">\n");
printf(" <input id=\"submit\" name=\"submit\" type=\"submit\" value=\"Create Form\">");
printf("</form>\n");
}
?>
<form method="post" action="index.php">
<input id="submit" name="submit" type="submit" value="Back">
</form>
<form method="post" action="logout.php">
<input id="submit" name="submit" type="submit" value="Logout">
</form>
<p>
<!-- © Copyright by landuca -->
</p>
</section>
<ul>
<li id="draggable" class="ui-state-highlight">Drag me down</li>
</ul>
<ul id="sortable">
<li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li>
<li class="ui-state-default">Item 3</li>
<li class="ui-state-default">Item 4</li>
<li class="ui-state-default">Item 5</li>
</ul>
</body>
</html>