<?php
/* Nulled by Wizzywig */
/***********تعريب***********/
/**          saher        **/
/**  منتديات شباب وصبايا  **/
/**   www.shababtop.com   **/
/**  saher1986@live.com   **/
/***************************/

// ########################## INCLUDE BACK-END ###########################
include_once ('config.php');
include_once ('domaincfg.php');
include_once (dirname(__FILE__).'/includes/data_core.php');

// ######################### RENDER DEBUG HTML ###########################
echo ' 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr"> 
<head profile="http://gmpg.org/xfn/11">
	<title>ArrowChat Debug</title>
</head> 
 
<body>
	<div style="font-family:arial,verdana; font-size:16px;">';

// ############################### DEBUG #################################
// Show User ID
if (empty($userid)) {
	echo "
	<span style='color:#c92d2d; font-weight:bold;'>User ID: 0</span><br />You are being registered as not logged in.  If you are logged in, please check the functions_receive.php file to make sure the getUserID function is correct.<br /><br />";
} else {
	echo "
	<span style='color:#2dc93f; font-weight:bold;'>User ID: ".$userid."</span><br />You are being registered as logged in.  If you are not logged in, please check the functions_receive.php file to make sure the getUserID function is correct.<br /><br />";
}

// Check if getFriendsList function is correct
$sql = getFriendsList($userid, time());
$result = mysql_query($sql);
if ($result) {
	$online_friends = mysql_num_rows($result);
	echo "
	<span style='color:#2dc93f; font-weight:bold;'>Online Friends: ".$online_friends."</span><br />It appears that your getFriendsList function is functioning properly.<br /><br />";
} else {
	echo "
	<span style='color:#c92d2d; font-weight:bold;'>There was an error with your getFriendsList function.</span>  Please check your includes/functions_receive.php file and fix your getFriendsList function so that it is receiveing your online friends correctly.<br /><br />";
}


// Show is user ID is banned
if (in_array($_SERVER['REMOTE_ADDR'], $banlist) || in_array($userid, $banlist)) {
	echo "
	<span style='color:#c92d2d; font-weight:bold;'>User ID is banned.</span><br /><br />";
} else {
	echo "
	User ID is <span style='color:#2dc93f; font-weight:bold;'>not banned</span>.<br /><br />";
}

// Check if subdomain files exist
if (test_url_file('http://'.$subdomain.'.'.$domain.'/index.php') && test_url_file('http://channel.narrowchat.com/config.php')) {
	echo "
	Your <span style='color:#2dc93f; font-weight:bold;'>subdomain is setup correctly</span>.<br /><br />";
} else {
	echo "
	ArrowChat is detecting that <span style='color:#c92d2d; font-weight:bold;'>your subdomain files are not setup correctly</span>.  Make sure you have a subdomain like channel.yourdomain.com and the CONTENTS of the subdomain folder are uploaded to the root.  Also, make sure you have a config.php file in the subdomain folder.  If you do not, reinstall ArrowChat and pay close attention to the instructions.<br /><br />";
}

// Check if browser is IE6
if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6.') !== FALSE)) {
	echo "
	You are using an unsupported version of Internet Explorer (version 6).  <span style='color:#c92d2d; font-weight:bold;'>Arrowchat WILL NOT LOAD with this browser.</span><br /><br />";
} else {
	echo "
	You are using an ArrowChat <span style='color:#2dc93f; font-weight:bold;'>compatible browser</span>.<br /><br />";
}

// Check if functions_receive.php exists
if (file_exists(dirname(__FILE__).'/includes/functions_receive.php')) {
	echo "
	You have a <span style='color:#2dc93f; font-weight:bold;'>functions_receive.php file</span>.<br /><br />";
} else {
	echo "
	<span style='color:#c92d2d; font-weight:bold;'>IMPORTANT: You do not have an includes/functions_receive.php file.</span>  Arrowchat needs this to run properly.  Please rename the includes/functions_receive_yourIntegration.php file to functions_receive.php.  If you are using the standalone version, you also need to make sure you edit this file's functions to suit your site.";
}

// ######################### RENDER DEBUG HTML ###########################
echo '
	</div>
</body> 
</html>';

function test_url_file($url) {
	$res = (($ftest = @fopen($url, ‘r’)) === false) ? false : @fclose($ftest);
	return ($res == TRUE) ? 1:0 ;
}

?>