Commit 8bfcd3bc authored by dmorley's avatar dmorley

allow save

parent 8ce76218
......@@ -29,32 +29,39 @@ echo "token not a match";die;
if ($row["tokenexpire"] < date("Y-m-d H:i:s", time())) {
echo "token expired";die;
}
echo "Authorized to edit <b>" . $domain . "</b> until " .$row["tokenexpire"] . "<br>";
echo "Stats URL <input type=text size=100 value=" .$row["pingdomurl"] . "><br>";
echo "Email <input type=text size=40 value=" .$row["email"] . "><br>";
echo "Weight <input type=text size=2 value=" .$row["weight"] . "> This lets you weight your pod lower on the list if you have too much trafic coming in<br>";
echo "save button goes here<br><br><br>";
echo "delete button with big warning its forever<br>";
//save and exit
if ($_GET['save'] == $row["token"]){
if ($_GET['weight'] > 10) {
echo "10 is max weight";
die;
}
if ($sfsdthis == 1) {
$expire = date("Y-m-d H:i:s", time() + 7000);
$sql = "UPDATE pods SET token=$1, tokenexpire=$2 WHERE domain = '$domain'";
$result = pg_query_params($dbh, $sql, array($uuid,$expire));
$sql = "UPDATE pods SET email=$1, pingdomurl=$2, weight=$3 WHERE domain = $4";
$result = pg_query_params($dbh, $sql, array($_GET['email'],$_GET['pingdomurl'],$_GET['weight'],$_GET['domain']));
if (!$result) {
die("Error in SQL query: " . pg_last_error());
}
$to = $_POST["email"];
$subject = "Temporary edit key for poduptime ";
$message = "Link: https://podupti.me/db/edit.php?domain=" . $_POST["domain"] . "&token=" . $uuid . " Expires: " . $expire . "\n\n";
$headers = "From: support@diasp.org\r\n";
@mail( $to, $subject, $message, $headers );
$to = $_GET["email"];
$subject = "Edit notice from poduptime ";
$message = "Data for " . $_GET["domain"] . " Updated. If it was not you reply and let me know! \n\n";
$headers = "From: support@diasp.org\r\nCc:support@diasp.org,". $_GET['oldemail'] ."\r\n";
@mail( $to, $subject, $message, $headers );
echo "Link sent to your email";
pg_free_result($result);
pg_close($dbh);
echo "Data saved. Will go into effect on next hourly change";
die;
}
//form
echo "Authorized to edit <b>" . $domain . "</b> until " .$row["tokenexpire"] . "<br>";
echo "<form action='' method='get'><input type=hidden name=oldemail value=" . $row["email"] . "><input type=hidden name=save value=" . $_GET['token'] . "><input type=hidden name=token value=" . $_GET['token'] . "><input type=hidden name=domain value=" . $_GET['domain'] . ">";
echo "Stats <input type=text size=50 name=pingdomurl value=" .$row["pingdomurl"] . ">full URL if pingdom, just API key if Uptimerobot<br>";
echo "Email <input type=text size=20 name=email value=" .$row["email"] . "><br>";
echo "Weight <input type=text size=2 name=weight value=" .$row["weight"] . "> This lets you weight your pod lower on the list if you have too much trafic coming in, 10 is the norm use lower to move down the list.<br>";
echo "<input type=submit name=submit><br><br><br>";
echo "delete button soon, remove your stats data and save to goto hidden list for now.<br>";
}
?>
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