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

parent 2e4b29ee
......@@ -4,10 +4,15 @@ require_once __DIR__ . '/config.php';
$dbh = pg_connect("dbname=$pgdb user=$pguser password=$pgpass");
$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 || die('Error in SQL query: ' . pg_last_error());
$row = pg_fetch_all($result);
$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
Data last refreshed: <br><?php echo date('F d Y H:i:s.', filemtime($lastfile)); ?> EST
</div>
<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>
<div class="table-responsive">
......
......@@ -53,7 +53,7 @@ $numrows = pg_num_rows($result);
$row['uptimelast7'],
$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 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);
$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";
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')) {
$version = '.dev';
......
......@@ -51,7 +51,7 @@ foreach ($csv as $cords) {
'type': 'Feature',
'id': '1',
'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': {
'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