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

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

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

if(empty($domainname))
$domainname=$domain;

if(!empty($domainname)) {
    $DOMAIN = new Domain;
    $DOMAIN->retrieveAllDomains($DBCONN);
    if($DOMAIN->retrieveDomain($DBCONN,$domainname)) {
      $ACCOUNT = new Account;
      $ACCOUNT->retrieveDomainInfo($DBCONN,$domainname);
      $show=1;
    }
}
else {
//redirect to error page

}

if(!empty($error)) {
  if($error=="error1") {
    $errormsg="<h3>Required fields are missing</h3>";	
  }
  else if($error=="error2") {
    $errormsg="<h3>Alias already exists - try another!</h3>";	
  }
  else if($error=="error3") {
    $errormsg="<h3>Error occured in creating the account!</h3>";	
  }
  else if($error=="error5") {
    $errormsg="<h3>DB-ERROR</h3>";	
  }
  else if($error=="error6") {
    $errormsg="<h3>Domain name could not be found!</h3>";	
  }
  else if($error=="error7") {
    $errormsg="<h3>Alias is not valid!</h3>";
  } 
  else if($error=="error8") {
    $errormsg="<h3>Password must be at least ".$ACCOUNT_PASSWORD_LENGTH." characters long!</h3>";
  }

}


$activetab=3;
$showtabs=6;
include("domains3_menu.php");
?>
<span class="headline">Create new account</span><br><br>
<%=$errormsg%>

<% if(!empty($show)) {%>
<form action="account_update.php" type="post">
<table border=0>
<tr>
  <td colspan="2"><%=$domainname%> has <b><%=$ACCOUNT->getAffectedRows()%></b> active accounts out of <b><% if($DOMAIN->getMaxAccounts()==0) echo "unlimited"; else echo $DOMAIN->getMaxAccounts();%></b></td>
</tr>
<tr>
  <td colspan="2">Finding first available.....</td>
</tr>
<tr>
  <td>&nbsp;</td>
</tr>
<tr>
  <td class="td-hl" colspan=2>Create account</td>
</tr>
 <% if($DOMAIN->getMaxAccounts()==0) $maxaccounts=$ACCOUNT_LIMIT; else $maxaccounts=$DOMAIN->getMaxAccounts(); %>
   <% if($maxaccounts>$ACCOUNT->getAffectedRows()) { %> 
   <% for($i=0;$i<$maxaccounts;$i++) {%>
      <% if (!(trim($ACCOUNT->getUserName($i))==trim(($DOMAIN->getPrefix().($i+1))))) {%>
       <tr>
       <td>Domainname:</td>
       <td><%=$DOMAIN->getName()%></td>
       </tr>
       <tr>
       <td>Username:</td>
       <td><%=($DOMAIN->getPrefix().($i+1))%></td>
       </tr>
       <tr>
       <td>Password:*</td>
       <td><input type="text" name="password" value="<%=$password%>" size="12" maxlength="20"></td>
       </tr>
       <tr>
       <td>Alias:*</td>
       <td><input type="text" name="alias" value="<%=$alias%>" size="20" maxlength="100">@<%=$DOMAIN->getName()%></td>
       </tr>
       <tr>
       <td></td>
       <td>Required fields are marked with *</td>
       </tr>
       <tr>
       <td>&nbsp;</td>
       <td></td>
       </tr>
       <tr>
       <td></td>
       <td><input type="submit" name="createaccount" value="Create" CLASS="button" ONMOUSEOVER="this.className='buttonhover'" ONMOUSEOUT="this.className='button'"></td>
       </tr>
       </table>
       <input type="hidden" name="username" value="<%=($DOMAIN->getPrefix().($i+1))%>">
       <input type="hidden" name="domainname" value="<%=$DOMAIN->getName()%>">
       <input type="hidden" name="prefix" value="<%=$DOMAIN->getPrefix()%>">
       <input type="hidden" name="caller" value="domain">  
       </form>
     <% break;} %> 
    <% } %>
   <% } else { %>
         <tr>
          <td class="td-content" colspan=2>no accounts available!</td>
         </tr>
         </table>
          <% } %>
<% } %>

<% menu_html_trail() %>	
Return current item: Replex