<?php
if(isset($_POST['PSA_submit'])){
$PSA_id=$_POST['PSA_id'];
// the user's password will be changed along with other info changes.
$PSA_pass_test=$PSA_SYS->password_valid($_POST['PSA_pass']);
$PSA_pass_trim=trim($_POST['PSA_pass']);
if(empty($PSA_pass_trim)){
$PSA_pass_empty = FALSE;
}else{
$PSA_pass_empty = TRUE;
}
if(isset($_POST['PSA_emonth']) && $_POST['PSA_emonth']>0){
// expiration date was sent, assemble pieces for a midnight expiration
$_POST['PSA_expiration']=$_POST['PSA_eyear'].'-'.$_POST['PSA_emonth'].'-'.$_POST['PSA_eday'].' 00:00:00';
}
if(($_POST['PSA_pass']==$_POST['PSA_pass2']) && $PSA_pass_test || !$PSA_pass_empty){
$PSA_result=$PSA_SYS->user_edit($_POST);
if(isset($_POST['PSA_active']) && $PSA_SYS->is_admin($_SESSION['PSA_psaun']))
$PSA_SYS->user_activate($_POST['PSA_id']);
else if($PSA_SYS->is_admin($_SESSION['PSA_psaun']))
$PSA_SYS->user_activate($_POST['PSA_id'],0);
if(!$PSA_result){
$PSA_SYS->error();
}else{
echo ' <p>',_("User Updated Successfully."),'</p>',"\n";
}
}else{
echo ' <p class="psaErrorMsg">',_("Passwords have invalid format or do not match."),'</p>',"\n";
}
}
if(isset($_GET['PSA_id']))
$PSA_id=$_GET['PSA_id'];
$psa_users=$PSA_SYS->get_users();
$PSA_user=$psa_users[$PSA_id];
if(!empty($PSA_user['expiration'])){
$PSA_edate=$PSA_user['expiration'];
}
?>
<h2><?php echo _("Edit connections") ?></h2>
<p><a href="<?php echo $_SERVER['PHP_SELF'] ?>?psaSec=user_edit&PSA_id=<?php echo $PSA_id ?>" title="<?php echo _("Back") ?>"><?php echo _("Back") ?></a></p>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?psaSec=user_edit_connections">
<fieldset>
<input type="hidden" name="PSA_id" value="<?php echo $PSA_user['id'] ?>" />
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<th><?php echo _("Username") ?></th>
<td valign="top"><?php echo $PSA_id ?></td>
</tr>
<tr>
<th><?php echo _("Password") ?></th>
<td valign="top"><input type="password" size="30" name="PSA_pass" /></td>
</tr>
<tr>
<th><?php echo _("Verify") ?></th>
<td valign="top"><input type="password" size="30" name="PSA_pass2" /></td>
</tr>
<?php
if($PSA_SYS->is_admin($_SESSION['PSA_psaun'])){
?>
<tr>
<th valign="top"><?php echo _("Account Expiration") ?><p>(<?php echo _("Leave month blank for no expiration") ?>)</p></th>
<td valign="top">
<?php
if(!defined('PSA_PATH')) define('PSA_PATH',dirname(__FILE__).'/..');
include PSA_PATH.'/include/expdate.form.php';
?><br />
</tr>
<tr>
<th valign="top"><?php echo _("Allowed Connection Addresses") ?><span class="psaAsterisk">*</span>
<p>(<?php echo _("Blank is any address") ?>)</p></th>
<td valign="top">
<textarea name="PSA_connection" rows="3" cols="25"><?php echo $PSA_user['connection'] ?></textarea></td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox"<?php if($PSA_user['active']) echo ' checked="checked"'; ?> name="PSA_active" value="1" />
<b><?php echo _("Account Active") ?></b>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="2"><input type="submit" name="PSA_submit" value="<?php echo _("Update User") ?>" /></td>
</tr>
</table>
</fieldset>
</form>
<?php
if($PSA_SYS->is_admin($_SESSION['PSA_psaun'])){
?>
<p><span class="psaAsterisk">*</span> : <?php echo _("To only allow the user to log in from certain computers, see below examples:<br /><br />To allow only from one address, enter the IP (only works with static IPs).<br /><span style='font-family: typewriter'>192.168.1.201</span>To allow from all machines with an address that starts with s sequence:<br /><span style='font-family: typewriter'>192.168.1.</span>or<br /><span style='font-family: typewriter'>192.168.</span>You can also use mulitple entries by separating with a comma:<br /><span style='font-family: typewriter'>192.168.1.161, 192.168.2., 10.10.220.</span>") ?></p>
<?php
}
?>