<?php
if (!defined("root")) {
	define("root", $_SERVER['DOCUMENT_ROOT']);
}
require(root."/___simple_config.php");
session_start();
require(root."/".adminFolder."/_common.php");
require(root."/".adminFolder."/_lib/db.php");
require(root."/".adminFolder."/_lib/main.php");
require(root."/".adminFolder."/_lib/bootstraps.php");
$pageSubOf = "pages";
$pageName = "results";
$pageTitle = "Results";
$thisUrl = "results";
$ajax_page = "ajax_results.php";
$pageUrl = "/".adminFolder."/$thisUrl";
$a = cekpost(cleanQuery($_GET["a"]), "");
$err = "";
if ($a=="section_main") {
	$fil_stgl = trim(cekpost(cleanQuery($_REQUEST["fil_stgl"]), ""));
	$fil_etgl = trim(cekpost(cleanQuery($_REQUEST["fil_etgl"]), ""));
	$fil_kdpasar = trim(cekpost(cleanQuery($_REQUEST["fil_kdpasar"]), ""));
	$fil_nomor = trim(cekpost(cleanQuery($_REQUEST["fil_nomor"]), ""));
	$fil_isactive = trim(cekpost(cleanQuery($_REQUEST["fil_isactive"]), ""));
	$swhere = '';
	$stgl = cekpost(cleanQuery($_REQUEST["fil_stgl"]), date('d-m-Y', time()));
	$etgl = cekpost(cleanQuery($_REQUEST["fil_etgl"]), date('d-m-Y', time()));
	$q_stgl = strtotime($stgl);
	$q_etgl = strtotime($etgl)+86400;
	$fil_stgl = strtotime($stgl);
	$fil_etgl = strtotime($etgl);
	
	if ($fil_nomor!="") { $swhere .= " AND a.nomor LIKE '%$fil_nomor%' "; }
	if ($fil_kdpasar!="") { $swhere .= " AND a.kdpasar = '$fil_kdpasar' "; }
	if ($fil_isactive!="") { $swhere .= " AND a.isactive = '$fil_isactive' "; }
	
	$rs=array(); $q="SELECT a.*, namapasar FROM hasil a 
		LEFT JOIN pasaran b ON b.kdpasar=a.kdpasar
		WHERE 1=1 $swhere
		AND UNIX_TIMESTAMP(FROM_UNIXTIME(tanggal))>=UNIX_TIMESTAMP(FROM_UNIXTIME(".$q_stgl.")) 
		AND UNIX_TIMESTAMP(FROM_UNIXTIME(tanggal))< UNIX_TIMESTAMP(FROM_UNIXTIME(".$q_etgl.")) 
		ORDER BY tanggal DESC
		";
	callRS($rs, $q);
	if (count($rs)!=0) {
		$ld = 20;
		$cp = cekpost(cleanQuery($_GET["cp"]), "1");
		$tp = intval(count($rs) / $ld) + (count($rs)%$ld==0?0:1);
		$sr = ($cp-1) * $ld;
		$pagination = '';
		if ($tp!=1) {
			$pagination .= ('<ul class="pagination pagination-sm">');
				$disabled = '';
				$purl = '#';
				$onclick = '';
				if ($cp<=1) {
					$disabled = 'disabled';
					$onclick = ' onclick="return false;" ';
				}
				$pagination .= ('<li class="'.$disabled.'"><a href="'.$purl.'" '.($onclick!=""?$onclick:'onclick="filterReload(\''.$pageName.'\', 1);return false;"').'>&lt;&lt;</a></li>');
				$pagination .= ('<li class="'.$disabled.'"><a href="'.$purl.'" '.($onclick!=""?$onclick:'onclick="filterReload(\''.$pageName.'\', '.($cp-1).');return false;"').'>&lt;</a></li>');
				for ($c=1;$c<=$tp;$c++) {
					$active = '';
					$purl = '#';
					$disabled = '';
					$onclick = '';
					if ($c==$cp) {
						$active = 'active';
					} else {
						$purl = '#';
						$onclick = ' onclick="filterReload(\''.$pageName.'\', '.$c.');return false;" ';
					}
					$pagination .= ('<li class="'.$active.' '.$disabled.'"><a href="'.$purl.'" '.$onclick.'>'.$c.'</a></li>');
				}
				$disabled = '';
				$onclick = '';
				if ($cp>=$tp) {
					$disabled = 'disabled';
					$onclick = ' onclick="return false;" ';
				}
				$pagination .= ('<li class="'.$disabled.'"><a href="#" '.($onclick!=""?$onclick:'onclick="filterReload(\''.$pageName.'\', '.($cp+1).');return false;"').'>&gt;</a></li>');
				$pagination .= ('<li class="'.$disabled.'"><a href="#" '.($onclick!=""?$onclick:'onclick="filterReload(\''.$pageName.'\', '.$tp.');return false;"').'>&gt;&gt;</a></li>');
			$pagination .= ('</ul>');
		}
		cout('<div class="alert alert-info" role="alert"><strong>Total whole data</strong> <span class="badge">'.count($rs).'</span></div>');
		
		if ($tp!=1) {
			cout($pagination);
		}
		cout('<table class="table table-striped table-bordered">');
			cout('<thead>');
				cout('<tr>');
					cout('<th class="text-center">#</th>');
					cout('<th class="text-center hidden-xs hidden-sm">Day</th>');
					cout('<th class="text-center">Date</th>');
					cout('<th class="text-center hidden-xs hidden-sm">Market</th>');
					cout('<th class="text-center">Result</th>');
					cout('<th class="text-center">Active Status</th>');
					cout('<th></th>');
				cout('</tr>');
			cout('</thead>');
			cout('<tbody>');
			$cnt = 0;
			for ($i=$sr;$i<count($rs) && $cnt<$ld;$i++) {
				$cnt++;
				$kdhasil = $rs[$i]["kdhasil"];
				if (intval($rs[$i]["isactive"])==0) {
					$isactive = '<a href="#" title="Activate" onclick="chActive(\''.$pageName.'\', '.$kdhasil.', '.$rs[$i]["isactive"].');return false;">Non-Active</a>';
				} else {
					$isactive = '<a href="#" title="Deactivate" onclick="chActive(\''.$pageName.'\', '.$kdhasil.', '.$rs[$i]["isactive"].');return false;">Active</a>';
				}
				
				cout('<tr>');
					cout('<td class="text-center">'.($i+1).'</td>');
					cout('<td class="text-center hidden-xs hidden-sm">'.date('l', $rs[$i]["tanggal"]).'</td>');
					cout('<td class="text-center">'.date('d F Y', $rs[$i]["tanggal"]).'</td>');
					cout('<td class="text-center hidden-xs hidden-sm">'.$rs[$i]["namapasar"].'</td>');
					cout('<td class="text-center"><a href="'.$pageUrl.'/view/'.$rs[$i]["kdhasil"].'/">'.$rs[$i]["nomor"].'</a></td>');
					cout('<td class="text-center isactive'.$kdhasil.'">'.$isactive.'</td>');
					cout('<td class="text-center">');
						cout('<a href="'.$pageUrl.'/edit/'.$kdhasil.'/"><span class="glyphicon glyphicon-pencil"></span><span class="hidden-xs hidden-sm"> Edit</span></a>');
						cout(BSTextSeparator());
						cout('<a href="'.$pageUrl.'/delete/'.$kdhasil.'/"><span class="glyphicon glyphicon-trash"></span><span class="hidden-xs hidden-sm"> Delete</span></a>');
					cout('</td>');
				cout('</tr>');
			}
			cout('</tbody>');
		cout('</table>');
		
		if ($tp!=1) {
			cout($pagination);
		}
		cout('<div class="alert alert-info" role="alert"><strong>Total whole data</strong> <span class="badge">'.count($rs).'</span></div>');
		$act_ket = "Results: Main List";
		if ($swhere!="") { $act_ket .= ": ".cleanQuery($swhere).""; }
		updateUserActivities($act_ket);
	} else {
		cout('<div class="alert alert-info" role="alert">');
			cout('<strong>No data available.</strong> Please add new data for display.');
		cout('</div>');
	}
}
if ($a=="chactive") {
	$kd = cekpost(cleanQuery($_REQUEST["kd"]), "");
	$ca = cekpost(cleanQuery($_REQUEST["ca"]), "");
	$kd = (trim($kd)=="undefined")?'':$kd;
	$ca = (trim($ca)=="undefined")?'':$ca;
	if ($kd!="" && $kd!=0 && $ca!="") {
		$na = $ca==0?1:0;
		$modby = $_SESSION["user"]["inisial"];
		$modtime = time();
		$qu = "UPDATE hasil SET isactive='$na', modby='$modby', modtime='$modtime' WHERE kdhasil='$kd'";
		execRS($qu);
		$act_ket = "Results: Ch. Active [kd: $kd][from Act: $ca][to Act: $na]";
		updateUserActivities($act_ket);
		if (intval($na)==0) {
			$isactive = '<a href="#" title="Activate" onclick="chActive(\''.$pageName.'\', '.$kd.', '.$na.');return false;">Non-Active</a>';
		} else {
			$isactive = '<a href="#" title="Deactivate" onclick="chActive(\''.$pageName.'\', '.$kd.', '.$na.');return false;">Active</a>';
		}
		echo $isactive;
	}
}

if ($a=="section_view") {
	$id = cekpost(cleanQuery($_GET["id"]), "0");
	$rs=array(); $q="SELECT a.*, namapasar FROM hasil a 
		LEFT JOIN pasaran b ON b.kdpasar=a.kdpasar
		WHERE kdhasil='$id'";
	callRS($rs, $q);
	if (intval($rs[0]["isactive"])==0) {
		$isactive = '<a href="#" title="Activate" onclick="chActive(\''.$pageName.'\', '.$rs[0]["kdhasil"].', '.$rs[0]["isactive"].');return false;">Non-Active</a>';
	} else {
		$isactive = '<a href="#" title="Deactivate" onclick="chActive(\''.$pageName.'\', '.$rs[0]["kdhasil"].', '.$rs[0]["isactive"].');return false;">Active</a>';
	}
	$creby = (trim($rs[0]["creby"])!=""?'By: <strong>'.$rs[0]["creby"].'</strong>':'By: &lt;<em>no data</em>&gt;').(trim($rs[0]["cretime"])?' ('.date('d M Y, H:i:s A', $rs[0]["cretime"]).')':' &lt;<em>no data</em>&gt;');
	$modby = (trim($rs[0]["modby"])!=""?'By: <strong>'.$rs[0]["modby"].'</strong>':'By: &lt;<em>no data</em>&gt;').(trim($rs[0]["modtime"])?' ('.date('d M Y, H:i:s A', $rs[0]["modtime"]).')':' &lt;<em>no data</em>&gt;');
	cout('<dl class="dl-horizontal dldata">');
		cout('<dt>Date</dt>');
		cout('<dd>'.date('d F Y', $rs[0]["tanggal"]).'</dd>');
		
		cout('<dt>Market</dt>');
		cout('<dd>'.$rs[0]["namapasar"].'</dd>');
		
		cout('<dt>Result</dt>');
		cout('<dd>'.$rs[0]["nomor"].'</dd>');
		
		cout('<dt>Active Status</dt>');
		cout('<dd class="isactive'.$rs[0]["kdhasil"].'">'.$isactive.'</dd>');
		
		
		cout('<dt>Created</dt>');
		cout('<dd>'.$creby.'</dd>');
		
		cout('<dt>Modified</dt>');
		cout('<dd>'.$modby.'</dd>');
		
		
	cout('</dl>');
	
	$act_ket = "Results: View: [kd: ".$rs[0]["kdhasil"]."][kode: ".$rs[0]["kode"]."][nama: ".$rs[0]["nama"]."]";
	updateUserActivities($act_ket);
	exit;
}
if ($a=="do_delete") {
	$kirim = cekpost(cleanQuery($_REQUEST["kirim"]), "");
	if ($kirim=="1") {
		$delby = $_SESSION["user"]["inisial"];
		$deltime = time();
		$kdhasil = cekpost(cleanQuery($_POST["kdhasil"]), "0");
		$rs=array(); $q="SELECT * FROM hasil WHERE kdhasil='$kdhasil'";
		callRS($rs, $q);
		
		$q = "DELETE FROM hasil WHERE kdhasil='$kdhasil'";
		execRS($q);
		$act_ket = "Results: Delete: Deleted [kd: $kdhasil][tanggal: ".date('d M Y', $rs[0]["tanggal"])."][Result: ".$rs[0]["nomor"]."]";
		updateUserActivities($act_ket);
		cout('<script type="text/javascript">parent.window.location="'.$pageUrl.'/";</script>');
		exit;
	}
}
if ($a=="section_delete") {
	$id = cekpost(cleanQuery($_GET["id"]), "0");
	$rs=array(); $q="SELECT * FROM hasil WHERE kdhasil='$id'";
	callRS($rs, $q);
	
	cout('<form method="post" target="quick_iframe" action="/'.adminFolder.'/_ajax/'.$ajax_page.'?a=do_delete" role="form">');
		cout('<input type="hidden" name="kirim" id="kirim" value="1" />');
		cout('<input type="hidden" name="kdhasil" id="kdhasil" value="'.$rs[0]["kdhasil"].'" />');
		cout('<dl class="dl-horizontal dldata">');
			cout('<dt>Date</dt>');
			cout('<dd>'.date('d M Y', $rs[0]["tanggal"]).'</dd>');
			
			cout('<dt>Result</dt>');
			cout('<dd>'.$rs[0]["nomor"].'</dd>');
			
			cout('<dt></dt>');
			cout('<dd><button class="btn btn-primary" type="submit">Delete</button></dd>');
		cout('</dl>');
	cout('</form>');
	$viewFrame = 0;
	if ($viewFrame==1) {
		cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="300" height="100" style="overflow:;border:1px red solid;" visibility="" scrolling="yes" frameborder="1"></iframe>');
	} else {
		cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="300" height="11" style="overflow:hidden;" visibility="hidden" scrolling="no" frameborder="0"></iframe>');
	}
	$act_ket = "Results: Deleting... [kd: ".$rs[0]["kdhasil"]."][nama: ".$rs[0]["nama"]."]";
	updateUserActivities($act_ket);
	exit;
}
if ($a=="section_image") {
	$id = cekpost(cleanQuery($_GET["id"]), "0");
	$rs=array(); $q="SELECT * FROM hasil WHERE kdhasil='$id' AND isdeleted=0";
	callRS($rs, $q);
	$rsi=array(); $qi="SELECT * FROM u_files WHERE kdhasil='$id'";
	callRS($rsi, $qi);
	if (count($rsi)!=0) {
		cout('<script type="text/javascript">parent.loadUploadedImage(\''.$pageName.'\', \''.$id.'\');</script>');
	} else {
		cout('<script type="text/javascript">parent.loadFormUploadImage(\''.$pageName.'\', \''.$id.'\', 0, 0);</script>');
	}
	$act_ket = "Results: Upload Image... [kd: ".$rs[0]["kdhasil"]."][nama: ".$rs[0]["nama"]."]";
	updateUserActivities($act_ket);
	exit;
}
if ($a=="do_edit") {
	$kirim = cekpost(cleanQuery($_REQUEST["kirim"]), "");
	$err = "";
	if ($kirim=="1") {
		$kdhasil = cekpost(cleanQuery($_REQUEST["kdhasil"]), "0");
		$tanggal = cekpost(cleanQuery($_REQUEST["tanggal"]), "");
		$kdpasar = cekpost(cleanQuery($_REQUEST["kdpasar"]), "");
		$nomor = cekpost(cleanQuery($_REQUEST["nomor"]), "");
		$isactive = cekpost(cleanQuery($_REQUEST["isactive"]), 0);
		if ($tanggal!="") { $tanggal = strtotime($tanggal." ".date('H:i:s', time())); }
		if ($nomor=="") { $err.= BSErrorMessage('Result must be filled'); }
		if ($kdpasar=="") { $err.= BSErrorMessage('Market must be choose'); }
		if ($tanggal=="") { $err.= BSErrorMessage('Date must be filled'); }
		if ($err=="") {
			$modby = $_SESSION["user"]["inisial"];
			$modtime = time();
			$q = "UPDATE hasil SET tanggal='$tanggal', kdpasar='$kdpasar', nomor='$nomor', isactive='$isactive', modby='$modby', modtime='$modtime' 
				WHERE kdhasil='$kdhasil'";
			execRS($q);
			$act_ket = "Results: Edit: Updated [kd: $kdhasil][tanggal: $tanggal][kdpasar: $kdpasar][nomor: $nomor][isactive: $isactive]";
			updateUserActivities($act_ket);
			cout('<script type="text/javascript">parent.window.location="'.$pageUrl.'/view/'.$kdhasil.'/";</script>');
		} else {
			cout('<script type="text/javascript">parent.showError(\''.$err.'\');</script>');
		}
		exit;
	}
	exit;
}

if ($a=="section_edit") {
	$id = cekpost(cleanQuery($_GET["id"]), "0");
	$rs=array(); $q="SELECT * FROM hasil WHERE kdhasil='$id'";
	callRS($rs, $q);
	cout('<form method="post" target="quick_iframe" action="/'.adminFolder.'/_ajax/'.$ajax_page.'?a=do_edit" role="form">');
		cout('<input type="hidden" name="kirim" id="kirim" value="1" />');
		cout('<input type="hidden" name="kdhasil" id="kdhasil" value="'.$rs[0]["kdhasil"].'" />');
		cout('<dl class="dl-horizontal dldata">');
			cout('<dt><label for="tanggal">Date</label></dt>');
			cout('<dd>
				<div class="form-group">
					<div class="controls">
						<div class="input-group">
							<input id="tanggal" name="tanggal" type="text" class="tanggal form-control" placeholder="Date" value="'.date('d-m-Y', $rs[0]["tanggal"]).'" />
							<label for="tanggal" class="input-group-addon btn">
								<span class="glyphicon glyphicon-calendar"></span>
							</label>
						</div>
					</div>
				</div>
			</dd>');
			
			cout('<dt><label for="kdpasar">Market</label></dt>');
			cout('<dd>');
				cout('<select name="kdpasar" id="kdpasar" class="form-control">');
					cout('<option value="">- Choose Market -</option>');
					$rsx=array();$qx="SELECT * FROM pasaran WHERE isactive=1";
					callRS($rsx, $qx);
					for ($x=0;$x<count($rsx);$x++) {
						$sel = intval($rsx[$x]["kdpasar"])==intval($rs[0]["kdpasar"])?' selected="selected" ':'';
						cout('<option value="'.$rsx[$x]["kdpasar"].'" '.$sel.'>'.$rsx[$x]["namapasar"].'</option>');
					}
				cout('</select>');
			cout('</dd>');
			
			cout('<dt><label for="nomor">Result</label></dt>');
			cout('<dd><input class="form-control" type="text" name="nomor" id="nomor" value="'.$rs[0]["nomor"].'" /></dd>');
			$isactive0 = intval($rs[0]["isactive"])==0?'selected="selected"':'';
			$isactive1 = intval($rs[0]["isactive"])==1?'selected="selected"':'';
			cout('<dt><label for="isactive">Active Status</label></dt>');
			cout('<dd>
				<select name="isactive" id="isactive" class="form-control">
					<option value="0" '.$isactive0.'>Non-Active</option>
					<option value="1" '.$isactive1.'>Active</option>
				</select>
			</dd>');
			
			cout('<dt></dt>');
			cout('<dd class="err"></dd>');
			
			cout('<dt></dt>');
			cout('<dd><button class="btn btn-primary" type="submit">Update</button></dd>');
		cout('</dl>');
	cout('</form>');
	$viewFrame = 0;
	if ($viewFrame==1) {
		cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="300" height="100" style="overflow:;border:1px red solid;" visibility="" scrolling="yes" frameborder="1"></iframe>');
	} else {
		cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="300" height="11" style="overflow:hidden;" visibility="hidden" scrolling="no" frameborder="0"></iframe>');
	}
	$act_ket = "Results: Editing... [kd: ".$rs[0]["kdhasil"]."][nama: ".$rs[0]["nama"]."]";
	updateUserActivities($act_ket);
	exit;
}
if ($a=="do_add") {
	$kirim = cekpost(cleanQuery($_REQUEST["kirim"]), "");
	$err = "";
	if ($kirim=="1") {
		$nomor = cekpost(cleanQuery($_REQUEST["nomor"]), "");
		$kdpasar = cekpost(cleanQuery($_REQUEST["kdpasar"]), "");
		$isactive = cekpost(cleanQuery($_REQUEST["isactive"]), 0);
		$tanggal = cekpost(cleanQuery($_REQUEST["tanggal"]), "");
		if ($tanggal!="") { $tanggal = strtotime($tanggal." ".date('H:i:s', time())); }
		if ($nomor=="") { $err.= BSErrorMessage('Result Number must be filled'); }
		if ($kdpasar=="") { $err.= BSErrorMessage('Market must be choose'); }
		if ($tanggal=="") { $err.= BSErrorMessage('Date must be filled'); }
		if ($err=="") {
			$creby = $_SESSION["user"]["inisial"];
			$cretime = time();
			$kdhasil = getID("hasil", "kdhasil");
			$q = "INSERT INTO hasil (kdhasil, kdpasar, tanggal, nomor, isactive, creby, cretime) 
				VALUES ('$kdhasil', '$kdpasar', '$tanggal', '$nomor', '$isactive', '$creby', '$cretime')";
			execRS($q);
			$act_ket = "Results: Add [kd: $kdhasil][kdpasar: $kdpasar][tanggal: $tanggal][nomor: $nomor]";
			updateUserActivities($act_ket);
			cout('<script type="text/javascript">parent.window.location="'.$pageUrl.'/view/'.$kdhasil.'/";</script>');
		} else {
			cout('<script type="text/javascript">parent.showError(\''.$err.'\');</script>');
		}
		exit;
	}
	exit;
}
if ($a=="section_add") {
	cout('<form method="post" target="quick_iframe" action="/'.adminFolder.'/_ajax/'.$ajax_page.'?a=do_add" role="form">');
		cout('<input type="hidden" name="kirim" id="kirim" value="1" />');
		cout('<dl class="dl-horizontal dldata">');
			cout('<dt><label for="tanggal">Date</label></dt>');
			cout('<dd>
				<div class="form-group">
					<div class="controls">
						<div class="input-group">
							<input id="tanggal" name="tanggal" type="text" class="tanggal form-control" placeholder="Date" value="'.date('d-m-Y', time()).'" />
							<label for="tanggal" class="input-group-addon btn">
								<span class="glyphicon glyphicon-calendar"></span>
							</label>
						</div>
					</div>
				</div>
			</dd>');
			
			cout('<dt><label for="kdpasar">Market</label></dt>');
			cout('<dd>');
				cout('<select name="kdpasar" id="kdpasar" class="form-control">');
					cout('<option value="">- Choose Market -</option>');
					$rsx=array();$qx="SELECT * FROM pasaran WHERE isactive=1";
					callRS($rsx, $qx);
					for ($x=0;$x<count($rsx);$x++) {
						cout('<option value="'.$rsx[$x]["kdpasar"].'">'.$rsx[$x]["namapasar"].'</option>');
					}
				cout('</select>');
			cout('</dd>');
			
			cout('<dt><label for="nomor">Result</label></dt>');
			cout('<dd><input class="form-control" type="text" name="nomor" id="nomor" /></dd>');
			
			cout('<dt><label for="isactive">Active Status</label></dt>');
			cout('<dd>
				<select name="isactive" id="isactive" class="form-control">
					<option value="0">Non-Active</option>
					<option value="1">Active</option>
				</select>
			</dd>');
			
			cout('<dt></dt>');
			cout('<dd class="err"></dd>');
			
			cout('<dt></dt>');
			cout('<dd><button class="btn btn-primary" type="submit">Add</button></dd>');
		cout('</dl>');
	cout('</form>');
	cout('<script>parent.bindDatePicker(\'.tanggal\');</script>');
	$viewFrame = 0;
	if ($viewFrame==1) {
		cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="300" height="100" style="overflow:;border:1px red solid;" visibility="" scrolling="yes" frameborder="1"></iframe>');
	} else {
		cout('<iframe name="quick_iframe" id="quick_iframe" src="/'.adminFolder.'/_ajax/index.php" width="300" height="11" style="overflow:hidden;" visibility="hidden" scrolling="no" frameborder="0"></iframe>');
	}
	$act_ket = "Results: Adding...";
	updateUserActivities($act_ket);
	exit;
}
?>