Passed
Push — master ( ea458a...8c060d )
by Maxwell
02:01
created
func/func.php 1 patch
Indentation   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -11,140 +11,140 @@
 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) {
20
-	$markdown = new Michelf\Markdown;
21
-	$markdown->no_markup = true;
22
-	$transformed = $markdown->transform($comment);
23
-	return preg_replace(
24
-		"/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i",
25
-		"Attempted XSS: $2 ($1)",
26
-		$transformed
27
-	);
20
+    $markdown = new Michelf\Markdown;
21
+    $markdown->no_markup = true;
22
+    $transformed = $markdown->transform($comment);
23
+    return preg_replace(
24
+        "/<a href=(?:'|\")javascript:(.*?)(?:'|\")>(.*?)<\/a>/i",
25
+        "Attempted XSS: $2 ($1)",
26
+        $transformed
27
+    );
28 28
 }
29 29
 
30 30
 function validateCaptcha($privatekey, $response) {
31
-	$responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response));
32
-	return $responseData->success;
31
+    $responseData = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$privatekey.'&response='.$response));
32
+    return $responseData->success;
33 33
 }
34 34
 
35 35
 function requireLogin() {
36
-	if (!isset($_SESSION['user'])) {
37
-		header("Location: /login.php?r_login"); die();
38
-	}
36
+    if (!isset($_SESSION['user'])) {
37
+        header("Location: /login.php?r_login"); die();
38
+    }
39 39
 }
40 40
 
41 41
 function getID($user, $connection) {
42
-	$stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
43
-	$stmt->bind_param("s", $user);
44
-	$stmt->execute();
45
-	$result = $stmt->get_result();
46
-	if($result->num_rows === 0) return 'error';
47
-	while($row = $result->fetch_assoc()) {
48
-		$id = $row['id'];
49
-	} 
50
-	$stmt->close();
51
-	return $id;
42
+    $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
43
+    $stmt->bind_param("s", $user);
44
+    $stmt->execute();
45
+    $result = $stmt->get_result();
46
+    if($result->num_rows === 0) return 'error';
47
+    while($row = $result->fetch_assoc()) {
48
+        $id = $row['id'];
49
+    } 
50
+    $stmt->close();
51
+    return $id;
52 52
 }
53 53
 
54 54
 function getName($id, $connection) {
55
-	$stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
56
-	$stmt->bind_param("s", $id);
57
-	$stmt->execute();
58
-	$result = $stmt->get_result();
59
-	if($result->num_rows === 0) return('error');
60
-	while($row = $result->fetch_assoc()) {
61
-		$name = htmlspecialchars($row['username']);
62
-	} 
63
-	$stmt->close();
64
-	return $name;
55
+    $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
56
+    $stmt->bind_param("s", $id);
57
+    $stmt->execute();
58
+    $result = $stmt->get_result();
59
+    if($result->num_rows === 0) return('error');
60
+    while($row = $result->fetch_assoc()) {
61
+        $name = htmlspecialchars($row['username']);
62
+    } 
63
+    $stmt->close();
64
+    return $name;
65 65
 }
66 66
 
67 67
 function getPFP($user, $connection) {
68
-	$stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
69
-	$stmt->bind_param("s", $user);
70
-	$stmt->execute();
71
-	$result = $stmt->get_result();
72
-	if($result->num_rows === 0) return('error');
73
-	while($row = $result->fetch_assoc()) {
74
-		$pfp = htmlspecialchars($row['pfp']);
75
-	} 
76
-	$stmt->close();
77
-	return $pfp;
68
+    $stmt = $connection->prepare("SELECT * FROM users WHERE username = ?");
69
+    $stmt->bind_param("s", $user);
70
+    $stmt->execute();
71
+    $result = $stmt->get_result();
72
+    if($result->num_rows === 0) return('error');
73
+    while($row = $result->fetch_assoc()) {
74
+        $pfp = htmlspecialchars($row['pfp']);
75
+    } 
76
+    $stmt->close();
77
+    return $pfp;
78 78
 }
79 79
 
80 80
 function checkIfFriended($friend1, $friend2, $connection)
81 81
 {
82
-	$stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?");
83
-	$stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1);
84
-	$stmt->execute();
85
-	$result = $stmt->get_result();
86
-	if($result->num_rows === 1){ return true; }
87
-	return false;
82
+    $stmt = $connection->prepare("SELECT * FROM `friends` WHERE reciever = ? AND sender = ? OR reciever = ? AND sender = ?");
83
+    $stmt->bind_param("ssss", $friend1, $friend2, $friend2, $friend1);
84
+    $stmt->execute();
85
+    $result = $stmt->get_result();
86
+    if($result->num_rows === 1){ return true; }
87
+    return false;
88 88
 }
89 89
 
90 90
 function getUser($id, $connection) {
91
-	$stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
92
-	$stmt->bind_param("i", $id);
93
-	$stmt->execute();
94
-	$result = $stmt->get_result();
95
-	if($result->num_rows === 0) echo('That user does not exist.');
96
-	while($row = $result->fetch_assoc()) {
97
-		$username = $row['username'];
98
-		$id = $row['id'];
99
-		$date = $row['date'];
100
-		$bio = $row['bio'];
101
-		$css = $row['css'];
102
-		$pfp = $row['pfp'];
103
-		$badges = explode(';', $row['badges']);
104
-		$music = $row['music'];
105
-	}
106
-	$stmt->close();
107
-
108
-	$stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?");
109
-	$stmt->bind_param("s", $username);
110
-	$stmt->execute();
111
-	$result = $stmt->get_result();
112
-
113
-	$comments = 0;
114
-	while($row = $result->fetch_assoc()) {
115
-		$comments++;
116
-	}
117
-	$stmt->close();
118
-
119
-	$stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?");
120
-	$stmt->bind_param("s", $username);
121
-	$stmt->execute();
122
-	$result = $stmt->get_result();
123
-
124
-	$profilecomments = 0;
125
-	while($row = $result->fetch_assoc()) {
126
-		$profilecomments++;
127
-	}
128
-	$stmt->close();
129
-
130
-	$stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'");
131
-	$stmt->bind_param("s", $username);
132
-	$stmt->execute();
133
-	$result = $stmt->get_result();
134
-
135
-	$filesuploaded = 0;
136
-	while($row = $result->fetch_assoc()) {
137
-		$filesuploaded++;
138
-	}
139
-	$stmt->close();
140
-	return array(
141
-		'id' => $id,
142
-		'date' => $date,
143
-		'bio' => $bio,
144
-		'css' => $css,
145
-		'pfp' => $pfp,
146
-		'badges' => $badges,
147
-		'music' => $music
148
-	);
91
+    $stmt = $connection->prepare("SELECT * FROM users WHERE id = ?");
92
+    $stmt->bind_param("i", $id);
93
+    $stmt->execute();
94
+    $result = $stmt->get_result();
95
+    if($result->num_rows === 0) echo('That user does not exist.');
96
+    while($row = $result->fetch_assoc()) {
97
+        $username = $row['username'];
98
+        $id = $row['id'];
99
+        $date = $row['date'];
100
+        $bio = $row['bio'];
101
+        $css = $row['css'];
102
+        $pfp = $row['pfp'];
103
+        $badges = explode(';', $row['badges']);
104
+        $music = $row['music'];
105
+    }
106
+    $stmt->close();
107
+
108
+    $stmt = $connection->prepare("SELECT * FROM gamecomments WHERE author = ?");
109
+    $stmt->bind_param("s", $username);
110
+    $stmt->execute();
111
+    $result = $stmt->get_result();
112
+
113
+    $comments = 0;
114
+    while($row = $result->fetch_assoc()) {
115
+        $comments++;
116
+    }
117
+    $stmt->close();
118
+
119
+    $stmt = $connection->prepare("SELECT * FROM comments WHERE author = ?");
120
+    $stmt->bind_param("s", $username);
121
+    $stmt->execute();
122
+    $result = $stmt->get_result();
123
+
124
+    $profilecomments = 0;
125
+    while($row = $result->fetch_assoc()) {
126
+        $profilecomments++;
127
+    }
128
+    $stmt->close();
129
+
130
+    $stmt = $connection->prepare("SELECT * FROM files WHERE author = ? AND status='y'");
131
+    $stmt->bind_param("s", $username);
132
+    $stmt->execute();
133
+    $result = $stmt->get_result();
134
+
135
+    $filesuploaded = 0;
136
+    while($row = $result->fetch_assoc()) {
137
+        $filesuploaded++;
138
+    }
139
+    $stmt->close();
140
+    return array(
141
+        'id' => $id,
142
+        'date' => $date,
143
+        'bio' => $bio,
144
+        'css' => $css,
145
+        'pfp' => $pfp,
146
+        'badges' => $badges,
147
+        'music' => $music
148
+    );
149 149
 }
150 150
 ?>
151 151
\ No newline at end of file
Please login to merge, or discard this patch.