0) { $EmptyFieldCount++; } } else { # not okay, count as empty $EmptyFieldCount++; $frmmrkCaptchaInput=" style=\"background: #ffcccc;\""; } } } if ($EmptyFieldCount==7) { $ThisIs="new"; $frmmrkTitle=""; $frmmrkWhere=""; $frmmrkWhenBegin=""; $frmmrkWhenEnd=""; $frmmrkDescr=""; $frmmrkURL=""; $frmmrkCaptchaInput=""; } else { if ($EmptyFieldCount==0) { $ThisIs="complete"; } else { # allways mark the captcha field as 'empty' $frmmrkCaptchaInput=" style=\"background: #ffcccc;\""; $ThisIs="incomplete"; $Instruction="Please enter all the fields, notably the coloured fields."; } } return $ThisIs; } # send message to admin (and/or client) function inform_admin() { global $frmTitle; global $frmWhere; global $frmWhenBegin; global $frmWhenEnd; global $frmDescr; global $frmURL; # LOAD STANDARD MESSAGE # new-event.txt $message=load_message("new-event"); $message=str_replace("#TITLE#",$frmTitle,$message); $message=str_replace("#WHERE#",$frmWhere,$message); $message=str_replace("#WHENBEGIN#",$frmWhenBegin,$message); $message=str_replace("#WHENEND#",$frmWhenEnd,$message); $message=str_replace("#DESCR#",$frmDescr,$message); $message=str_replace("#URL#",$frmURL,$message); # message to admin $headers = "MIME-Version: 1.0\r\n"; $headers.= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "From: www.morechemistry.com \r\n"; $headers.= "Reply-to: info@morechemistry.com\r\n"; # $headers.= "Envelope-from: info@morechemistry.com\r\n"; $subject = "Event suggestion"; $Email1 = "b.boshuizen@tudelft.nl"; mail($Email1, $subject, $message, $headers,'-f info@morechemistry.com'); $_SESSION['encoded_captcha'] = md5('default' . 'my_secret_key'); } function create_thank_you_message() { $ThisText =<<< THANKYOU

Thank you!

Thank you for your suggestion. We will evaluate it as soon as possible. In the mean time feel free to make additional suggestion and to visit morechemistry.com for updates.

You can manage your events yourself with your own morechemistry.com account.

THANKYOU; return $ThisText; } function create_form() { global $frmTitle; global $frmWhere; global $frmWhenBegin; global $frmWhenEnd; global $frmDescr; global $frmURL; global $frmCaptchaInput; global $frmmrkTitle; global $frmmrkWhere; global $frmmrkWhenBegin; global $frmmrkWhenEnd; global $frmmrkDescr; global $frmmrkURL; global $frmmrkCaptchaInput; global $Instruction; $ThisText =<<< FORM

Your event suggestion

Enter the following fields and press the submit button. We will evaluate your suggestion as soon as possible.

Your event:

Title
Where
When (begin-end)  
Description
URL
Enter the 'secret' text:

${Instruction}

FORM; return $ThisText; } function create_disabled_for_now() { $ThisText =<<< NOUSER Thank you for your interest in becoming a member of the morechemistry.com community. Being a member allows you to put chemistry related links and events on our website.

Until recently you could enter a form and start adding links and events. However, due to too many false admissions this service had to be disabled. After we have made the necessary precautionary measures this service will be re-enabled.

Meanwhile existing members can still log in.

We apologize for the inconvenience.

November 4th 2009.

NOUSER; return $ThisText; } ################################# PROGRAM STARTS HERE ################################## $frmTitle=$_REQUEST['frmTitle']; $frmWhere=$_REQUEST['frmWhere']; $frmWhenBegin=$_REQUEST['frmWhenBegin']; $frmWhenEnd=$_REQUEST['frmWhenEnd']; $frmDescr=$_REQUEST['frmDescr']; $frmURL=$_REQUEST['frmURL']; $frmCaptchaInput=$_REQUEST['frmCaptchaInput']; $FormStatus=check_form(); if (($FormStatus == "new") or ($FormStatus == "incomplete")) { $SpecificText=create_form(); } else { inform_admin(); $SpecificText=create_thank_you_message(); } $SpecificText=create_disabled_for_now(); $content.=$SpecificText; layout_show($layoutpage,$content,$googlecode,$title,$keywords,$description); ?>