-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtype-change.php
More file actions
49 lines (47 loc) · 1.24 KB
/
type-change.php
File metadata and controls
49 lines (47 loc) · 1.24 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
<?php
session_start();
include 'system.php';
page_header();
if(isset($_SESSION['is_logged'])===true && $_SESSION['user_info']['type']==3){
if(isset($_POST['submit'])){
db_init();
$id = (int)$_POST['id'];
$type = $_POST['type'];
$sql = "UPDATE users SET type = $type WHERE id = $id" ;
$retval = run_mysql_query( $sql );
if(! $retval )
{
die('Could not delete data: ' . mysql_error());
}
echo "<article><br /><img src='img/button_ok.png' width='16' heigh='16' /> <span style='bottom:4px; position:relative;'>Data deleted successfully!</span><br /><br /><a href='type_change.php'>Back</a></article>";
mysql_close();
}else{
?>
<article>
<header>
<hgroup>
<h2 class="display_color">Change Type</h2>
</hgroup>
</header><br />
<p>
<form method="post" action="<?php $_PHP_SELF ?>">
<input name="id" type="text" id="id" placeholder="User ID"><br /><br />
<select name="type" id="type">
<option selected value="3">Admin</option>
<option selected value="2">Moderator</option>
<option selected value="1">User</option>
</select><br /><br />
<input name="submit" type="submit" id="submit" value="Change Type">
</form></P>
<footer>
<a href='admin.php'>Back</a>
</footer>
</article>
<?php
}
}else{
header('Location: index.php');
exit;
}
page_footer();
?>