Esempio n. 1
0
function verifyWork($work_id, $work_solution) {
	include("ratelimit.php");
	global $works;
	$res = ($works->{$work_id} == $work_solution); // Solution is right
	logtext($work_id.": ".$works->{$work_id}." ? ".$work_solution);
	unset($works->{$work_id});
	saveWorks();
	return $res;
}
Esempio n. 2
0
header('Access-Control-Allow-Headers: *');

if ($_SERVER['REQUEST_METHOD'] != "POST") {
	logdie("Not allowed");
}

if (isset($_SERVER['HTTP_REFERER']) and strpos($_SERVER['HTTP_REFERER'], $site) === false and strpos(strtolower($_SERVER['HTTP_REFERER']), $site_domain) === false) { 
	header('HTTP/1.0 403 Forbidden');
	logdie("Referer error.");
}

logtext("Request: Parsing parameters...");

logtext($_SERVER);
logtext($_POST);

logtext("Adding work...");

list($work_id, $work_task, $work_solution) = addWork();

$back = array();
$back["work_id"] = $work_id;
$back["work_task"] = $work_task;

$back = json_encode($back);

logtext("Sending work: $back");

echo $back;

?>
Esempio n. 3
0

logtext("Adding to users...");
$data->users->{$user_name} = "web,$auth_address,$sign";
$json_out = json_encode($data, JSON_PRETTY_PRINT);

$f = fopen($users_json, "w");
fwrite($f, $json_out);
fclose($f);


logtext("Signing...");
$out = array();
exec("python zeronet.py --debug siteSign $site $privatekey --publish 2>&1", $out);
$out = implode("\n", $out);
logtext($out);
if (strpos($out, "content.json signed!") === false) {
	header("HTTP/1.0 500 Internal Server Error");
	logdie("Site sign error, please contact site owner!");
}

/*
logtext("Publishing...");
$server_ip = $_SERVER['SERVER_ADDR'];
$out = array();
exec("python zeronet.py --debug --ip_external $server_ip sitePublish $site 2>&1", $out);
$out = implode("\n", $out);
logtext($out);
if (strpos($out, "Successfuly published") === false) {
	header("HTTP/1.0 500 Internal Server Error");
	logdie("Publish error, please contact site owner!");