<?php
include("config.php");
include("core.php");

if($mime== WEB)
{
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";

	echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";

	}else{
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";

	echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
}





	if($mime== WEB)
	{
	echo webhead($uthm,$stitle);

	$getuthm = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));

	$uth = $getuthm[0];

	$uthm = $uth;	





connectdb();
$action = $_GET['action'];
$ses = $_GET['ses'];
$page = $_GET['page'];
$who = $_GET['who'];
$pmid = $_GET['pmid'];
if(islogged($ses)==false)
{

echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo webfoot();
exit();
}
$uid = getuid_ses($ses);
if(isbanned($uid))
{
echo webhead($uthm,$stitle);
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
echo "You are <b>Banned</b><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties
WHERE uid='".$uid."' AND penalty='1'"));
$remain = $banto[0]- time();
$rmsg = gettimemsg($remain);
echo "Time to finish your penalty: $rmsg<br/><br/>";
//echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo webfoot();
exit();
}


else if($action=="send")
{
addonline(getuid_ses($ses),"Sending pop-up MSG","");
echo webhead($uthm,$stitle);
echo "<p align=\"center\">";
$whonick = getnick_uid($who);
$byuid = getuid_ses($ses);
$tm = time();

$res = mysql_query("INSERT INTO fun_pops SET text='".$msg."',
byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");



echo "<img src=\"images/sent.gif\" alt=\"O\"/><br/>";
echo "Popup Message Sent to $whonick!<br/>";

echo "<br/>---<br/><a href=\"index.php?action=main&amp;ses=$ses\">Home</a>";
echo "</p>";
echo webfoot();
exit();

}
else if($action=="sendto"){

$who = $_get['who'];

addonline(getuid_ses($ses),"Sending pop-up MSG","");
echo webhead($uthm,$stitle);
echo "<p align=\"center\">";
echo "$getbuttons <br/>";

$who = $_get['who'];


$whonick = getnick_uid($who);
$byuid = getuid_ses($ses);

echo "<input name=\"msg\" maxlength=\"150\"/><br/>";
echo "SEND<go href=\"popus.php?action=send&amp;who=$who&amp;ses=$ses\"
method=\"post\">";
echo "<postfield name=\"msg\" value=\"$(msg)\"/>";
echo "</go><br/>";


echo "
<br/>-
<br/><a href=\"index.php?action=main&amp;ses=$ses\">Home</a>
";
}
echo "</p>";









	echo webfoot();
}else{

	echo waphead($stitle);
	
	




echo "<p align=\"center\">";
echo "You are not logged in<br/>";
echo "Or Your session has been expired<br/><br/>";
echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo wapfoot();
exit();
}
$uid = getuid_ses($ses);
if(isbanned($uid))
{
echo waphead($stitle););
echo "<p align=\"center\">";
echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
echo "You are <b>Banned</b><br/>";
$banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties
WHERE uid='".$uid."' AND penalty='1'"));
$remain = $banto[0]- time();
$rmsg = gettimemsg($remain);
echo "Time to finish your penalty: $rmsg<br/><br/>";
//echo "<a href=\"index.php\">Login</a>";
echo "</p>";
echo wapfoot();
exit();
}


else if($action=="send")
{
addonline(getuid_ses($ses),"Sending pop-up MSG","");
echo waphead($stitle);
echo "<p align=\"center\">";
$whonick = getnick_uid($who);
$byuid = getuid_ses($ses);
$tm = time();

$res = mysql_query("INSERT INTO fun_pops SET text='".$msg."',
byuid='".$byuid."', touid='".$who."', timesent='".$tm."'");



echo "<img src=\"images/sent.gif\" alt=\"O\"/><br/>";
echo "Popup Message Sent to $whonick!<br/>";

echo "<br/>---<br/><a href=\"index.php?action=main&amp;ses=$ses\">Home</a>";
echo "</p>";
echo wapfoot();
exit();

}
else if($action=="sendto"){

$who = $_get['who'];

addonline(getuid_ses($ses),"Sending pop-up MSG","");
echo waphead($stitle);
echo "<p align=\"center\">";
echo "$getbuttons <br/>";

$who = $_get['who'];


$whonick = getnick_uid($who);
$byuid = getuid_ses($ses);

echo "<input name=\"msg\" maxlength=\"150\"/><br/>";
echo "SEND<go href=\"popus.php?action=send&amp;who=$who&amp;ses=$ses\"
method=\"post\">";
echo "<postfield name=\"msg\" value=\"$(msg)\"/>";
echo "</go><br/>";


echo "
<br/>-
<br/><a href=\"index.php?action=main&amp;ses=$ses\">Home</a>
";
}
echo "</p>";





	echo wapfoot();

	}

?>