This repository was archived by the owner on Dec 22, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofile-settings.php
More file actions
137 lines (132 loc) · 3.83 KB
/
profile-settings.php
File metadata and controls
137 lines (132 loc) · 3.83 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?php
session_start();
include("utils/db.php");
if(!isset($_GET['action']))
{
if(!isset($_GET['username'])||!isset($_GET['password']))
{
if(session_status() == PHP_SESSION_ACTIVE)
{
if(!isset($_SESSION['username'])||!isset($_SESSION['password']))
{
http_response_code(403);
die();
} else {
if(!CheckIfCorrect($_SESSION['username'],$_SESSION['password'],$conn))
{
http_response_code(403);
die();
}
}
} else {
http_response_code(403);
die();
}
} else {
//include("utils/db.php");
$user = $_GET['username'];
$pass = md5($_GET['password']);
if(CheckIfCorrect($user,$pass,$conn))
{
session_start();
$_SESSION['username']=$user;
$_SESSION['password']=$pass;
} else {
Header("location:login.php");
die();
}
}
} else {
$action = $_GET['action'];
if(session_status() == PHP_SESSION_ACTIVE)
{
if(!isset($_SESSION['username'])||!isset($_SESSION['password']))
{
http_response_code(403);
die();
} else {
if(!CheckIfCorrect($_SESSION['username'],$_SESSION['password'],$conn))
{
http_response_code(403);
die();
}
}
}
if($action == "changepfp")
{
$uploadDir = "forum/avatars/";
$userid = GetUserIdByUsername($conn,$_SESSION['username']);
$uploadPath = "forum/avatars/$userid.jpg";
if (move_uploaded_file($_FILES["image"]["tmp_name"], $uploadPath)) {
include("utils/utils.php");
ConvertTo128By128($uploadPath);
Header("location: profile-settings.php");
die();
} else {
Header("location: profile-settings.php");
die();
}
}
if($action == "banuser")
{
$username = $_POST['username'];
$reason = $_POST['reason'];
$date = $_POST['date'];
BanUser($conn,$username,$date,$reason);
}
}
?>
<?php ini_set('display_errors', 0); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Settings</title>
<style>
@import url("main.css");
</style>
</head>
<body>
<div id="container">
<form action="/profile-settings.php?action=changepfp" method="POST" enctype="multipart/form-data"/>
<label for="image">Choose an image(must be 128x128 or it will be bugged in client):</label>
<input type="file" name="image" id="image" accept="image/*" required>
<br>
<input type="submit" id="searchButton" value="Change profile picture">
</form>
<?php
if(CheckIfAdmin($conn,$_SESSION['username']))
{
echo "
<br/>
<br/>
<form action='newmap-handle.php' method='GET'>
<div>
<p>Beatmap checksum</p>
<input name='c'/>
<br/>
<br/>
<input type='submit' id='searchButton' value='Add beatmap to whitelist'/>
</div>
</form>
<br/>
<br/>
<form action='/profile-settings.php?action=banuser' method='POST'>
<div>
<p>username</p>
<input name='username'/>
<p>reason</p>
<input name='reason'/>
<p>expire date(Y-M-D format)</p>
<input name='date'/>
<br/>
<br/>
<input type='submit' id='searchButton' value='Ban user'/>
</div>
</form>";
}
?>
</div>
</body>
</html>