<?php


session_start();
include("include/config.php");
include("include/functions/import.php");
$thebaseurl = $config['baseurl'];

$mainmenu = "7";
STemplate::assign('mainmenu',$mainmenu);
$submenu = "6";
STemplate::assign('submenu',$submenu);

// Verify valid video
if (is_numeric($_REQUEST[pid]))
{
	$pid = $_REQUEST[pid];
	STemplate::assign('pid',$pid);
}
else
{
	$error = "$lang[582]";
}

if ($error == "")
{
	if (does_profile_exist($pid))
	{
		$query = "SELECT * FROM members WHERE USERID='".mysql_real_escape_string($pid)."'";
       	$executequery = $conn->execute($query);
       	$profilearray = $executequery->getarray();
		STemplate::assign('profilearray',$profilearray);
		
		if(mysql_affected_rows()>=1)
		{
		$USERID = $profilearray[0][USERID];
		STemplate::assign('USERID',$USERID);
		
		STemplate::assign('pagetitle',$profilearray[0][username]."'s $lang[34]");
		
		$query = "select * from friends where USERID='$USERID' order by FID desc"; 
		$results = $conn->execute($query);
		$listprofilefriends = $results->getrows();
		STemplate::assign('listprofilefriends',$listprofilefriends);
		$listprofilefriendscount = count($listprofilefriends);
		STemplate::assign('listprofilefriendscount',$listprofilefriendscount);
	
		$showtheme = "memberfriends.tpl";
		}
		else
		{
			$error = "$lang[583]";
		}
	}	
	else
	{
		$error = "$lang[584]";
	}
}


//TEMPLATES BEGIN
STemplate::assign('error',$error);
STemplate::assign('message',$message);

STemplate::display('header.tpl');
if ($error == "")
{
	STemplate::display($showtheme);
}
else
{
	STemplate::display('playvideoerror.tpl');
}
STemplate::display('footer.tpl');
//TEMPLATES END
?>