Location: PHPKode > projects > Admbook > user-edit.php
<?php
	class Timer {
		var $startTime;
		var $endTime;
		function start() {
			$this->startTime = gettimeofday();
		}
		function stop() {
			$this->endTime = gettimeofday();
		}
		function elapsed() {
			return (($this->endTime["sec"] - $this->startTime["sec"]) * 1000000 + ($this->endTime["usec"] - $this->startTime["usec"])) / 1000000;
		}
	}
	$timer = new Timer();
	$timer->start();
	session_start();
	include("settings-data.php");
	include("lib.php");
	include("users-data.php");
	include("config-data.php");
	if (!isset($error))
		$error = "";
	if (!isset($style))
		$style = "";
	if (!isset($id))
		$id = "";
	if (!isset($user[$id]))
	{
		session_destroy();
		Header("Location: user-login.php");exit;
	}
	if (!isset($userLogin))
		$userLogin = "";
	if (!isset($userPassword))
		$userPassword = "";
	checkUserPermissions($userLogin, $userPassword);
	$currentContent = $user[$id];
?>
<html>
<head>
<title>admbook :: version <?=$constant['version']?></title>
<?php
	if ($constant['charset'] != "")
	{
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?=$constant['charset']?>"/>
<?php
	}
?>
<link href="style.css" type="text/css" rel="stylesheet"/>
<style type="text/css">
<!--
#error {
	color : <?=$constant['error-color']?>
}

textarea {
	width : 490px;
}

.text {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['text-color']?>
}

.link {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['link-color']?>
}

.messagetext {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['message-text-color']?>
}

.messagelink {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['message-link-color']?>
}

.admintext {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['admin-message-text-color']?>
}

.adminlink {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['admin-message-link-color']?>
}

.headertext {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['header-text-color']?>
}

.headerlink {
	font : 8pt "Verdana","Arial Cyr", "Arial","Tahoma","Helvetica", sans-serif;
	color : <?=$constant['header-link-color']?>
}

<?=$style?>
-->
</style>
</head>
<body bgcolor="<?=$constant['background-color']?>" text="<?=$constant['text-color']?>" link="<?=$constant['link-color']?>" vlink="<?=$constant['link-color']?>" alink="<?=$constant['link-color']?>" leftmargin="0" marginwidth="0" topmargin="0" marginheight="0">
<table width="760" border="0" cellpadding="0" cellspacing="0" align="center" height="100%">
<tr>
	<td valign="top" height="1">
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="100%" border="0" cellpadding="2" cellspacing="1">
				<tr>
					<td bgcolor="<?=$constant['header-background-color']?>" class="headertext" id="book-title">Admbook versi0n <?=$constant['version']?></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
		<br/>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td bgcolor="<?=$constant['border-color']?>">
				<table width="100%" border="0" cellpadding="2" cellspacing="1">
				<tr>
					<td bgcolor="<?=$constant['header-background-color']?>" align="center" class="headertext"><b>Edit user profile</b></td>
				</tr>
				</table>
			</td>
		</tr>
		</table>
	</td>
</tr>
<tr>
	<form action="user-update.php" method="post">
	<input type="hidden" name="page" value="<?=$page?>"/>
	<input type="hidden" name="id" value="<?=$id?>"/>
	<td align="center">
		<table border="0" cellpadding="2" cellspacing="0">
<?php
	if ($error != "")
	{
?>
		<tr>
			<td colspan="5" class="text">
				<b>Detect following errors:</b><br/>
				<span id="error"><?=$error?></span><br/>
			</td>
		</tr>
<?php
		session_unregister("error");
		session_unregister("style");
	}
?>
		<tr>
			<td align="center"><img src="img/name.gif" width="11" height="14" border="0" alt="Admin name"/></td>
			<td><img src="img/sp.gif" width="5" height="1"/></td>
			<td class="text"><span class="name">Name:</span></td>
			<td><img src="img/sp.gif" width="5" height="1"/></td>
			<td><input type="text" size="15" name="name" value="<?php if (isset($name)) { print stripslashes($name); session_unregister("name"); } else { print $currentContent['name']; } ?>" maxlength="30" class="longfield"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/mail.gif" width="18" height="15" border="0" alt="e-mail"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text"><span class="email">e-mail:</span></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td><input type="text" size="15" name="email" value="<?php if (isset($email)) { print stripslashes($email); session_unregister("email"); } else { print $currentContent['mail']; } ?>" maxlength="128" class="longfield"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/password.gif" width="18" height="18" border="0" alt="password"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text"><span class="password">new password:</span></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td><input type="password" size="15" name="newPassword" value="<?php if (isset($newPassword)) { print stripslashes($newPassword); session_unregister("newPassword"); } ?>" maxlength="30" class="longfield"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/password.gif" width="18" height="18" border="0" alt="password"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text"><span class="password">confirm password:</span></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td><input type="password" size="15" name="confirmPassword" value="<?php if (isset($confirmPassword)) { print stripslashes($confirmPassword); session_unregister("confirmPassword"); } ?>" maxlength="30" class="longfield"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/mail.gif" width="18" height="15" border="0" alt="e-mail"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text"><span class="url">url:</span></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td><input type="text" size="15" name="url" value="<?php if (isset($url)) { print stripslashes($url); session_unregister("url"); } else { print $currentContent['url']; } ?>" maxlength="128" class="longfield"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/icq.gif" width="17" height="18" border="0" alt="icq"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text" nowrap><span class="icq">icq:</span></td>
			<td width="10"><spacer width="10" height="1" type="block"></td>
			<td width="170"><input type="text" size="16" name="icq" value="<?php if (isset($icq)) { print stripslashes($icq); session_unregister("icq"); } else { print $currentContent['icq']; }?>" maxlength="30" class="longfield"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/sp.gif" width="1" height="1" border="0" alt=""/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text" nowrap><span class="country">country:</span></td>
			<td width="10"><spacer width="10" height="1" type="block"></td>
			<td width="170">
				<select name="country">
					<option value="">&nbsp;</option>
<?php
		if (isset($country))
			session_unregister("country");
		else
			$country = $currentContent['country'];
		while (list($key, $value) = each($config['country']))
		{
			$selected = false;
			if ($country == $key)
				$selected = true;
?>					<option value="<?=$key?>"<?=$selected ? " selected" : ""?>><?=$value?></option>
<?php
		}
?>
				</select>
			</td>
		</tr>
		<tr>
			<td align="center"><img src="img/sp.gif" width="1" height="1" border="0" alt=""/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text" nowrap><span class="city">city:</span></td>
			<td width="10"><spacer width="10" height="1" type="block"></td>
			<td width="170"><input type="text" size="16" name="city" value="<?php if (isset($city)) { print stripslashes($city); session_unregister("city"); } else { print $currentContent['city']; }?>" maxlength="30" class="longfield"/></td>
		</tr>
		<tr>
			<td align="center"><img src="img/date.gif" width="17" height="18" border="0" alt="birthday"/></td>
			<td><img src="img/sp.gif" width="1" height="1"/></td>
			<td class="text" nowrap><span class="birthday">birthday:</span></td>
			<td width="10"><spacer width="10" height="1" type="block"></td>
			<td width="170">
				<select name="day">
					<option value="">&nbsp;</option>
<?php
		if (isset($day))
			session_unregister("day");
		else
			$day = $currentContent['day'];
		while (list($key, $value) = each($config['day']))
		{
			$selected = false;
			if ($day == $key)
				$selected = true;
?>					<option value="<?=$key?>"<?=$selected ? " selected" : ""?>><?=$value?></option>
<?php
		}
?>
				</select><select name="month">
					<option value="">&nbsp;</option>
<?php
		if (isset($month))
			session_unregister("month");
		else
			$month = $currentContent['month'];
		while (list($key, $value) = each($config['month']))
		{
			$selected = false;
			if ($month == $key)
				$selected = true;
?>					<option value="<?=$key?>"<?=$selected ? " selected" : ""?>><?=$value?></option>
<?php
		}
?>
				</select><input type="text" size="16" name="year" value="<?php if (isset($year)) { print stripslashes($year); session_unregister("year"); } else { print $currentContent['year']; }?>" maxlength="4" class="shortfield"/>
			</td>
		</tr>
		<tr>
			<td colspan="5" align="right">
				<input type="submit" value="update" class="button"/><br/>
				<input type="button" value="back" class="halfbutton" onClick="javascript:window.location.href='index.php?page=<?=$page?>'"/><input type="button" value="logout" class="halfbutton" onClick="javascript:window.location.href='user-logout.php'"/>
			</td>
		</tr>
		</table>
	</td>
	</form>
<?
	$timer->stop();
?>
</tr>
<tr>
	<td valign="bottom" align="right" height="1" class="text">
		<br/>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="50%" bgcolor="<?=$constant['header-background-color']?>" class="headertext" align="center"><span class="text">&copy;&nbsp;</span>trent&nbsp;<a href="http://www.low.ru/dev/guestbook/" class="text" target="_top">Download this guestbook</a>&nbsp;</td>
			<td width="50%" bgcolor="<?=$constant['header-background-color']?>" class="headertext" align="center"><span class="text">&nbsp;&nbsp;&nbsp;</span><a href="http://www.mylov.ru" onclick="location.href='http://partner.mylov.ru/link.phtml?pid=10359084&lid=553';return false;" class="link" target="_top">Çíàêîìñòâà è îáùåíèå</a>&nbsp;</td>
		</tr>
		</table>
	</td>
</tr>
</table>
<!-- generation time <?=$timer->elapsed()." sec";?> -->
</body>
</html>
Return current item: Admbook