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

	#----------------------------------------------------------------------------
	# $Id: postres.php3,v 1.9 2000/12/14 19:13:55 shevett Exp $
	#----------------------------------------------------------------------------
	
	# First lets do some validation.  If there's a problem, let 'em know.

	$ck = db_query("select * from resources where r_tag='$a_r_tag'");
	if (db_numrows($ck) and ($f_resflag=="add")) {
		$f_flag="skip";
		?>
	<tr bgcolor=#BBBBBB>
	<td width=100% bgcolor=#202020 align=center>
	<table width=50% bgcolor=#bbbbbb cellspacing=2>
		<tr>
			<td bgcolor=#909090 align=center>
				<font color=#ffffff>
				<h3>WARNING!</h3>
				Resource Tag <b><? echo "$a_r_tag</b> already exists!"; ?><br>
				Use your browser's 'BACK' button to fix, or click Cancel.<p>
			</td>
		</tr>
		<tr>
			<td bgcolor=#90FF90 align=center>
				<a href="nbrowse.php3">Cancel</a>
			</td>
		</tr>
	</table>
	</td>
	</tr>
	<?
	} else {

	
	$now=time();
	
	$a_descrip	=	addslashes($a_descrip);

	$flist = "r_ptag, r_multi, r_serno, r_mctag, r_mcphone, r_mcadd, r_model, r_class, r_loc, r_qoh, r_desc, r_status, r_currtech, r_ctag, r_cphone, r_cadd, r_u1val, r_u2val, r_u3val, r_u4val, r_u5val";
	$vlist = "'$a_r_ptag',$a_r_multi,'$a_r_serno','$a_r_mctag','$a_r_mcphone','$a_r_mcadd','$a_r_model','$a_r_class','$a_r_loc',$a_r_qoh,'$a_r_desc','$a_r_status','$a_r_currtech','$a_r_ctag','$a_r_cphone','$a_r_cadd','$a_r_u1val','$a_r_u2val','$a_r_u3val','$a_r_u4val','$a_r_u5val'";

	if ($f_resflag == "add") {
		
		$result	=	db_query("insert into resources (r_tag,$flist) values ('$a_r_tag',$vlist)");
		LogIt("DEBUG","postres.php3","ADD flist is $flist");
		LogIt("DEBUG","postres.php3","ADD vlist is $vlist");
		
		$lastresult[0] = 0;
		$lastresult[1] = "Resource '$a_r_tag' added successfully";
		
		LogIt("DEBUG","postres.php3","Calling insertextras with 'resources' and '$a_r_tag'");
		InsertExtras("resources","$a_r_tag");
		
	}
	
	if ($f_resflag == "mod") {

		$result = db_query("delete from resources where r_tag='$a_r_tag'");
		$result = db_query("insert into resources (r_tag,$flist) values ('$a_r_tag',$vlist)");
		LogIt("DEBUG","postres.php3","MOD flist is $flist");
		LogIt("DEBUG","postres.php3","MOD vlist is $vlist");
		$lastresult[0] = 0;
		$lastresult[1] = "Resource '$a_r_tag' updated.";

		$toss = db_query("delete from ebulk where btable='resources' and bkeyref='$a_r_tag'");
		InsertExtras("resources","$a_r_tag");
	}
	}
		
?>

