<?
	#---------------------------------------------------------------------#
	# This source code is (c)2000 White Pajamas, Inc                      #
	# see http://www.stonekeep.com/license.html for licensing information #
	#---------------------------------------------------------------------#

	#----------------------------------------------------------------------
	# $Id: contactbrowse.php3,v 1.3 2000/12/21 16:46:15 shevett Exp $
	#----------------------------------------------------------------------
	
	include "./conf/keystone.conf.default";
	if (file_exists("./conf/keystone.conf")) {
		include "./conf/keystone.conf";
	}

	$publicfile = "contactbrowse.php3";
	
	include "./db.php3";
	$result = db_connect("");
	include "./utils.php3";
	include "./publicutils.php3";

	#
	# load the status array.  we'll need it.
	#
	
	LoadStatus();

	$curruser = $login;
	$wclause = "where tag='$login'";
	$q = db_query("select passwd,tag from contacts $wclause");
	$usertable = db_fetch_array($q);

	if (strcmp($password, $usertable[passwd]) != 0) {
		echo "<html><body bgcolor=#ffffff><p align=center>\n";
		OpenMessage();
		echo "<font color=#0000000>";
		echo "Incorrect password or no such Contact.<br>";
		echo "<a href=\"index.php3\">Return to Login screen</a></font>";
		CloseMessage();
		echo "</p></body></html>\n";
		exit();
	}
	
	#
	# set up the outside view
	#
	
	FrameTop();
	LeftMenu();
	echo "<td bgcolor=#202020 width=80%>";
	echo "<table width=100% border=0 cellspacing=0 cellpadding=0>";
	
	# 
	# what do we need to do here?
	#

	# make sure the $sid we're getting is just a number, not a hacked SQL command.
	$sid = ereg_replace("[^0-9]","",$sid);

	
	switch ($v_func) {
		case "addfollow" : {
			AddFollow($sid);
			break;;
		}

		case "postfoll" : {
			PostFup($sid);
			break;;
		}

		case "select" : {
			Breaker("&nbsp;");
			SelectBar(); 
			Breaker("");
			ShowSlips();
			break;;
		}
		case "zoom" : {
			SlipZoom($sid);
			break;;
		}
		case "addslip" : {
			AddForm();
			break;;
		}
		case "postit" : {
			PostSlip();
			break;;
		}
		case "" : {
			Breaker("&nbsp;");
			SelectBar(); 
#			Breaker("<hr>");
			ShowSlips();
		}
	}
	
	echo "</table>";
	echo "</td>";
	echo "</tr>";
	FrameFoot(); 
	
?>
</table>
