Commit 90b67ca4 authored by dmorley's avatar dmorley

more fix

parent bc1157e6
......@@ -13,7 +13,7 @@ require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error());
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden FROM pods WHERE domain = $1';
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,date_created,date_updated,date_laststats,hidden FROM pods WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$_domain]);
$result || die('Error in SQL query: ' . pg_last_error());
......
......@@ -54,7 +54,7 @@ EOF;
}
echo '</feed>';
} elseif ($_format === 'json') {
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,dateCreated,dateUpdated,dateLaststats,hidden,terms,sslexpire,uptime_custom,dnssec,softwarename,total_users,local_posts,comment_counts,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods';
$sql = 'SELECT id,domain,status,secure,score,userrating,adminrating,city,state,country,lat,long,ip,ipv6,statsurl,monthsmonitored,uptime_alltime,responsetime,local_posts,comment_counts,date_created,date_updated,date_laststats,hidden,terms,sslexpire,uptime_custom,dnssec,softwarename,total_users,local_posts,comment_counts,service_facebook,service_twitter,service_tumblr,service_wordpress,service_xmpp FROM pods';
$result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error());
......
......@@ -6,31 +6,37 @@ ALTER TABLE pods RENAME COLUMN xmpp TO service_xmpp;
ALTER TABLE pods RENAME COLUMN uptimelast7 TO uptime_alltime;
ALTER TABLE pods RENAME COLUMN responsetimelast7 TO responsetime;
ALTER TABLE pods RENAME COLUMN dateUpdated TO date_updated;
ALTER TABLE pods RENAME COLUMN dateLaststats TO date_laststats;
ALTER TABLE pods RENAME COLUMN dateCreated TO date_created;
ALTER TABLE pods ALTER COLUMN ipv6 TYPE boolean USING ipv6::boolean;
ALTER TABLE pods ALTER hidden DROP DEFAULT;
ALTER TABLE pods ALTER COLUMN hidden TYPE boolean USING hidden::boolean;
ALTER TABLE pods ALTER COLUMN secure TYPE boolean USING secure::boolean;
ALTER TABLE pods ALTER COLUMN signup TYPE boolean USING signup::boolean;
DROP TABLE users;
CREATE TABLE apikeys (
key text,
email text,
usage int,
dateCreated timestamp DEFAULT current_timestamp
date_created timestamp DEFAULT current_timestamp
);
CREATE TABLE clicks (
domain text,
manualclick int,
autoclick int,
dateClicked timestamp DEFAULT current_timestamp
date_clicked timestamp DEFAULT current_timestamp
);
CREATE TABLE checks (
domain text,
online boolean,
error text,
dateChecked timestamp DEFAULT current_timestamp
date_checked timestamp DEFAULT current_timestamp
);
......@@ -169,7 +169,7 @@ while ($row = pg_fetch_all($result)) {
continue;
echo 'no connection to pod';
$sql = 'INSERT INTO checks (domain, online, error) VALUES ($1, $2)';
$sql = 'INSERT INTO checks (domain, online, error) VALUES ($1, $2, $3)';
$result = pg_query_params($dbh, $sql, [$domain, false, $outputsslerror]);
$result || die('Error in SQL query: ' . pg_last_error());
......@@ -386,7 +386,7 @@ while ($row = pg_fetch_all($result)) {
//sql it
$timenow = date('Y-m-d H:i:s');
$sql = 'UPDATE pods SET secure = $2, hidden = $3, ip = $4, ipv6 = $5, monthsmonitored = $6, uptime_alltime = $7, status = $8, dateLaststats = $9, dateUpdated = $10, responsetime = $11, score = $12, adminrating = $13, country = $14, city = $15, state = $16, lat = $17, long = $18, userrating = $19, shortversion = $20, masterversion = $21, signup = $22, total_users = $23, active_users_halfyear = $24, active_users_monthly = $25, local_posts = $26, name = $27, comment_counts = $28, service_facebook = $29, service_tumblr = $30, service_twitter = $31, service_wordpress = $32, weightedscore = $33, service_xmpp = $34, softwarename = $35, sslvalid = $36, uptime_custom = $37
$sql = 'UPDATE pods SET secure = $2, hidden = $3, ip = $4, ipv6 = $5, monthsmonitored = $6, uptime_alltime = $7, status = $8, date_laststats = $9, date_updated = $10, responsetime = $11, score = $12, adminrating = $13, country = $14, city = $15, state = $16, lat = $17, long = $18, userrating = $19, shortversion = $20, masterversion = $21, signup = $22, total_users = $23, active_users_halfyear = $24, active_users_monthly = $25, local_posts = $26, name = $27, comment_counts = $28, service_facebook = $29, service_tumblr = $30, service_twitter = $31, service_wordpress = $32, weightedscore = $33, service_xmpp = $34, softwarename = $35, sslvalid = $36, uptime_custom = $37
WHERE domain = $1';
$result = pg_query_params($dbh, $sql, [$domain, $secure, $hidden, $ip, $ipv6, $months, $uptime, $status, $statslastdate, $timenow, $responsetime, $score, $adminrating, $country, $city, $state, $lat, $long, $userrating, $shortversion, $masterversion, $signup, $total_users, $active_users_halfyear, $active_users_monthly, $local_posts, $name, $comment_counts, $service_facebook, $service_tumblr, $service_twitter, $service_wordpress, $weightedscore, $service_xmpp, $softwarename, $outputsslerror, $uptime_custom]);
$result || die('Error in SQL query3: ' . pg_last_error());
......
......@@ -43,9 +43,9 @@ CREATE TABLE pods (
dnssec boolean,
comment_counts int,
weight int DEFAULT 50,
dateUpdated timestamp DEFAULT current_timestamp,
dateLaststats timestamp DEFAULT current_timestamp,
dateCreated timestamp DEFAULT current_timestamp
date_updated timestamp DEFAULT current_timestamp,
date_laststats timestamp DEFAULT current_timestamp,
date_created timestamp DEFAULT current_timestamp
);
CREATE TABLE rating_comments (
id serial8 UNIQUE PRIMARY KEY,
......@@ -62,20 +62,20 @@ CREATE TABLE apikeys (
key text,
email text,
usage int,
dateCreated timestamp DEFAULT current_timestamp
date_created timestamp DEFAULT current_timestamp
);
CREATE TABLE clicks (
domain text,
manualclick int,
autoclick int,
dateClicked timestamp DEFAULT current_timestamp
date_clicked timestamp DEFAULT current_timestamp
);
CREATE TABLE checks (
domain text,
online boolean,
error text,
dateChecked timestamp DEFAULT current_timestamp
date_checked timestamp DEFAULT current_timestamp
);
......@@ -6,7 +6,7 @@ Create a monitor for your pod, then in "My Settings" create a monitor-specific A
<form action="https://<?php echo $_SERVER['HTTP_HOST'] ?>/db/add.php" method="post">
<label>Monitor API Key: <input type="text" name="url" class="xlarge span8" placeholder="m58978-80abdb799f6ccf15e3e4ttwe"> (don't copy the period on the end)</label><br>
<label>Pod Domain Name: <input type="text" name="domain" class="xlarge span4" placeholder="domain.com"></label><br>
<label>Pod Terms Link: <input type="text" name="domain" class="xlarge span4" value="/terms" placeholder="/terms"></label><br>
<label>Pod Terms Link: <input type="text" name="terms" class="xlarge span4" value="/terms" placeholder="/terms"></label><br>
<label>Your Email: <input type="text" name="email" class="xlarge span4" placeholder="user@domain.com"></label><br>
<input type="submit" value="submit">
</form>
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