-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetmessage.php
33 lines (32 loc) · 1.06 KB
/
getmessage.php
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
<?php require_once('Connections/weblib.php'); ?>
<?php
header("Content-Type:text/html; charset=utf-8");
date_default_timezone_set('Asia/Shanghai');
$uid = $_SESSION["userid"];
if($uid != ""){
if(isset($_POST["submit"])){
$message = $_POST["message"];
if($message == ""){
echo "<script>alert('留言不能为空!'); history.go(-1);</script>";
}
else{
echo "<meta http-equiv='Content-Type'' content='text/html; charset=utf-8'>";
echo "<script charset='utf-8' type='text/javascript'>alert('$message');</script>";
$sql = "insert into message(uid,content) values('$uid','$message')";
$result = mysql_query($sql);
if($result){
echo "<script>alert('提交成功!'); window.location.href='index.php';</script>";
}
else{
echo "<script>alert('提交失败!');history.go(-1);</script>";
}
}
}
else{
echo "<script>alert('提交未成功!'); history.go(-1);</script>";
}
}
else{
echo "<script>alert('请先登录'); history.go(-1);</script>";
}
?>