Code: Select all
<?php
// This will allow to use the css inside includes if editing this file directly... probably
$visitingfiledirectly = false;
if($visitingfiledirectly)
{
?>
<link rel="stylesheet" type="text/css" media="screen" href="../stylus.css">
<?php
}
?>
<?php
//To check default
$gender = "Female";
$age1 = "";
$age2 = "";
$country = "All";
$status = "";
$orderby = "BirthYear";
if(isset($_POST["gender"]) && ($_POST["gender"] == "Male" || $_POST["gender"] == "Female" || $_POST["gender"] == ""))
{
$gender = $_POST["gender"];
}
if(isset($_POST["age1"]) && is_numeric($_POST["age1"]))
{
$age1 = $_POST["age1"];
}
if(isset($_POST["age2"]) && is_numeric($_POST["age2"]))
{
$age2= $_POST["age2"];
}
if(isset($_POST["country"]) && $_POST["country"] != "All")
{
$country = PHP_slashes($_POST["country"]);
}
if(isset($_POST["status"]) && ($_POST["status"] == "Single" || $_POST["status"] == "Married"))
{
$status = $_POST["status"];
}
if(isset($_POST["orderby"]) && ($_POST["orderby"] == "BirthYear" || $_POST["orderby"] == "Name"))
{
$orderby = $_POST["orderby"];
}
$query = "";
//check if the starting row variable was passed in the URL or not
if (!isset($_GET['startrow']) or !is_numeric($_GET['startrow'])) {
$startrow = 0;
//otherwise we take the value from the URL
} else {
$startrow = (int)$_GET['startrow'];
}
$url = "index.php?section=browse";
$checkuser = "SELECT BirthYear, Id, Avatar, Name, Email FROM users WHERE %extend% LIMIT $startrow, 10"; // FIND THE DESIRED USER BY ID
//Name - to display the name
$extend = "";
$and = "";
if($gender != "")
{
$extend = $extend.$and."Gender='".$gender."'";
$and = " AND ";
}
$extend = $extend.$and."BirthYear<='".(date("Y")-$age1)."'";
$and = " AND ";
$extend = $extend.$and."BirthYear>='".(date("Y")-$age2)."'";
if($country != "All")
{
$extend = $extend.$and."Country='".$country."'";
$and = " AND ";
}
if($status != "")
{
$extend = $extend.$and."Status='".$status."'";
$and = " AND ";
}
if($orderby == "BirthYear")
{
$extend = $extend." ORDER BY BirthYear DESC";
}
if($orderby == "Name")
{
$extend = $extend." ORDER BY Name ASC";
}
$checkuser = str_replace("%extend%", $extend, $checkuser);
$checkuser = mysql_query($checkuser);
//$user = mysql_fetch_array($checkuser); // COLLECT HIS DATA INTO AN ARRAY
$admin = getMyAdminLevel();
?>
<form method="POST" id="smform">
<b>Browse for People</b>
<font color="#FF0000"><br>You must signed up & log in to view the full profile.</font><br />
Gender: <input type="radio" name="gender" value="Male" <?php if($gender == 'Male')echo'checked';?> /> Male
<input type="radio" name="gender" value="Female" <?php if($gender == 'Female')echo'checked';?> /> Female
<input type="radio" name="gender" value="" <?php if(strlen($gender) == 0)echo'checked';?> /> Both<br>
Age:<input type="text" size="1" name="age1" <?php echo'value="'.$age1.'"'?>/>~<input type="text" size="1" name="age2" <?php echo'value="'.$age2.'"'?>/>
       Location:<?php printCountries($country,TRUE);?>
<br />
Status:<select name="status">
<?php if($status != "")
{
echo'<option value="'.$status.'">'.$status.'</option>';
}?>
<option value="Single">Single</option>
<option value="Married">Married</option>
<option value="">Any</option>
</select>
         Order by:<input type="radio" name="orderby" value="BirthYear" <?php if($orderby == 'BirthYear')echo'checked';?> /> Age
<input type="radio" name="orderby" value="Name" <?php if($orderby == 'Name')echo'checked';?>/> Name       
<input type="submit" value="Browse" id="sm">
</form>
<table border="0" align="center">
<tr>
<?php
$counter = 0;
while($user = mysql_fetch_array($checkuser))
{
?>
<td>
<p align="center">
<a target="_blank" href="index.php?section=profile&uid=<?php echo $user["Id"];?>"><?php echo $user["Name"];?></a>  <br>
<!--["Name"] - to display the name-->
<img src="<?php echo $user["Avatar"];?>" width="100" height="100"/></a></td></p>
<?php
$counter++;
if($counter >= 5)
{
?></tr><tr><?php
$counter = 0;
}
}
?>
<?php
//Next page
?><div class="browse"><?php
$numrows = mysql_num_rows($checkuser);
if ($numrows >= 10)
echo '<a href="'.$url.'&startrow='.($startrow+10).'">Next</a>         ';
$prev = $startrow - 10;
//Previous page
if ($prev >= 0)
echo '<a href="'.$url.'&startrow='.$prev.'">Previous</a>';
?>
</table>
</div>