\n\n"; // *** LOADING CONFIG FILE $data="../database/inscr_tdd.db"; // file location $bips="../database/bips.db"; // file location $maxchar=500; // maximum characters $racename="42nd Tour de Dudelange (kids races)"; // race name $racedate="April 14th, 2019"; // race date $exp_date_inscription = strtotime("2019-04-10"); $todays_date = date("Y-m-d"); $today = strtotime($todays_date); function conv_asc2html($str,$mode){ if ($mode==1){ $str=str_replace(">",">",$str); $str=str_replace("<","<",$str); $str=str_replace("é","é",$str); $str=str_replace("è","è",$str); $str=str_replace("ü","ü",$str); $str=str_replace("ö","ö",$str); $str=str_replace("ä","ä",$str); } if ($mode==2){ $str=str_replace(">",">",$str); $str=str_replace("<","<",$str); $str=str_replace("é","é",$str); $str=str_replace("è","è",$str); $str=str_replace("ü","ü",$str); $str=str_replace("ö","ö",$str); $str=str_replace("ä","ä",$str); } return $str; } // splits text if longer than w_max, then in chunks of w_cut function splitwordx(&$text,$w_max,$w_cut){ if (!strstr($text," ")){ $text=$text." "; } $word = explode(" ", $text); if (empty($w_max)){ $w_max=10; } if (empty($w_cut)){ $w_cut=10; } for ($w=0; $w$w_max){ $wordnew=""; $wordpart=""; for ($l=0; $l\n"; echo " Inscription error :
$str\n"; echo " Please use your browser's Back button to return to your entered fields!\n"; echo "
\n"; } function send_mail($emailaddress, $body, $lracename) { $eol="\r\n"; //$mime_boundary=md5(time()); $fromaddress="inscriptions@cadudelange.lu"; $emailsubject="New inscription entry for the ".$lracename; # Common Headers $headers .= 'From: CAD Online inscriptions <'.$fromaddress.'>'.$eol; $headers .= 'Reply-To: CAD Online inscriptions <'.$fromaddress.'>'.$eol; $headers .= 'Return-Path: CAD Online inscriptions <'.$fromaddress.'>'.$eol; // these two to set reply address $headers .= "Message-ID: <".$now." TheSystem@".$_SERVER['SERVER_NAME'].">".$eol; $headers .= "X-Mailer: PHP v".phpversion().$eol; // These two to help avoid spam-filters # Boundry for marking the split & Multitype Headers $headers .= 'MIME-Version: 1.0'.$eol; $headers .= 'Content-type: text/plain; charset=ISO-8859-1'.$eol; $msg = $body; # SEND THE EMAIL ini_set(sendmail_from,$fromaddress); // the INI lines are to force the From Address to be used ! mail($emailaddress, $emailsubject, $msg, $headers); ini_restore(sendmail_from); } // *** CHECKING FILE EXISTING if (!file_exists($data)){ disperr("File "$data" not found!"); exit; } ?> PHP Inscription for CAD event Tour de Dudelange 2017 inscription ".$racename.""; if ($exp_date_inscription <= $today) { echo "Below you can find the athletes who have already inscribed for the races.
"; } else { echo "If you are interested in running at the ".$racename.", you can send us your inscription using the form below. If you specify a valid email address, you will get a confirmation within the next few minutes!
"; } ?>
$today) { if ($_POST[act]=="post"){ if (empty($_POST[firstname])){ $ferr.="
  • Please enter your first name"; } if (empty($_POST[lastname])){ $ferr.="
  • Please enter your last name"; } if ($_POST[select]==0){ $ferr.="
  • Please select the race in which you want to run"; } if ($_POST[by]<1900){ $ferr.="
  • Please enter your born year in the format YYYY"; } if (!empty($ferr)){ disperr($ferr); } else { $ftanggal=date("d M Y - H:i"); if ($_POST[select]==1) { // 10km race $id=$bip; } else { $id="FLA"; $bips_new=$bip.",".$bips_new; // release again bip as FLA bip attributed } $contents_new="|#line#|".$ftanggal."|#|".$id; $selectclubs=array("0"=>"(please choose)","999"=>"other/anderer/autre","10"=>"AASL Wooltz","20"=>"AC Dampicourt","1010"=>"ALCAD","40"=>"Amicale BCL","50"=>"Amicale P&T Luxembourg","60"=>"AS CFL","70"=>"AS Douanes","80"=>"Aspels","90"=>"Banque de Luxembourg","100"=>"Bartz/Painworld","110"=>"Beetebuerg beweegt sech","120"=>"CA Belvaux","1020"=>"CA Dudelange","140"=>"CA Fola","150"=>"CA Schifflange","160"=>"CAE Grevenmacher","170"=>"CAPA Ettelbruck","180"=>"Celtic Diekirch","190"=>"CS Luxembourg","200"=>"CSN Clervaux","210"=>"Dexia BIL Runners","220"=>"DJK Irrel","230"=>"DJK Wißmannsdorf","240"=>"Downhill Runners","250"=>"Ent. Sylvesterlaf Rammerech","260"=>"FLTRI","270"=>"Fortis Running","280"=>"Foyer","290"=>"Globe-Trotters","300"=>"Hôpital Kirchberg","310"=>"HSBC","320"=>"ING Luxembourg","330"=>"Jogging Espace","340"=>"KBL","350"=>"Keespelter Gazellen","360"=>"Kirchberg Runners","370"=>"Konkelrunners Schwebsange","380"=>"L.C. Spuerkees","390"=>"Laaftreff Wanseler","400"=>"Laaftreff Leideleng","410"=>"Lafclub Police Grand-Ducale","420"=>"Lauftreff Welschbillig e.V.","430"=>"LC Saucony Saar","440"=>"LG Kammerwald","450"=>"LG Langsur","460"=>"LT Büdlich-Breit-Naurath","470"=>"LT Hesper","480"=>"LT Schweich","490"=>"LT Wasserliesch","500"=>"LT Welschbillig e. V.","510"=>"Lusitanos","520"=>"Maacher Mettwochsleefer","530"=>"Mousecat Team","540"=>"okay.lu","550"=>"Olympia Clausen","560"=>"PwC Running Club","570"=>"RBUAP","580"=>"Remicher Rieflais","590"=>"RRE","600"=>"RTL Runners Team Luxbg","610"=>"Spiridon Letzebuerg","620"=>"Sports pour Tous","630"=>"SV Tawern","640"=>"Swimming Luxembourg","650"=>"Syrdall Rennmais","660"=>"Team Coque","670"=>"TG-Konz","680"=>"Tooltime","690"=>"Treppeler","700"=>"Trilux","710"=>"Trispeed Mamer","720"=>"Tränteler","730"=>"TV Bitburg","740"=>"TV St. Wendel","750"=>"U.S. Rambrouch","760"=>"Walfer Huesen"); if ($_POST[club]=="999" or $_POST[club]=="0") {$selectedclub=$_POST[club_alt];} else {$selectedclub=$selectclubs[$_POST[club]];} $contents_entry="|#|".ucwords($_POST[firstname])."|#|".strtoupper($_POST[lastname])."|#|".strtoupper($_POST[street])."|#|".strtoupper($_POST[country])."|#|".$_POST[zip]."|#|".strtoupper($_POST[city])."|#|".strtoupper($selectedclub)."|#|".$_POST[license]."|#|".$_POST[gender]."|#|".$_POST[by]; if ($_POST[select]==0) {$contents_entry.="|#|no selected race";} if ($_POST[select]==3) {$contents_entry.="|#|Mini Race (725m)";} if ($_POST[select]==4) {$contents_entry.="|#|Benjamin(e)s Race (725m)";} if ($_POST[select]==5) {$contents_entry.="|#|Debutant(e)s Race (1450m)";} if ($_POST[select]==6) {$contents_entry.="|#|Scolaires Race (1450m)";} $contents_entry.="|#|".$_POST[email]; // Send now confirmation mail $eol="\r\n"; $emailsubject=$emailsubject." (".$ftanggal.")"; $mail_addressee='inscribe@cadudelange.lu'.','.$_POST[email]; $mail_body ="A new entry to the ".$racename." inscription was added on ".$ftanggal." with the following information:".$eol; $mail_body.="Name: ".ucwords($_POST[firstname])." ".strtoupper($_POST[lastname]).$eol; $mail_body.="Address: ".$_POST[street]." ".$_POST[country]."-".$_POST[zip]." ".$_POST[city].$eol; $mail_body.="Club: ".$selectedclub.$eol; $mail_body.="Bib: ".$id.$eol; $mail_body.="License: ".$_POST[license].$eol; $mail_body.="Gender: ".$_POST[gender].$eol; $mail_body.="Born: ".$_POST[by].$eol; $mail_body.="Race: "; if ($_POST[select]==0) {$mail_body.="no selected race".$eol;} if ($_POST[select]==3) {$mail_body.="Mini Race (725m)".$eol;} if ($_POST[select]==4) {$mail_body.="Benjamin(e) Race (725m)".$eol;} if ($_POST[select]==5) {$mail_body.="Debutant(e)s Race (1450m)".$eol;} if ($_POST[select]==6) {$mail_body.="Scolaires Race (1450m)".$eol.$eol;} if ($_POST[select]==1 and $_POST[club]<1000) {$mail_body.=$eol."Please make your payment of 7.50EUR to either BGLL IBAN LU52 0030 1182 4440 1000 - CAD or BCEE IBAN LU57 0019 7000 0333 9000 - CAD".$eol."Thank you!".$eol;} $mail_body.=$eol."See you at the Kennedy Stadium in Dudelange on ".$racedate."!".$eol; $mail_body.="Your CA Dudelange".$eol; send_mail($mail_addressee, $mail_body, $racename); $contents_new.=$contents_entry; $contents_new=stripslashes($contents_new); $contents_new=conv_asc2html($contents_new,1); if (strstr($contents_old,$contents_entry)){ disperr("Duplicate entry"); } else { if ($file=fopen($data,"w")) { // update inscription database file $contents_new=$contents_new."\r\n".$contents_old; fputs($file,$contents_new); fclose($file); $contents_old=$contents_new; } if ($file=fopen($bips,"w")) { // update bip database file fputs($file,$bips_new); fclose($file); $bips_old=$bips_new; } } } } // Build here the inscription form echo "
    \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo " \n"; echo "
    first name
    Vorname - Prénom
    last name
    Nachname - Nom
    street name / nbr
    Strasse u. Nr - Rue et numéro
    country and post code
    Land u. PLZ - Pays etCP
    -
    city
    Stadt - ville
    club
    Klub - Club
    \n"; echo " \n"; echo "
    other club
    anderer KLub - autre club
    type of license
    Lizenzart - Type de license
    \n"; echo " \n"; echo "
    gender
    Geschlecht - Sexe
    born year
    Jahrgang - Année de naissance
    race
    Rennen - Course
    \n"; echo " \n"; echo "
    email
    \n"; echo " "; echo "
    \n"; echo " \n"; echo " \n"; echo "
    \n"; echo "
    \n"; } // *** END OF UPDATING CONTENT -- WILL NOT BE EXECUTED WHEN DEADLINE PASSED $contents_old=conv_asc2html($contents_old,2); $ar_row=explode("|#line#|",$contents_old); $recperpage=15; $row_first=1; $row_last=count($ar_row)-1; if (empty($_GET[row_start])){ $_GET[row_start]=$row_first; } $row_end=$_GET[row_start]+$recperpage-1; if ($row_end>$row_last){ $row_end=$row_last; } if ($row_last>$recperpage){ echo "Page : "; for ($p=1; $p<=ceil($row_last / $recperpage); $p++){ if ($p>1){ $start=((($p-1)*$recperpage)+1); } else { $start=1; } echo "[$p] "; } } echo "\n"; for ($r=$_GET[row_start]; $r<=$row_end; $r++){ $ar_field=explode("|#|",$ar_row[$r]); $ldate=$ar_field[0]; $lrace=$ar_field[12]; if ($lrace=="10 km"){ $lrace="Tour de Dudelange (10km)";} $lgender=$ar_field[10]; $lby=$ar_field[11]; $lid=$ar_field[1]; $lname=$ar_field[2]." ".$ar_field[3]; $lclub=$ar_field[8]; $lcountry=$ar_field[5]; echo "\n"; echo "\n"; } echo "
    $ldate $lrace $lgender $lby
    $lid $lname $lclub $lcountry
    \n"; ?>

    last update: 12.02.2019
    PHP script by Claude Schaeffer (based on a script by Ridwank - Thanks guy!)