<?php
require_once("config_sql.php");
$zoek = strtolower($_GET['zoek']);
$jouwnaam = strtolower($_GET['jouwnaam']);
$sql = mysql_query("SELECT * FROM members WHERE naam='".$zoek."';");
if (mysql_num_rows($sql) == 1) 
{
	while ($row = mysql_fetch_array($sql)) 
    {
	    $check_online = mysql_num_rows(mysql_query("SELECT * FROM members WHERE DATE_SUB(NOW(),INTERVAL 2 MINUTE) <= last_online AND naam='".$zoek."';"));
	    $check_v = mysql_num_rows(mysql_query("SELECT * FROM vrienden WHERE eigenaar='".$zoek."' AND vriend='".$jouwnaam."';"));
	    $check_v2 = mysql_num_rows(mysql_query("SELECT * FROM vrienden WHERE eigenaar='".$jouwnaam."' AND vriend='".$zoek."';"));
	    $online_status = "offline";
	    $v_status = "ja";
	    if ($check_online == 1)
	    {
		    $online_status = "online";
	    }
	    if (($check_v == 1) or ($check_v2 == 1))
	    {
		    $v_status = "nee";
	    }
	    echo "console_zoek_1 = '".$row['console']."';";
	    echo "console_zoek_2 = '".$row['last_online2']."';";
	    echo "console_zoek_3 = '".$online_status."';";
	    echo "console_zoek_4 = '".$row['functie']."';";
	    echo "console_zoek_5 = '".$v_status."';";
	}
}
else
{
	echo "error";
}
?>