Location: PHPKode > projects > Akasha > akasha/addressbook.php
<?

if ($akashaID == $ID) {

	include ("includes/global.inc"); 		// Global Variables
	include ("includes/functions.inc"); 	// Global Functions
	include ("includes/head.inc"); 			// Standard Headers
	include ("stylesheets/homestyle.inc"); 	// Stylesheets

  echo "</head>\n";
  echo "<body bgcolor='#FFFFFF' leftmargin='0' text='#000000' link='#3457A9' vlink='#3457A9' alink='#009966'>\n";
  echo "<table width='100%' border='0' cellspacing='0' cellpadding='0' height='200'>\n";
  echo "  <tr>\n";
  echo "    <td valign='top'>\n";
  echo "      <table align='center' width='100%' border='0' cellspacing='0' cellpadding='0'>\n";
  echo "        <tr bgcolor='#2B3D61'>\n";
  echo "          <td><b><font color='#DCD7CB'><i>Addressbook</i></font></b></td>\n";
  echo "        </tr>\n";
  echo "      </table>&nbsp;<br>\n";
  echo "        <table width='100%' border='0' cellspacing='2' cellpadding='0'>\n";
  echo "          <tr>\n";
  echo "            <td width='15%' bgcolor='#DCD7CB'><b><font color='#2B3D61'>Last Name</font></b></td>\n";
  echo "            <td width='15%' bgcolor='#DCD7CB'><b><font color='#2B3D61'>First Name</font></b></td>\n";
  echo "            <td width='15%' bgcolor='#DCD7CB'><b><font color='#2B3D61'>Company</font></b></td>\n";
  echo "            <td width='25%' bgcolor='#DCD7CB'><b><font color='#2B3D61'>E-mail</font></b></td>\n";
  echo "            <td width='20%' colspan='1' bgcolor='#DCD7CB'><b><font color='#2B3D61'>Work Number</font></b></td>\n";
  echo "            <td width='20%' colspan='3' bgcolor='#DCD7CB'>&nbsp</td>\n";
  echo "          </tr>\n";

	$user_id = findUserByHash($ID);
	$num_contacts = 0;
	$query = "select count(item_id) from tblAdressbook where user_id = $user_id";
	$result = mysql_db_query("$dbname",$query);
	if($result) {
		while ($r = mysql_fetch_array($result)) {
 			$num_contacts = $r["count(item_id)"];
		}
	}		

	if ($num_contacts == 0) {
    echo "          <tr>\n";
    echo "            <td nowrap colspan='4'><div align='center'>&nbsp;<br><b><font color='#304167'>You have no contacts recorded</font></b></div></td>\n";
    echo "          </tr>\n";
	} else {
  	$query = "select * from tblAdressbook where user_id = $user_id order by
last_name";
  	$result = mysql_db_query("$dbname",$query);
  	if($result) {
  		while ($r = mysql_fetch_array($result)) {
   			$item_id = $r["item_id"];
   			$txtlast = $r["last_name"];
   			$txtfirst = $r["first_name"];			
			$txtemail = $r["ab_email"];
   			$txtwork = $r["work_phone"];
			$txtcompany = $r["company"];

        echo "          <tr bgcolor='#E3E7E8'>\n";
        echo "            <td nowrap width='20%' nowrap>$txtlast</td>\n";
       echo "            <td nowrap width='20%' nowrap>$txtfirst</td>\n";
       echo "            <td nowrap width='20%' nowrap>$txtcompany</td>\n";
        echo "            <td width='40%' nowrap><a href='new_message.php?ID=$ID&to=$email'>$txtemail</a>&nbsp;</td>\n";
       	echo "            <td width='20%' nowrap bgcolor='#E3E7E8' align='center'>$txtwork &nbsp;</td>\n";
        echo "            <td width='10%' nowrap align='center'><a href='contact_delete.php?ID=$ID&item_id=$item_id'>Delete</a></td>\n";
        echo "            <td width='10%' nowrap align='center'><a href='contact_modify.php?ID=$ID&item_id=$item_id'>Modify</a></td>\n";
       echo "            <td width='10%' nowrap align='center'><a href='contact_view.php?ID=$ID&item_id=$item_id'>View</a></td>\n";
        echo "          </tr>\n";
  		}
  	}		
	}
echo "        </table>\n";
echo "      <form method='post' action='contact_add.php?ID=$ID'>\n";
echo "      <table width='550' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>\n";
echo "        <tr>\n";
echo "          <td>\n";
echo "            <table width='100' border='0' cellspacing='0' cellpadding='0' align='center'>\n";
echo "              <tr bgcolor='#FFFFFF'>\n";
echo "                  <td align='center' colspan='3'><b><input type='image' src='images/add.gif' border='0' height='30' width='70'></td>\n";
echo "                </tr>\n";
echo "            </table>\n";
echo "            </td>\n";
echo "        </tr>\n";
echo "      </table>\n";
echo "      </form>\n";
echo "    </td>\n";
echo "  </tr>\n";
echo "</table>\n";
echo "</body>\n";
echo "</html>\n";

} else {
		Header("Location: main.php?error_code=1");
}

?>
Return current item: Akasha