Files
xxx/publish/preview.inc.php
T
2015-11-22 00:22:34 +02:00

42 lines
1.4 KiB
PHP

<?
$result = get_post_data(TRUE, TRUE);
extract($result[0], EXTR_OVERWRITE);
if (isset($_POST['g-recaptcha-response'])) {
$captcha = $_POST['g-recaptcha-response'];
if (! $captcha) {
$validate['captcha'] = 'Invalid captcha. Please try again.';
include('./write.inc.php');
return;
}
$captcha_resp = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".urlencode(config('RECAPTCHA_SECRET'))."&response=".
$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']);
var_dump($captcha_resp);
if ($captcha_resp.success==false) {
$validate['captcha'] = 'The words you typed in the captcha were not correct. Please try again.';
include('./write.inc.php');
return;
}
}
echo '<p>Please review your submission. Once you\'ve finished, please click "Submit" at the bottom of the page, or click "Preview" to check it again.</p>';
if (is_uploaded_file($_FILES['upload']['tmp_name']) && !isset($validate['upload'])) {
$tmp_file = $_FILES['upload']['tmp_name'];
$upload = getimagesize($tmp_file);
$new_file = $_SERVER['DOCUMENT_ROOT'] . "/graphics" . $tmp_file;
move_uploaded_file($tmp_file, $new_file);
$file_src = "/graphics" .$tmp_file;
} else if (isset($uploaded) && is_file($_SERVER['DOCUMENT_ROOT'] . $uploaded) && !$remove_img) {
$file_src = $uploaded;
}
echo display_stories();
echo "<br /><br />\n";
include('./write.inc.php');
return;
?>