From c98e670db0be664780ae68e25431d76d8fce95b2 Mon Sep 17 00:00:00 2001 From: dmorley Date: Sun, 29 Jan 2017 14:24:32 -0800 Subject: [PATCH] few misses --- db/add.php | 29 +++++++++++++++-------------- showstats.php | 50 -------------------------------------------------- 2 files changed, 15 insertions(+), 64 deletions(-) delete mode 100644 showstats.php diff --git a/db/add.php b/db/add.php index d54a412..56f5ed0 100644 --- a/db/add.php +++ b/db/add.php @@ -71,25 +71,26 @@ if (stristr($outputssl, 'openRegistrations')) { echo 'Your pod has ssl and is valid
'; $publickey = md5(uniqid($domain, true)); - $sql = 'INSERT INTO pods (domain, email, terms, publickey) VALUES ($1, $2, $3, $4, $5)'; + $sql = 'INSERT INTO pods (domain, email, terms, publickey) VALUES ($1, $2, $3, $4)'; $result = pg_query_params($dbh, $sql, [$_domain, $_email, $_terms, $publickey]); $result || die('Error in SQL query: ' . pg_last_error()); - $to = $adminemail; - $subject = 'New pod added to ' . $_SERVER['HTTP_HOST']; - $headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email]; + if ($_email) { + $to = $adminemail; + $subject = 'New pod added to ' . $_SERVER['HTTP_HOST']; + $headers = ['From: ' . $_email, 'Reply-To: ' . $_email, 'Cc: ' . $_email]; - $message_lines = [ - 'https://' . $_SERVER['HTTP_HOST'], - 'Stats Url: https://api.uptimerobot.com/getMonitors?format=json&noJsonCallback=1&customUptimeRatio=7-30-60-90&apiKey=' . $_stats_apikey, - 'Pod: https://' . $_SERVER['HTTP_HOST'] . '/db/pull.php?debug=1&domain=' . $_domain, - '', - 'Your pod will not show up right away, as it needs to pass a few checks first.', - 'Give it a few hours!', - ]; - - @mail($to, $subject, implode("\r\n", $message_lines), implode("\r\n", $headers)); + $message_lines = [ + 'https://' . $_SERVER['HTTP_HOST'], + 'Pod: https://' . $_SERVER['HTTP_HOST'] . '/db/pull.php?debug=1&domain=' . $_domain, + '', + 'Your pod will not show up right away, as it needs to pass a few checks first.', + 'Give it a few hours!', + ]; + @mail($to, $subject, implode("\r\n", $message_lines), implode("\r\n", $headers)); + } + echo 'Data successfully inserted! Your pod will be reviewed and live on the list in a few hours!'; } else { diff --git a/showstats.php b/showstats.php deleted file mode 100644 index f140b3b..0000000 --- a/showstats.php +++ /dev/null @@ -1,50 +0,0 @@ - 1, 'format' => 'json', 'custom_uptime_ratios' => '7-30-60-90', 'response_times' => 1, 'response_times_average' => 86400, 'api_key' => $key]; -curl_setopt($upti, CURLOPT_URL, 'https://api.uptimerobot.com/v2/getMonitors'); -curl_setopt($upti, CURLOPT_HEADER, 0); -curl_setopt($upti, CURLOPT_POST, 1); -curl_setopt($upti, CURLOPT_POSTFIELDS, http_build_query($data)); -curl_setopt($upti, CURLOPT_RETURNTRANSFER, 1); -curl_setopt($upti, CURLOPT_CONNECTTIMEOUT, 8); -$uptr = json_decode(curl_exec($upti)); -curl_close($upti); -echo 'UptimeRobot Json displayed in Human

'; -echo 'Name: ' . $uptr->monitors[0]->friendly_name . '
'; -echo 'Url: ' . $uptr->monitors[0]->url . '
'; -echo 'Interval: ' . $uptr->monitors[0]->interval . 'ms
'; -echo 'Uptime: ' . $uptr->monitors[0]->all_time_uptime_ratio . '%
'; -echo 'Response Time: ' . round($uptr->monitors[0]->average_response_time) . 'ms
'; -if ($uptr->monitors[0]->status == 2) { - $live = 'Up'; -} -if ($uptr->monitors[0]->status == 0) { - $live = 'Paused'; -} -if ($uptr->monitors[0]->status == 1) { - $live = 'Not Checked Yet'; -} -if ($uptr->monitors[0]->status == 8) { - $live = 'Seems Down'; -} -if ($uptr->monitors[0]->status == 9) { - $live = 'Down'; -} -echo 'Status: ' . $live; -- GitLab