All pastes #548238 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-07 17:40 UTC
rendered paste body
<html>
 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Player Search</title>
</head>
 
<body style="font-family: Arial" link="#FF0000" text="#FFFFFF" bgcolor="#EEA24D">
 
<h2>Battlefield Players.com - Player Search</h2> 
</HEAD>
 
<form name="search" method="post" action="<?=$PHP_SELF?>">
Seach for: <input type="text" name="guid" /> in 
<Select NAME="field">
<Option VALUE="hash">CD-hash</option>
<Option VALUE="alias">alias</option>
</Select>
<input type="hidden" name="searching" value="yes" />
<input type="submit" name="search" value="Search" />
</form>
 
<?php

$hash = $_GET['cdhash']; 
echo "<BR>" .$hash;

 
if ($_REQUEST['searching'] =="yes")
{ 
echo "You searched for:<b> " .$guid , "</B> in <B>" .$field ,"'s</B>";
echo "<P>";
 
echo "<h2>Results</h2><p>";  
if ($_REQUEST['guid'] == "") 
 
{ 
echo "<p>You forgot to enter a search term"; 
exit; 
} 
echo "<P>";

$rpp = 25;
if(!$page || $page == 1){
	$start = 0;
}else{
	$offset = $page-1;
	$start = ($offset * $rpp);
}

 
Print "<table border=1 width=700 align=center bordercolorlight=#D87B14 bordercolordark=#FF9900 cellpadding=0>";
Print "<tr>"; 
Print "<th>Alias:</th>"; 
Print "<th>CD Hash:</th>"; 
Print "<th>First Seen:</th>";
Print "<th>Last Seen:</th></tr>";

{
   echo $row['val'] . '<br>';
}

$db = mysql_connect('localhost', 'bfplayers', '66948940') or die(mysql_error());
mysql_select_db('bfplayers', $db);
$res = mysql_query("
       SELECT DISTINCT a.alias_string,
              MIN(s.time_first) AS time_first,
              MAX(IF(s.time_last IS NULL, sv.last_update, s.time_last)) AS time_last
       FROM   aliases AS a, guids AS g, sessions AS s, servers AS sv 
       WHERE  s.alias_key=a.alias_key
              AND s.guid_key=g.guid_key
              AND s.server_key=sv.server_key
              AND g.guid_string LIKE '%${_REQUEST['guid']}%'

       GROUP BY alias_string
       ORDER BY alias_string ASC LIMIT $start, 25", $db) or die(mysql_error());
 
 
while ($row = mysql_fetch_assoc($res)) {
//      print "${row['alias_string']} was first seen at: ${row['time_first']} and last seen at: ${row['time_last']}<br>\n";
 
{ 
Print "<tr>"; 
Print "<th>${row['alias_string']}</th>";
Print "<th>${row['guid_string']}</th>";
Print "<th>${row['time_first']}</th>";
Print "<th>${row['time_last']}</th></tr>";} 

}
Print "</table>";

if($page > 1){
	$prevpage = $page - 1;
}
$currentend = $start + 25;

if($page > 1){
	$prevpage = $page - 1;
}
$currentend = $start + 25;
if(mysql_num_rows($res)>$currentend)
{
	if(!$page){
		$nextpage = 2;
	}else{
		$nextpage = $page + 1;
	}
}


if ($prevpage || $nextpage) {
	if($prevpage){
		echo ("<a href=\"?page=".$prevpage."\">Previous
Page</a>");
	}else{
		echo ("");
	}
	if($nextpage){
		echo ("<a href=\"?page=".$nextpage."\">Next
Page</a>");
	}else{
		echo ("");
	}
}

$anymatches=mysql_num_rows($res); 
if ($anymatches == 0) 
{ 
echo "Sorry, but we can not find a CD-hash to match your search term<br><br>"; 
} 
else
echo "<P>Total number of matching records: <B> " .$anymatches , "</B>";
echo "<P>Start page: " .$start;
echo "<P>Current page: " .$page;
echo "<P>next page: " .$nextpage;
echo "<P>End page: " .$currentend;
 
mysql_close($db);

}  
 
?> 
 
</body>
 
</html>