add.php 674 Bytes
Newer Older
David Morley's avatar
David Morley committed
1 2 3 4 5 6 7
<?php
 include('config.php');
 $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
     if (!$dbh) {
         die("Error in connection: " . pg_last_error());
     }
    
8
     $pingdomurl = pg_escape_string($_POST['url']);
David Morley's avatar
David Morley committed
9 10 11
     $domain = pg_escape_string($_POST['domain']);
     $email = pg_escape_string($_POST['email']);
    
12
     $sql = "INSERT INTO pods (domain, pingdomurl, email) VALUES('$domain', '$pingdomurl', '$email')";
David Morley's avatar
David Morley committed
13 14 15 16 17 18 19 20 21 22 23 24
     $result = pg_query($dbh, $sql);
     if (!$result) {
         die("Error in SQL query: " . pg_last_error());
     }
    
     echo "Data successfully inserted!";
    
     pg_free_result($result);
    
     pg_close($dbh);

?>