13){ try { function getRandomString() { $length = 8; //string of all possible characters to go into the code $passwordRandomString = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789"; //initialize the new code string $newPW = ""; //seed the random function srand(); //go through to generate a random code. for($x=0; $x < $length; $x++) { $newPW .= substr($passwordRandomString,rand(0,62),1); } return $newPW; } $ConfirmationCode = getRandomString(); $confirmation=0; $Email = $_POST['email']; $fname=$_POST["FirstName"]; $sname = $_POST["SurName"]; $name = $fname." ".$sname; $itemid =" "; $phone = $_POST['phone']; $terms =$_POST['terms']; $today=time(); $dateof=date('y-m-d',strtotime('+0 day',$today)); // connect to the database $servername = "localhost"; $user = "ecovibdc_tudsy66"; $password = "power99661"; $conn = new PDO("mysql:host=$servername;dbname=ecovibdc_Subscribers", $user, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); //add the person to the database $query = "INSERT INTO emailcomm (emailcommitemid,Ageofcommmember,nameofcommmember,emailaddress,phonenumberofcomm,termsofcom,ConfirmationCode,Confirmation) VALUES ('$itemid','$age','$name','$Email','$phone','$terms','$ConfirmationCode','$confirmation')"; $conn->query($query) OR die(mysql_error()); $count++; $fp=fopen('numofcommmem.dat','w'); fwrite($fp,$count); fclose($fp); $to ="ecovib2d@live.com"; $subject = ""; /* subject */ $subject = $Email." has subscribed to the community on ".$dateof; mail($to,$subject,' ',' '); if(isset($name) && isset($_POST['email'] )){ $username = $name; $Email = $_POST['email']; } $errorMessage = ""; //check to make sure they're not empty. if(empty($fname) && empty($sname)) $errorMessage .= "You didn't enter your name. Hit the back browser button to enter your username.
\n "; if(empty($Email)) $errorMessage .= "You didn't enter an email address.
\n Hit the back browser button to enter your email address."; if(empty($Email) && empty($fname) && empty($sname)) $errorMessage.="You didn't enter an username and an email address !
\n Hit the back browser button to re-enter details."; //if there was no error, send them them the email if(empty($errorMessage)) { // Generate random hash to use as e-mail multipart_boundary $rnd_hash = md5(date("r", time())); $subject = "Welcome to the ECOVIB2D Community!"; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"Multipart_Boundary_{$rnd_hash}\"\r\n"; $headers .= "From: \"ADRIAN \" \r\n"; $message = "--Multipart_Boundary_{$rnd_hash}\r\n"; $message .= "Content-Type: text/plain; charset=UTF-8\r\n"; $message .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $message .= "Ecovib2d Confirmation:\r\n"; $message .= "You are receiving this email because you filled out a registration form on this website. If you did not subscribe, you can simply delete this email. No further action is required. To complete confirmation and add your subscription, please click on the following link: https://ecovib2d.com.au/workfromhome/Emailcomm/confirm.php?c=$ConfirmationCode&t=$to As mentioned, for joining the community you will receive a free eBook (Click the following link: https://ecovib2d.com.au/workfromhome/Emailcomm/handymanbiz1.pdf). To Unsubscribe - Click this link: https://ecovib2d.com.au//workfromhome/unsubscribe/Usubscribe.php Thank you and hope you enjoy using Ecovib2d!"; $message .= "--Multipart_Boundary_{$rnd_hash}\r\n"; $message .= "Content-Type: text/html; charset=UTF-8\r\n"; $message .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $message .= "\r\n"; $message .= "\r\n"; $message .= "\r\n"; $message .= "\r\n"; $message .= "

Welcome to the Ecovib2d Community

\r\n"; $message .= "Ecovib2d Confirmation:\r\n"; $message .= "

You are receiving this email because you filled out a registration form on this website. If you did not subscribe, you can simply delete this email. No further action is required. To complete confirmation and add your subscription, please click on the following link: https://ecovib2d.com.au/workfromhome/subscribe/confirm.php?c=$ConfirmationCode&t=$to As mentioned, for joining the community you will receive a free eBook (Click the following link: https://ecovib2d.com.au/workfromhome/Emailcomm/handymanbiz1.pdf). To Unsubscribe - Click this link: https://ecovib2d.com.au//workfromhome/unsubscribe/Usubscribe.php

\r\n"; $message .= "\r\n"; $message .= "\r\n"; $message .= "--Multipart_Boundary_{$rnd_hash}--\r\n"; $message = wordwrap($message, 71); mail($Email, $subject, $message, $headers); $line =""; echo $line; } } catch(PDOException $e) { echo "Error Message: " . $e->getMessage(); $line3 = " Try again !" ; echo $line3; } $conn=null; } else{ echo 'You are under 13-You need parental consent to subscribe'; echo " Back to my site"; } ?>