0) { $EmptyFieldCount++; } } else { # not okay, count as empty $EmptyFieldCount++; $frmmrkCaptchaInput=" style=\"background: #ffcccc;\""; } } } if ($EmptyFieldCount==3) { $ThisIs="new"; $frmmrkName=""; $frmmrkEmail=""; $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; } # add user step 1 - select a password function add_user_step_1() { global $NewID; global $NewPasswd; # set user ID $NewID="${remoteName}.${currentTime}"; # select a password $NewPasswd = ''; for ($i=0; $i<7; $i++) { //PICK A RANDOM LOWERCASE LETTER USING ASCII CODE $NewPasswd .= chr(rand(97,122)); } } # add user step 2 - add user to database function add_user_step_2() { global $frmName; global $frmEmail; global $NewPasswd; $encodedPasswd=md5($NewPasswd . 'my_secret_key'); $ip=$_SERVER['REMOTE_ADDR']; $t=time(); $newlongid=$ip.'.'.$t; $names= "UserID, UserLongID, UserName, UserNickname, UserKey1, UserKey2, UserPasswd, UserHint, UserRole, UserVisibility, UserURL, UserProfile, UserLastLogin"; $values="'', "; // UserID $values.="'$newlongid', "; // UserLongID $values.="'$frmName', "; // UserName $values.="'$frmName', "; // UserNickname $values.="'$frmEmail', "; // UserKey1 $values.="'$frmEmail', "; // UserKey2 $values.="'$encodedPasswd', "; // UserPasswd $values.="'', "; // UserHint $values.="'', "; // UserRole $values.="'', "; // UserVisibility $values.="'', "; // UserURL $values.="'', "; // UserProfile $values.="''"; // UserLastLogin $insert = "INSERT INTO users_copy ($names) VALUES ($values)"; mysql_query($insert) or die(mysql_error()); # dbmopen(%UserHash, "${dirData}users/listed", 0600); # $UserHash{$frmEmail}="${NewID}|${frmName}|${NewPassWd}|$NewHint|${frmBasicUrl}|${currentTime}|${Spare}"; # dbmclose(%UserHash); } # add user step 3 - send new user a mail message function add_user_step_3() { global $frmName; global $frmEmail; global $NewPasswd; $ip=$_SERVER['REMOTE_ADDR']; $t=time(); $newlongid=$ip.'.'.$t; # LOAD STANDARD MESSAGE # new-member.txt $message=load_message("new-member"); $message=str_replace("#NAME#",$frmName,$message); $message=str_replace("#EMAIL#",$frmEmail,$message); $message=str_replace("#PASSWD#",$NewPasswd,$message); $message=str_replace("#IP#",$ip,$message); $message=str_replace("#LONGID#",$newlongid,$message); # message to new member $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 = "User account"; $Email1 = "b.boshuizen@tudelft.nl, bart@morechemistry.com"; $Email2 = $frmEmail; # $Email3 = ""; mail($Email1, $subject, $message, $headers,'-f info@morechemistry.com'); # header("location: /about_us.html"); $_SESSION['encoded_captcha'] = md5('default' . 'my_secret_key'); # message to administrator } # add user function add_user() { add_user_step_1(); add_user_step_2(); add_user_step_3(); } function create_specific_text_for_old_user() { $ThisText =<<< OLDUSER Dear ${frmName} (${frmEmail}),

You are already a member of the morechemistry.com community.

You should already have received an email message containing your password. In case you didn't receive such a message please contact the webmaster.

OLDUSER; return $ThisText; } function create_thank_you_message() { global $frmName; global $frmEmail; $ThisText =<<< NEWUSER

Thank you!

Thank you ${frmName} for becoming a member of the morechemistry.com community.

An email message containing your password has been sent to ${frmEmail}. You require both this password and email address to obtain access to your morechemistry.com account.

NEWUSER; return $ThisText; } function create_form() { global $frmEmail; global $frmName; global $frmCaptchaInput; global $frmmrkEmail; global $frmmrkName; global $frmmrkCaptchaInput; global $Instruction; $ThisText =<<< FORM

Membership details

Before becoming a member please read about the membership details. This will you inform you on 'member admittance', 'member services', 'member conduct' and 'member rights'.

Fill in this form

Enter the following three fields and press the submit button and you are well on your way to become a member of the morechemistry.com community.

1.Your email address
This must be typed correctly. If typed incorrectly you cannot receive the email message containing your password.
2. Your name
This is what we will call you when you are logged in or in case we send you an email message.
3. Enter the 'secret' text:

${Instruction}

And this is what happens next..

If this is a new request to become a member, you will see a welcome message on your screen. At the same time an email message will be send to the abovementioned email address. This message contains the password that will give you access to your morechemistry.com account.

FORM; return $ThisText; } function create_disabled_for_now() { $ThisText =<<< NOUSER2009 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.

NOUSER2009; return $ThisText; } function create_disabled_2021() { $ThisText =<<< NOUSER2021

Membership of the morechemistry.com community is a thing of the past. In stead of a community driven collection of chemistry related links and events, morechemistry.com now focusses on presenting information on the use of the Thermo Fisher K-Alpha XPS.

Google will still help you find information on LabVIEW, Colours and Dyes and on food additves

May 11th 2021.

NOUSER2021; return $ThisText; } ################################# PROGRAM STARTS HERE ################################## $frmName=$_REQUEST['frmName']; $frmEmail=$_REQUEST['frmEmail']; $frmCaptchaInput=$_REQUEST['frmCaptchaInput']; #&get_active_user; #&find_user($frmEmail); $FormStatus=check_form(); if (($FormStatus == "new") or ($FormStatus == "incomplete")) { $SpecificText=create_form(); } else { # first do other checks # e.g. exist if existing # if ($rUser) # { # $SpecificText=create_specific_text_for_old_user(); # } # else # { # find_hostname; # add_user; # $SpecificText=create_thank_you_message(); # } add_user(); $SpecificText=create_thank_you_message(); } $SpecificText=create_disabled_2021(); $content.=$SpecificText; layout_show($layoutpage,$content,$googlecode,$title,$keywords,$description); ?>