Commit f0d68b1d authored by dmorley's avatar dmorley

deal with blank api key

parent 6688da24
......@@ -110,7 +110,9 @@ echo "✪";
<input name="comments" size=10>
<input name="domain" value="<?php echo $row["domain"] ?>" type="hidden">
<input name="adminkey" value="<?php echo $_COOKIE["adminkey"] ?>" type="hidden">
<input type="submit" value="Delete">
<input name="action" type="radio" value="warn">warn
<input name="action" type="radio" value="delete">delete
<input type="submit" value="Process">
</form>
</td>
<?php
......
......@@ -8,6 +8,11 @@ if (!$_POST['adminkey']){
echo "no token given";
die;
}
if (!$_POST['action']){
echo "no action selected";
die;
}
$domain = $_POST['domain'];
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
if (!$dbh) {
......@@ -23,7 +28,7 @@ if ($adminkey <> $_POST['adminkey']) {
echo "admin key fail";die;
}
//save and exit
if ($_POST['action'] == "delete") {
$sql = "DELETE from pods WHERE domain = $1";
$result = pg_query_params($dbh, $sql, array($domain));
if (!$result) {
......@@ -38,6 +43,17 @@ echo "admin key fail";die;
}
pg_free_result($result);
pg_close($dbh);
} elseif ($_POST['action'] == "warn") {
if ($row["email"]) {
$to = $row["email"];
$subject = "Pod removal warning from poduptime ";
$message = "Pod " . $_POST["domain"] . " is on the list to be deleted now because: " . $_POST["comments"] . ". \n\n Please let me know if you need help fixing before it is removed. \n\n";
$headers = "From: support@diasp.org\r\nCc:support@diasp.org,". $row["email"] ."\r\n";
@mail( $to, $subject, $message, $headers );
}
}
header( 'Location: https://podupti.me/?cleanup=true' ) ;
}
......
......@@ -307,6 +307,7 @@ $score=$score-2;
$up2 = substr ($uptimerobot, strlen($json_encap) - 1, strlen ($uptimerobot) - strlen($json_encap));
$uptr = json_decode($up2);
if ($debug) {print_r($uptr);}
if (!$uptr) {$score=$score-2;}
$responsetime = 'n/a';
$uptimerobotstat = $uptr->stat;
$uptime = $uptr->monitors->monitor{'0'}->alltimeuptimeratio;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment