<?php
/*************************************************************
$Id: account4.php,v 1.5 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("lib/domain.php");
include("lib/libfunction.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($account)) {
$ACCOUNT = new Account;
if($ACCOUNT->retrieveAccount($DBCONN,$account)) {
$domain=$ACCOUNT->getDomainName();
$show=1;
}
else {
$show=0;
}
}
if(!empty($error)) {
if($error=="error1") {
$errormsg="<h3>Required fields are missing</h3>";
$show=1;
$ACCOUNT->name[0]=$account;
$ACCOUNT->password[0]=$password;
for($a=0;$a<count($alias);$a++) {
$ACCOUNT->alias[$a]=$alias[$a]."@".$domain;
}
}
else if($error=="error2") {
$errormsg="<h3>Account does not exist!</h3>";
}
else if($error=="error4") {
$errormsg="<h3>DB-ERROR</h3>";
$show=1;
}
else if($error=="error5") {
$errormsg="<h3>Alias is already used!</h3>";
$show=1;
$ACCOUNT->name[0]=$account;
$ACCOUNT->password[0]=$password;
for($a=0;$a<count($alias);$a++) {
$ACCOUNT->alias[$a]=$alias[$a]."@".$domain;
}
}
else if($error=="error6") {
$errormsg="<h3>Alias is not valid!</h3>";
$show=1;
$ACCOUNT->name[0]=$account;
$ACCOUNT->password[0]=$password;
for($a=0;$a<count($alias);$a++) {
$ACCOUNT->alias[$a]=urldecode($alias[$a])."@".$domain;
}
}
else if($error=="error7") {
$errormsg="<h3>Password must be at least ".$ACCOUNT_PASSWORD_LENGTH." characters long!</h3>";
$show=1;
$ACCOUNT->name[0]=$account;
$ACCOUNT->password[0]=$password;
for($a=0;$a<count($alias);$a++) {
$ACCOUNT->alias[$a]=$alias[$a]."@".$domain;
}
}
}
$activetab=1;
$showtabs=2;
include("accounts3_menu.php");
?>
<% if($show): %>
<% $ALIAS = new Alias; %>
<span class="headline">Edit account: <%=$ACCOUNT->getUserName()%></span><br><br>
<%=$errormsg%>
<form action="account_update.php" type="post">
<table border=0>
<tr>
<td>Password:*</td>
<td><input type="text" name="password" value="<%=$ACCOUNT->getPassword()%>" size="12" maxlength="20"></td>
</tr>
<tr>
<td>Alias:*</td>
<td <%if($aliaserror[0]=="true") echo "class=inputerror"%>><input type="text" name="alias[]" value="<% if(trim($ACCOUNT->strRemoveDomain($ACCOUNT->getAlias(0)))=="") { echo "*";} else {echo $ACCOUNT->strRemoveDomain($ACCOUNT->getAlias(0));}%>" size="20" maxlength="100">@<%=$ACCOUNT->getDomainName(0)%></td>
</tr>
<% $b=count($ACCOUNT->alias);%>
<% for($a=1;$a<$b;$a++):%>
<tr><td></td><td <%if($aliaserror[$a]=="true") echo "class=inputerror"%>><input type="text" name="alias[]" value="<% if(trim($ACCOUNT->strRemoveDomain($ACCOUNT->getAlias($a)))=="" && ($a+1)!=$b) { echo "*";} else {echo $ACCOUNT->strRemoveDomain($ACCOUNT->getAlias($a));} %>" size="20" maxlength="100">@<%=$ACCOUNT->getDomainName(0)%></td>
</tr>
<% endfor %>
<% if(empty($error)):%>
<tr>
<td></td>
<td><input type="text" name="alias[]" value="" size="20" maxlength="100">@<%=$ACCOUNT->getDomainName(0)%></td>
</tr>
<% endif %>
<tr>
<td></td>
<td>Required fields are marked with *</td>
</tr>
<tr>
<td></td>
<td> </td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="updateaccount" value="Update" CLASS="button" ONMOUSEOVER="this.className='buttonhover'" ONMOUSEOUT="this.className='button'"> <input type="submit" name="deleteaccount" value="Delete" ONCLICK="if(confirm('This will delete the account from the system and all aliases belonging to this account')){return true;}else return false;" CLASS="button" ONMOUSEOVER="this.className='buttonhover'" ONMOUSEOUT="this.className='button'"></td>
</tr>
</table>
<input type="hidden" name="account" value="<%=$ACCOUNT->getUserName()%>">
<input type="hidden" name="domainname" value="<%=$ACCOUNT->getDomainName()%>">
</form>
<% endif %>
<% menu_html_trail() %>