8. Updatepost (modify the submission page)
Copy the codeThe code is as follows:
<?php
require_once('');
$username = $_POST['name'];
$info = $_POST['info'];
$id = $_GET['id'];
//echo $id;
$sql = "update lo set username= '".$username."',info='".$info."' where <script>alert('Modification was successful!');='';</script>";
?>
9. (Delete the message page)
Copy the codeThe code is as follows:
<?php
session_start();
require_once('');
$id=$_GET['id'];
if($_SESSION["key"]==1)
{
$sql = "delete from lo where <script>=''</script>";
}
else
{
header('location:');
}
?>
10. (Administrative login page)
Copy the codeThe code is as follows:
<?php
require_once('');
require_once('');
?>
<div >
<form method="post" action="">
<h1>Administrator login</h1>
<p>Name: <input type="text" name="name" size="20" class="y" /> </p>
Password: <input type="password" name="password" size="20" class="y" // </p>
<p class="cen"><input type="submit" value="administrator login"//</p>
<p class="cen1">Silver Message Board Version 1.0</p>
</form>
</div>
11. (Management Verification Page)
Copy the codeThe code is as follows:
<?php
session_start();
require_once('');
$name = $_POST['name'];
$password = $_POST['password'];
$sql = "select * from admin where name='".$name."'";
$result = mysql_query($sql);
$num = mysql_num_rows($result);
if (strrpos($name,"<")!==false || strrpos($name,">")!==false||strrpos($name,"@")!==false||strrpos($name,"\"")!==false||strrpos($name,"'")!==false||strrpos($name,"_")!==false)
{
echo "<script>alert('can't have special characters!');='';</script>";
}
if($num)
{//If the user exists, check whether the password is correct
$rs = mysql_fetch_array($result);
if($rs[2]!=$password)
{
echo "<script>alert('Password is incorrect, please confirm and enter it!');='';</script>";
}
else
{//The username and password are correct, register the SESSION variable, and then jump to the homepage
$_SESSION["key"]=1;
echo "<script>alert('Login successfully!');='';</script>";
}
}
else
{//If there is no such user
echo "<script>alert('There is no such user, please confirm and enter it!');='';</script>";
}
?>
12. (Exit management page)
Copy the codeThe code is as follows:
<?php
session_start();
$_SESSION["key"] = 0;//Make SESSION not 1, 0 is a tourist, 1 is an administrator
header('location:');
?>
I just haven't added some basic things, such as MD5 encryption, UBB, emoticon pictures, adding administrator accounts, replying messages (-_!!) etc. I've not added them. Interested students can improve them. Please point out the shortcomings ^_^
Administrator account: wuleying Password: 123456
Message board packaging and download
Previous page1234Read the full text