<?php

/*
 STORE THE TPP NOTIFICATION IN A DATABASE

 Usefull to use as a notification URL in TPP
*/

 
header("Access-Control-Allow-Origin: *");

require("../shared/functions.php");

$db = connecti('mvalezy');


//$db->query("CREATE TABLE NotificationsTPP LIKE NotificationsWallet;");



$rawPostData = file_get_contents("php://input");
    
$notification    = $db->real_escape_string($rawPostData);

$query_ins = "INSERT INTO NotificationsTPP SET content = '$notification'";
$sql = $db->query($query_ins);

echo "OK<hr><b>Content</b><br>";

echo "<textarea style='width:90%;height:200px;' disabled>$rawPostData</textarea>";
echo "<hr><b>Headers</b><br>";
foreach (getallheaders() as $name => $value) {
    echo "$name: $value\n<br>";
}


?>