Location: PHPKode > projects > web-cp - Web Hosting Control Panel > webcp/web/personal/emailset.phps
<?
// If data is set (i.e the submit button has been hit)
if (isset($data)) {
	if (is_array($data)) {
		// remove spaces and slashes.
		while (list($key, $val) = each($data))
			$data[$key] = trim(stripslashes($val));
		
		// HARDCODED $data['uid'], 'id'
		$data['uid'] = $personaldata['username'];
		$data['id'] = $personaldata['id'];
		
		if ($userdata['level'] > 3) {
			$data['catchall'] = false;
		}
		
		$error = user("update",$data);
		if ($error)
			echo "<br>&nbsp;&nbsp;&bull; ".implode("<br>\n&nbsp;&nbsp;&bull; ",$error)."<br>\n";
		else {
			echo "<br><div align='center'><b>".$T['e-mail updated']."</b></div><br>\n";
			
			// update $personaldata
			$personaldata = fetchdata("*","user",$personaldata['username']);
		}
	}
}
?>

<div align="center">
<form action="<?=$current_url;?>" method="post" name="webcp" onSubmit="submitonce(this);">
<table border="0" cellpadding="0" cellspacing="0" summary="">
	<tr>
		<td>
		<table border="0" cellspacing="0" cellpadding="0" class="tblbg">
			<tr>
				<td>
				<table border="0" cellspacing="1">
					<tr>
						<td colspan="2" class="tbltop">&nbsp;<?=$T[$cp][$url];?>&nbsp;</td>
					</tr>
					<tr>
						<td class="row1"><b>&nbsp;<?=$T['E-Mail Aliases'];?>&nbsp;</b></td>
						<td class="row2">
						<?if ($userdata['level'] < 4){
							echo "&nbsp;<textarea name=\"data[aliases]\" cols=\"30\" rows=\"3\">".
							str_replace(" ",", ",$personaldata['aliases'])
							."</textarea>&nbsp;";
						} else {
							echo str_replace(" ",", ",$personaldata['aliases']);
						}
						?></td>
					</tr>
					<tr>
						<td class="row1"><b>&nbsp;<?=$T['Catch-All'];?>&nbsp;</b></td>
						<td class="row2">
						<?if ($userdata['level'] < 4) {
							echo "&nbsp;<input type=\"radio\" name=\"data[catchall]\" value=\"true\"";
							if ($personaldata['catchall'] == "true") echo " CHECKED";
							echo ">on";
							echo "<input type=\"radio\" name=\"data[catchall]\" value=\"false\"";
							if ($personaldata['catchall'] == "false") echo " CHECKED";
							echo ">off &nbsp;";
						} else {
							if ($personaldata['catchall'] == "true") echo "on";
							if ($personaldata['catchall'] == "false") echo "off";
						}
						?>
						</td>
					</tr>
					<tr>
						<td class="row1"><b>&nbsp;<?=$T['Forward'];?>&nbsp;</b></td>
						<td class="row2">&nbsp;<textarea name="data[forward]" cols="30" rows="3"><?=str_replace(" ",", ",$personaldata['forward']);?></textarea>&nbsp;</td>
					</tr>
					<tr>
						<td class="row1"><b>&nbsp;<?=$T['Autoresponder'];?>&nbsp;</b></td>
						<td class="row2">&nbsp;<textarea name="data[autoreply]" cols="30" rows="3"><?=$personaldata['autoreply'];?></textarea>&nbsp;</td>
					</tr>
				</table>
				</td>
			</tr>
		</table><br>
		<div align="right"><input type="submit" value="<?=$T['Update E-Mail'];?>"></div>
		</td>
	</tr>
</table>
</form><br><br>
</div>

Return current item: web-cp - Web Hosting Control Panel