- time: documentation ( source)
- mt_rand: documentation ( source)
- hash: documentation ( source)
- explode: documentation ( source)
- sleep: documentation ( source)
- header: documentation ( source)
<?php require_once('../inc/connect.php'); $pageTitle = 'Bericht plaatsen'; include(ROOT_DIR.'/header.php');
$append = '';
if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['secure']) && isset($_POST['ref']) && isset($_POST['email']) && isset($_POST['message']) && $_POST['token'] === $_SESSION['TICKET_FORM_TOKEN'] && isset($_POST['recaptcha_challenge_field']) && isset($_POST['recaptcha_response_field'])) {
sleep(2);
$_SESSION['TICKET_FORM_TOKEN'] = hash('sha256',mt_rand().time());
$resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY,$_SERVER["REMOTE_ADDR"],$_POST["recaptcha_challenge_field"],$_POST["recaptcha_response_field"]);
if($_POST['secure'] === hash('sha256',$_POST['ref'].$_POST['email'].SECRET_STRING)) {
if($ticket = $_ticket->getTicket($_POST['ref'],$_POST['email'])) {
if($resp->is_valid) {
$status = explode('|',$_ticket->addAnwser($ticket['id'],$_POST['message'],0));
if($status[0] == 'OK') {
$append = '<div class="alert alert-success">Uw bericht is succesvol toegevoegd.</div><a href="'.$setting['url'].'view-ticket?ref='.$ticket['ref'].'&email='.$ticket['email'].'" class="btn btn-block">Klik hier om terug te gaan</a>';
} else {
$append = '<div class="alert alert-error">Uw bericht kon niet toegevoegd worden: '.$status[1].'</div><a href="javascript:;" onclick="history.go(-1)" class="btn btn-block">Klik hier om terug te gaan</a>';
}
} else {
$append = '<div class="alert alert-error">U heeft de veiligheidscode verkeerd ingevoerd.</div><a href="javascript:;" onclick="history.go(-1)" class="btn btn-block">Klik hier om terug te gaan</a>';
}
} else {
$append = '<div class="alert alert-error">Geen ticket gevonden</div><a href="javascript:;" onclick="history.go(-1)" class="btn btn-block">Klik hier om terug te gaan</a>';
}
} else {
$append = '<div class="alert alert-error">U bent niet gemachtigd om deze pagina te bekijken</div><a href="javascript:;" onclick="history.go(-1)" class="btn btn-block">Klik hier om terug te gaan</a>';
}
} else {
header('Location: '.$setting['url']);
die();
}
?>
<div class="row-fluid">
<div class="span4 offset4">
<h2>Bericht plaatsen</h2>
<div class="well">
<?=$append;?>
</div>
</div>
</div>
<?php include(ROOT_DIR.'/footer.php'); ?>