<?php
function xoopsfwrite() {
	if (isPost()) {
	} else {
		return false;
	}
	if (myRefererCheck($errstr)) {
	} else {
		return false;
	}
	return true;
}

function isPost() {
	global $REQUEST_METHOD;
	if ($REQUEST_METHOD == "POST" ) {
		return true;
	} else {
		return false;
	}
}

function myRefererCheck(&$errstr) {
	global $REQUEST_URI, $HTTP_REFERER, $HTTP_HOST, $SCRIPT_NAME;
	$referer = $HTTP_REFERER;
	if(strlen($referer) == 0) {
		return false;
	}
	$filepath = (!empty($REQUEST_URI)) ? $REQUEST_URI : $SCRIPT_NAME;
	$myurl = "http://".$HTTP_HOST.str_replace(basename($filepath),"",$filepath);
	if (strpos($referer,$myurl) != 0 ) {
		return false;
	}
	return true;
}

function myTextForm($url , $value) {
	return "<form action='$url' method='post'><input type='submit' value='$value' /></form>\n";
}
?>