Location: PHPKode > projects > Replex > replex-0.9.0/admin/account1.php
<?php
/*************************************************************
$Id: account1.php,v 1.8 2001/05/19 02:43:13 jimir Exp $
 
 ***************************************************************/

include("include/config.php");
include("lib/user.php");
include("lib/search.php");
include("lib/account.php");
include("lib/alias.php"); 
include("db/class_mysql.php");

# Authenticate current user
$USER = new User;
if (!$USER->HTTPauthenticate($DBCONN)) {
  $USER->http_refuse();
}

$ACCOUNT = new Account;
$ALIAS   = new Alias;

if(!empty($search_id) && !empty($page)) {
  $ACCOUNT->retrieveAccounts($DBCONN,'search_id',$search_id,'','',$page);
  $show=1;
}

if(!empty($search)) {
  //we have a search
  $page=1;
  $s_value["CONTENT"]=$content;
  $s_value["COLUMN"]=$column;
  $ACCOUNT->retrieveAccounts($DBCONN,'search',$s_value,$sort,$perpage,$page);
  $show=1;
}
if(!empty($showall)) {
  //we have a showall
  $page=1;
  $ACCOUNT->retrieveAccounts($DBCONN,'showall','',$sort,$perpage,$page);
  $show=1;
}

if(empty($page)) {
  $page=1;
}

if(!empty($error)) {
  if($error=="error1") {
    $errormsg="<h3></h3>";	
  }
  
}


$activetab=0;
$showtabs=1;
include("accounts1_menu.php");
?>
<span class="headline">Accounts</span><br><br>
<%=$errormsg%>

<form metod="post" action="account1.php">
<table border=0>
<tr>
  <td>Search for:</td>
  <td>
<select name="column">
  <option value="1" <%if($column==1) echo "selected";%>>Username<option value="2" <%if($column==2) echo "selected";%>>Domain name</select></td>
<td><input type="text" name="content" value="<%=htmlentities($content)%>"></td>
<td><input type="submit" name="search" value="Search" CLASS="button" ONMOUSEOVER="this.className='buttonhover'" ONMOUSEOUT="this.className='button'">
&nbsp;<input type="submit" name="showall" value="Show all" CLASS="button" ONMOUSEOVER="this.className='buttonhover'" ONMOUSEOUT="this.className='button'">
</td>
</tr>
<tr>
 <td>Sort by:</td>
 <td>
   <select name="sort">
     <option value="1" <%if($sort==1) echo "selected";%>>Username<option value="2" <%if($sort==2) echo "selected";%>>Domain Name</select>
  </td>
 <td>&nbsp;</td>
 <td>&nbsp;</td>
</tr>
<tr>
 <td>Show per page:</td>
 <td>
   <select name="perpage">
     <option value="1" <%if($perpage==1) echo "selected";%>>30<option value="2" <%if($perpage==2) echo "selected";%>>50<option value="3" <%if($perpage==3) echo "selected";%>>100<option value="4" <%if($perpage==4) echo "selected";%>>5</select>
  </td>
 <td>&nbsp;</td>
 <td>&nbsp;</td>
</tr>
</table>
</form>

<% if(!empty($show)): %>
<table border=0>
<tr>
  <td colspan="4">Found <b><%=$ACCOUNT->getAffectedRows()%></b> result(s)</td>
</tr>
<tr>
  <td class="td-hl">Username</td>
  <td class="td-hl">Password</td>
  <td class="td-hl">Domainname</td>
  <td class="td-hl">Alias</td>  
</tr>
 <% for($i=0;$i<count($ACCOUNT->username);$i++): %>
 <tr>
   <td class="td-content" valign="top"><a href=account3.php?account=<%=$ACCOUNT->getUserName($i)%>><%=$ACCOUNT->getUserName($i)%></a></td>
   <td class="td-content" valign="top"><%=$ACCOUNT->getPassword($i)%></td>
   <td class="td-content" valign="top"><%=$ACCOUNT->getDomainName($i)%></td>

   <% $ALIAS->retrieveAliasPerAccount($DBCONN,$ACCOUNT->getUserName($i)); %>
   <td class="td-content" align="right" valign="top">
     <% for($a=0;$a<count($ALIAS->alias);$a++): %>
       <% if($ALIAS->getAlias($a)=="@".$ACCOUNT->getDomainName($i)):%>
          <%="*".$ALIAS->getAlias($a)%><br>
        <% else: %>
          <%=$ALIAS->getAlias($a)%><br>
        <% endif %>
     <% endfor %>
   </td>

 </tr>
 <% endfor %>
</table>
<% endif %>
<% if($ACCOUNT->total_pages>1) { $SEARCH = new Search; if(empty($search_id)) {$SEARCH->generateSearchId($DBCONN,$ACCOUNT->search_sql,$ACCOUNT->perpage); } else { $SEARCH->search_id=$search_id;}	%>
<br>
<table border=0>
<tr>
<td>Result pages: 
<% $s_id=$SEARCH->getSearchId(); if($ACCOUNT->total_pages>5){$countnumber=5;}else {$countnumber=$ACCOUNT->total_pages;} for($i=0;$i<$countnumber;$i++) { if($page==($i+1)){ echo "<b>".$page."</b>&nbsp;";} else {echo "<a href=account1.php?search_id=".$s_id."&page=".($i+1).">".($i+1)."</a>&nbsp;";}} %>
<% if($page!=$ACCOUNT->total_pages) { %><a href=account1.php?search_id=<%=$s_id%>&page=<%=($page+1)%>>Next</a></td><% } %>
</tr>
</table>
<% } %>
<% menu_html_trail() %>	
Return current item: Replex