0) { $EmptyFieldCount++; } } else { # not okay, count as empty $EmptyFieldCount++; $frmmrkCaptchaInput=" style=\"background: #ffcccc;\""; } } } if ($EmptyFieldCount==4) { $ThisIs="new"; $frmmrkTitle=""; $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 $frmDescr; global $frmURL; # LOAD STANDARD MESSAGE # new-link.txt $message=load_message("new-link"); $message=str_replace("#TITLE#",$frmTitle,$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 = "Link suggestion"; # $Email1 = "b.boshuizen@tudelft.nl, bart@morechemistry.com"; $Email1 = "b.boshuizen@tudelft.nl"; # $Email3 = ""; mail($Email1, $subject, $message, $headers,'-f info@morechemistry.com'); # header("location: /about_us.html"); $_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 suggestions and to visit morechemistry.com for updates.

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

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

Your link suggestion

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

Your link:

Title
Description
URL
Enter the 'secret' text:

${Instruction}

FORM; return $ThisText; } function create_disabled_for_now() { $ThisText =<<< NOUSER Thank you for your interest adding a link to the morechemistry.com website. Until recently you could enter a form and suggest a link. 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 and manage their links.

We apologize for the inconvenience.

November 30th 2009.

NOUSER; return $ThisText; } ################################# PROGRAM STARTS HERE ################################## $frmTitle=$_REQUEST['frmTitle']; $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); ?>