print "<pre>"; print_r($_GET); print "</pre>"; */ if (!empty($_GET['first'])) { $firstName = $_GET['first']; print "<p>Hello, {$firstname}</p>"; } else { print "<p>First name is required.</p>"; } // function validName($string) { // return ctype_alpha($string) // AND !empty($string); // } if (validName($_GET['first'])) { $firstName = $_GET['first']; echo "<p>Name: {$firstName}"; } else { echo "<p class='warning'>First name is required.</p>"; } // function validYear($string) { // //return true if year is not empty and // if (!empty($string)){ // // //year is numeric // if (is_numeric($string)) { // //and consists of four digits // if (strlen($string) == 4){ // //and is after 1800 // if ($string >= 1800) {
if ($_POST['pass'] != $_POST['pass2']) { $error = 'Su contraseña no coincide en ambos campos<br />'; } } if (!$error) { if (User::updateUser($user->id, $user->rol, $user->mail, $_POST['pass'])) { $msj = 'Se actualizó su contraseña con éxito.'; } else { $error = 'Ocurrió un error interno registrando su cuenta, intente más tarde.'; } } } else { if ($_GET['op'] == 'update_data') { $error = ''; $countries = getCountries(); if (strlen($_POST['name']) < 3 || !validName($_POST['name'])) { $error .= '- Su Nombre es requerido, solo puede usar caracteres alfanuméricos<br />'; } if (strlen($_POST['address']) < 3 || !validAddress($_POST['address'])) { $error .= '- Su Dirección es requerida, solo puede usar caracteres alfanuméricos<br />'; } if (strlen($_POST['phone']) < 3 || !validPhone($_POST['phone'])) { $error .= '- Su Teléfono es requerido, solo puede usar dígitos<br />'; } if (strlen($_POST['vat']) > 0 && !validVat($_POST['vat'])) { $error .= '- Su identificación fiscal solo puede tener caracteres alfanuméricos<br />'; } if ($error == '') { if (User::updateUserData($user->id, $_POST['name'], $_POST['vat'], $_POST['address'], $user->country, $_POST['phone'])) { $msj = 'Se actualizó su información con éxito.'; } else {
an expansion of my CS50x final project winter/spring 2014 with Launch Code */ require '../include/helfun.php'; $error = false; $director = false; $email = null; $name = null; if (isset($_POST['email'])) { // send though PHP internals $email = saniTizeEmail($_POST['email']); // send though a regular expression $email = validEmail($email); } if (isset($_POST['name'])) { $name = validName(saniTize($_POST['name'])); } // set grp number based on last group user chose if (isset($_COOKIE['leaderboard_cookie'])) { $group = saniTize($_COOKIE['leaderboard_cookie']); } else { // skip the alert the second time though if (isset($_GET['con']) || saniTize($_POST['director']) == true) { $director = true; } else { header("Location: alert?gsnc=yes"); //exit; } } if ($group === null) { $group = $defaultString;
$lname = ""; $method = ""; //See if the form has been submitted if (isset($_GET['submit'])) { //Create a boolean flag to track validation errors $isValid = true; //Check first name if (validName($_GET['fname'])) { $fname = $_GET['fname']; } else { print "<p>Please enter your first name.</p>"; $fname = NULL; $isValid = false; } //Check last name if (validName($_GET['lname'])) { $lname = $_GET['lname']; } else { print "<p>Please enter your last name.</p>"; $lname = NULL; $isValid = false; } //Get the method (pick up or delivery) $method = ""; if (isset($_GET['method']) && validDelivery($_GET['method'])) { $method = $_GET['method']; //Check for address if method is delivery if ($method == 'delivery') { if (!empty($_GET['address'])) { $address = $_GET['address']; } else {
//checks for organization input. if (validName($_POST['organization'])) { $lname = $_POST['organization']; } else { print "<p>Please enter organization.</p>"; $isValid = false; } //checks phone number. if (validName($_POST['phone'])) { $phone = $_POST['phone']; } else { print "<p>Please enter phone number.</p>"; $isValid = false; } //checks email. if (validName($_POST['email'])) { $email = $_POST['email']; } else { print "<p>Please enter organization.</p>"; $isValid = false; } // checks gold sponsorship level $gold = ""; if (isset($_POST['gold']) and validMethod($_POST['gold'])) { $gold = $_POST['gold']; } else { print "<p>Please select an option .</p>"; $isValid = false; } //checks for silver sponsorship level. $silver = "";