Location: PHPKode > projects > Replex > replex-0.9.0/admin/domain1.php
<?php
/*************************************************************
$Id: domain1.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/domain.php");
include("lib/alias.php");
include("db/class_mysql.php");

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


$DOMAIN = new Domain;
$ALIAS  = new Alias;

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

if(!empty($search)) {
  //we have a search
  $s_value["CONTENT"]=$content;
  $s_value["COLUMN"]=$column;
  $DOMAIN->retrieveDomains($DBCONN,'search',$s_value,$sort,$perpage,$page);
  $show=1;
}
if(!empty($showall)) {
  //we have a showall
  $DOMAIN->retrieveDomains($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("domains1_menu.php");
?>
<span class="headline">Domains</span><br><br>
<%=$errormsg%>

<form metod="get" action="domain1.php">
<table border=0>
<tr>
  <td>Search for:</td>
  <td>
<select name="column">
  <option value="1" <%if($column==1) echo "selected";%>>Domain name <option value="2" <%if($column==2) echo "selected";%>>Prefix</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";%>>Domain name<option value="2" <%if($sort==2) echo "selected";%>>Prefix</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>
<input type="hidden" name="page" value="<%=$page%>">
</form>

<% if(!empty($show)): %>
<table border=0>
<tr>
  <td colspan="4">Found <b><%=$DOMAIN->getAffectedRows()%></b> result(s)</td>
</tr>
<tr>
  <td class="td-hl">Domain Name</td>
  <td class="td-hl">Prefix</td>
  <td class="td-hl">Max Accounts</td>
  <td class="td-hl">Alias</td>
  <td class="td-hl">Destination</td>
</tr>
 <% for($i=0;$i<count($DOMAIN->name);$i++): %>
 <tr>
   <td class="td-content" valign="top"><a href=domain3.php?domain=<%=$DOMAIN->getName($i)%>><%=$DOMAIN->getName($i)%></a></td>
   <td class="td-content" valign="top"><%=$DOMAIN->getPrefix($i)%></td>
   <td class="td-content" align="right" valign="top"><% if($DOMAIN->getMaxAccounts($i)==0) echo "unlimited"; else echo $DOMAIN->getMaxAccounts($i); %></td>
  <% $ALIAS->retrieveAliasPerDomain($DBCONN,$DOMAIN->getName($i)); %>
   <td class="td-content" align="right" valign="top">
     <% for($a=0;$a<count($ALIAS->alias);$a++): %>
        <% if($ALIAS->getAlias($a)=="@".$DOMAIN->getName($i)):%>
          <%="*".$ALIAS->getAlias($a)%><br>
        <% else: %>
          <%=$ALIAS->getAlias($a)%><br>
        <% endif %>
     <% endfor %>
   </td>
   <td class="td-content" align="right" valign="top">
     <% for($a=0;$a<count($ALIAS->alias);$a++): %>
       <%=$ALIAS->getDest($a)%><br>
     <% endfor %>
   </td>
 </tr>
 <% endfor %>
</table>
<% endif %>
<% if($DOMAIN->total_pages>1) { $SEARCH = new Search; if(empty($search_id)) {$SEARCH->generateSearchId($DBCONN,$DOMAIN->search_sql,$DOMAIN->perpage); } else { $SEARCH->search_id=$search_id;}	%>
<br>
<table border=0>
<tr>
<td>Result pages: 
<% $s_id=$SEARCH->getSearchId(); if($DOMAIN->total_pages>5){$countnumber=5;}else {$countnumber=$DOMAIN->total_pages;} for($i=0;$i<$countnumber;$i++) { if($page==($i+1)){ echo "<b>".$page."</b>&nbsp;";} else {echo "<a href=domain1.php?search_id=".$s_id."&page=".($i+1).">".($i+1)."</a>&nbsp;";}} %>
<% if($page!=$DOMAIN->total_pages) { %><a href=domain1.php?search_id=<%=$s_id%>&page=<%=($page+1)%>>Next</a></td><% } %>
</tr>
</table>
<% } %>
<% menu_html_trail() %>	
Return current item: Replex