<?php
	$time = time();
	$sContent = file_get_contents('php://input');
	$sName = 'uploads/' . $time . '.jpg';
	file_put_contents($sName,$sContent);
	$image_test = getimagesize($sName);
	if ( $image_test['mime'] == "image/jpeg" ) {
		$domaine = 'http://' . $_SERVER['SERVER_NAME'];
		$self = $_SERVER["PHP_SELF"];
		$base = str_replace( '/wp-content/plugins/facethumb/upload.php', '', $domaine.$self);
		$link = $_GET['link'];
		$name = $_GET['name'];
		$url = str_replace( 'upload.php', $sName, $domaine.$self);
		header("Location: ". $base ."/?name=". $name . "&link=" . $link . "&url=" . $url . "&time=" . $time);
	}
	else {
		unlink($sName);
	}
?>
