<?php 
/*
##################################################################
#                       PHP 4&5 MySQL 4&5                        #
##################################################################
#           Copyright (c) 2004-2008 Armia Systems Inc            #
##################################################################
#               This file is part of Cybermatch site             #
##################################################################
#    Developed By: simi (simi@armia.com)                         #

##################################################################
#               Developed On:   03-04-2008                       #
##################################################################
#               Modified By:                                     #
##################################################################
#               Modified On:                                     #
##################################################################
# This script may not be distributed, sold, given away for free  #
# to third party, or used as a part of any internet ervices such #
# as webdesign etc.                                              #
##################################################################
*/
require_once ("../config.inc.php");
require_once ("../includes/userlogincheck.mobile.inc.php");
require_once ("../includes/mysql_mobile.inc.php");
require_once ("../includes/arrays.inc.php");
require_once ("../classes/userside.class.php");
require_once ("../includes/Pager/Pager.php");
require_once ("../classes/misc.class.php");

$message	= "";
$script		= "";
$pages		= "";
$data		= array();
$array		= array();
$page		= isset($_REQUEST['page'])	?	trim($_REQUEST['page'])				:	"1";
$name		= isset($_POST['vUN'])		?	stripslashes(trim($_POST['vUN']))	:	"";

if (!$objDB) {
	$message	= "Unable to Locate Database Server.";
} else {
	$objC		= new check();
	$objU		= new userside($objDB);
	$objM		= new misc($objDB);
	if (isset($_POST['SearchNow'])) {
		$array		= $objU->search_profiles($_POST, true);
	} else {
		$array		= $objU->search_profiles($_SESSION);
	}
	$params 	= array(
		'mode'      => 'Sliding',
		'perPage'   => 3,
		'urlVar'    => 'page',
		'extraVars' => array(),
		'itemData'  => $array
	);
	$objP 		= & Pager::factory($params);
	$data  		= $objP->getPageData();	
	if (empty($data))
		$message	.= "No profile(s) exists.<br>";
	else
		$pages	= $objP->links;;		
		
	if (isset($_POST['VP'])) {
		$id	= $objU->get_profile_id($name);
		if ($id > 0) {
			header("Location:profile.php?id=$id");
			exit();
		} else {
			$message	= "Invalid username.<br>";
		}
	}
	$script		= $objU->get_script($message);
	$message	= $objU->remove_script($message);
}
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head><title>Cybermatch</title>
<link href="images/mobile.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div xmlns="http://www.w3.org/1999/xhtml">
<div class="list"><img src="images/logo.jpg" alt="Cybermatch" width="73" height="100"></div>
<div>&nbsp;</div>
    <div>
        <div><i>+</i> <a href="index.php">Home</a></div>
        <div><i>+</i> <a href="search.php">Search</a></div>
        <div><i>+</i> <a href="dashbox.php" accesskey="2">Account</a> </div>
        <div><i>+</i> <a href="logout.php">Logout</a></div>
    </div>
<div>&nbsp;</div>
<div><a name="search"></a><strong>Profile Listing</strong></div>
<div>&nbsp;</div>
<div class="message"><?php echo $message?></div>
<div>&nbsp;</div>
<?php if (!empty($data)) { 
  foreach ($data as $key => $value) { ?>
<div><a href="profile.php?id=<?php echo $value['nUser_Id']?>&page=<?php echo $page?>"><img src="<?php echo $objU->get_pimage_url(PROFILE_IMAGE_URL, $value['nPhoto_Id'], $value['vGender']);?>" width="75" height="75" border="0"></a></div> 
<div class="list"><div class="listi">
<span><div><b><a href="profile.php?id=<?php echo $value['nUser_Id']?>&page=<?php echo $page?>"><?php echo $value['vTitle']?></a></b></div>
<div><span class="j"><?php echo $value['vLogin']?> - <?php echo $value['vAge']?> -year-old <?php echo $value['vGender']?></span></div>
<div><span class="j"><?php echo $value['vCounty']?> , <?php echo $value['vState']?></span></div></span></div></div>
<?php }
}?>		
<div>&nbsp;</div>
<?php if ($pages <> "") { ?>
<div class="listi"><?php echo $pages?></div><div class="l">&nbsp;</div>
<?php } ?>  
<?php include_once('footer.inc.php');?>