MySQL based forum (1) _php Foundation
Last Update:2017-01-19
Source: Internet
Author: User
###############################################
This article is original, if there are references, please indicate the author information.
Author: Cold Love Madman
Email:edincur@yeah.net
Http://safebase.yeah.net
###############################################
# # adduser.php ################################
###############################################
<?php
Require ("func.php");
if (empty ($name) or empty ($pwd 1)) {
Show_error (2);
$founderr = 1;
}
if (Is_user_exits ($name)) {
Show_error (3);
$founderr = 1;
}
if ($pwd 1<> $pwd 2) {
Show_error (5);
$founderr = 1;
}
if (strlen ($name) >16 or strlen ($pwd 1) >16 or strlen ($QM) >255) {
Show_error (6);
$founderr = 1;
}
$password = $pwd 1;
if (! $founderr) {
AddUser ();
echo "Success!"
}
?>
######################
### admin.php ########
######################
<?php
Require "func.php";
if (Adminok ()) {
?>
<title> Management </title>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<link rel= "stylesheet" type= "Text/css" href= "Css/index.css" >
<body bgcolor= "#FFFFFF" >
Please select the layout to operate <br>
<table width= "98%" border= "0" cellspacing= "0" cellpadding= "0" >
<tr>
<TD width= "52%" valign= "Top" >
<table width= "98%" border= "1" cellspacing= "0" cellpadding= "0" bordercolorlight= "#000000" bordercolordark= "#FFFFFF ">
<TR align= "center" bgcolor= "#eeeeee" >
<TD width= "42%" height= ">Chinesename</td>"
<TD width= "33%" height= ">Name</td>"
</tr>
<?php
$sql = "SELECT * from Boardinfo";
$sql _result=mysql_query ($sql);
while ($sql _row=mysql_fetch_array ($sql _result)) {
?>
<TR align= "center" >
<TD width= "42%" ><a href= "admin.php?board=<?php echo $sql _row[name];? > "><?php echo $sql _row[chinesename];? ></a></td>
<TD width= "33%" ><?php echo $sql _row[name];? ></td>
</tr>
<?php
}
?>
</table>
<br>
<form name= "FORM5" action= "oper.php" >
English Name:
<input type= "text" name= "name" size= "Maxlength=" >
<br>
Chinese name:
<input type= "text" name= "Chinesename" size= "maxlength=" >
<input type= "hidden" name= "Add_board" value= "Y" >
<br>
<input type= "Submit" Name= "Add_board" value= "Add Page" >
</form>
</td>
<TD width= "48%" valign= "Top" >
<?php
if (Isset ($board)) {
$sql = "SELECT * from Boardinfo where name= ' $board '";
$sql _result=mysql_query ($sql);
$sql _row=mysql_fetch_array ($sql _result);
$name = $sql _row[name];
$chinesename = $sql _row[chinesename];
?>
<table width= "98%" border= "1" cellspacing= "0" cellpadding= "0" bordercolorlight= "#FFFFFF" bordercolordark= "#CCCCCC ">
<tr>
<td>
<form name= "Form1" action= "oper.php" >
Add Moderator:
<input type= "text" name= "name" size= "Maxlength=" >
<input type= "Submit" Name= "Add_admin" value= "Add" >
<input type= "hidden" name= "add_admin" value= "Y" >
<input type= "hidden" name= "board" value= "<?php echo" $board "?>" >
</form>
</td>
</tr>
<tr>
<td>
<form name= "Form2" action= "oper.php" >
Delete Moderator:
<select name= "Name" >
<?php
$sql = "SELECT name from user where slaveboard= ' $board '";
$sql _result=mysql_query ($sql);
while ($sql _row=mysql_fetch_array ($sql _result)) {
echo "<option value=\" $sql _row[name]\ "> $sql _row[name]</option>";
}
?>
</select>
<input type= "Submit" Name= "Delete_admin" value= "Delete" >
<input type= "hidden" name= "delete_admin" value= "Y" >
</form>
</td>
</tr>
<tr>
<td>
<form name= "form3" action= "oper.php" >
Chinese name
<input type= "text" name= "Chinesename" size= "" maxlength= "" "Value=" <?php echo "$chinesename"?> ">
<br>
English name
<input type= "text" name= "name" size= "maxlength=" "value=" "<?php echo" $name "?>" >
<input type= "hidden" name= "Modify" value= "Y" >
<input type= "Submit" name= "Modify" value= "Change" >
</form>
</td>
</tr>
<tr>
<td>
<form name= "FORM4" action= "oper.php" >
<input type= "Submit" Name= "Del_board" value= "Delete plate" >
<input type= "hidden" name= "board" value= "<?php echo" $board "?>" >
<input type= "hidden" name= "Del_board" value= "Y" >
</form>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<?php
}
?>
</td>
</tr>
</table>
</body>
<?php
}
else {
Show_error (1);
}
?>