Passed
Push — master ( f2618d...c254af )
by Maxwell
02:21
created
register.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
     <body> 
15 15
         <?php 
16 16
             require(__DIR__ . "/important/header.php"); 
17
-         ?>
17
+            ?>
18 18
         <center><h1 style="display: inline-block;">4Grounds - Register</h1><br>
19 19
             <?php
20 20
                 if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['password'] && $_POST['username']) 
Please login to merge, or discard this patch.
view/index.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
             <form method="post" enctype="multipart/form-data" id="submitform">
96 96
                 <textarea required cols="77" placeholder="Comment" name="comment"></textarea><br>
97 97
                 <input type="submit" value="Post" <?php 
98
-                  if ($config['use_recaptcha']) 
98
+                    if ($config['use_recaptcha']) 
99 99
                     echo 'class="g-recaptcha" data-sitekey="' . $config['recaptcha_sitekey'] . '" data-callback="onSubmit"'
100 100
                 ?>> <small>max limit: 500 characters | supports <a href="https://www.markdownguide.org/basic-syntax">Markdown</a></small>
101 101
             </form>
Please login to merge, or discard this patch.
func/func.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -11,91 +11,91 @@  discard block
 block discarded – undo
11 11
 }
12 12
 
13 13
 function validateCSS($validate) {
14
-	$DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); 
14
+    $DISALLOWED = array("<?php", "?>", "behavior: url", ".php", "@import", "@\import", "@/import"); 
15 15
 
16
-	$validated = str_replace($DISALLOWED, "", $validate);
16
+    $validated = str_replace($DISALLOWED, "", $validate);
17 17
     return $validated;
18 18
 }
19 19
 function validateMarkdown($comment, $type = "comment") {
20
-	$comment = htmlspecialchars($comment);
21
-	$Parsedown = new Parsedown();
22
-	$Parsedown->setSafeMode(true);
23
-
24
-	if ($type === "profile") {
25
-		return $Parsedown->parse($comment);
26
-	} else {
27
-		return $Parsedown->line($comment);
28
-	}
20
+    $comment = htmlspecialchars($comment);
21
+    $Parsedown = new Parsedown();
22
+    $Parsedown->setSafeMode(true);
23
+
24
+    if ($type === "profile") {
25
+        return $Parsedown->parse($comment);
26
+    } else {
27
+        return $Parsedown->line($comment);
28
+    }
29 29
 }
30 30
 
31 31
 
32 32
 function validateCaptcha($privatekey, $response) {
33
-	$responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response));
34
-	return $responseData->success;
33
+    $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response));
34
+    return $responseData->success;
35 35
 }
36 36
 
37 37
 function requireLogin() {
38
-	if (!isset($_SESSION['user'])) {
39
-		header("Location: /login.php?r_login"); die();
40
-	}
38
+    if (!isset($_SESSION['user'])) {
39
+        header("Location: /login.php?r_login"); die();
40
+    }
41 41
 }
42 42
 
43 43
 function getGroup($id, $conn) {
44
-	$stmt = $conn->prepare("SELECT * FROM `groups` WHERE `id` = ?");
45
-	$stmt->bind_param("i", $id);
46
-	$stmt->execute();
47
-	$result = $stmt->get_result();
48
-	if ($result->num_rows === 0) return 'error';
49
-	return $result->fetch_assoc();
44
+    $stmt = $conn->prepare("SELECT * FROM `groups` WHERE `id` = ?");
45
+    $stmt->bind_param("i", $id);
46
+    $stmt->execute();
47
+    $result = $stmt->get_result();
48
+    if ($result->num_rows === 0) return 'error';
49
+    return $result->fetch_assoc();
50 50
 }
51 51
 
52 52
 function getID($user, $connection) {
53
-	$stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
54
-	$stmt->bind_param("s", $user);
55
-	$stmt->execute();
56
-	$result = $stmt->get_result();
57
-	if($result->num_rows === 0) return 'error';
58
-	while($row = $result->fetch_assoc()) {
59
-		$id = $row['id'];
60
-	} 
61
-	$stmt->close();
62
-	return $id;
53
+    $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
54
+    $stmt->bind_param("s", $user);
55
+    $stmt->execute();
56
+    $result = $stmt->get_result();
57
+    if($result->num_rows === 0) return 'error';
58
+    while($row = $result->fetch_assoc()) {
59
+        $id = $row['id'];
60
+    } 
61
+    $stmt->close();
62
+    return $id;
63 63
 }
64 64
 
65 65
 function getName($id, $connection) {
66
-	$stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
67
-	$stmt->bind_param("s", $id);
68
-	$stmt->execute();
69
-	$result = $stmt->get_result();
70
-	if($result->num_rows === 0) return('error');
71
-	while($row = $result->fetch_assoc()) {
72
-		$name = htmlspecialchars($row['username']);
73
-	} 
74
-	$stmt->close();
75
-	return $name;
66
+    $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
67
+    $stmt->bind_param("s", $id);
68
+    $stmt->execute();
69
+    $result = $stmt->get_result();
70
+    if($result->num_rows === 0) return('error');
71
+    while($row = $result->fetch_assoc()) {
72
+        $name = htmlspecialchars($row['username']);
73
+    } 
74
+    $stmt->close();
75
+    return $name;
76 76
 }
77 77
 
78 78
 function getPFP($user, $connection) {
79
-	$stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
80
-	$stmt->bind_param("s", $user);
81
-	$stmt->execute();
82
-	$result = $stmt->get_result();
83
-	if($result->num_rows === 0) return('error');
84
-	while($row = $result->fetch_assoc()) {
85
-		$pfp = htmlspecialchars($row['pfp']);
86
-	} 
87
-	$stmt->close();
88
-	return $pfp;
79
+    $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
80
+    $stmt->bind_param("s", $user);
81
+    $stmt->execute();
82
+    $result = $stmt->get_result();
83
+    if($result->num_rows === 0) return('error');
84
+    while($row = $result->fetch_assoc()) {
85
+        $pfp = htmlspecialchars($row['pfp']);
86
+    } 
87
+    $stmt->close();
88
+    return $pfp;
89 89
 }
90 90
 
91 91
 function checkIfFriended($friend1, $friend2, $connection)
92 92
 {
93
-	$stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?");
94
-	$stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1);
95
-	$stmt->execute();
96
-	$result = $stmt->get_result();
97
-	if($result->num_rows === 1){ return true; }
98
-	return false;
93
+    $stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?");
94
+    $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1);
95
+    $stmt->execute();
96
+    $result = $stmt->get_result();
97
+    if($result->num_rows === 1){ return true; }
98
+    return false;
99 99
 }
100 100
 
101 101
 function isAdmin($user, $conn) {
@@ -115,58 +115,58 @@  discard block
 block discarded – undo
115 115
 }
116 116
 
117 117
 function getUser($id, $connection) {
118
-	$userResult = array();
119
-	$stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
120
-	$stmt->bind_param("i", $id);
121
-	$stmt->execute();
122
-	$result = $stmt->get_result();
123
-	if($result->num_rows === 0) echo('That user does not exist.');
124
-	while($row = $result->fetch_assoc()) {
125
-		$userResult['username'] = $row['username'];
126
-		$userResult['id'] = $row['id'];
127
-		$userResult['date'] = $row['date'];
128
-		$userResult['bio'] = $row['bio'];
129
-		$userResult['css'] = $row['css'];
130
-		$userResult['pfp'] = $row['pfp'];
131
-		$userResult['badges'] = explode(';', $row['badges']);
132
-		$userResult['music'] = $row['music'];
133
-		$userResult['rank'] = $row['rank'];
134
-		$userResult['currentgroup'] = $row['currentgroup'];
135
-	}
136
-	$stmt->close();
137
-
138
-	$stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?");
139
-	$stmt->bind_param("s", $userResult['username']);
140
-	$stmt->execute();
141
-	$result = $stmt->get_result();
142
-
143
-	$userResult['comments'] = 0;
144
-	while($row = $result->fetch_assoc()) {
145
-		$userResult['comments']++;
146
-	}
147
-	$stmt->close();
148
-
149
-	$stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?");
150
-	$stmt->bind_param("s", $userResult['username']);
151
-	$stmt->execute();
152
-	$result = $stmt->get_result();
153
-
154
-	$userResult['profilecomments'] = 0;
155
-	while($row = $result->fetch_assoc()) {
156
-		$userResult['profilecomments']++;
157
-	}
158
-	$stmt->close();
159
-
160
-	$stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'");
161
-	$stmt->bind_param("s", $userResult['username']);
162
-	$stmt->execute();
163
-	$result = $stmt->get_result();
164
-
165
-	$userResult['filesuploaded'] = 0;
166
-	while($row = $result->fetch_assoc()) {
167
-		$userResult['filesuploaded']++;
168
-	}
169
-	$stmt->close();
170
-	return $userResult;
118
+    $userResult = array();
119
+    $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
120
+    $stmt->bind_param("i", $id);
121
+    $stmt->execute();
122
+    $result = $stmt->get_result();
123
+    if($result->num_rows === 0) echo('That user does not exist.');
124
+    while($row = $result->fetch_assoc()) {
125
+        $userResult['username'] = $row['username'];
126
+        $userResult['id'] = $row['id'];
127
+        $userResult['date'] = $row['date'];
128
+        $userResult['bio'] = $row['bio'];
129
+        $userResult['css'] = $row['css'];
130
+        $userResult['pfp'] = $row['pfp'];
131
+        $userResult['badges'] = explode(';', $row['badges']);
132
+        $userResult['music'] = $row['music'];
133
+        $userResult['rank'] = $row['rank'];
134
+        $userResult['currentgroup'] = $row['currentgroup'];
135
+    }
136
+    $stmt->close();
137
+
138
+    $stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?");
139
+    $stmt->bind_param("s", $userResult['username']);
140
+    $stmt->execute();
141
+    $result = $stmt->get_result();
142
+
143
+    $userResult['comments'] = 0;
144
+    while($row = $result->fetch_assoc()) {
145
+        $userResult['comments']++;
146
+    }
147
+    $stmt->close();
148
+
149
+    $stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?");
150
+    $stmt->bind_param("s", $userResult['username']);
151
+    $stmt->execute();
152
+    $result = $stmt->get_result();
153
+
154
+    $userResult['profilecomments'] = 0;
155
+    while($row = $result->fetch_assoc()) {
156
+        $userResult['profilecomments']++;
157
+    }
158
+    $stmt->close();
159
+
160
+    $stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'");
161
+    $stmt->bind_param("s", $userResult['username']);
162
+    $stmt->execute();
163
+    $result = $stmt->get_result();
164
+
165
+    $userResult['filesuploaded'] = 0;
166
+    while($row = $result->fetch_assoc()) {
167
+        $userResult['filesuploaded']++;
168
+    }
169
+    $stmt->close();
170
+    return $userResult;
171 171
 }
172 172
 ?>
173 173
\ No newline at end of file
Please login to merge, or discard this patch.