Browse code

allow setting of name, email and website by get-variable

rwa authored on 10.03.2019 14:51:35
Showing 1 changed files

... ...
@@ -51,6 +51,10 @@
51 51
 		}
52 52
 	}
53 53
 
54
+	if (isset($_GET['count_link']) && !empty($_GET['count_link'])) {
55
+		$count_query = 'true';
56
+	}
57
+
54 58
 	// Use UTF-8 character set
55 59
 	ini_set ('default_charset', 'UTF-8');
56 60
 
... ...
@@ -122,6 +126,18 @@
122 126
 		}
123 127
 	}
124 128
 
129
+	// load username & email from $_GET 
130
+	if ( isset($_GET['name']) && !empty($_GET['name']) ) {
131
+		setcookie('name', $_GET['name'], $expire, '/', str_replace('www.', '', $domain));
132
+	}
133
+	if ( isset($_GET['email']) && !empty($_GET['email']) ) {
134
+		setcookie('email', $_GET['email'], $expire, '/', str_replace('www.', '', $domain));
135
+	}
136
+	if ( isset($_GET['website']) && !empty($_GET['website']) ) {
137
+		setcookie('website', $_GET['website'], $expire, '/', str_replace('www.', '', $domain));
138
+	}
139
+
140
+
125 141
 	// Get use avatar URL by hash
126 142
 	function get_user_avatar ($hash) {
127 143
 		global $root_dir, $domain;
... ...
@@ -173,13 +189,11 @@
173 189
 			exit(jsAddSlashes('<b>HashOver - Error:</b> Failed to create comment thread directory at "' . $dir . '"', 'single'));
174 190
 		}
175 191
 	}
176
-
192
+		
177 193
 	// If the "count_link" query is set, display link to comment
178
-	if (isset($script_query)) {
179
-		if (isset($_GET['count_link']) and !empty($_GET['count_link'])) {
180
-			if (!file_exists($dir)) {
181
-				exit(jsAddSlashes('<a href="' . $_GET['count_link'] . '#comments">' . $text['post_cmt'] . '</a>', 'single'));
182
-			}
194
+	if (isset($script_query) && isset($count_query)) {
195
+		if (!file_exists($dir)) {
196
+			exit(jsAddSlashes('<a href="' . $_GET['count_link'] . '#comments">' . $text['post_cmt'] . '</a>', 'single'));
183 197
 		}
184 198
 	}
185 199
 
... ...
@@ -210,15 +224,13 @@
210 224
 	}
211 225
 
212 226
 	// If the "count_link" query is set, echo comment count as link
213
-	if (isset($script_query)) {
214
-		if (isset($_GET['count_link']) and !empty($_GET['count_link'])) {
215
-			read_comments($dir, 'no'); // Run read_comments function
227
+	if (isset($script_query) && isset($count_query)) {
228
+		read_comments($dir, 'no'); // Run read_comments function
216 229
 
217
-			if ($total_count > 1) {
218
-				exit(jsAddSlashes('<a href="' . $_GET['count_link'] . '#comments">' . display_count() . '</a>', 'single'));
219
-			} else {
220
-				exit(jsAddSlashes('<a href="' . $_GET['count_link'] . '#comments">' . $text['post_cmt'] . '</a>', 'single'));
221
-			}
230
+		if ($total_count > 1) {
231
+			exit(jsAddSlashes('<a href="' . $_GET['count_link'] . '#comments">' . display_count() . '</a>', 'single'));
232
+		} else {
233
+			exit(jsAddSlashes('<a href="' . $_GET['count_link'] . '#comments">' . $text['post_cmt'] . '</a>', 'single'));
222 234
 		}
223 235
 	}
224 236