} $LinkLabel = $link['#']; $WindowName = md5($link['@']['url']); $tpl_data['studylinks'][] = array('url' => $BaseURL . $LinkArgs, 'label' => $LinkLabel, 'windowName' => $WindowName); } } catch (ConfigurationException $e) { } $err = array(); if ($_SERVER['REQUEST_METHOD'] == "POST") { if (!checkLen('name')) { $err[] = 'The First Name field is empty!'; } if (!checkLen('lastname')) { $err[] = 'The Last Name field is empty!'; } if (!checkLen('from')) { $err[] = 'The Email Address field is empty!'; } else { if (!filter_var($_REQUEST['from'], FILTER_VALIDATE_EMAIL)) { $err[] = 'Your email is not valid!'; } } if (isset($_SESSION['tntcon']) && md5($_REQUEST['verif_box']) . 'a4xn' != $_SESSION['tntcon']) { $err[] = 'The verification code is incorrect'; } if (count($err)) { $tpl_data['error_message'] = $err; } if (!count($err)) { $name = $_REQUEST["name"]; $lastname = $_REQUEST["lastname"];
} $err = array(); if (!checkLen('name')) { $err[] = 'The name field is too short or empty!'; } if (!checkLen('email')) { $err[] = 'The email field is too short or empty!'; } else { if (!checkEmail($_POST['email'])) { $err[] = 'Your email is not valid!'; } } if (!checkLen('subject')) { $err[] = 'The subject field is empty!'; } if (!checkLen('message')) { $err[] = 'The message field is too short or empty!'; } if ((int) $_POST['captcha'] != $_SESSION['expect']) { $err[] = 'The captcha code is wrong!'; } if (count($err)) { if ($_POST['ajax']) { echo '-1'; } else { if ($_SERVER['HTTP_REFERER']) { $_SESSION['errStr'] = implode('<br />', $err); $_SESSION['post'] = $_POST; header('Location: ' . $_SERVER['HTTP_REFERER']); } }
$err = array(); if ($_SERVER['REQUEST_METHOD'] == "POST") { if (!checkLen('name')) { $err[] = 'The minimum length for First Name field is 3 characters'; } if (!checkLen('lastname')) { $err[] = 'The minimum length for Last Name field is 3 characters'; } if (!checkLen('from')) { $err[] = 'Your email is not valid!'; } else { if (!filter_var($_REQUEST['from'], FILTER_VALIDATE_EMAIL)) { $err[] = 'Your email is not valid!'; } } if (!checkLen('site', 0)) { $err[] = 'The Site field is empty!'; } if (isset($_SESSION['tntcon']) && md5($_REQUEST['verif_box']) . 'a4xn' != $_SESSION['tntcon']) { $err[] = 'The verification code is incorrect'; } $fields = array('name' => 'First Name', 'lastname' => 'Last Name', 'from' => 'Email'); // For each fields, check if quotes or if some HTML/PHP // tags have been entered foreach ($fields as $key => $field) { $value = $_REQUEST[$key]; if (preg_match('/["]/', html_entity_decode($value))) { $err[] = "You can't use quotes in {$field}"; } if (strlen($value) > strlen(strip_tags($value))) { $err[] = "You can't use tags in {$field}";