Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!count($_POST)){
- die();
- }
- if(isset($_POST['subject'])){
- $subject = $_POST['subject'];
- } else {
- $subject = 'Subscription Request';
- }
- mail('email@gmail.com,email@email.com',$subject,print_r($_POST,true));
- $servername = "localhost";
- $username = "inthemoodus1";
- $password = "fQtl+QOZ5kIC";
- $dbname = "email";
- //try {
- //Creating connection for mysql
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- // set the PDO error mode to exception
- //$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- //echo "Connected successfully";
- // $sql = "INSERT INTO emails (emailaddress)
- // VALUES ('".$_POST['email']."')";
- // if ($conn->query($sql)) {
- // //echo '<p style="color:green">successfully added ' . $email . ' to our database <p/>';
- // }
- // else{
- // //echo '<p style="color:red;font-weight:bold;">unable to add ' . $email . ' to our database <p/>';
- // }
- $sql = "SELECT id FROM emails
- WHERE emailaddress = ('".$_POST['email']."')";
- if ($result = $conn->query($sql)) {
- //echo '<p style="color:green">successfully added ' . $email . ' to our database <p/>';
- $id = current($result)['id'];
- }
- else{
- //echo '<p style="color:red;font-weight:bold;">unable to add ' . $email . ' to our database <p/>';
- }
- $sql = "UPDATE emails
- SET first_name = ('".$_POST['firstname']."'),
- last_name = ('".$_POST['lastname']."'),
- first_name2 = ('".$_POST['firstname2']."'),
- last_name2 = ('".$_POST['lastname2']."'),
- email = ('".$_POST['email']."'),
- device = ('".$_POST['radio1']."'),
- device2 = ('".$_POST['radio2']."')
- WHERE id = $id";
- if ($conn->query($sql)) {
- //echo '<p style="color:green">successfully added ' . $email . ' to our database <p/>';
- }
- else{
- //echo '<p style="color:red;font-weight:bold;">unable to add ' . $email . ' to our database <p/>';
- }
- $sql = "INSERT INTO emails (emailaddress, first_name, last_name, device)
- VALUES (
- '".$_POST['partner_email']."',
- '".$_POST['partner_firstN']."',
- '".$_POST['partner_lastN']."',
- '".$_POST['radio2']."'
- )";
- if ($conn->query($sql)) {
- //echo '<p style="color:green">successfully added ' . $email . ' to our database <p/>';
- }
- else{
- //echo '<p style="color:red;font-weight:bold;">unable to add ' . $email . ' to our database <p/>';
- }
- $sql = "UPDATE emails
- SET partner_id = id
- WHERE emailaddress = partner_email";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement