<?php


include("../include/config.php");
include_once("../include/functions/import.php");
verify_login_admin();
        
		
if($_REQUEST['update'] == "success")
{
	$message = "Member Successfully Edited";
	Stemplate::assign('message',$message);
	STemplate::display("administrator/show_message.tpl");
}
        
if($_REQUEST['edit_member'])
{
	$username = escape($_REQUEST['username']);
	$firstname = escape($_REQUEST['firstname']);
	$lastname = escape($_REQUEST['lastname']);
	$url = escape($_REQUEST['url']);
	$featured = escape($_REQUEST['featured']);
	$gender = escape($_REQUEST['gender']);
	$status = escape($_REQUEST['status']);
	$familyfilter = escape($_REQUEST['familyfilter']);	
	$USERID = escape($_REQUEST['USERID']);
	
	$query = "update members set
	username = '".mysql_real_escape_string($username)."',
	firstname = '".mysql_real_escape_string($firstname)."',
	lastname = '".mysql_real_escape_string($lastname)."',
	url = '".mysql_real_escape_string($url)."',
	featured = '".mysql_real_escape_string($featured)."',
	gender = '".mysql_real_escape_string($gender)."',
	status = '".mysql_real_escape_string($status)."',
	familyfilter = '".mysql_real_escape_string($familyfilter)."'
	where USERID='".mysql_real_escape_string($USERID)."'";
	$conn->execute($query);
	header("Location: listmembersedit.php?update=success&USERID=$USERID");
}

if($_REQUEST['USERID']!="")
{
$USERID = escape($_REQUEST['USERID']);
$query = $conn->execute("select * from members where USERID='".mysql_real_escape_string($USERID)."' limit 1");
$member = $query->getrows();
Stemplate::assign('member', $member[0]);
}

Stemplate::assign('error',$error);
STemplate::display("administrator/listmembersedit.tpl");
?>