fix random, rename to go, link pods out for stats

parent 2e4b29ee
...@@ -4,10 +4,15 @@ require_once __DIR__ . '/config.php'; ...@@ -4,10 +4,15 @@ require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass"); $dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$dbh || die('Error in connection: ' . pg_last_error()); $dbh || die('Error in connection: ' . pg_last_error());
$sql = "SELECT * FROM pods WHERE adminrating <> -1 AND hidden <> 'yes' AND uptimelast7 > 95 AND masterversion = shortversion AND signup = 1 ORDER BY RANDOM() LIMIT 1"; $url = $_GET['url'];
if ($url) {
header('Location:' .$url);
} else {
$sql = "SELECT secure,domain FROM pods WHERE score > 90 AND masterversion = shortversion AND signup = 1 ORDER BY RANDOM() LIMIT 1";
$result = pg_query($dbh, $sql); $result = pg_query($dbh, $sql);
$result || die('Error in SQL query: ' . pg_last_error()); $result || die('Error in SQL query: ' . pg_last_error());
$row = pg_fetch_all($result); $row = pg_fetch_all($result);
$scheme = $row[0]['secure'] === 'true' ? 'https://' : 'http://'; $scheme = $row[0]['secure'] === 'true' ? 'https://' : 'http://';
header('Location: http' . $scheme . $row[0]['domain'] . '/users/sign_up'); header('Location:' . $scheme . $row[0]['domain'] . '/users/sign_up');
}
...@@ -66,7 +66,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi ...@@ -66,7 +66,7 @@ $simpleview = !($advancedview || $mapview || $cleanup || $podmin || $podminedi
Data last refreshed: <br><?php echo date('F d Y H:i:s.', filemtime($lastfile)); ?> EST Data last refreshed: <br><?php echo date('F d Y H:i:s.', filemtime($lastfile)); ?> EST
</div> </div>
<div class="main col-md-10 offset-md-2"> <div class="main col-md-10 offset-md-2">
<a href="random.php" class="btn btn-sm btn-success">Confused? Auto pick a pod for you.</a> <a href="go.php" class="btn btn-sm btn-success">Confused? Auto pick a pod for you.</a>
<div class="row placeholders"> <div class="row placeholders">
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
......
...@@ -53,7 +53,7 @@ $numrows = pg_num_rows($result); ...@@ -53,7 +53,7 @@ $numrows = pg_num_rows($result);
$row['uptimelast7'], $row['uptimelast7'],
$row['score'] $row['score']
); );
echo '<tr><td><div title="' . $tip . '" data-toggle="tooltip" data-placement="bottom"><a class="' . $class . ' url" target="_self" href="' . $scheme . $row['domain'] . '">' . $row['domain'] . '</a></div></td>'; echo '<tr><td><div title="' . $tip . '" data-toggle="tooltip" data-placement="bottom"><a class="' . $class . ' url" target="_self" href="/go.php?url=' . $scheme . $row['domain'] . '">' . $row['domain'] . '</a></div></td>';
echo '<td>' . $row['uptimelast7'] . '%</td>'; echo '<td>' . $row['uptimelast7'] . '%</td>';
echo '<td data-toggle="tooltip" data-placement="bottom" title="active six months: ' . $row['active_users_halfyear'] . ', active one month: ' . $row['active_users_monthly'] . '">' . $row['active_users_halfyear'] . '</td>'; echo '<td data-toggle="tooltip" data-placement="bottom" title="active six months: ' . $row['active_users_halfyear'] . ', active one month: ' . $row['active_users_monthly'] . '">' . $row['active_users_halfyear'] . '</td>';
......
...@@ -54,7 +54,7 @@ $numrows = pg_num_rows($result); ...@@ -54,7 +54,7 @@ $numrows = pg_num_rows($result);
$tip .= "\n This {$row['softwarename']} pod {$pod_name} has been watched for {$row['monthsmonitored']} months with an uptime of {$row['uptimelast7']}% this month and a response time average today of {$row['responsetimelast7']}ms was last checked on {$row['dateupdated']}. "; $tip .= "\n This {$row['softwarename']} pod {$pod_name} has been watched for {$row['monthsmonitored']} months with an uptime of {$row['uptimelast7']}% this month and a response time average today of {$row['responsetimelast7']}ms was last checked on {$row['dateupdated']}. ";
$tip .= "On a scale of 100 this pod is a {$row['score']} right now"; $tip .= "On a scale of 100 this pod is a {$row['score']} right now";
echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" class="' . $class . '" target="_self" href="' . $scheme . $row['domain'] . '">' . $row['domain'] . '</a></td>'; echo '<tr><td><a title="' . $tip . '" data-toggle="tooltip" data-placement="bottom" class="' . $class . '" target="_self" href="/go.php?url=' . $scheme . $row['domain'] . '">' . $row['domain'] . '</a></td>';
if (stristr($row['shortversion'], 'head')) { if (stristr($row['shortversion'], 'head')) {
$version = '.dev'; $version = '.dev';
......
...@@ -51,7 +51,7 @@ foreach ($csv as $cords) { ...@@ -51,7 +51,7 @@ foreach ($csv as $cords) {
'type': 'Feature', 'type': 'Feature',
'id': '1', 'id': '1',
'properties' : { 'properties' : {
'html': '{$pod_name}<br><a href="{$scheme}{$row['domain']}">Visit</a><br> Open Signup: {$signup}<br> Users: {$row['active_users_halfyear']}<br> Uptime: {$row['uptimelast7']}%<br> Services:{$feat}' 'html': '{$pod_name}<br><a href="/go.php?url={$scheme}{$row['domain']}">Visit</a><br> Open Signup: {$signup}<br> Users: {$row['active_users_halfyear']}<br> Uptime: {$row['uptimelast7']}%<br> Services:{$feat}'
}, },
'geometry': { 'geometry': {
'type': 'Point', 'type': 'Point',
......
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