setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
//get input data
$username = $_POST['username'];
$email = $_POST['email'];
$errorMessage = "";
//check to make sure they're not empty.
if(empty($username)) $errorMessage .= "You didn't enter a username. 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($username)) $errormessage.=" You didn't enter a username and an email address !
\n Hit the back browser button to re-enter details.";
$itemid="";
//if there was no error, do the rest of the code.
if(empty($errorMessage))
{
//get a random 8 character string.
$confirmationCode = getRandomString();
//add the person and the confirmation code to the database.
$query = "INSERT INTO 'ecovibdc_Subscribers'.'subscribers' ('itemid','username', 'email', 'confirmationCode', 'Confirmation')
VALUES ('itemid','$username','$email','$confirmationCode','0')";
$result = PDO::query($query) OR die(mysql_error());
//now we want to send them an email telling them to confirm their account.
$to ="";
$subject = "";
$message="";
$headers="";
/* recipients */
$to = $email;
/* subject */
$subject = "Welcome to Ecovib2d !!!!!!!";
/* message */
$message ="
Thank you and hope you enjoy using Ecovib2d!
To unsubscribe, please click the following link: Click here to Unsubscribe.