<?
require_once "configure.php";
require_once "paginator.php";
require_once "paginator_html.php";



if(!isset($_SESSION["egoUserName"])){
	print("<script type='text/javascript'>location.href='signin.php'</script>");
}


?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=TITLE;?></title>
<link rel="stylesheet" type="text/css" href="style.css" >
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}
//  End -->
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="46" bgcolor="#38abe3">
      <? require_once "header.php"; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>
    
    <form name="form" method="post" action="<?=$PHP_SELF;?>">
    <table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="35" class="signin">Account List</td>
          </tr>
          <tr>
            <td height="35" class="signin"><span class="phpmaker">
              <input type="text" name="word" id="word" size="20" value="<?=$word ?>" />
              <input type="submit" name="Submit2" id="Submit2" value="Search " />
            </span></td>
          </tr>
           
        </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td bgcolor="#ccc"><table width="100%" border="0" cellpadding="1" cellspacing="1">
                  <tr>
                    <td width="26%" height="40" bgcolor="#cfecff" class="text">Email</td>
                    <td width="35%" bgcolor="#cfecff" class="text">Full Name </td>
                    <td width="18%" bgcolor="#cfecff" class="text">NRIC No.</td>
                    <td width="13%" bgcolor="#cfecff" class="text">Mobile No.</td>
                    <td width="8%" bgcolor="#cfecff" class="text">Approval</td>
                    </tr>
                  <?

  		    $sql = "SELECT * from user where type='User' ";
			if($word)$sql.="and (name like '%$word%' or email like '%$word%' or ic '%$word%' or mobile like '%$word%' ) ";
			$result=mysql_query($sql);
			$num_rows=mysql_num_rows($result);
	
			$pass="so=1&word=$word";
			$a =& new Paginator_html($_GET['page'],$num_rows,$pass);	
			$a->set_Limit(20);
			$a->set_Links(10);  	
			$limit1 = $a->getRange1();  
			$limit2 = $a->getRange2();  
			$sql.=" order by id limit $limit1,$limit2 ";	
			
			$param=$word;
			
	
			$result =mysql_query($sql)or die(mysql_error());
			while($myrow=MySQL_fetch_array($result))
			{
				$id=$myrow["id"];

				echo "<tr bgcolor='#e3f4ff'>";
				echo "<td height='25' class='text'>".$myrow["email"]."</td>";
				echo "<td class='text'>".$myrow["name"]."</td>";
				echo "<td class='text'>".$myrow["ic"]."</td>";				
				echo "<td class='text'>".$myrow["mobile"]."</td>";				
				echo "<td class='text'>".$myrow["approval"]."</td>";				
				echo "</tr>";
			}
		  
		  ?>
                                </table></td>
              </tr>
            </table>
       </td>
      </tr>
      <tr>
        <td align="right">&nbsp;</td>
      </tr>
      <tr>
        <td><?  require_once "page_result.php";  ?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><a href="http://egenos.com" target="_blank">Powered by eGen online solution</a></td>
      </tr>
    </table> </form></td>
  </tr>
</table>
</body>
</html>
