📄 users.php
字号:
<?
include('secret_include.php');
include('../lib/conf.php');
$field = $_GET["field"];
$text = $_GET["text"];
$table = $_GET["table"];
$status = $_GET["status"];
$id = $_GET["id"];
if (isset($table) && isset($status) && isset($id)) {
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$conn);
$query ="UPDATE $table SET status = '$status' WHERE id = $id";
mysql_query($query)
or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Users Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div align="center">
<div id="header-space">
<div id="header">
Admin Pages</div>
</div>
<div id="links-space">
<a href="index.php">Home</a> · <a href="users.php">Users</a> · <a href="comm.php">Community</a> · <a href="logout.php">LogOut</a></div>
<div id="content-space">
<div class="news-header">
Users Table</div>
<div class="entry">
<div align="center">
<table id="table1" border="0" cellpadding="5" width="630">
<tr>
<td>
<form method="get" action="users.php">
<p>Search in <select size="1" name="field">
<option value="id">ID</option>
<option value="user_name">UserName</option>
<option value="name">Name</option>
<option value="surname">Surname</option>
<option value="email">Email</option>
<option value="status">Status</option>
</select><input name="text" size="20" type="text"><input value="Search Users" type="submit"></p>
</form>
</td>
<td align="right" valign="top">
<form method="get" action="users.php">
<p align="left">
<input value="All Users" type="submit" style="float: right">
</p>
</form>
</td>
</tr>
<?
$conn = mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$conn);
if ($field != NULL ) {
$query = "SELECT id,email,user_name,name,surname,status FROM USERS WHERE $field LIKE '$text%'";
}
else {
$query = "SELECT id,email,user_name,name,surname,status FROM USERS WHERE 1";
}
$result = mysql_query($query)
or die("<br>Invalid query: $query\n<BR>\n" . mysql_error());
while ($row = mysql_fetch_array($result)) {
?> <tr>
<td colspan="2"><hr></td>
</tr>
<tr>
<td rowspan="3">Id: <? echo $row['id'] ?><br />
Email: <? echo $row['email'] ?><br />
User Name: <? echo $row['user_name'] ?><br />
Name: <? echo $row['name'] ?><br />
SurName: <? echo $row['surname'] ?><br />
User status: <?
if ($row['status'] == "1") echo "Enable";
else echo "Disable"; ?></td>
<td><a href="info_user.php?user_name=<? echo $row['user_name'] ?>">
<img src="img/info.gif" border="0" height="16" width="16">
Which community</a></td>
</tr>
<tr>
<td><a href="users.php?table=USERS&id=<? echo $row['id'] ?>&status=0">
<img src="img/drop.gif" border="0" height="16" width="16">
Disable</a></td>
</tr>
<tr>
<td><a href="users.php?table=USERS&id=<? echo $row['id'] ?>&status=1">
<img src="img/accept.gif" border="0" height="18" width="18">
Enable</a></td>
</tr>
<?
}
mysql_close($conn);
?> </table>
</div>
</div>
</div>
<div id="foot-space"> © MyVPN Admin</div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -