PostReferer

SC to be used with NP_SpamCheck
Description: Checks if the refering url is the same as the host when posting something
Filename: SC.PostReferer.php

Code

<?php
 
//
// PostReferer SC
// by:    Legolas
// web:   http://www.legolasweb.nl/
// email: legolas@legolasweb.nl
//
// Let's users only post if the referer is on the same host.
//
 
function SCType_PostReferer() {
	return "referer";
}
 
function SC_PostReferer($url) {
	if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST)) {
		$parts = parse_url($url);
		$ref = $parts["host"];
		if ($_SERVER["SERVER_NAME"] != $ref) {
			return true;
		}
	}
	return false;
}
 
?>
sc/postreferer.txt · Last modified: 2006/07/05 13:03 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki