<%
include_once( "../modules/utils.inc.php" );
include( "$modules/header.insecure.inc.php" );
$tok = $_COOKIE["c_pass_token"];
$u = $_COOKIE["c_uid"];
$sessionUserId = $u;
$con = mysql_connect();
mysql_selectdb( getDBName() );
$qs = "SELECT COUNT(*) FROM links";
$q = mysql_query( $qs );
if( $q ) {
$count = mysql_result($q,0);
# we pick twice as many as we need,
# to allow for skipping private links,
# and holes in the link ID space
$numPicks = 6;
for( $i = 0; $i < $numPicks; $i++ ) {
$picks[$i] = rand( 1, $count );
}
%>
<h3><%= count( $picks ) / 2 %> random links:</h3>
<%
foreach( $picks as $randomLink ) {
if( isValidLink( $randomLink ) && !isPrivate( $randomLink ) && $linksPrinted < 3 ) {
$linksPrinted++;
%>
<div class="attention">
<%= makeUserLink( getOwnerForLink( $randomLink )) %>'s <%= makeLinkOut( $randomLink ) %> <%= makePermaLink( $randomLink ) %>
</div>
<%
}
}
}
mysql_close( $con );
%>
<% include( "$modules/footer.inc.php" ); %>