astrXbian/www/boris/ajax.php

36 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php
$headers = "From: support@qo-op.com"; // Who should it come from?
$to = "support@qo-op.com"; // Your email address
$subject = "Astroport qo-op BLOB";
2021-08-11 05:00:57 +02:00
$arguments = getopt("l:p:"); // php ajax.php -l "https://myserve.com/link.html"
if (isset($_REQUEST['link'])) $link = $_REQUEST['link']; else $link = urldecode($arguments['l']);
2021-08-11 05:00:57 +02:00
if (isset($_REQUEST['phone'])) $phone = $_REQUEST['phone']; else $phone = urldecode($arguments['p']);
2021-08-11 05:00:57 +02:00
$message = "Proposition de ". $phone ." message : ".$link;
2021-08-12 11:45:22 +02:00
$TIMESTAMP=system("date -u +%s%N | cut -b1-13", $retval);
2021-08-12 11:32:19 +02:00
print_r($TIMESTAMP);
2021-08-12 11:00:01 +02:00
$YOU=system("ps u -C ipfs | tail -n 1 | cut -f 1 -d ' '", $retval);
2021-08-12 11:32:19 +02:00
print_r($YOU);
2021-08-12 11:42:27 +02:00
//$IPFSNODEID=curl_exec("http://127.0.0.1:5001/ipns/");
//print_r($IPFSNODEID);
2021-08-12 11:25:39 +02:00
2021-08-12 11:32:19 +02:00
// WRITE MESSAGE LOCALY
2021-08-12 11:42:27 +02:00
$myfile = fopen("/home/".$YOU."/astroport/www/".$TIMESTAMP.".newfile.txt", "w") or die("Unable to open file!");
2021-08-12 10:49:35 +02:00
fwrite($myfile, $message);
fclose($myfile);
2021-08-12 11:32:19 +02:00
// WRITE MESSAGE TO IPFS
2021-08-12 11:42:27 +02:00
//$myfile = fopen("/home/".$YOU."/.zen/ipfs/.$IPFSNODEID/astroport/www/newfile.txt", "w") or die("Unable to open file!");
//fwrite($myfile, $message);
//fclose($myfile);
2021-08-12 11:32:19 +02:00
2021-08-11 05:30:02 +02:00
error_log("SEND ". $phone ." message : ".$link );
mail($to, $subject, $message, $headers);
echo "OK";
?>