Location: PHPKode > projects > HuskyMail Webmail > contacts/list.php
<table border='0' cellpadding='0' cellspacing='0'>
	<?php if (count($notice) > 0) { ?>
	<tr><td class='titlebars' align='center'>
		<b style='font-size: 11px; color: #FF0000;'>ERRORS AND WARNINGS</b></td></tr>
	<form name='contacts_form' action='compose.php' method='post'>
	<tr><td style='padding: 10px; border: 1px solid #666666; background-color: rgb(250,250,250);' align='center'>
		<b>The following errors occurred:</b><br/>
		<?php foreach ($notice as $k) { echo "<br/>".$k; } ?>
	</td></tr>
	<tr><td height='5'></td></tr>
	<?php } ?>
	<tr><td class='titlebars' align='center'>
		<b style='font-size: 11px;'>CONTACT FILES</b></td></tr>
	<form name='contacts_form' action='compose.php' method='post'>
	<tr><td style='padding: 10px; border: 1px solid #666666; background-color: rgb(250,250,250);' align='center'>

<?php
$problem = false;
$contacts = array();
$handle = opendir($bookdir);
$skip = array(".","..","index.php","backups","groups.php","security.php","thumbs.db","desktop.ini",".DS_Store","_notes");
while($file = readdir($handle)) {
	if (!in_array($file,$skip)) { array_push($contacts,$file); }}
if (count($contacts) == 0) { echo "You currently have no contacts"; }
else {
	$some = 0;
	echo "<table border='0' cellpadding='0' cellspacing='0'>";
	foreach($contacts as $c) {
		require_once($bookdir.$c);
		if ($test_encrypt != "husky") {
			if (isset($_COOKIE['passkey'])) {
				$passkey = $foo->decode($_COOKIE['passkey'],$default_key);
				if ($foo->decode($test_encrypt,$passkey) == "husky") {
					$identifier = $foo->decode($identifier,$passkey);
					$emailhome = $foo->decode($emailhome,$passkey);
					$emailwork = $foo->decode($emailwork,$passkey);
					$uniqueid = $foo->decode($uniqueid,$passkey);
					$mod = false;
				} else { $mod = true; }
			} else { $mod = true; }
		} else { $mod = false; }
		if ($mod == true) {
			$some++;
			$identifier = "Encrypted";
			$emailhome = "Encrypted";
			$emailwork = "Encrypted";
			$uniqueid = str_replace(".php","",$c); }
		echo "<tr></td><td>";
		echo "<input type='checkbox' name='addr_list[]' value='";
		if ($emailwork != "") { echo $emailwork; }
		if (($emailhome != "") && ($emailwork != "")) { echo ", "; }
		if ($emailhome != "") { echo $emailhome; }
		echo "'>";
		echo "</td><td></td><td width='2'></td><td><td><b>".$identifier."</b></td><td style='width: 10px;'>&nbsp;</td><td>";
		if ($emailhome != "") { echo "<tt>[</tt>"; }
		echo "</td><td width='2'></td><td>";
		if ($emailhome != "") { echo "<a onfocus='this.blur();' style='text-transform: lowercase; font-size: 12px; font-weight: normal;' href='compose.php?send_to=".$emailhome."'>".$emailhome."</a>"; }
		echo "</td><td width='2'></td><td>";
		if ($emailhome != "") { echo "<tt>]</tt>"; }
		echo "</td><td width='2'></td><td>";
		if ($emailwork != "") { echo "<tt>[</tt>"; }
		echo "</td><td width='2'></td><td>";
		if ($emailwork != "") { echo "<a onfocus='this.blur();' style='text-transform: lowercase; font-size: 12px; font-weight: normal;' href='compose.php?send_to=".$emailwork."'>".$emailwork."</a>"; }
		echo "</td><td width='2'></td><td>";
		if ($emailwork != "") { echo "<tt>]</tt>"; }
		echo "</td><td width='15'></td>";
		if ($identifier == "Encrypted") { echo "<td></td><td width='2'></td>"; }
		else { echo "<td><tt>[</tt><a onfocus='this.blur();' href='contacts.php?view=".$uniqueid."'>VIEW</a><tt>]</tt></td><td width='2'></td>"; }
		if ($identifier == "Encrypted") { echo "<td></td><td width='2'></td>"; }
		else { echo "<td><tt>[</tt><a onfocus='this.blur();' href='contacts.php?edit=".$uniqueid."'>EDIT</a><tt>]</tt></td><td width='2'></td>"; }
		echo "<td><tt>[</tt><a onfocus='this.blur();' href='contacts.php?delete=1&file=".$uniqueid."'>DELETE</a><tt>]</tt></td>";
		echo "<td style='padding-left: 10px;'>";
		if ($test_encrypt != "husky") {
			if ($identifier == "Encrypted") {
				echo "<span style='color: #FF0000; font-size: 12px;'><b>&#10003;</b></span>"; }
			else { echo "<span style='color: #00CC00; font-size: 12px;'><b>&#10003;</b></span>"; }
		}
		else { echo "<span style='color: #666666; font-size: 12px;'><b>&#10003;</b></span>"; }
		echo "</td>";
		echo "</tr>"; }
	echo "</table>";
	if ($some > 0) { $problem = true; }}
?>
	
	<table border='0' cellpadding='0' cellspacing='0' style='margin-top: 15px;'>
		<tr>
			<td>Create New Contact:</td>
			<td width='10'></td>
			<td><input type='text' id='new_contact' size="20" /></td>
			<td width='10'></td>
			<td><tt>[</tt><input type='button' name='createcontact' value='CREATE' onfocus='this.blur()' onclick='newcontact();' /><tt>]</tt></td>
		</tr>
	</table>
	</td></tr>
	<?php if (count($contacts) > 0) { ?>
	<tr><td style='padding: 5px; border: 1px solid #666666; border-top: none;' align='center'>
<table border='0' cellpadding='0' cellspacing='0'>
	<tr>
		<td style='font-size: 11px; color: #666666;'>Select:</td>
		<td width='5'></td>
		<td><tt>[</tt><a onfocus='this.blur();' href='JavaScript:contacts_all();'>ALL</a><tt>]</tt></td>
		<td width='2'></td>
		<td><tt>[</tt><a onfocus='this.blur();' href='JavaScript:contacts_none();'>NONE</a><tt>]</tt></td>
		<td width='2'></td>
		<td><tt>[</tt><a onfocus='this.blur();' href='JavaScript:contacts_toggle();'>TOGGLE</a><tt>]</tt></td>
		<td width='20'>&nbsp;</td>
		<td style='font-size: 11px; color: #666666;'>with selected:</td>
		<td width='5'></td>
		<td><tt>[</tt><input type='submit' name='submit' value='COMPOSE' onfocus='this.blur();' class='btn'><tt>]</tt></td>
	</tr>
</table>
	</td></tr>
	<?php } ?>
	</form>
	<tr><td height='5'></td></tr>
	<form name='groups_form' action='compose.php' method='post'>
	<tr><td class='titlebars' align='center'>
		<b style='font-size: 11px;'>CONTACT GROUPS</b></td></tr>
	<tr><td style='padding: 10px; border: 1px solid #666666; background-color: rgb(250,250,250);' align='center'>
		<?php
		include($bookdir."groups.php");
		if (count($group_names) == 0) { echo "You currently have no groups"; }
		else {
echo "<table border='0' cellpadding='0' cellspacing='0'>";
for ($g=0; $g<count($group_names); $g++) {
	echo "<tr><td><input type='checkbox' name='addr_list[]' value='";
	
	if (count($group_files[$g]) > 0) {
		$e = "";
		foreach ($group_files[$g] as $k) {
			if (file_exists($bookdir.$k.".php")) {
				include($bookdir.$k.".php");
				if (($emailhome != "") && ($emailwork != "")) {
					$e .= $emailhome.", ".$emailwork; }
				else if ($emailhome != "") { $e .= $emailhome; }
				else if ($emailwork != "") { $e .= $emailwork; }
				$e .= ", "; }}
		$len = strlen($e);
		$slast = $len - 2;
		$last = $len - 1;
		$end = $e[$slast].$e[$last];
		if ($end == ", ") {
			$temp = "";
			for ($r=0; $r<$slast; $r++) { $temp .= $e[$r]; }
			$e = $temp; }
		echo $e; }
	
	echo "'></td><td width='10'></td><td><b>".$group_names[$g]."</b></td><td width='20'></td><td><b>".count($group_files[$g])."</b> Contact";
	if (count($group_files[$g]) > 1) { echo "s"; }
	echo "</td><td></td><td width='20'></td><td><tt>[</tt> <a href='contacts.php?edit_group=".$group_names[$g]."' onfocus='this.blur();'>EDIT</a> <tt>]</tt> <tt>[</tt> <a href='contacts.php?del_group=".$group_names[$g]."' onfocus='this.blur();'>DELETE</a> <tt>]</tt></td></tr>";
}
echo "</table>"; }
		?>
		<table border='0' cellpadding='0' cellspacing='0' style='margin-top: 15px;'>
			<tr>
				<td>Create New Group:</td>
				<td width='10'></td>
				<td><input type='text' id='new_group' size="20" /></td>
				<td width='10'></td>
				<td><tt>[</tt><input type='button' name='creategroup' value='CREATE' onfocus='this.blur()' onclick='newgroup();' /><tt>]</tt></td>
			</tr>
		</table>
	</td></tr>
<?php if (count($group_names) > 0) { ?>
	<tr><td style='padding: 5px; border: 1px solid #666666; border-top: none;' align='center'>
<table border='0' cellpadding='0' cellspacing='0'>
	<tr>
		<td style='font-size: 11px; color: #666666;'>Select:</td>
		<td width='5'></td>
		<td><tt>[</tt><a onfocus='this.blur();' href='JavaScript:groups_all();'>ALL</a><tt>]</tt></td>
		<td width='2'></td>
		<td><tt>[</tt><a onfocus='this.blur();' href='JavaScript:groups_none();'>NONE</a><tt>]</tt></td>
		<td width='2'></td>
		<td><tt>[</tt><a onfocus='this.blur();' href='JavaScript:groups_toggle();'>TOGGLE</a><tt>]</tt></td>
		<td width='20'>&nbsp;</td>
		<td style='font-size: 11px; color: #666666;'>with selected:</td>
		<td width='5'></td>
		<td><tt>[</tt><input type='submit' name='submit' value='COMPOSE' onfocus='this.blur();' class='btn'><tt>]</tt></td>
	</tr>
</table>
	</td></tr>
<?php } ?>
	</form>
	<tr><td height='5'></td></tr>
	<tr><td class='titlebars' align='center'>
		<b style='font-size: 11px;'>ADDRESS BOOK BACKUPS</b></td></tr>
	<tr><td style='padding: 10px; border: 1px solid #666666; background-color: rgb(250,250,250);' align='center'>
<?php
$backups = $bookdir."backups";
if (isset($_GET['delbkp'])) { @unlink($backups."/".$_GET['delbkp']); }
$b = array();
$skip = array(".","..","index.php",".htaccess","thumbs.db","desktop.ini",".DS_Store","_notes");
if (file_exists($backups)) {
	$handle = opendir($backups);
	while($file = readdir($handle)) {
		if (!in_array($file,$skip)) { array_push($b,$file); }}
	if (count($b) == 0) { echo "You currently have no backups"; }
	else {
		echo "<table border='0' cellpadding='0' cellspacing='0'>";
		foreach ($b as $k) {
			echo "<tr><td nowrap>";
			echo $k[15].$k[16].":".$k[17].$k[18].":".$k[19].$k[20]." &nbsp; ".
			$k[13].$k[14]." / ".$k[11].$k[12]." / ".$k[7].$k[8].$k[9].$k[10];
			echo "</td><td width='10'></td><td><tt>[</tt><a href='".$backups."/".$k."' onfocus='this.blur();'>DOWNLOAD</a><tt>]</tt></td><td width='2'></td><td><tt>[</tt><a href='contacts.php?restore=".$k."' onfocus='this.blur();'>RESTORE</a><tt>]</tt></td><td width='2'></td><td><tt>[</tt><a href='contacts.php?delbkp=".$k."' onfocus='this.blur();'>DELETE</a><tt>]</tt></td>";
			echo "</tr>";
		}
		echo "</table>";
	}
}
else { echo "You currently have no backups"; }
?>
<table border='0' cellpadding='0' cellspacing='0' style='margin-top: 15px;'>
	<tr>
		<form action='contacts.php' method='post' enctype="multipart/form-data">
		<input type='hidden' name='uploadr' value='1'>
		<td>Upload Backup File:</td>
		<td width='10'></td>
		<td><input type='file' name='file' size="20" /></td>
		<td width='10'></td>
		<td><tt>[</tt><input type='submit' name='submit' value='UPLOAD' onfocus='this.blur()' /><tt>]</tt></td>
		</form>
	</tr>
</table>
	</td></tr>
	<tr><td style='padding: 5px; border: 1px solid #666666; border-top: none;' align='center'>
		<tt>[</tt><a onfocus='this.blur();' href='contacts.php?backup=1'>BACKUP</a><tt>]</tt>
	</td></tr>
	<?php if ($problem == true) { ?>
	<tr><td height='5'></td></tr>
	<tr><td class='titlebars' align='center'>
		<b style='font-size: 11px;'>CHANGE SESSION ENCRYPTION PASSKEY</b></td></tr>
	<tr><td style='padding: 10px; border: 1px solid #666666; background-color: rgb(250,250,250);' align='center'>
<div style='margin-bottom: 10px; width: 500px;' align='center'>
Some of your contact files are encrypted and cannot be accessed either because you didn't sign in with a passkey, or the passkey specified during login is different to that used to encrypt the files. If you don't know the passkey used to encrypt an address book contact file, you cannot decrypt its contents.</div>
<table border='0' cellpadding='0' cellspacing='0'><form method='post' target='_top' action='passkey.php'><input type='hidden' name='redirect' value='contacts'><tr><td nowrap><b>New Session Passkey:</b></td><td width='10'>&nbsp;</td><td><input type='password' class='txt' name='newpasskey' id='newpasskey' value='' style='width: 100px;'></td><td width='10'>&nbsp;</td><td><tt>[</tt><input onfocus='this.blur();' type='submit' onmouseover='look(this,1);' onmouseout='look(this,0);' vspace='0' hspace='0' class='btn' name='submit' value='CHANGE'><tt>]</tt></td></tr></form></table>
	</td></tr>
	<?php } ?>
</table>
<div style='margin-top: 10px;' align='center'>
<span style='font-size: 11px; color: #666666;'>
<span style='color: #666666; font-size: 12px;'><b>&#10003;</b></span> Not Encrypted
<span style='color: #00CC00; font-size: 12px;'><b>&#10003;</b></span> Encrypted
<span style='color: #FF0000; font-size: 12px;'><b>&#10003;</b></span> Wrong Encryption Passkey
</span></div>
Return current item: HuskyMail Webmail