Back to start " ; echo $line3; } // connect to the database $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); if ($Value == "blog"){ $new_win = ""; echo $new_win; } else { // Value equals unsubscribe $stmt =$conn->prepare("SELECT FROM Customers WHERE email = :Email”); $stmt->bindValue(':Email', $Email); $stmt->execute(); $stmt1=$conn->prepare(“SELECT FROM CustomersArt WHERE emailadd = :Email”); $stmt1->bindValue(':Email', $Email); $stmt1->execute(); $stmt2=$conn->prepare(“SELECT FROM CustomersVideo WHERE emailaddr = :Email”); $stmt2->bindValue(':Email', $Email); $stmt2->execute(); $stmt3=$conn->prepare(“SELECT FROM emaillcomm WHERE emailaddress = :Email”); $stmt3->bindValue(':Email', $Email); $stmt3->execute(); $stmt4=$conn->prepare(“SELECT FROM subscribers WHERE emailsub = :Email"); $stmt4->bindValue(':Email', $Email); $stmt4->execute(); if ($stmt || $stmt1 || $stmt2 || $stmt3 || $stmt4){ // email found - delete the email in the database $sth0 = $conn->prepare("DELETE FROM Customers WHERE email = :Email”); $sth0-> bindValue(':Email', $Email); $sth0 -> execute(); $sth1=$conn->prepare (“DELETE FROM CustomersArt WHERE emailadd = :Email”); $sth1-> bindValue(':Email', $Email); $sth1 -> execute(); $sth2=$conn->prepare(“DELETE FROM CustomersVideo WHERE emailaddr = :Email”); $sth2-> bindValue(':Email', $Email); $sth2 -> execute(); $sth3=$conn->prepare(“DELETE FROM emaillcomm WHERE emailaddress = :Email”); $sth3-> bindValue(':Email', $Email); $sth3-> execute(); $sth4=$conn->prepare(“DELETE FROM subscribers WHERE emailsub = :Email"); $sth4-> bindValue(':Email', $Email); $sth4 -> execute(); $new_win2 = ""; echo $new_win2; $to ="tudsy@ecovib2d.com.au"; $subject = ""; /* subject */ $subject = $Email.' has unsubscribed at '.$Dateof; imap_mail($to,$subject,' ',' ',NULL,NULL,NULL); /* write to file */ $fp=fopen('GDPR_ePR.dat', 'a'); fwrite($fp,$Email.' has unsubscribed on '.$Dateof. " \r\n "); fclose($fp); $conn = null; } else { // or not exit(‘Hi’); } } } catch(PDOException $e) { echo "Error Message: " . $e->getMessage(); echo "
"; } ?>