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