Combine echo and die statements.

Remove superfluous PHP ending ?>
parent ba6693f3
......@@ -85,4 +85,3 @@ elseif ($_GET['format'] == "json") {
pg_free_result($result);
pg_close($dbh);
}
?>
......@@ -6,24 +6,24 @@ require_once __DIR__ . '/../logging.php';
$log = new Logging();
$log->lfile($log_dir."/add.php.log");
if (!$_POST['url']){
echo "no url given";$log->lwrite('no url given '.$_POST['domain']);
die;
$log->lwrite('no url given '.$_POST['domain']);
die("no url given");
}
if (!$_POST['email']){
echo "no email given";$log->lwrite('no email given '.$_POST['domain']);
die;
$log->lwrite('no email given '.$_POST['domain']);
die("no email given");
}
if (!$_POST['domain']){
echo "no pod domain given";$log->lwrite('no domain given '.$_POST['domain']);
die;
$log->lwrite('no domain given '.$_POST['domain']);
die("no pod domain given");
}
if (!$_POST['url']){
echo "no API key for your stats";$log->lwrite('no api given '.$_POST['domain']);
die;
$log->lwrite('no api given '.$_POST['domain']);
die("no API key for your stats");
}
if (strlen($_POST['url']) < 14){
echo "API key bad needs to be like m58978-80abdb799f6ccf15e3e3787ee";$log->lwrite('api key too short '.$_POST['domain']);
die;
$log->lwrite('api key too short '.$_POST['domain']);
die("API key bad needs to be like m58978-80abdb799f6ccf15e3e3787ee");
}
require_once __DIR__ . '/../config.php';
......@@ -39,10 +39,12 @@ if (!$result) {
}
while ($row = pg_fetch_array($result)) {
if ($row["domain"] == $_POST['domain']) {
echo "domain already exists";$log->lwrite('domain already exists '.$_POST['domain']);die;
$log->lwrite('domain already exists '.$_POST['domain']);
die("domain already exists");
}
if ($row["pingdomurl"] == $_POST['url']) {
echo "API key already exists";$log->lwrite('API key already exists '.$_POST['domain']);die;
$log->lwrite('API key already exists '.$_POST['domain']);
die("API key already exists");
}
}
......@@ -68,11 +70,13 @@ $output = curl_exec($ch);
curl_close($ch);
if (stristr($outputssl, 'nodeName')) {
echo "Your pod has ssl and is valid<br>";$log->lwrite('Your pod has ssl and is valid '.$_POST['domain']);
$log->lwrite('Your pod has ssl and is valid '.$_POST['domain']);
echo "Your pod has ssl and is valid<br>";
$valid=1;
}
if (stristr($output, 'nodeName')) {
echo "Your pod does not have ssl but is a valid pod<br>";$log->lwrite('Your pod does not have ssl but is a valid pod '.$_POST['domain']);
$log->lwrite('Your pod does not have ssl but is a valid pod '.$_POST['domain']);
echo "Your pod does not have ssl but is a valid pod<br>";
$valid=1;
}
if ($valid=="1") {
......@@ -98,4 +102,3 @@ if ($valid=="1") {
echo "Could not validate your pod on http or https, check your setup!<br>Take a look at <a href='https://".$_POST['domain']."/nodeinfo/1.0'>your /nodeinfo</a>";$log->lwrite('Could not validate your pod on http or https, check your setup! '.$_POST['domain']);
}
$log->lclose();
?>
......@@ -29,4 +29,3 @@ while ($row = pg_fetch_array($result)) {
}
pg_free_result($result);
pg_close($dbh);
?>
......@@ -16,4 +16,3 @@ while($entry = $dirh->read()) {
}
}
}
?>
<?php
if (!$_GET['domain']){
echo "no pod domain given";
die;
die("no pod domain given");
}
if (!$_GET['token']){
echo "no token given";
die;
die("no token given");
}
if (strlen($_GET['token']) < 6){
echo "bad token";
die;
die("bad token");
}
$domain = $_GET['domain'];
......@@ -26,10 +23,10 @@ if (!$result) {
}
while ($row = pg_fetch_array($result)) {
if ($row["token"] <> $_GET['token']) {
echo "token not a match";die;
die("token not a match");
}
if ($row["tokenexpire"] < date("Y-m-d H:i:s", time())) {
echo "token expired";die;
die("token expired");
}
//delete pod
if ($_GET['delete'] == $row["token"]){
......@@ -38,14 +35,13 @@ while ($row = pg_fetch_array($result)) {
if (!$result) {
die("Error in SQL query: " . pg_last_error());
} else {
echo "pod removed from DB";
echo "pod removed from DB";
}
}
//save and exit
if ($_GET['save'] == $row["token"]){
if ($_GET['weight'] > 10) {
echo "10 is max weight";
die;
die("10 is max weight");
}
$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']));
......@@ -59,8 +55,7 @@ while ($row = pg_fetch_array($result)) {
@mail( $to, $subject, $message, $headers );
pg_free_result($result);
pg_close($dbh);
echo "Data saved. Will go into effect on next hourly change";
die;
die("Data saved. Will go into effect on next hourly change");
}
//form
......@@ -73,6 +68,4 @@ while ($row = pg_fetch_array($result)) {
echo "<form action='' method='get'><input type=hidden name=delete value=" . $_GET['token'] . "><input type=hidden name=token value=" . $_GET['token'] . "><input type=hidden name=domain value=" . $_GET['domain'] . ">";
echo "WARNING: This can not be undone, you will need to add your pod again if you want back on list: <input type=submit name=submit value=delete><br><br><br>";
}
?>
<?php
$systemTimeZone = system('date +%Z');
if (!$_POST['domain']){
echo "no pod domain given";
die;
die("no pod domain given");
}
$domain = $_POST['domain'];
......@@ -19,12 +18,12 @@ if (!$result) {
}
$rows = pg_num_rows($result);
if ($rows <= 0) {
echo "domain not found";die;
die("domain not found");
}
while ($row = pg_fetch_array($result)) {
if ($_POST['email']){
if ($row["email"] <> $_POST['email']) {
echo "email not a match";die;
die("email not a match");
}
$uuid = md5(uniqid($domain, true));
$expire = date("Y-m-d H:i:s", time() + 2700);
......@@ -57,5 +56,3 @@ while ($row = pg_fetch_array($result)) {
pg_free_result($result);
pg_close($dbh);
}
?>
<?php
if (!$_POST['domain']){
echo "no pod domain given";
die;
die("no pod domain given");
}
if (!$_POST['adminkey']){
echo "no token given";
die;
die("no token given");
}
if (!$_POST['action']){
echo "no action selected";
die;
die("no action selected");
}
$domain = $_POST['domain'];
......@@ -26,7 +23,7 @@ if (!$result) {
}
while ($row = pg_fetch_array($result)) {
if ($adminkey <> $_POST['adminkey']) {
echo "admin key fail";die;
die("admin key fail");
}
//save and exit
if ($_POST['action'] == "delete") {
......@@ -55,4 +52,3 @@ while ($row = pg_fetch_array($result)) {
}
echo $result;
}
?>
......@@ -304,5 +304,3 @@ while ($row = pg_fetch_all($result)) {
}
pg_free_result($result);
pg_close($dbh);
?>
<?php
if (!$_POST['username']){
echo "no username given";
die;
die("no username given");
}
if (!$_POST['userurl']){
echo "no userurl given";
die;
die("no userurl given");
}
if (!$_POST['domain']){
echo "no pod domain given";
die;
die("no pod domain given");
}
if (!$_POST['comment']){
echo "no comment";
die;
die("no comment");
}
if (!$_POST['rating']){
echo "no rating given";
die;
die("no rating given");
}
require_once __DIR__ . '/../config.php';
......@@ -39,4 +34,3 @@ $headers = "From: ".$_POST["email"]."\r\n";
echo "Comment posted!";
pg_free_result($result);
pg_close($dbh);
?>
......@@ -7,4 +7,3 @@ if ($dur > 4500) {
else {
http_response_code(200);
}
?>
......@@ -13,4 +13,3 @@ if (!$result) {
$row = pg_fetch_all($result);
if ($row[0]['secure'] == "true") {$ssl="s";} else {$ssl="";}
header("Location: http" . $ssl . "://" . $row[0]['domain'] . "/users/sign_up");
?>
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