-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcgname.php
More file actions
37 lines (37 loc) · 854 Bytes
/
cgname.php
File metadata and controls
37 lines (37 loc) · 854 Bytes
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>名字提交页面</title>
<?php require('include/start.php');islogin(); ?>
</head>
<body>
</body>
</html>
<?php
if (isset($_POST['avatar'])){
$avatar=$_POST['avatar'];
$name=$_COOKIE["name"];
include "install/config.php";
$conn = mysqli_connect($servername, $username, $password, $db);
if (!$conn){
die("数据库连接失败<br>"."原因:".mysqli_connect_error());
}
//密码要写这
$password=$_COOKIE["password"];
$sql="UPDATE user SET name='$avatar' WHERE name='$name' AND password='$password'";
//die($password);
if (@mysqli_query($conn,$sql)){
}
else{
die("修改名字失败<br>".mysqli_error($conn));
}
$conn->close();
modal("名字修改","成功");
echo "<script>setTimeout(\"window.location='out.php'\",1500)</script>";
//setTimeout("",1000)
}
else{
die("参数不完整");
}
?>