PHP Code:
<?php
include("inc/func.inc.php");
//include("inc/func2.inc.php");
//check_injection();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
if(!db()){
echo "<head>";
echo "<title>$numesite - Mereu alaturi de tine !</title>";
include("inc/css.inc.php");
echo "</head>";
echo "<body>";
echo getdberror();
echo "</body>";
echo "</html>";
exit();
}
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$uid = getuid_sid($sid);
$uip = getip();
$ubr = $_SERVER['HTTP_USER_AGENT'];
cleardata();
addvisitor();
if(isipbanned($uip,$ubr)){
if(!isshield(getuid_sid($sid))){
echo "<head>";
echo "<title>$numesite - Mereu alaturi de tine !</title>";
include("inc/css.inc.php");
echo "</head>";
echo "<body>";
echo getipbanned($uip, $ubr);
echo "</body>";
echo "</html>";
exit();
}
}
if(($action != "") && ($action != "terms")){
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0)){
echo "<head>";
echo "<title>$numesite - Mereu alaturi de tine !</title>";
include("inc/css.inc.php");
echo "</head>";
echo "<body>";
echo getsesexplog();
echo "</body>";
echo "</html>";
exit();
}
}
if((isbanned($uid))&&($uid != '0')){
echo "<head>";
echo "<title>$numesite - Mereu alaturi de tine !</title>";
include("inc/css.inc.php");
echo "</head>";
echo "<body>";
echo getbanned($uid);
echo "</body>";
echo "</html>";
exit();
}
$r = rand(0,100000);
////////////////////////////////////////MENIU TRIVIA
$timeto = 600;
$timenw = time();
$timeout = $timenw-$timeto;
$deleted = mysql_query("DELETE FROM trivia WHERE timp<".$timeout."");
addtotrivia($uid);
$timeto = 300;
$timenw = time();
$timeout = $timenw-$timeto;
$deleted = mysql_query("DELETE FROM trivia WHERE timp<".$timeout."");
$nick = getnick_sid($sid);
if($action=="trivia")
{
$uid = getuid_sid($sid);
$whonick = getnick_uid($who);
$autorizat = mysql_fetch_array(mysql_query("SELECT validated FROM mx_users WHERE id='".getuid_sid($sid)."'"));
$nick = getnick_sid($sid);
include("header_trivia.inc.php");
addonline(getuid_sid($sid),"<b>(web)</b> Joaca Trivia","trivia.php?action=$action&timp=$r");
echo "<p align=\"center\">";
echo "<small><a href=\"trivia.php?action=trivia&sid=$sid&intr=$r\"><img src=\"images/timer.gif\" alt=\"x\"/> [refresh] </a></small><br/>";
echo "<form action=\"trivia.php?action=trivia&sid=$sid&intr=$r\" method=\"post\">";
echo "<input name=\"mesaj\" maxlength=\"100\">";
echo "<input type=\"Submit\" value=\"OK\" name=\"OK\"></form>";
$chatters=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM onlinetrivia"));
echo "<small>Jucatori? <a href=\"trivia.php?action=conectati&sid=$sid&intr=$r\">[$chatters[0]]</a></small>";
$unreadinbox=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_private WHERE unread='1' AND touid='".$uid."'"));
$pmtotl=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM mx_private WHERE touid='".$uid."'"));
$unrd="[".$unreadinbox[0]."]";
if ($unreadinbox[0]>0)
{
echo "<small>/ Posta: <a href=\"inbox.php?action=main&sid=$sid\">$unrd</a></small>";
}
echo " <br/>";
echo "</p><p align=\"left\">";
////////////
$cerere = @mysql_query("select `mesaj` from trivia where uid='".$uid."' order by id desc;");
$anterior = @mysql_fetch_array($cerere);
$mesaj=htmlspecialchars(stripslashes(trim($mesaj)));
if(!empty($mesaj) && $mesaj!=$anterior['mesaj'])
{
@mysql_query("SELECT uid FROM trivia");
$chnick = getnick_uid($chat[0]);
$whonick = getnick_uid($who);
$chatok = mysql_query("INSERT INTO trivia SET id=0, uid='".$uid."', mesaj='$mesaj', timp='".time()."', valid=0;");
$puncte_user_trivia=mysql_fetch_array(mysql_query("SELECT chmsgs FROM mx_users WHERE id='".$uid."'"));
$totl = $puncte_user_trivia[0]+1;
$msgst= mysql_query("UPDATE mx_users SET chmsgs='".$totl."' WHERE id='".$uid."'");
}
$chats = mysql_query("SELECT `identificare`,`raspuns`,`timp` FROM trivia WHERE uid='' ORDER BY id DESC;");
$trivie = @mysql_fetch_array($chats);
$chat3 = @mysql_query("select * from intrebari;");
$numar = @mysql_num_rows($chat3);
$intr = $trivie['identificare'];
if(empty($intr))
$intr = rand(1,$numar);
$cerere2 = @mysql_query("select * from intrebari where id='$intr';");
$cerere = @mysql_fetch_array($cerere2);
$intrebare2 = $cerere['intrebare'];
$webadv = strtolower($cerere['raspuns']);
$mesaj = strtolower($mesaj);
$dan = $trivie['raspuns'];
$intrebare = $trivie['identificare'];
$time = $trivie['timp'];
$litere = strlen($webadv);
$now = time();
$xfile = @file("puncte.dll");
$random_num = rand (0,count($xfile)-1);
$udata = explode("::",$xfile[$random_num]);
if($intrebare)
{
if(($now < $time + 100)&&(empty($dan)))
{
if(preg_match("/$webadv/i","$mesaj"))
{
$puncte_user_trivia=mysql_fetch_array(mysql_query("SELECT punctaj FROM mx_users WHERE id='".$uid."'"));
@mysql_query("update mx_users set punctaj=".($puncte_user_trivia[0]+$udata[1])." where id='".$uid."'");
$uid = getuid_sid($sid);
$whonick = getnick_uid($who);
$nick = getnick_sid($sid);
echo "<small>CORECT </small><img src=\"bravo.gif\" alt=\".\"/>";
@mysql_query("INSERT INTO trivia SET id=0, timp='".time()."',mesaj=' $nick!Ai castigat $udata[1] puncte Total:".($puncte_user_trivia[0]+$udata[1])." puncte!', valid=1;");
@mysql_query("update trivia set raspuns='1' where identificare='$intr' and uid=''");
}
}else{
if(empty($dan)&&(!empty($intrebare)))
$chat = mysql_query("INSERT INTO trivia SET id=0, timp='".time()."', mesaj='Raspunsul era: $webadv!', identificare='0', raspuns='0', valid=1;");
}
}else{
$chat = mysql_query("INSERT INTO trivia SET id=0, timp='".time()."', mesaj='$intrebare2 ($litere litere)', identificare='$intr', raspuns='0', valid=1;");
}
/////////////////////////boot trivia inceput
$num_msgs1=2;
$sql = "SELECT id, uid, mesaj, timp FROM trivia WHERE valid='1' ORDER BY id desc limit $num_msgs1;";
$posts = mysql_query($sql);
while($post = mysql_fetch_array($posts))
{
$unick = getnick_uid($post[1]);
$usl = "";
$pst = parsemsg($post[2], $sid);
echo " <small>$pst</small><br/><small>~~~~~~~~</small><br/>";
}
////////////////////////////////boot trivia sfarsit
/////////////////////////blocheaza pc inceput
if(istrashed($uid))
{
}else{
}
////////////////////////////////////////////
$num_msgs=5;
$sql = "SELECT id, uid, mesaj, timp FROM trivia WHERE valid='0' ORDER BY id desc limit $num_msgs;";
$posts = mysql_query($sql);
while($post = mysql_fetch_array($posts))
{
$unick = getnick_uid($post[1]);
$dtot = date("H:i:s",$post[3]);
$usl = "<a href=\"trivia.php?action=usertrivia&sid=$sid&who=$post[1]\">".getsimboluri($post[1])."$unick</a>-$dtot";
$pst = htmlspecialchars($post[2]);
echo "<small><br/>$usl<br/> $pst</small>";
}
echo "<br/>";
echo "</p><p align=\"center\">";
echo "<small><a href=\"trivia.php?action=toptrivia&sid=$sid&intr=$r\"> +Top Trivia</a></small><br/>";
//echo "<small><a href=\"trivia.php?action=infotrivia&sid=$sid&intr=$r\"> *Info Trivia</a></small><br/>";
echo "<small><a href=\"index.php?action=main&sid=$sid\">".$homeimg."Meniu Prim</a></small>";
echo "</p>";
include("footer.inc.php");
echo "</html>";
exit();
}
//////////////////////////////conectati
else if ($action=="conectati")
{
include("header.inc.php");
echo "<p align=\"left\">";
addonline(getuid_sid($sid),"<b>(web)</b> Conectati Trivia","trivia.php?action=$action&intr=$r");
$inside=mysql_query("SELECT DISTINCT * FROM onlinetrivia WHERE uid IS NOT NULL");
while($ins=mysql_fetch_array($inside))
{
$unick = getnick_uid($ins[1]);
$userl = "<small>» <a href=\"trivia.php?action=usertrivia&sid=$sid&who=$ins[1]\">".getsimboluri($ins[1])."$unick</a></small><br/>";
echo "$userl";
}
echo "</p>";
echo "<p align=\"center\">";
echo "<br/><small>---=---</small><br/>";
echo "<small><a href=\"trivia.php?action=trivia&sid=$sid&intr=$r\">«Inapoi la Trivia</a></small><br/>";
echo "<small><a href=\"trivia.php?action=toptrivia&sid=$sid&intr=$r\">+ Top trivia</a></small><br/>";
echo "<small><a href=\"index.php?action=main&sid=$sid\">".$homeimg."Meniu Prim</a></small><br/>";
echo "</p>";
include("footer.inc.php");
}
//////////////////////////////Info Trivia
else if ($action=="infotrivia")
{
addonline(getuid_sid($sid),"<b>(web)</b> Info Trivia","trivia.php?action=$action&intr=$r");
include("header.inc.php");
echo "<p align=\"center\">";
echo "<b>Info Trivia</b>";
echo "</p>";
echo "<p align=\"left\">";
/// INFO
echo "<small>";
echo "*Acesta este un joc de cultura generala, automat, tip chat si inserare automata punctaj<br/>";
echo "*Pe durata desfasurarii jocului, este interzis floodul, spamul sau agresarea verbala a participantilor la joc<br/>";
echo "</small>";
/// END INFO
echo "</p>";
echo "<p align=\"center\">";
echo "<br/><small>---=---</small><br/>";
echo "<small><a href=\"trivia.php?action=trivia&sid=$sid&intr=$r\">«Inapoi la Trivia</a></small><br/>";
echo "<small><a href=\"trivia.php?action=toptrivia&sid=$sid&intr=$r\">+ Top trivia</a></small><br/>";
echo "<small><a href=\"index.php?action=main&sid=$sid\">".$homeimg."Meniu Prim</a></small><br/>";
echo "</p>";
include("footer.inc.php");
}
else if ($action=="usertrivia")
{
addonline(getuid_sid($sid),"<b>(web)</b> Profil Jucator Trivia","trivia.php?action=$action&intr=$r");
include("header.inc.php");
echo "<p align=\"center\">";
if($who==""||$who==0)
{
$mnick = $_POST["mnick"];
$who = getuid_nick($mnick);
}
$whonick = getnick_uid($who);
echo "<b>Profil Jucator ".getsimboluri($who)."$whonick</b>";
echo "</p>";
echo "<p align=\"left\">";
$avlink = getavatar($who);
echo "<br/><a href=\"$avlink\"><img src=\"max.php?filename=$avlink\" alt=\"$unick\"/></a><br/>";
echo "<small><a href=\"inbox.php?action=sendpm&who=$who&sid=$sid\">+ Trimite-i PM</a></small><br/>";
$nopl = mysql_fetch_array(mysql_query("SELECT punctaj FROM mx_users WHERE id='".$who."'"));
echo "<small>Puncte Trivia: <b>$nopl[0]</b><br/>---=---<br/></small>";
echo "<small>Status: <b>".getstatus($who)."</b></small><br/>";
$nopl = mysql_fetch_array(mysql_query("SELECT sex, birthday, location FROM mx_users WHERE id='".$who."'"));
$uage = getage($nopl[1]);
if($nopl[0]=='M')
{
$usex = "Baiat";
}else if($nopl[0]=='F'){
$usex = "Fata";
}else{
$usex = "Necunoscut";
}
$nopl[2] = htmlspecialchars($nopl[2]);
echo "<small>Varsta: <b>$uage</b></small><br/>";
echo "<small>Sex: <b>$usex</b></small><br/>";
echo "<small>Localitate: <b>$nopl[2]</b></small><br/>";
$uact = " -";
$plc = mysql_fetch_array(mysql_query("SELECT place FROM mx_online WHERE userid='".$who."'"));
$uact .= $plc[0];
echo "<small>Joaca Trivia de: </small>";
$noi = mysql_fetch_array(mysql_query("SELECT lastact FROM mx_users WHERE id='".$who."'"));
$var1 = date("His",$noi[0]);
$var2 = time();
$var21 = date("His",$var2);
$var3 = $var21 - $var1;
$var4 = date("s",$var3);
$remain = time() - $noi[0];
$idle = gettimemsg($remain);
echo "<small><b>$idle</b></small><br/>";
$nopl = mysql_fetch_array(mysql_query("SELECT browser FROM mx_users WHERE id='".$who."'"));
echo "<small>Intra cu: <b>$nopl[0]</b></small><br/>";
$nopl = mysql_fetch_array(mysql_query("SELECT signature FROM mx_users WHERE id='".$who."'"));
$sign = parsepm($nopl[0], $sid);
echo "<small>Motto: $sign</small><br/>";
if(ismod(getuid_sid($sid)))
{
echo "<small><a href=\"modproc.php?action=boot&sid=$sid&who=$who\">+ Kick User</a></small><br/>";
echo "<small><a href=\"modcp.php?action=user&who=$who&sid=$sid&who=$who\">+ Modereaza Userul</a></small><br/>";
}
echo "</p>";
echo "<p align=\"center\">";
echo "<small><a href=\"trivia.php?action=trivia&sid=$sid&intr=$r\">«Inapoi in Trivia</a></small><br/>";
echo "<small><a href=\"index.php?action=main&sid=$sid\">".$homeimg."Meniu Prim</a></small>";
echo "</p>";
include("footer.inc.php");
}
//////////////////////////////////Top Trivia
else if($action=="toptrivia")
{
addonline(getuid_sid($sid),"<b>(web)</b> Top Trivia","trivia.php?action=$action&intr=$r");
include("header.inc.php");
echo "<p align=\"center\">";
echo "<b>Top Trivia Wap-Comunity</b>";
echo "</p>";
if($page=="" || $page<=0)$page=1;
$num_items = regmemcount(); //changable
$items_per_page= 10;
$num_pages = ceil($num_items/$items_per_page);
if(($page>$num_pages)&&$page!=1)$page= $num_pages;
$limit_start = ($page-1)*$items_per_page;
$sql = "SELECT id, name, punctaj FROM mx_users ORDER BY punctaj DESC LIMIT $limit_start, $items_per_page";
echo "<p>";
$items = mysql_query($sql);
$cou =1;
echo mysql_error();
if(mysql_num_rows($items)>0)
{
while ($item = mysql_fetch_array($items))
{
$lnk = "» <a href=\"index.php?action=viewuser&who=$item[0]&sid=$sid\">".getsimboluri($item[0])."$item[1]</a>: <small> $item[2] puncte</small>";
echo "$lnk<br/>";
}
}
echo "</p>";
echo "<p align=\"center\">";
if($page>1)
{
$ppage = $page-1;
echo "<a href=\"trivia.php?action=toptrivia&page=$ppage&sid=$sid&view=$view\">«Inapoi</a>";
}
if($page<$num_pages)
{
$npage = $page+1;
echo "<a href=\"trivia.php?action=toptrivia&page=$npage&sid=$sid&view=$view\">Inainte»</a>";
}
echo "<br/>$page/$num_pages<br/>";
if($num_pages>2)
{
$rets = "<form action=\"trivia.php\" method=\"get\">";
$rets .= "<input name=\"page\" style=\"-wap-input-format: '*N'\" size=\"2\"/>";
$rets .= "<input type=\"hidden\" name=\"action\" value=\"$action\">";
$rets .= "<input type=\"hidden\" name=\"sid\" value=\"$sid\">";
$rets .= "<input type=\"Submit\" name=\"Submit\" Value=\"Sari la pagina\"></form>";
echo $rets;
}
echo "</p>";
echo "<p align=\"center\">";
echo "<small><a href=\"trivia.php?action=trivia&sid=$sid&intr=$r\">«Inapoi in Trivia</a></small><br/>";
echo "<small><a href=\"index.php?action=main&sid=$sid\">".$homeimg."Meniu Prim</a></small>";
echo "</p>";
include("footer.inc.php");
}
else{
/////////////////////////
include("../header.inc.php");
echo "<p align=\"center\">";
echo "Nu esti logat pe site<br/>";
echo "Sau ti-a expirat sesiunea<br/>---=---<br/>";
echo "<form action=\"../login2.php\" method=\"get\">";
echo "<b>User:</b><br/><input align=\"center\" name=\"loguid\" style=\"-wap-input-format: '*x'\" size=\"12\" maxlength=\"12\"/><br/>";
echo "<b>Parola:</b><br/><input align=\"center\" type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
echo "<input name=\"LOGIN\" type=\"submit\" value=\"Intra\"></form>";
echo "---=---<br/>Daca nu esti inscris pe site<br/>";
echo "Creaza-ti acum un cont, clic mai jos<br/>-----<br/>";
echo "<a href=\"../register2.php\">=Cont Nou=</a><br/><br/>";
echo "<a href=\"../index2.php\">«Inapoi</a>";
echo "</p>";
include("../footer.inc.php");
}
?>
</html>
Comment