function _insupdplayer($v_pid = 0, $last_name = '') { # ------------------------ # v02 BH 2003/7/3 # v07 BH 10.9. included add fields # v09 BH removed vverband this is done auto by vrealm # // v10 removed membership entries - just basic player details ... # ----------------------- # TODO v5 merge this and the egate_code to the ORM Modell ... if (isset($_POST['vfname']) && strlen(dounhtmlentities($_POST['vfname'])) < 30) { $first_name = strip_tags($_POST['vfname']); } else { $first_name = ''; } if (isset($_POST['vbirthdate']) && strlen(dounhtmlentities($_POST['vbirthdate'])) < 15) { $v_birthdate = strip_tags($_POST['vbirthdate']); } else { $v_birthdate = '1901-01-01'; } if (isset($_POST['vgender']) && strlen(dounhtmlentities($_POST['vgender'])) < 2) { $v_gender = strip_tags($_POST['vgender']); } else { $v_gender = 'H'; } if (isset($_POST['vactive']) && is_numeric(dounhtmlentities($_POST['vactive']))) { $v_active = strip_tags($_POST['vactive']); } else { $v_active = 1; } if (isset($_POST['vcomment']) && strlen(dounhtmlentities($_POST['vcomment'])) < 50) { $v_comment = strip_tags($_POST['vcomment']); } else { $v_comment = ''; } $v_username = ''; if (isset($_POST['vnation']) && strlen(dounhtmlentities($_POST['vnation'])) < 12) { $v_nation = strip_tags($_POST['vnation']); } else { $v_nation = ''; } if (isset($_POST['vtown']) && strlen(dounhtmlentities($_POST['vtown'])) < 30) { $v_town = strip_tags($_POST['vtown']); } else { $v_town = ''; } if (isset($_POST['vplz']) && strlen(dounhtmlentities($_POST['vplz'])) < 10) { $v_plz = strip_tags($_POST['vplz']); } else { $v_plz = ''; } if (isset($_POST['vstreet']) && strlen(dounhtmlentities($_POST['vstreet'])) < 60) { $v_street = strip_tags($_POST['vstreet']); } else { $v_street = ''; } if (isset($_POST['vtel1']) && strlen(dounhtmlentities($_POST['vtel1'])) < 20) { $v_tel1 = strip_tags($_POST['vtel1']); } else { $v_tel1 = ''; } if (isset($_POST['vtel2']) && strlen(dounhtmlentities($_POST['vtel2'])) < 20) { $v_tel2 = strip_tags($_POST['vtel2']); } else { $v_tel2 = ''; } if (isset($_POST['vemail']) && strlen(dounhtmlentities($_POST['vemail'])) < 80) { $v_email = strip_tags($_POST['vemail']); } else { $v_email = ''; } global $dbi, $sipgoback, $usertoken; dsolog(2, $usertoken['uname'], "<b>UPDATE REQUEST</b> Player: {$last_name}({$v_pid})"); if ($usertoken['usertype_id'] < 2 && $usertoken['usertype_id'] != 0) { die("<h3>Illegal attempt to change data ....</h3>"); } if (sizeof($usertoken['registermap']) < 1 && $usertoken['usertype_id'] != 0) { die("<h3>Illegal attempt to change data .......</h3>"); } # # sanity checks come here please ........ # $v_gender = strtoupper($v_gender); if (!ereg("([H,D,J]{1})", $v_gender)) { die("Wrong Gender should be H,D or J ... {$sipgoback}"); } if (checkBirthDate($v_birthdate) == 0) { die("Geburtsdatum ist <b>kein gültges Datum</b> ... {$sipgoback}"); } if (strlen($last_name) == 0) { die("Nachname <b>muss</b> angegeben werden ... {$sipgoback}"); } if (strlen($first_name) == 0) { die("Vorname <b>muss</b> angegeben werden ... {$sipgoback}"); } /* * in case of an insert the PID=0, check if unique */ if ($v_pid == 0) { $playerlist = CheckUniquePlayer($first_name, $last_name, $v_birthdate); if (!strlen($playerlist) == 0) { die("<h3>Achtung, Doppel Einträge gefunden:</h3><p>Vorname, Nachname, Geburtsdatum ident:</p><br/>" . $playerlist . "<br/><br/> ...{$sipgoback}"); } } $upd_user = $usertoken['uname']; $upd_date = ls_getdate(); if (!ereg("([0-1]{1})", $v_active)) { die("<h3>Aktiv Flag entweder 0 oder 1</h3> ... {$sipgoback}"); } // FINALLY ACTION if ($v_pid > 1) { $qry = "update tplayer set pfname=\"{$first_name}\",plname=\"{$last_name}\",pgender=\"{$v_gender}\"," . "pactive={$v_active},pcomment=\"{$v_comment}\",pusername=\"{$v_username}\",pbirthdate=\"{$v_birthdate}\"," . "pupd_user=\"{$upd_user}\",pupd_date=\"{$upd_date}\",pnationality=\"{$v_nation}\"," . "ptown=\"{$v_town}\",pplz=\"{$v_plz}\",pstreet=\"{$v_street}\",ptel1=\"{$v_tel1}\",ptel2=\"{$v_tel2}\",pemail=\"{$v_email}\" where pid={$v_pid} limit 1"; } else { $qry = "insert into tplayer (pid,pfname,plname,pgender,pactive,sipcount,pcomment,pusername,psipstatus,pbirthdate,pcre_date,pcre_user,ptel1,ptel2,pnationality,ptown,pplz,pstreet,pemail) values(0,\"{$first_name}\",\"{$last_name}\",\"{$v_gender}\",1,0,\"{$v_comment}\",\"{$v_username}\",0,\"{$v_birthdate}\",\"{$upd_date}\",\"{$upd_user}\",\"{$v_tel1}\",\"{$v_tel2}\",\"{$v_nation}\",\"{$v_town}\",\"{$v_plz}\",\"{$v_street}\",\"{$v_email}\")"; } $res = sql_query($qry, $dbi); return $res; }
//Civilité if (!checkSelect($_POST['civilite'], [0, 1])) { $errors['civilite'] = "Langue Invalide"; $_POST['civilite'] = 0; } // Nom & Prénom : if (!checkTextInput($_POST['nom'], "/^[a-zâäàéèùêëîïôöçñ][a-zâäàéèùêëîïôöçñ' -]+\$/i")) { $errors['nom'] = 'Nom invalide, il ne peut contenir que des lettres (accentuées) des tirets, des espaces et des apostrophes.'; } if (!checkTextInput($_POST['prenom'], "/^[a-zâäàéèùêëîïôöçñ][a-zâäàéèùêëîïôöçñ' -]+\$/i")) { $errors['prenom'] = 'Prénom invalide, il ne peut contenir que des lettres (accentuées) des tirets, des espaces et des apostrophes.'; } //DDN var_dump(checkBirthDate($_POST['ddn'])); var_dump($_POST['ddn']); if (!checkBirthDate($_POST['ddn'])) { $errors['ddn'] = 'Date invalide, elle est à venir ou n\'est pas au format AAAA-MM-JJ ou JJ-MM-AAAA'; } //Tel if (!checkTextInput($_POST['tel'], "/^0\\d{9}\$/")) { $errors['tel'] = 'Numéro de téléphone invalide, il contient trop de chiffres, commence par autre chose que 0 ou des lettres et caractères non autorisés.'; } // Adresse : if (!checkAddress($_POST['adresse'])) { $errors['adresse'] = 'Adresse invalide'; } // Cas de suppression d'adresse if (!empty($contents['id_adresse']) and empty($_POST['adresse'])) { $_POST['adresse'] = -1; } // Langue :
<input type="text" name="date"><br> Month:<br> <input type="text" name="month"> <br> Year:<br> <input type="text" name="year"> <input type="submit" name="go" value="submit"> </form> </body> </html> <?php $chrono->mark('before_do_something'); // Check input data: whether user older then 18 years if (!empty($_POST['go'])) { if (($_POST['date'] && $_POST['month'] && $_POST['year']) == 0) { echo '<p class="N">Dear, filds with your Birthday are required</p>'; } else { if (checkBirthDate($_POST['month'], $_POST['date'], $_POST['year'])) { echo '<p id="Y">You may use this web site.</p>'; } else { echo '<p class="N">You are too young (or too old!!) to proceed.</p>'; } } $chrono->mark('after_do_something'); $diff = $chrono->diff('before_do_something', 'after_do_somthing'); echo sprintf("<br>check's duration is: %.3f c<br>", $diff); $chrono->stop(); //end timing $total_in_micro_seconds = $chrono->total(6); echo sprintf("Whole script's duration is %.6f seconds\n", $total_in_micro_seconds); }