<?php
include("config.php");
ws_check_sessions();
$wspmsql = wsd_query("id, fromid, toid, message, time WSIN ".WS_PMS." WSIS toid='$uid' AND new='1' ORDER BY id ASC LIMIT 1","n","c");
$total = $wspmsql[1];
if(!empty($total)){
$msg = "";
while($wsp = mysql_fetch_array($wspmsql["0"])){
$message = ws_parse($wsp["message"]);
$time = ws_date("d.m.Y - H:i", $time);
$msg .= "<small>".ws_is_online($wsp["fromid"])."".ws_prolink($wsp["fromid"],ws_userfromid($wsp["fromid"]))."<br/>
$time<br/><br/><b>$message</b><br/><br/></small>";
if($wsp["toid"]==$uid){
wsd_query("".WS_PMS." SET new='0' WSIS id='".$wsp["id"]."'","u");
}else {
$msg .= "This message is not yours to view!!<br/><br/>";
}
$curr = str_replace("&","&",ws_currentpage());
$currarr = explode("?w=".$wsid."&s=",$curr);
$currencrypt = str_replace("==","",base64_encode($currarr[1]));
$what = Array("msg","from","mid","curr","currencrypt");
$with = Array($msg,$from,$mid,$currarr[1],$currencrypt);
ws_temp("popup");
exit();
}
}
if(in_array($wsm,$empty_temps)){
$what = Array();
$with = Array();
ws_temp($wsm);
}
if(in_array($wsm,$admin_empty_temps)){
ws_admincheck();
$what = Array();
$with = Array();
ws_temp($wsm);
}
if($wsm=="updatemore"){
$myinfo = wsd_query("* WSIN ".WS_USERS." WSIS wsid='$wsid'","f");
$headline = $myinfo["headline"];
$more = explode("[+]",$myinfo["allabout"]);
$lookingfor = $more[0];
$rs = $more[1];
$so = $more[2];
$religion = $more[3];
$smoke = $more[4];
$drink = $more[5];
$children = $more[6];
$education = $more[7];
$ethnicity = $more[8];
$bodytype = $more[9];
$what = Array("lookingfor","rs","so","religion","smoke","drink","children","education","ethnicity","bodytype","headline","aboutme");
$with = Array($lookingfor,$rs,$so,$religion,$smoke,$drink,$children,$education,$ethnicity,$bodytype,$headline,$about);
ws_temp("updatemore");
}
if($wsm=="readmypm"){
$mid = ws_get_var("mid");
if(empty($mid)){
ws_err("Message id is missing!");
}
$msg .= "";
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS id='$mid' LIMIT 1","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS id='$mid' LIMIT 1","c");
if(!empty($total)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = ws_parse($wspmdata["message"]);
$starred = $wspmdata["starred"];
$new = $wspmdata["new"];
$time = ws_date("d.m.Y H:i", $time);
if($toid!==$uid){
ws_err("This is not your message to read!");
}
$msg .= "".ws_is_online($fromid)."".ws_prolink($fromid,$from)."<br/>$time<br/>------<br/>$message<br/>";
}
} else {
$msg .= "This message does not exist!!<br/>";
}
if($toid==$uid){
wsd_query("".WS_PMS." SET new='0' WSIS id='$mid'","u");
}
$what = Array("msg","from","mid");
$with = Array($msg,$from,$mid);
ws_temp("pmread");
}
if($wsm=="pmdialog"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$clubs = "";
$limit = 10;
$start = ($page - 1) * $limit;
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS toid='$uid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS toid='$uid'","n");
if(!empty($total)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = ws_parse($wspmdata["message"]);
$starred = $wspmdata["starred"];
$new = $wspmdata["new"];
$time = ws_date("d.m.Y H:i", $time);
if($toid!==$uid){
ws_err("This is not your message to read!");
}
$msg .= "".ws_is_online($fromid)."".ws_prolink($fromid,$from)."<br/>$time<br/>------<br/>$message<br/>------<br/>";
}
} else {
$msg .= "This message does not exist!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
if($level=="admin"){
$adminadd = "<a href=\"".$self."".$mode."addclubcat\">Add Catergory</a><br/>";
}
$what = Array("online","nav","mybutton","adminadd","owner_delete");
$with = Array($msg,$nav,$mybutton,$adminadd,$owner_delete);
ws_temp("dialog_list");
}
if($wsm=="readsentpm"){
$mid = ws_get_var("mid");
if(empty($mid)){
ws_err("Message id is missing!");
}
$msg .= "";
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS id='$mid' LIMIT 1","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS id='$mid' LIMIT 1","c");
if(!empty($total)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = ws_parse($wspmdata["message"]);
$starred = $wspmdata["starred"];
$new = $wspmdata["new"];
$time = ws_date("d.m.Y H:i", $time);
if($fromid!==$uid){
ws_err("This is not your message to read!");
}
$msg .= "
To:".ws_is_online($toid)."".ws_prolink($toid,$to)."<br/><br/>
$message<br/><br/>
$time<br/>";
}
} else {
$msg .= "This message does not exist!!<br/>";
}
$what = Array("msg","from","mid");
$with = Array($msg,$from,$mid);
ws_temp("pmreadsent");
}
if($wsm=="readoutpm"){
$mid = ws_get_var("mid");
if(empty($mid)){
ws_err("Message id is missing!");
}
$msg .= "";
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS id='$mid' LIMIT 1","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS id='$mid' LIMIT 1","c");
if(!empty($total)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = ws_parse($wspmdata["message"]);
$starred = $wspmdata["starred"];
$new = $wspmdata["new"];
$time = ws_date("d.m.Y H:i", $time);
$msg .= "
From:".ws_prolink($fromid,$from)."<br/>
To:".ws_prolink($toid,$to)."<br/>
$message<br/>
$time<br/>";
}
} else {
$msg .= "This message does not exist!!<br/>";
}
$what = Array("msg","from","mid");
$with = Array($msg,$from,$mid);
ws_temp("pmreadout");
}
if($wsm=="readhd"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$mid = ws_get_var("mid");
if(empty($mid)){
ws_err("Ticket id is missing!");
}
$msg .= "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$total = $total = wsd_query("* WSIN ".WS_HELPDESK." WSIS id='$mid' OR parent='$mid'","c");
$wspmsql = wsd_query("* WSIN ".WS_HELPDESK." WSIS id='$mid' OR parent='$mid' LIMIT $start, $limit","n");
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = $wspmdata["message"];
$open = $wspmdata["open"];
$time = ws_date("d.m.Y H:i", $time);
$msg .= "Msg from ".ws_prolink($fromid,$from)."<br/>$time<br/>------<br/>$message<br/>";}
$tots = $limit * $page;
$nav = ws_nav("&mid=".$mid."");
if(wsd_query("* WSIN ".WS_HELPDESK." WSIS open='1' AND id='$mid'","c")=="0"){
$dotype = "Open Ticket";
$mydo = "openhd";
} else {
$dotype = "Close Ticket";
$mydo = "closehd";
}
$what = Array("msg","from","mid","nav","dotype","mydo");
$with = Array($msg,$from,$mid,$nav,$dotype,$mydo);
ws_temp("hdread");
}
if($wsm=="movebud"){
$mygroup = ws_get_var("group");
$myproid = ws_get_var("bid");
$budid = ws_idfromuser($myproid);
if(empty($myproid)){
$puname = "<postfield name=\"bid\" value=\"$(bid)\"/>";
} else {
$puname = "<postfield name=\"bid\" value=\"".ws_userfromid($budid)."\"/>";
}
$yesno = "";
if(empty($myproid)){
$yesno .= "Username:<br/><input name=\"bid\" type=\"text\"/><br/>";
} else {
$yesno .= "<b>Username:</b>".ws_userfromid($budid)."<br/>";
}
$yesno .= "<b>To Group:</b><br/>
<select name=\"thegroup\" multiple=\"false\">";
$listcatssql = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$uid'","n");
while($row = mysql_fetch_array($listcatssql)){
$yesno .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$yesno .= "</select><br/>";
$what = Array("group","yesno","uname");
$with = Array($mygroup,$yesno,$puname);
ws_temp("movebud");
}
if($wsm=="hdreply"){
$hid = ws_get_var("hid");
$to = "12345";
$toname = ws_get_var("touser");
$what = Array("touser","toname","hid");
$with = Array($to,$toname,$hid);
ws_temp("hdreply");
}
if($wsm=="clubs"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$clubs = "";
$limit = 10;
$start = ($page - 1) * $limit;
$clubssql = wsd_query("* WSIN ".WS_CLUBS." WSIS type='cat' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_CLUBS." WSIS type='cat'","c");
if(!empty($total)){
while($row = mysql_fetch_array($clubssql)){
if($level=="admin"){
$del = "<a href=\"".$self."".$mode."deleteclubcat&id=".$row["id"]."\">[x]</a>";
}
$clubs .= "<small><a href=\"".$self."".$mode."cc&cat=".$row["id"]."\"><img src=\"./images/clubcat.gif\" alt=\"-\"/>".$row["name"]."</a>-".$del."</small><br/>";
}
} else {
$clubs .= "There are no clubs to display!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
if($level=="admin"){
$adminadd = "<a href=\"".$self."".$mode."addclubcat\">Add Catergory</a><br/>";
}
$what = Array("online","nav","mybutton","adminadd","owner_delete");
$with = Array($clubs,$nav,$mybutton,$adminadd,$owner_delete);
ws_temp("club_list");
}
if($wsm=="profile"){
$profileinfo = "";
$proid = ws_get_var("proid");
@wsd_query("".WS_USERS." SET pv=pv+1 WSIS id='$proid'","u");
$pvs = @wsd_query("pv WSIN ".WS_USERS." WSIS id='$proid'","f");
$proviews = $pvs[0];
ws_ignored($proid);
$prosql = wsd_query("* WSIN ".WS_USERS." WSIS id='$proid' LIMIT 1","n");
while($row = mysql_fetch_array($prosql)){
$dd = $row["bday"];
$mm = $row["bmonth"];
$yyyy = $row["byear"];
$age = @ws_dob($dd,$mm,$yyyy);
$sign = @ws_getsign($dd,$mm);
$plusses = $row["chatm"] + $row["forumm"] + $row['shouts'];
$type = ws_get_var("type");
if($type=="pro"){
if(!empty($row["photo"])){
$profileinfo = "Click the photo for fullsize<br/><a href=\"".$row["photo"]."\"><img src=\"ws_genimg.php?id=".$row["id"]."\" alt=\"".$row["user"]."\"/></a><br/><br/>";
}
if(!empty($row["id"])){
$prouser = ws_userfromid($proid);
$what = Array("prouser","proid","profileinfo");
$with = Array($prouser,$proid,$profileinfo);
ws_temp("pro");
exit();
}
}
if($type=="more"){
$lookingfor = Array("Dating","Serious Relationship","Friends","Networking","All");
$rs = Array("Single","In a Relationship","Married","Divorced");
$so = Array("Straight","Gay","Bi");
$religion = Array("Agnostic","Atheist","Buddhist","Catholic","Christian - Other","Christian - Protestant","Confucian","Hindu","Jewish","Muslim","Scientology","Taoist","Other");
$smoke = Array("Never","Socially","Daily");
$drink = Array("Never","Socially","Daily");
$children = Array("Never","Someday","Undecided","Parent");
$education = Array("High School","School Graduate","Some College","College Graduate","Post-Graduate");
$ethnicity = Array("African descent (black)","Asian","Caucasian (white)","East Indian","Latino - Hispanic","Middle Eastern","Native American","Pacific Islander","Other");
$bodytype = Array("Slim","Athletic","Average","Few Extra Pounds","Heavy");
$more = explode("[+]",$row["allabout"]);
if($more[0]!=="-1"){
$profileinfo .= "<b>Looking For:</b> ".$lookingfor["".$more[0].""]."<br/>";
}
if($more[1]!=="-1"){
$profileinfo .= "<b>Relasionship Status: </b>".$rs["".$more[1].""]."<br/>";
}
if($more[2]!=="-1"){
$profileinfo .= "<b>Sexual Orientation: </b>".$so["".$more[2].""]."<br/>";
}
if($more[3]!=="-1"){
$profileinfo .= "<b>Religion:</b> ".$religion["".$more[3].""]."<br/>";
}
if($more[4]!=="-1"){
$profileinfo .= "<b>Smoke:</b> ".$smoke["".$more[4].""]."<br/>";
}
if($more[5]!=="-1"){
$profileinfo .= "<b>Drink:</b> ".$drink["".$more[5].""]."<br/>";
}
if($more[6]!=="-1"){
$profileinfo .= "<b>Children:</b> ".$children["".$more[6].""]."<br/>";
}
if($more[7]!=="-1"){
$profileinfo .= "<b>Education:</b> ".$education["".$more[7].""]."<br/>";
}
if($more[8]!=="-1"){
$profileinfo .= "<b>Ethnicity:</b> ".$ethnicity["".$more[8].""]."<br/>";
}
if($more[9]!=="-1"){
$profileinfo .= "<b>Body Type:</b> ".$bodytype["".$more[9].""]."<br/>";
}
$profileinfo .= "<a href=\"".$self."".$mode."profile&proid=".$row["id"]."\">Back..</a><br/>";
}
if(empty($type)){
if(!empty($row["user"])){
$profileinfo .= "".$row["user"]."'s Profile<br/>";
}
if(!empty($row["headline"])){
$profileinfo .= " \"".$row["headline"]."\"<br/>------<br/>";
}
if(!empty($row["userstat"])){
$profileinfo .= "<img src=\"".$row["userstat"]."\" alt=\"-\"/><br/>";
}
$profileinfo .= "<a href=\"".$self."".$mode."budgroupspro&proid=".$row["id"]."\">".$row["user"].",s Friend,s</a><br/>";
$profileinfo .= "<a href=\"".$self."".$mode."rateme&proid=".$row["id"]."\">Rate ".$row["user"]."</a><br/>";
if(!empty($row["lps"])){
$profileinfo .= "Last Plusses Reason: <b>".$row["lps"]."</b>!<br/>";
}
$op = ws_getop($row["ip"]);
$iiop = ws_getopsubone($row["ip"]);
if(!empty($row["id"])){
$profileinfo .= "Member's ID: <b>".$row["id"]."</b><br/>";
}
$myco = wsd_query("* WSIN ".WS_OPS." WSIS subone='$iiop'","f");
if(empty($row["location"])){
if(!empty($myco["country"])){
$loc = ws_flag_img($myco["country"]);
} else {
$loc = "Unknown";
}
} else {
$loc = ws_flag_img($row["location"]);
}
$profileinfo .= "A/S/L: ".$age."/".$row["sex"]."/".$loc."<br/>";
$profileinfo .= "Zodiac Sign:<b>".$sign."</b><br/>";
if(!empty($row["forumm"])){
$profileinfo .= "Topics: <b>".$row["forumm"]."</b><br/>";
}
if(!empty($plusses)){
$profileinfo .= "Plusses: <b>".$plusses."</b><br/>";
}
if(!empty($row["chatm"])){
$profileinfo .= "Chat Posts: <b>".$row["chatm"]."</b><br/>";
}
if(!empty($row["shouts"])){
$profileinfo .= "Shouts:<b>".$row["shouts"]."</b><br/>";
}
if(!empty($row["joined"])){
$profileinfo .= "Joined On: <b>".ws_date("d.m.Y H:i", "".$row["joined"]."")."</b><br/>";
}
if(!empty($row["lseen"])){
$profileinfo .= "Last Active: <b>".ws_date("d.m.Y H:i", "".$row["lseen"]."")."</b><br/>";
}
if(!empty($row["client"])){
$profileinfo .= "Browser: <b>".$row["client"]."</b><br/>";
}
if(!empty($row["email"])){
$profileinfo .= "E-mail: <b><b>".$row["email"]."</b></b><br/>";
}
if(!empty($row["site"])){
$profileinfo .= "Site: <a href=\"".$row["site"]."\">".$row["site"]."</a><br/>";
}
if(!empty($row["signiture"])){
$profileinfo .= "<b>Signature:</b><br/>".$row["signiture"]."<br/>";
}
if(!empty($row["ip"])){
$profileinfo .= "IP:<b>".$row["ip"]."</b><br/>";
}
$profileinfo .= "Operator:<br/><b>".$op."</b><br/><br/>";
if(!empty($row["pv"])){
$profileinfo .= "Profile Views:".$row["pv"]."<br/>";
}
if(!empty($row["allabout"])){
$profileinfo .= "<a href=\"".$self."".$mode."profile&proid=".$row["id"]."&type=more\">More Info..</a><br/>";
}
}
if($level=="admin"){
$adminlink = "<a href=\"".$self."".$mode."adminuser&myuser=".$proid."\">Admin ".ws_userfromid($proid)."</a><br/>";
}
}
$what = Array("profileinfo","adminlink");
$with = Array($profileinfo,$adminlink);
ws_temp("userprofile");
}
if($wsm=="hdbox"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$type = ws_get_var("type");
$limit = 5;
$start = ($page - 1) * $limit;
if($type=="open"){
$wspmsql = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='1' AND parent='' AND fromid='$uid' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='1' AND parent='' AND fromid='$uid' ","c");
}
if($type=="closed"){
$wspmsql = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='0' AND fromid='$uid' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='0' AND fromid='$uid' ","c");
}
if(!empty($total)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = $wspmdata["message"];
$open = $wspmdata["open"];
$time = ws_date("d.m.Y H:i", $time);
if($open=="1"){
$msg .= "<a href=\"".$self."".$mode."readhd&mid=$id\">(new)$from:$subject</a><br/>";
}else{
$msg .= "<a href=\"".$self."".$mode."readhd&mid=$id\">$from:$subject</a><br/>";
}
}
} else {
$msg .= "No Support Tickets!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&type=".$type."");
$what = Array("msg","nav");
$with = Array($msg,$nav);
ws_temp("hdbox");
}
if($wsm=="del"){
$mode = ws_get_var("mode");
if($mode=="delread"){
$wsdelsql = wsd_delete("".WS_PMS." WSIS toid='$uid' AND new='0' AND starred='0'");
if($wsdelsql){
$message = "All read messages have been removed!!<br/>";
}else{
$message = "Error: messages could not be removed please try again<br/>";
}
}
if($mode=="delunread"){
$wsdelsql = wsd_delete("".WS_PMS." WSIS toid='$uid' AND new='1' AND starred='0' AND reported='0'");
if($wsdelsql){
$message = "All Un-Read messages have been removed!!<br/>";
}else{
$message = "Error: messages could not be removed please try again<br/>";
}
}
if($mode=="delall"){
$wsdelsql = wsd_delete("".WS_PMS." WSIS toid='$uid' AND new='1' AND starred='1' AND reported='0'");
if($wsdelsql){
$message = "All messages have been removed!<br/>";
}else{
$message = "Error: messages could not be removed please try again<br/>";
}
}
if($mode=="delus"){
$wsdelsql = wsd_delete("".WS_PMS." WSIS toid='$uid' AND starred='0' AND reported='0'");
if($wsdelsql){
$message = "All unstared messages have been removed!<br/>";
}else{
$message = "Error: messages could not be removed please try again!<br/>";
}
}
$button = "<a href=\"".$self."".$mode."pms\">Pm Inbox</a><;br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("pmdel");
}
if($wsm=="hddel"){
$mode = ws_get_var("mode");
if($mode=="delread"){
$wsdelsql = wsd_delete("".WS_HELPDESK." WSIS fromid='$uid' AND open='0'");
if($wsdelsql == TRUE){
$message = "Selected tickets have been removed!!<br/>";
}else if($wsdelsql == FALSE){
$message = "Error: Tickets could not be removed please try again<br/>";
}
}
if($mode=="delunread"){
$wsdelsql = wsd_delete("".WS_HELPDESK." WSIS fromid='$uid' AND open='1'");
if($wsdelsql == TRUE){
$message = "Selected tickets have been removed!!<br/>";
}else if($wsdelsql == FALSE){
$message = "Error: Tickets could not be removed please try again<br/>";
}
}
if($mode=="delall"){
$wsdelsql = wsd_delete("".WS_HELPDESK." WSIS fromid='$uid'");
if($wsdelsql=="TRUE"){
$message = "Selected tickets have been removed!!<br/>";
}else if($wsdelsql=="FALSE"){
$message = "Error: Tickets could not be removed please try again<br/>";
}
}
$button = "<a href=\"".$self."".$mode."helpdesk\">Helpdesk</a><;br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("hddel");
}
if($wsm=="smilies"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$files = "";
if(!($dp = opendir("./smilies"))) die ("Cannot open smilies folder ");
$file_array = array();
while ($file = readdir ($dp)){
if(substr($file,0,1) != '.' and $file != "index.php"){
$file_array[] = $file;
}
}
$total = count($file_array);
sort ($file_array);
if ($total > 0){
$limit = 5;
$first_record = $page * $limit;
$tots = $first_record + $limit;
while (list($fileIndexValue, $file_name) = each ($file_array)){
if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $tots)){
$ifile = explode(".",$file_name);
$smilename = $ifile["0"];
$files .= "<img src=\"".$wsm."/".$file_name."\" alt=\"".$file_name."\"/><br/>:".$smilename.":<br/>";
}
}
}
$nav = ws_nav();
closedir($dp);
$mybutton = "<a href=\"".$self."".$mode."cpanel\">settings</a><br/>";
$what = Array("nav","files","mybutton");
$with = Array($nav,$files,$mybutton);
ws_temp("folder_list");
}
if($wsm=="shn2"){
$listname = "Superhero Name";
$fname = ws_get_var("fname");
$files = "";
$nameseed = rand(0,19);
$files .= "".$fname." Your superhero name is <b>".superheroname($nameseed)."</b><br/>";
$files .= "<a href=\"".$self."".$mode."shn\">Another Go?</a><br/>";
$mybutton .= "<a href=\"".$self."".$mode."games\">Games</a><br/>";
$what = Array("nav","online","mybutton","listname");
$with = Array($nav,$files,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="login2"){
$message = NULL;
$imyuser = ws_get_var("username");
$myuser = strtolower($imyuser);
$icleanmypass = ws_get_var("password");
$cleanmypass = strtolower($icleanmypass);
$mypass = md5($cleanmypass);
$ip = $REMOTE_ADDR;
$iclient = explode(" ",$HTTP_USER_AGENT);
$client = $iclient["0"];
wsd_query("".WS_USERS." SET ip='$ip' WSIS user='$myuser'","u");
wsd_query("".WS_USERS." SET client='$client' WSIS user='$myuser'","u");
$loginwsql = "* WSIN ".WS_USERS." WSIS user='$myuser' AND pass='$mypass'";
$wscheck = wsd_query($loginwsql,"f");
$wscount = wsd_query($loginwsql,"c");
if($wscount > 0){
$mywsid = ws_sesgen($myuser,$mypass);
$wsid = $mywsid;
$updatewsql = "".WS_USERS." SET wsid='$mywsid' WSIS user='$myuser' AND pass='$mypass'";
wsd_query($updatewsql,"u");
ws_ulastseen($mywsid,$wsm);
$op = ws_getop($REMOTE_ADDR);
$tvar = ws_sesvar("tvar","tvar","ud");
if($op!=="Device Ip"){
$message = "Operator:<br/>".$op."<br/>";
}
$what = Array("message","myuser","mywsid");
$with = Array($message,$myuser,$mywsid);
ws_temp("autologin");
}else{
$what = Array();
$with = Array();
ws_temp("autologinfail");
}
}
if($wsm=="join2"){
if(empty($wsid)){
ws_err("Cant find session id!");
}
$passed_reg = ws_get_var("passed_reg");
$regsql = wsd_query("note WSIN ".WS_SETTINGS." WSIS type='registration'","f");
$regon = $regsql[0];
if($regon=="0"){
ws_temp("sorry");
exit();
}
$mypass = ws_get_var("pass");
$secreta = ws_get_var("secreta");
$secretq = ws_get_var("secretq");
if(empty($mypass) || empty($secreta) || empty($secretq)){
ws_err("Password/answer/question field cannot be empty please fill it in!");
}
if(strlen($mypass) < 3){
ws_err("Password is not long enough must be atleast 3 chars long!");
}
$myuser = ws_sesvar("user");
$mypass = ws_get_var("pass");
$mycpass = ws_get_var("pass");
$secreta = ws_get_var("secreta");
$secretq = ws_get_var("secretq");
$mybday = ws_get_var("bday");
$mysex = ws_get_var("sex");
$mylocation = ws_get_var("location");
$mydays = explode("-",$mybday);
$mydd = $mydays[0];
$mymm = $mydays[1];
$myyyyy = $mydays[2];
$myreg = time();
$encmypass = md5($mypass);
if(!wsd_query("* WSIN ".WS_USERS." WSIS user='$myuser'","c") > 0){
$myreged = wsd_query("".WS_USERS." (id,user,pass,bday,bmonth,byear,sex,location,joined,secreta,secretq) VALUES (0,'$myuser','$encmypass','$mydd','$mymm','$myyyyy','$mysex','$mylocation','$myreg','$secreta','$secretq')","i");
$myreguidsql = wsd_query("id WSIN ".WS_USERS." WSIS user='$myuser'","f");
$myreguid = $myreguidsql[0];
$lss = wsd_query("* WSIN ".WS_USERS." WSIS id='$myreguid' LIMIT 1","c");
if($lss=="1"){
wsd_query("".WS_BUDGROUPS." (id,name,uid,img) VALUES (0,'best friends','$myreguid' ,'1')","i");
wsd_query("".WS_BUDGROUPS." (id,name,uid,img) VALUES (0,'good friends','$myreguid' ,'2')","i");
wsd_query("".WS_BUDGROUPS." (id,name,uid,img) VALUES (0,'friends','$myreguid','1')","i");
wsd_query("".WS_BUDGROUPS." (id,name,uid,img) VALUES (0,'acquaintances','$myreguid','4')","i");
wsd_query(" ".WS_BUDGROUPS." (id,name,uid,img) VALUES (0,'havent met ','$myreguid','5')","i");
}
if(!$myreged){
ws_err("Sorry your registration request has failed please try again!");
} else {
ws_done("Thankyou and welcome to Wapside ".$myuser."!<br/><a href=\"".$self."".$mode."login2&username=$myuser&password=$mypass&tvar=1\">Login Here</a><br/>");
}
} else {
ws_err("Sorry the username ".$myuser." is allready in use please choose another one!");
}
$what = Array();
$with = Array();
ws_temp("signup2");
}
if($wsm=="mainmenu"){
$ccconline = "";
$cccbuds = "";
$mypage = ws_get_var("page");
$issent = ws_get_var("sent");
$page = ws_page($mypage);
if(isset($_REQUEST["quoteadded"])){
$qa = ws_get_var("quoteadded");
}
if(!empty($qa)){
$qaa = $qa;
} else {
$qaa = NULL;
}
$cats = "";
$limit = 10;
$start = ($page - 1) * $limit;
if($qaa=="1"){
$quote = ws_get_var("quote");
$time = ws_get_var("send");
if(wsd_query("* WSIN ".WS_QUOTES." WSIS quote='$quote' AND uid='$uid'","c") < 1){
$a = wsd_query("".WS_QUOTES." (id,quote,uid) VALUES ('','$quote','$uid')","n");
if($a){
$msg = "Quote Added";
}else{
return 0;
}
}
}
if($issent=="1"){
$message = ws_get_var("message");
$send = ws_get_var("send");
$time = ws_get_var("send");
if(@wsd_query("* WSIN ".WS_SHOUTS." WSIS time='$send' AND uid='$uid'","c") < 1){
wsd_query("".WS_USERS." SET shouts = shouts+1 WSIS id='$uid'","u");
$a = wsd_query(" ".WS_SHOUTS." (id,uid,time,message) VALUES (0,$uid,$time,'$message')","i");
if($a){
$msg = "Message sent";
}else{
return 0;
}
}
}
$last_shout = wsd_query("* WSIN ".WS_SHOUTS." WSIS id!='' ORDER BY id DESC","f");
$ls = ws_prolink($last_shout["uid"],ws_userfromid($last_shout["uid"])).":".ws_parse($last_shout["message"]);
$welcome_note = wsd_query("* WSIN ".WS_SETTINGS." WSIS id='1' LIMIT 1","f");
$wn = ws_parse($welcome_note["note"]);
$latest_member = wsd_query("* WSIN ".WS_USERS." WSIS id!='' ORDER BY id DESC","f");
$lm = ws_prolink(ws_idfromuser($latest_member["user"]),$latest_member["user"]);
$hdesk = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='1' AND parent='' AND fromid='$uid' ","c");
$in = wsd_query("* WSIN ".WS_PMS." WSIS toid='$uid' AND new='1'","c");
$all = wsd_query("* WSIN ".WS_PMS." WSIS toid='$uid' AND new='1' OR toid='$uid' AND new='0'","c");
$offtime = 300;
$lseent = time()-$offtime;
$onlinec = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=$lseent","c");
$budc = wsd_query("* WSIN ".WS_BUDDIES." WSIS uid=$uid","c");
$cccmybud = wsd_query("* WSIN ".WS_BUDDIES." WSIS uid='$uid'","f");
$ccconlinesql = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=$lseent","n");
while($row = mysql_fetch_array($ccconlinesql)){
if(@in_array($row["id"],$cccmybud)){
$cccbuds .= ws_prolink($row["id"],$row["user"])."<br/>";
} else {
$ccconline .= ws_prolink($row["id"],$row["user"])."<br/>";
}
}
$onlinebuds = count($cccbuds);
if($level=="admin"){
$adminlink = "<a href=\"".$self."".$mode."admin2k\">Admin Zone</a><br/>";
}
if($level=="admin"){
$sdel = "<a href=\"".$self."".$mode."adminclear&type=shout\">[x]</a>";
}
$myco = wsd_query("* WSIN ".WS_USERS." WSIS id='$uid'","f");
if(!empty($myco["country"])){
$co = ws_flag_img($myco["country"]);
} else {
$co = $myco["client"]."<br/>";
}
$mop = ws_getop($myco["ip"]);
if(!empty($mop) && $mop!=="Device Ip"){
$op= $mop;
} else {
$op = $myco["ip"]."<br/>";
}
if(!empty($coop)==""){
$coop = $co.$op."<br/>";
} else {
$coop = "";
}
$what = Array("coop","sdel","in","all","ls","lm","cats","wn","onlinec","allbuds","onlinebuds","adminlink","hdesk");
$with = Array($coop,$sdel,$in,$all,$ls,$lm,$cats,$wn,$onlinec,$budc,$onlinebuds,$adminlink,$hdesk);
ws_temp("mainmenu");
}
if($wsm=="shouts"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$shouts = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$shoutssql = wsd_query("* WSIN ".WS_SHOUTS." ORDER BY id DESC LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_SHOUTS."","c");
if(!empty($total)){
while($row = mysql_fetch_array($shoutssql)){
if($level=="admin"){
$sbdel = "<a href=\"".$self."".$mode."adminclear&type=sbshout&id=".$row["id"]."\">[x]</a>";
}
$shouts .= ws_prolink($row["uid"],ws_userfromid($row["uid"])).":".$row["message"]."<br/>".ws_date("h:i-d-m-y",$row["time"])."".$sbdel."<br/><br/>";
}
} else {
$shouts .= "Shoutbox is empty!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav");
$with = Array($shouts,$nav);
ws_temp("ws_shouts");
}
if($wsm=="request"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$shouts = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$shoutssql = wsd_query("* WSIN ".WS_BUDDIES." WSIS bid='$uid' AND accepted='0' LIMIT 1","n");
$total = wsd_query("* WSIN ".WS_BUDDIES." WSIS bid='$uid' AND accepted='0'","c");
if(!empty($total)){
while($row = mysql_fetch_array($shoutssql)){
$shouts .= ws_prolink(ws_userfromid(ws_idfromuser($row["uid"])),ws_userfromid($row["uid"]))." Would like to add you as one of his friends do you with to accept this request?<br/>------<br/><br/>";
$mybid = $row["uid"];
$bid = $row["uid"];
$yesno .= "<b>Add to Group:</b><br/>
<select name=\"thegroup\" multiple=\"false\">";
$listcatssql = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$uid'","n");
while($row = mysql_fetch_array($listcatssql)){
$yesno .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$yesno .= "</select><br/>";
}
} else {
$shouts .= "You havnt got any friend requests!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","bid","yesno","mybid");
$with = Array($shouts,$nav,$bid,$yesno,$mybid);
ws_temp("ws_request");
}
if($wsm=="quotes"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$shouts = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$shoutssql = wsd_query("* WSIN ".WS_QUOTES." ORDER BY id DESC LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_QUOTES."","c");
if(!empty($total)){
while($row = mysql_fetch_array($shoutssql)){
if($level=="admin"){
$quoteadmin = "<a href=\"".$self."".$mode."delq&id=".$row["id"]."\">[x]</a>";
}
$shouts .= ws_prolink(ws_userfromid(ws_idfromuser($row["uid"])),ws_userfromid($row["uid"])).":".$row["quote"]."".$quoteadmin."<br/>------<br/>";
}
} else {
$shouts .= "No Quotes to display!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav");
$with = Array($shouts,$nav);
ws_temp("ws_quotes");
}
if($wsm=="flags"){
$mysex = ws_sesvar("sex");
$mypage = ws_get_var("page");
$fletter = ws_get_var("fletter");
$page = ws_page($mypage);
$up = ws_get_var("up");
if($up!=="1"){
$mypass = ws_sesvar("pass");
$secreta = ws_sesvar("secreta");
$secretq = ws_sesvar("secretq");
if(empty($mypass) || empty($secreta) || empty($secretq)){
ws_err("Password/answer/question field cannot be empty please fill it in!");
}
if(strlen($mypass) < 3){
ws_err("Password is not long enough must be atleast 3 chars long!");
} else {
$mypass = ws_sesvar("pass");
$mycpass = ws_sesvar("pass");
$secreta = ws_sesvar("secreta");
$secretq = ws_sesvar("secretq");
}
$mybday = ws_sesvar("bday");
if((strlen($mybday)<10)OR(strlen($mybday)>10)){
ws_err("Enter the date in 'dd-mm-yyyy' format");
}
if((substr_count($mybday,"-"))<>2){
ws_err("Enter the date in 'dd-mm-yyyy' format");
}
$pos=strpos($mybday,"-");
$date=substr($mybday,0,($pos));
$result=ereg("^[0-9]+$",$date,$trashed);
if(!($result)){
ws_err("Enter a Valid Date");
}
if(($date<=0)OR($date>31)){
ws_err("Enter a Valid Date");
}
$month=substr($mybday,($pos+1),($pos));
if(($month<=0)OR($month>12)){
ws_err("Enter a Valid Month");
}
$result=ereg("^[0-9]+$",$month,$trashed);
if(!($result)){
ws_err("Enter a Valid Month");
}
$year=substr($mybday,($pos+4),strlen($mybday));
$result=ereg("^[0-9]+$",$year,$trashed);
if(!($result)){
ws_err("Enter a Valid year");
}
if(($year<1900)OR($year>2200)){
ws_err("Enter a year between 1900-2200");
}
$bday = ws_sesvar("bday");
}
$flags = "";
$limit = 10;
$start = ($page - 1) * $limit;
if(empty($fletter)){
$shoutssql = wsd_query("* WSIN ".WS_FLAGS." LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FLAGS."","c");
} else {
$shoutssql = wsd_query("* WSIN ".WS_FLAGS." WSIS flag_name LIKE '$fletter%' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FLAGS." WSIS flag_name LIKE '$fletter%'","c");
}
if(!empty($total)){
while($row = mysql_fetch_array($shoutssql)){
if($up!=="1"){
$flags .= "<a href=\"$self?w=$wsid&s=confirm&location=".$row["flag_name"]."\">".$row["flag_name"]."</a><br/>";
} else {
$flags .= "<a href=\"$self?w=$wsid&s=confirm&location=".$row["flag_name"]."&up=1\">".$row["flag_name"]."</a><br/>";
}
}
} else {
$flags = "No flags exist!!";
}
if(empty($fletter)){
$total = wsd_query("* WSIN ".WS_FLAGS."","c");
} else {
}
$tots = $limit * $page;
if($up!=="1"){
$nav = ws_nav("&w=$wsid&bday=".$bday."&pass=".$pass."&sex=".$sex."&secreta=".$secreta."&secretq=".$secretq."");
}
if($up!=="1"){
$nav = ws_nav("&w=$wsid&bday=".$bday."&pass=".$pass."&sex=".$sex."&secreta=".$secreta."&secretq=".$secretq."");
}
$what = Array("flags","nav","bday","up","pass","sex","secreta","secretq");
$with = Array($flags,$nav,$bday,$up,$pass,$sex,$secreta,$secretq);
ws_temp("ws_flags");
}
if($wsm=="updateflag"){
$mypage = ws_get_var("page");
$fletter = ws_get_var("fletter");
$page = ws_page($mypage);
$flags = "";
$limit = 10;
$start = ($page - 1) * $limit;
if(empty($fletter)){
$shoutssql = wsd_query("* WSIN ".WS_FLAGS." LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FLAGS."","c");
} else {
$shoutssql = wsd_query("* WSIN ".WS_FLAGS." WSIS flag_name LIKE '$fletter%' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FLAGS." WSIS flag_name LIKE '$fletter%'","c");
}
if(!empty($total)){
while($row = mysql_fetch_array($shoutssql)){
$flags .= "<a href=\"$self?w=$wsid&s=updateflag2&location=".$row["flag_name"]."\">".$row["flag_name"]."</a><br/>";
}
} else {
$flags = "No flags exist in ere!";
}
if(empty($fletter)){
$total = wsd_query("* WSIN ".WS_FLAGS."","c");
} else {
}
$tots = $limit * $page;
$nav = ws_nav("&fletter=".$fletter."");
$what = Array("flags","nav","fletter");
$with = Array($flags,$nav,$fletter);
ws_temp("ws_uflags");
}
if($wsm=="adminupdateflag"){
ws_admincheck();
$myuser = ws_get_var("myuser");
$mypage = ws_get_var("page");
$fletter = ws_get_var("fletter");
$page = ws_page($mypage);
$flags = "";
$limit = 10;
$start = ($page - 1) * $limit;
if(empty($fletter)){
$shoutssql = wsd_query("* WSIN ".WS_FLAGS." LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FLAGS."","c");
} else {
$shoutssql = wsd_query("* WSIN ".WS_FLAGS." WSIS flag_name LIKE '$fletter%' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FLAGS." WSIS flag_name LIKE '$fletter%'","c");
}
if(!empty($total)){
while($row = mysql_fetch_array($shoutssql)){
$flags .= "<a href=\"$self?w=$wsid&s=adminupdateflag2&location=".$row["flag_name"]."&myuser=".$myuser."\">".$row["flag_name"]."</a><br/>";
}
} else {
$flags = "No flags exist in ere!";
}
if(empty($fletter)){
$total = wsd_query("* WSIN ".WS_FLAGS."","c");
} else {
}
$tots = $limit * $page;
$nav = ws_nav("&fletter=".$fletter."&myuser=".$myuser."");
$what = Array("flags","nav","fletter","myuser");
$with = Array($flags,$nav,$fletter,$myuser);
ws_temp("ws_adminuflags");
}
if($wsm=="online"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$onlinesql = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS lseen>$lseen","c");
if(!empty($total)){
while($row = mysql_fetch_array($onlinesql)){
if($row["level"]=="admin"){
$stars = "*";
}
if(!$row["level"]=="admin"){
$stars = "";
}
$online .= ws_prolink($row["id"],"<img src=\"./images/".$row["sex"].".gif\" alt=\"".$row["sex"]."\"/>".$stars."".$row["user"])."<br/>";
}
} else {
$online .= "No Members Online!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$totmembers = wsd_query("* WSIN ".WS_USERS."","c");
$what = Array("totmembers","buds","online","nav");
$with = Array($totmembers,$buds,$online,$nav);
ws_temp("ws_online");
}
if($wsm=="iof"){
$fid = ws_get_var("fid");
ws_ulastseen($wsid,$wsm);
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$onlinesql = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='viewpost' AND userlocationfid='$fid' OR userlocation='viewforum' AND userlocationfid='$fid' OR userlocation='iof' AND userlocationfid='$fid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='viewpost' AND userlocationfid='$fid' OR userlocation='viewforum' AND userlocationfid='$fid' OR userlocation='iof' AND userlocationfid='$fid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($onlinesql)){
if($row["level"]=="admin"){
$stars = "*";
} else {
$starts = "";
}
$online .= ws_prolink($row["id"],"<img src=\"./images/".$row["sex"].".gif\" alt=\"".$row["sex"]."\"/>".$stars."".$row["user"])."<br/>";
}
} else {
$online .= "No Members Online in this forum<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","myfid");
$with = Array($online,$nav,$fid);
ws_temp("ws_iof");
}
if($wsm=="ioc"){
$cid = ws_get_var("cid");
ws_ulastseen($wsid,$wsm);
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$onlinesql = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='croom' AND userlocationcid='$fid' OR userlocation='ioc' AND userlocationcid='$fid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='croom' AND userlocationcid='$fid' OR userlocation='ioc' AND userlocationcid='$fid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($onlinesql)){
$online .= ws_prolink($row["id"],"<img src=\"./images/".$row["sex"].".gif\" alt=\"".$row["sex"]."\"/>".$stars."".$row["user"])."<br/>";
}
} else {
$online .= "No one is in this chatroom<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","mycid");
$with = Array($online,$nav,$cid);
ws_temp("ws_ioc");
}
if($wsm=="ioclub"){
$clubid = ws_get_var("cid");
ws_ulastseen($wsid,$wsm);
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$clubssql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$clubid' LIMIT 1","f");
$cfid = $clubssql["fid"];
$ccid = $clubssql["cid"];
$onlinesql = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='viewclub' AND cluserlocation='$clubid' OR userlocation='ioclub' AND cluserlocation='$clubid' OR userlocation='viewforum' AND userlocationfid='$cfid' OR userlocation='croom' AND userlocationcid='$ccid' OR userlocation='ioc' AND userlocationcid='$ccid' OR userlocation='iof' AND userlocationfid='$ccid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='viewclub' AND cluserlocation='$clubid' OR userlocation='ioclub' AND cluserlocation='$clubid' OR userlocation='viewforum' AND userlocationfid='$cfid' OR userlocation='croom' AND userlocationcid='$ccid' OR userlocation='ioc' AND userlocationcid='$ccid' OR userlocation='iof' AND userlocationfid='$ccid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($onlinesql)){
if($row["level"]=="admin"){
$stars = "@";
} else {
$starts = "";
}
$online .= ws_prolink($row["id"],"<img src=\"./images/".$row["sex"].".gif\" alt=\"".$row["sex"]."\"/>".$stars."".$row["user"])."<br/>";
}
} else {
$online .= "No one is in this chatroom<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","mycid");
$with = Array($online,$nav,$clubid);
ws_temp("ws_ioclub");
}
if($wsm=="pmbox"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$type = ws_get_var("type");
$msg = "";
$limit = 5;
$start = ($page - 1) * $limit;
if($type=="in"){
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS toid='$uid' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS toid='$uid'","c");
$box = "Inbox";
}
if($type=="sent"){
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS fromid='$uid' AND reported='0' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS fromid='$uid' AND reported='0'","c");
$box = "Sent Box";
}
if($type=="out"){
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS fromid='$uid' AND reported='0' AND new='1' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS fromid='$uid' AND reported='0' AND new='1'","c");
$box = "Outbox";
}
if($type=="reported"){
ws_admincheck();
$wspmsql = wsd_query("* WSIN ".WS_PMS." WSIS reported='1' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_PMS." WSIS reported='1'","c");
$box = "Reported Messages";
}
$msg .= "";
if(!empty($total)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = $wspmdata["message"];
$starred = $wspmdata["starred"];
$new = $wspmdata["new"];
$time = ws_date("d.m.Y H:i", $time);
$newimg = "newmessage.gif";
$readimg = "message.gif";
if($starred=="1"){
$newimg = "starred.gif";
$readimg = "starred.gif";
}
if($new=="1"){
if($type=="sent"){
$msg .= "<a href=\"".$self."".$mode."readsentpm&mid=$id\"><img src=\"./images/".$newimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
if($type=="in"){
$msg .= "<a href=\"".$self."".$mode."readmypm&mid=$id\"><img src=\"./images/".$newimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
if($type=="reported"){
$msg .= "<a href=\"".$self."".$mode."readreportedpm&mid=$id\"><img src=\"./images/".$newimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
if($type=="out"){
$msg .= "<a href=\"".$self."".$mode."readoutpm&mid=$id\"><img src=\"./images/".$newimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
}else{
if($type=="sent"){
$msg .= "<a href=\"".$self."".$mode."readsentpm&mid=$id\"><img src=\"./images/".$readimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
if($type=="in"){
$msg .= "<a href=\"".$self."".$mode."readmypm&mid=$id\"><img src=\"./images/".$readimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
if($type=="reported"){
$msg .= "<a href=\"".$self."".$mode."readreportedpm&mid=$id\"><img src=\"./images/".$readimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
if($type=="out"){
$msg .= "<a href=\"".$self."".$mode."readoutpm&mid=$id\"><img src=\"./images/".$readimg."\" alt=\"\"/>$from:$subject</a><br/>";
}
}
}
} else {
$msg .= "Your inbox is empty!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&type=".$type."");
$what = Array("msg","nav","reportedbox");
$with = Array($msg,$nav,$reportedbox);
ws_temp("wspm_box");
}
if($wsm=="pmops"){
$mid = ws_get_var("mid");
$mode = ws_get_var("mode");
if(empty($mid)){
ws_err("Message id is not found!");
}
$yours = wsd_query("toid WSIN ".WS_PMS." WSIS id='$mid'","f");
if($yours[0]!==$uid){
ws_err("This is not your pm!");
}
if($mode=="Star"){
$wsdelsql = wsd_query("".WS_PMS." SET starred='1' WSIS id='$mid'","u");
if($wsdelsql){
$opsmess = "Message has been starred!<br/>";
}else{
$opsmess = "Error: messages could not be starred please try again<br/>";
}
}
if($mode=="Unstar"){
$wsdelsql = wsd_query("".WS_PMS." SET starred='0' WSIS id='$mid'","u");
if($wsdelsql){
$opsmess = "Message has been un-starred!<br/>";
}else{
$opsmess = "Error: messages could not be un-starred please try again<br/>";
}
}
if($mode=="report"){
$wsdelsql = wsd_query("".WS_PMS." SET reported='1' WSIS id='$mid'","u");
if($wsdelsql){
$opsmess = "Mssages has been reported to staff!<br/>";
}else{
$opsmess = "Error: messages could not be reported please try again<br/>";
}
}
if($mode=="delete"){
$wsdelsql = wsd_delete("".WS_PMS." WSIS id='$mid'");
if($wsdelsql){
$opsmess = "Message has been removed!<br/>";
}else{
$opsmess = "Error: messages could not be removed please try again<br/>";
}
}
if(wsd_query("* WSIN ".WS_PMS." WSIS id='$mid' AND starred='1'","c")=="0"){
$star = "Star";
} else {
$star = "Unstar";
}
$what = Array("msg","mid","star");
$with = Array($opsmess,$mid,$star);
ws_temp("pmops");
}
if($wsm=="buds"){
$mypage = ws_get_var("page");
$mygroup = ws_get_var("group");
$page = ws_page($mypage);
$buds = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$budssql = wsd_query("* WSIN ".WS_BUDDIES." WSIS grp='".$mygroup."' AND uid='".$uid."' AND accepted!='0' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_BUDDIES." WSIS uid='$uid' AND grp='$group' AND accepted='1'","c");
if(!empty($total)){
while($row = mysql_fetch_array($budssql)){
$buds .= ws_prolink($row["bid"],ws_userfromid($row["bid"]))."<br/>";
}
} else {
$buds .= "You currently have no buddies!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","fid","groupid");
$with = Array($buds,$nav,$fid,$mygroup);
ws_temp("buddies");
}
if($wsm=="probuds"){
$mypage = ws_get_var("page");
$mygroup = ws_get_var("group");
$proid = ws_get_var("proid");
$prouser = ws_userfromid($proid);
$page = ws_page($mypage);
$buds = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$budssql = wsd_query("* WSIN ".WS_BUDDIES." WSIS grp='".$mygroup."' AND uid='".$proid."' AND accepted!='0' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_BUDDIES." WSIS uid='$proid' AND grp='$group' AND accepted='1'","c");
if(!empty($total)){
while($row = mysql_fetch_array($budssql)){
$buds .= ws_prolink($row["bid"],ws_userfromid($row["bid"]))."<br/>";
}
} else {
$buds .= "You currently have no buddies!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","fid","groupid","proid","prouser");
$with = Array($buds,$nav,$fid,$mygroup,$proid,$prouser);
ws_temp("probuddies");
}
if($wsm=="budgroups"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$buds = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$budssql = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$uid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$uid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($budssql)){
$buds .= "<a href=\"".$self."".$mode."buds&group=".$row["id"]."\"><img src=\"./images/fg".$row["img"].".gif\" alt=\"Group ".$row["img"]."\"/>".$row["name"]." (".wsd_query("* WSIN ".WS_BUDDIES." WSIS uid='".$uid."' AND grp='".$row["id"]."' AND accepted='1'","c").")</a><br/>";
}
} else {
$buds .= "You currently have no groups!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$budcount = wsd_query("* WSIN ".WS_BUDDIES." WSIS bid='$uid' AND accepted='0'","c");
$what = Array("online","nav","fid","budcount");
$with = Array($buds,$nav,$fid,$budcount);
ws_temp("buddiesgroup");
}
if($wsm=="budgroupspro"){
$proid = ws_get_var("proid");
$prouser = ws_userfromid($proid);
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$buds = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$budssql = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$proid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$proid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($budssql)){
$buds .= "<a href=\"".$self."".$mode."probuds&group=".$row["id"]."&proid=".$proid."\"><img src=\"./images/fg".$row["img"].".gif\" alt=\"Group ".$row["img"]."\"/>".$row["name"]." (".wsd_query("* WSIN ".WS_BUDDIES." WSIS uid='".$proid."' AND grp='".$row["id"]."' AND accepted='1'","c").")</a><br/>";
}
} else {
$buds .= "".ws_userfromid($proid)." currently has no groups!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$budcount = wsd_query("* WSIN ".WS_BUDDIES." WSIS bid='$proid' AND accepted='0'","c");
$prouser = ws_userfromid($proid);
$what = Array("online","nav","fid","budcount","proid","prouser");
$with = Array($buds,$nav,$fid,$budcount,$proid,$prouser);
ws_temp("buddiesgrouppro");
}
if($wsm=="ignored"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$buds = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$budssql = wsd_query("* WSIN ".WS_IGNORED." WSIS uid='$uid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_IGNORED." WSIS uid='$uid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($budssql)){
$buds .= "<a href=\" ".$self."".$mode."delignore&iid=".$row["bid"]."\">".ws_userfromid($row["bid"])."</a><br/>";
}
} else {
$buds .= "You have 0 ppl on your ignored list!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","fid");
$with = Array($buds,$nav,$fid);
ws_temp("ignored");
}
if($wsm=="viewforum"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$fid = ws_get_var("fid");
$catsql = wsd_query("cid WSIN ".WS_FORUMCATS." WSIS id='$fid'","f");
$cat = $catsql[0];
$clubdat = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$fid'","f");
if(wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$fid'","c")=="0"){
$catclub = "<a href=\"".$self."".$mode."viewfcat&fid=".$cat."\">Back to catergory</a><br/>";
}else{
if(wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS uid='$uid' AND cid='".$clubdat["id"]."'","c")=="0"){
ws_err("You are not a member of this club!");
}
$catclub = "<a href=\"".$self."".$mode."viewclub&id=".$clubdat["id"]."\">Back to club</a><br/>";
}
$posts = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$postssql = wsd_query("* WSIN ".WS_POSTS." WSIS parent='' AND fid='$fid' ORDER BY pinned DESC,id LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_POSTS." WSIS parent='' AND fid='$fid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($postssql)){
if($row["pinned"]=="1"){
$forums .= "* <img src=\"./images/post.gif\" alt=\"-\"/><a href=\"".$self."".$mode."viewpost&pid=".$row["id"]."\">".$row["title"]."</a><br/>";
} else {
$forums .= "<img src=\"./images/post.gif\" alt=\"-\"/><a href=\"".$self."".$mode."viewpost&pid=".$row["id"]."\">".$row["title"]."</a><br/>";
}
}
} else {
$forums .= "There are no posts to display!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&fid=".$fid."");
$now = time();
$lseen = time()-$offtime;
ws_ulastseen($wsid,$wsm);
$totalinhere = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='viewpost' AND userlocationfid='$fid' OR userlocation='viewforum' AND userlocationfid='$fid' OR userlocation='iof' AND userlocationfid='$fid'","c");
$what = Array("online","nav","fid","cat","totalinhere","catclub");
$with = Array($forums,$nav,$fid,$cat,$totalinhere,$catclub);
ws_temp("viewforum");
}
if($wsm=="viewpost"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$pid = ws_get_var("pid");
if(empty($pid)){
ws_err("Post id is not found!!");
}
$posts = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$postssql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$pid' OR parent='$pid' ORDER BY id LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_POSTS." WSIS id='$pid' OR parent='$pid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($postssql)){
if($row["parent"]==""){
$fid = $row["fid"];
$user = ws_userfromid($row["uid"]);
$forums .= "".ws_is_online($row["uid"])."".ws_prolink($row["uid"],$user).": ".ws_parse($row["body"])." <a href=\"".$self."".$mode."postops&tid=".$row["id"]."\">*</a><br/>".ws_date('d-m-y h:i:s',$row["time"])."<br/>------<br/>";
}
if($row["parent"]!==""){
$user = ws_userfromid($row["uid"]);
$forums .= "".ws_is_online($row["uid"])."".ws_prolink($row["uid"],$user).": ".ws_parse($row["body"])." <a href=\"".$self."".$mode."replyops&tid=".$row["id"]."\">*</a><br/>".ws_date('d-m-y h:i:s',$row["time"])."<br/>------<br/>";
}
}
} else {
$forums = "Post Doesnt seem to exist<br/>------<br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&fid=".$fid."&pid=".$pid."");
$what = Array("online","nav","fid","pid");
$with = Array($forums,$nav,$fid,$pid);
ws_temp("viewpost");
}
if($wsm=="m8b"){
$question = ws_get_var("question");
if(!empty($question)){
$result = rand (1,8);
$ans = "<b>Your question:</b><br/>$question<br/><br/>";
if ($result ==1){
$ans .= "<b>The 8-ball says:</b>Yes<br/>";
}
if ($result==2){
$ans .= "<b>The 8-ball says:</b>No<br/>";
}
if ($result==3){
$ans .= "<b>The 8-ball says:</b>Ask again later<br/>";
}
if($result==4){
$ans .= "<b>The 8-ball says:</b>Perhaps, perhaps, perhaps<br/>";
}
if ($result==5){
$ans .= "<b>The 8-ball says:</b>The future is hazy<br/>";
}
if ($result==6){
$ans .= "<b>The 8-ball says:</b>It is certain<br/>";
}
if ($result==7){
$ans .= "<b>The 8-ball says:</b>Without a doubt<br/>";
}
if ($result==8){
$ans .= "<b>The 8-ball says:</b>There is no chance<br/>";
}
$ans .= "<b>Question:</b><br/>";
if($tvar < 2){
$ans .= "<anchor>Ask Another Question
<go href=\"$self\" method=\"get\">
<postfield name=\"w\" value=\"$wsid\"/>
<postfield name=\"s\" value=\"$wsm\"/>
<postfield name=\"question\" value=\"$(question)\"/>
</go></anchor><br/>";
} else {
$ans .= "<form action=\"$self\" method=\"get\">
<input type=\"text\" name=\"question\"/><br/>
<input type=\"submit\" value=\"Ask Question\"/><br/>
<input type=\"hidden\" name=\"w\" value=\"$wsid\"/>
<input type=\"hidden\" name=\"s\" value=\"$wsm\"/>
</form><br/>";
}
} else {
$ans .= "<b>Question:</b><br/>";
if($tvar < 2){
$ans .= "
<input type=\"text\" name=\"question\"/><br/>
<anchor>Ask Question
<go href=\"$self\" method=\"get\">
<postfield name=\"w\" value=\"$wsid\"/>
<postfield name=\"s\" value=\"$wsm\"/>
<postfield name=\"question\" value=\"$(question)\"/>
</go></anchor><br/>";
} else {
$ans .= "
<form action=\"$self\" method=\"get\">
<input type=\"text\" name=\"question\"/><br/>
<input type=\"submit\" value=\"Ask Question\"/><br/>
<input type=\"hidden\" name=\"w\" value=\"$wsid\"/>
<input type=\"hidden\" name=\"s\" value=\"$wsm\"/>
</form><br/>";
}
}
$what = Array("answer");
$with = Array($ans);
ws_temp("ws_game");
}
if($wsm=="chat"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$croomsql = wsd_query("* WSIN ".WS_CROOMS." LIMIT 10","n");
$total = wsd_query("* WSIN ".WS_CROOMS."","c");
if(!empty($total)){
while($row = mysql_fetch_array($croomsql)){
$online .= "<a href=\"".$self."".$mode."croom&cid=".$row["id"]."\"><img src=\"./images/croom.gif\"/>".$row["name"]."</a><br/>";
}
} else {
$online .= "There are no chatrooms!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav");
$with = Array($online,$nav);
ws_temp("chat_list");
}
if($wsm=="croom"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$sent = ws_get_var("sent");
$cid = ws_get_var("cid");
//is a club room?
$clubdat = wsd_query("* WSIN ".WS_CLUBDATA." WSIS cid='$cid'","f");
if(wsd_query("* WSIN ".WS_CLUBDATA." WSIS cid='$cid'","c")=="0"){
$catclub = "<a href=\"".$self."".$mode."chat\">Chatrooms</a><br/>";
} else {
if(wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS uid='$uid' AND cid='".$clubdat["id"]."'","c")=="0"){
ws_err("You are not a member of this club!");
}
$catclub = "<a href=\"".$self."".$mode."viewclub&id=".$clubdat["id"]."\">Back to club</a><br/>";
}
$online = "";
$limit = 10;
if($sent=="1"){
$message = ws_get_var("msg");
$time = ws_get_var("send");
$cid = ws_get_var("cid");
if(empty($message)){
ws_err("Error: message cannot be empty!!");
}
if(empty($cid)){
ws_err("Error: Club id not found");
}
if(empty($time)){
ws_err("Error: sent time not found");
}
//delete old messages after more than 10 are subbmited
$oldest = wsd_query("MIN(id) WSIN ".WS_CTEXT." WSIS cid='$cid' LIMIT 1","sum");
if(wsd_query("* WSIN ".WS_CTEXT." WSIS cid='$cid'","c") > 8){
wsd_delete("".WS_CTEXT." WSIS id='$oldest[0]'");
}
if(wsd_query("* WSIN ".WS_CTEXT." WSIS time='$send' AND uid='$uid'","c") < 1){
wsd_query("".WS_USERS." SET chatm = chatm+1 WSIS id='$uid'","u");
$a = wsd_query("".WS_CTEXT." (id,uid,message,privid,time,cid) VALUES (0,'$uid','$message','','$time','$cid')","i");
if($a){
$msg = "Message sent";
}else{
return 0;
}
}
}
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$croomsql = wsd_query("* WSIN ".WS_CTEXT." WSIS cid='$cid' ORDER BY id DESC LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_CTEXT." WSIS cid='$cid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($croomsql)){
if($row["privid"]==""){
$online .= "<small>".ws_userfromid($row["uid"])." @ ".ws_date("h:i:s a",$row["time"])."</small><br/><b><small>".$row["message"]."</small></b><br/>";
}
if($row["privid"]!="" && $row["privid"]==$uid){
$online .= "<b>Private Msg:</b>".ws_userfromid($row["uid"])." @ ".$row["time"]."<br/>".$row["message"]."<br/>";
}
}
} else {
$online .= "Room is empty!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&cid=".$cid."");
$now = time();
$lseen = time()-$offtime;
ws_ulastseen($wsid,$wsm);
$totalinhere = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='croom' AND userlocationcid='$fid' OR userlocation='ioc' AND userlocationcid='$fid'","c");
$what = Array("online","nav","cid","totalinhere","clubcat");
$with = Array($online,$nav,$cid,$totalinhere,$catclub);
ws_temp("chat_room");
}
if($wsm=="addfile"){
$mid = ws_get_var("id");
$cat = ws_get_var("cat");
$type = ws_get_var("type");
if(empty($type)){
$type = "added";
}
if($type=="updated"){
$acheck = wsd_query("uid WSIN ".WS_FILES." WSIS id='$mid'","f");
if($acheck[0]!==$uid){
ws_err("You dont have permission to update this file!!");
}
$type = "updated";
}
$icatname = wsd_query("name WSIN ".WS_FILECATS." WSIS id='$cat'","f");
$catname = $icatname[0];
$time = time();
$what = Array("cat","catname","id","type");
$with = Array($cat,$catname,$mid,$type);
ws_temp("addfile");
}
if($wsm=="stats"){
$latest_member = wsd_query("* WSIN ".WS_USERS." WSIS id!='' ORDER BY id DESC","f");
$lm = ws_prolink(ws_idfromuser($latest_member["user"]),$latest_member["user"]);
$totpms = wsd_query("* WSIN ".WS_PMS."","c");
$regmems = wsd_query("* WSIN ".WS_USERS."","c");
$topics = wsd_query("* WSIN ".WS_POSTS." WSIS parent=''","c");
$replys = wsd_query("* WSIN ".WS_POSTS." WSIS parent!=''","c");
$ipv = wsd_query("SUM(pv) WSIN ".WS_USERS." WSIS pv!=''","sum");
$pvs = $ipv[0];
$what = Array("regmems","topics","replys","totpms","pvs","lm");
$with = Array($regmems,$topics,$replys,$totpms,$pvs,$lm);
ws_temp("ws_stats");
}
if($wsm=="join"){
$regsql = wsd_query("note WSIN ".WS_SETTINGS." WSIS type='registration'","f");
$regon = $regsql[0];
if(empty($wsid)){
ws_err("Cant find session id!");
}
$step = ws_get_var("step");
if(empty($step)){
$what = Array("SIGNUP_ERROR");
$with = Array("");
if($regon=="1"){
ws_temp("regone");
} else {
ws_temp("sorry");
}
exit();
}
if($step=="2"){
$myuser = ws_get_var("user");
if(empty($myuser)){
ws_err("Username is a required field!");
}
if(!ereg("(^[a-zA-Z0-9]+([a-zA-Z\_0-9\.-]*))$" , $myuser)){
ws_err("Username may only contain [A-Z][a-z][0-9]_-.");
}
if(strlen($myuser) < 3){
ws_err("Username is not long enough must be atleast 3 chars long!");
}
if(wsd_query("* WSIN ".WS_USERS." WSIS user='$myuser'","c") > 0){
$what = Array("SIGNUP_ERROR");
$with = Array("(!) USERNAME IS ALLREADY IN USE PLEASE CHOOSE ANOTHER ONE!<br/>");
if($regon=="1"){
ws_temp("regone");
} else {
ws_temp("sorry");
}
exit();
} else {
$myuser = ws_sesvar("user");
$what = Array("myuser");
$with = Array($myuser);
if($regon=="1"){
ws_temp("regtwo");
} else {
ws_temp("sorry");
}
exit();
}
}
}
if($wsm=="editclub"){
$clubeid = ws_get_var("clubeid");
$isadmin = ws_is_clubadmin($clubeid);
$ownersql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$clubeid'","f");
$owner = $ownersql["uid"];
if(!$isadmin==1 || !$uid==$owner){
ws_admincheck();
}
if(empty($clubeid)){
ws_err("Club id not found!");
}
$listcats = "";
$limit = 10;
$listcatssql = wsd_query("* WSIN ".WS_CLUBS." WSIS type='cat'","n");
while($row = mysql_fetch_array($listcatssql)){
$listcats .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$editdata = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$clubeid'","f");
$desc = $editdata["desc"];
$title = $editdata["title"];
$rules = $editdata["rules"];
$logo = $editdata["logo"];
$language = $editdata["language"];
$ucid = $editdata["ucid"];
$what = Array("clubeid","desc","title","rules","logo","language","ucid","listcats");
$with = Array($clubeid,$desc,$title,$rules,$logo,$language,$ucid,$listcats);
ws_temp("editclub");
}
if($wsm=="viewclub"){
$clubid = ws_get_var("id");
$now = time();
$lseen = time()-$offtime;
ws_ulastseen($wsid,$wsm);
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$clubs = "";
$limit = 10;
$start = ($page - 1) * $limit;
$clubssql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$clubid' LIMIT 1","n");
$tclubssql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$clubid' LIMIT 1","c");
if(!empty($tclubssql)){
$totalinhere = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=".$lseen." AND userlocation='viewclub' AND cluserlocation='$clubid' OR userlocation='ioclub' AND cluserlocation='$clubid' OR userlocation='viewforum' AND userlocationfid='$cfid' OR userlocation='croom' AND userlocationcid='$ccid' OR userlocation='ioc' AND userlocationcid='$ccid' OR userlocation='iof' AND userlocationfid='$ccid'","c");
$totalinherestaff = wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS cid='$clubid' AND cadmin='1'","c");
while($row = mysql_fetch_array($clubssql)){
$locci = wsd_query("location WSIN ".WS_USERS." WSIS id='$uid'","f");
$namei = wsd_query("name WSIN ".WS_CLUBS." WSIS id='".$row["ucid"]."'","f");
$myclubssql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$clubid' LIMIT 1","f");
$cfid = $myclubssql["fid"];
$ccid = $myclubssql["cid"];
$aretime = ws_date("d.m.Y H:i", $row["createdtime"]);
$clubcat = $row["cat"];
$clubid = $row["id"];
$title = $row["title"];
$desc = $row["desci"];
$members = wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS cid='$clubid'","c");
$language = $row["language"];
$rules = $row["rules"];
$clubowner = ws_prolink($row["uid"],ws_userfromid($row["uid"]));
$catergory = $namei[0];
$location = $locci[0];
if(!empty($row["logo"])){
$clulogo = "<img src=\" ".$row["logo"]." \" alt=\"-\"/><br/>";
}
if(wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS uid='".$row["uid"]."' AND cid='$clubid'","c")=="0"){
wsd_query("".WS_CLUBMEMBERS." VALUES (0,'".$row["uid"]."','$clubid','1')","i");
}
if($row["uid"]==$uid || $level=="admin" || wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS uid='$uid' AND cid='$clubid' AND cadmin='1'","c")=="1"){
$owner_links .= "------<br/>";
$owner_links .= "<a href=\"".$self."".$mode."promotecad&cid=".$row["id"]."\">Club Admin: Promote User</a><br/>";
$owner_links .= "<a href=\"".$self."".$mode."editclub&clubeid=".$row["id"]."\">Club Admin: Edit Club</a><br/>";
$owner_links .= "<a href=\"".$self."".$mode."deleteitclub_2&clubid=".$row["id"]."\">Club Admin:Delete Club</a><br/>";
}
if(wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS uid='$uid' AND cid='$clubid'","c")=="1"){
$clubs .= "
<a href=\"".$self."".$mode."viewforum&fid=".$row["fid"]."\">- Forum</a><br/>
<a href=\"".$self."".$mode."croom&cid=".$row["cid"]."\">- Chatroom</a><br/>";
} else {
$clubs .= "------<br/>You have to be a member to use this club!!!<br/><a href=\"".$self."".$mode."joinclub&cid=".$row["id"]."\">Join ".$row["title"]."</a><br/>";
}
}
} else {
ws_err("This club does not exist");
$clubs .= "<b>This Club doesnt exist!</b><br/>";
}
$what = Array("clulogo","online","nav","owner_links","adminadd","totalinhere","cid","clubid","title","desc","language","rules","clubowner","catergory","location","aretime","members","totalinherestaff");
$with = Array($clulogo,$clubs,$nav,$owner_links,$adminadd,$totalinhere,$clubid,$clubid,$title,$desc,$language,$rules,$clubowner,$catergory,$location,$aretime,$members,$totalinherestaff);
ws_temp("club_list2");
}
if($wsm=="adminhdbox"){
ws_admincheck();
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$type = ws_get_var("type");
if(empty($type)){
ws_err("Error: type not found!");
}
$limit = 5;
$start = ($page - 1) * $limit;
if($type=="open"){
$wspmsql = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='1' AND parent='' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='1' AND parent=''","c");
}
if($type=="closed"){
$wspmsql = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='0' ORDER BY time DESC LIMIT $start,$limit","n");
$total = wsd_query("* WSIN ".WS_HELPDESK." WSIS toid='12345' AND open='0'","c");
}
if(!empty($total)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = $wspmdata["message"];
$open = $wspmdata["open"];
$time = ws_date("d.m.Y H:i", $time);
if($open=="1"){
$msg .= "<a href=\"".$self."".$mode."adminreadhd&mid=$id\">(new)$from:$subject</a><br/>";
}else{
$msg .= "<a href=\"".$self."".$mode."adminreadhd&mid=$id\">$from:$subject</a><br/>";
}
}
} else {
$msg .= "<b>No Messages in ere!</b><br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&type=".$type."");
$what = Array("msg","nav");
$with = Array($msg,$nav);
ws_temp("adminhdbox");
}
if($wsm=="adminreadhd"){
ws_admincheck();
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$mid = ws_get_var("mid");
if(empty($mid)){
ws_err("Error: message id not found!");
}
$msg .= "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$wspmsql = wsd_query("* WSIN ".WS_HELPDESK." WSIS id='$mid' OR parent='$mid' ORDER BY id DESC LIMIT $start, $limit","n");
$twspmsql = wsd_query("* WSIN ".WS_HELPDESK." WSIS id='$mid' OR parent='$mid'","c");
if(!empty($twspmsql)){
while($wspmdata = mysql_fetch_array($wspmsql)){
$id = $wspmdata["id"];
$fromid = $wspmdata["fromid"];
$toid = $wspmdata["toid"];
$from = ws_userfromid($fromid);
$to = ws_userfromid($toid);
$time = $wspmdata["time"];
$subject = $wspmdata["subject"];
$message = $wspmdata["message"];
$open = $wspmdata["open"];
$time = ws_date("d/m/y H:i", $time);
$msg .= "".ws_prolink($fromid,$from).":$message<br/>$time<br/>------<br/>";
}
} else {
$msg .= "<b>This message does not exist!</b><br/>------<br/>";
}
if(wsd_query("* WSIN ".WS_HELPDESK." WSIS open='1' AND id='$mid'","c")=="0"){
$dotype = "Open Ticket";
$mydo = "adminopenhd";
} else {
$dotype = "Close Ticket";
$mydo = "adminclosehd";
}
$total = wsd_query("* WSIN ".WS_HELPDESK." WSIS id='$mid' OR parent='$mid'","c");
$tots = $limit * $page;
$nav = ws_nav("&mid=".$mid."");
$what = Array("dotype","mydo","msg","from","mid","nav");
$with = Array($dotype,$mydo,$msg,$from,$mid,$nav);
ws_temp("adminhdread");
}
if($wsm=="delete_itforums"){
ws_admincheck();
$myfid= ws_get_var("fid");
$dtype = ws_get_var("dtype");
$listcats = "";
$limit = 10;
if($dtype=="forumcats"){
$listcatssql = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='cat'","n");
}
if($dtype=="forums"){
$listcatssql = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='forum'","n");
}
while($row = mysql_fetch_array($listcatssql)){
$listcats .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$what = Array("listcats","dtype");
$with = Array($listcats,$dtype);
ws_temp("admindel");
}
if($wsm=="delete_itchat"){
$listcats = "";
$limit = 10;
$listcatssql = wsd_query("* WSIN ".WS_CROOMS."","n");
while($row = mysql_fetch_array($listcatssql)){
$listcats .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$what = Array("listcats");
$with = Array($listcats);
ws_temp("admindelchat");
}
if($wsm=="forgotpw2"){
$usrname = ws_get_var("uname");
if(empty($uname)){
ws_err("Error:Sorry the username cannot be empty!");
}
if(@wsd_query("* WSIN ".WS_USERS." WSIS user='$usrname'","c") < 1){
ws_err("Sorry the username ".$uname." was not found in are database!");
}
$sqq = wsd_query("* WSIN ".WS_USERS." WSIS user='$usrname'","f");
$sq = $sqq["secretq"];
$what = Array("sq","usrname");
$with = Array($sq,$usrname);
ws_temp("ws_forgotpw2");
}
if($wsm=="forgotpw3"){
$usrname = trim(ws_get_var("usrname"));
$answer = strtolower(trim(ws_get_var("answer")));
if(empty($usrname)){
ws_err("Error: Sorry the username cannot be empty!");
}
if(empty($answer)){
ws_err("Error: Sorry the answer cannot be empty!");
}
$sqq = wsd_query("* WSIN ".WS_USERS." WSIS user='$usrname' AND secreta='$answer'","f");
$bb = substr($sqq["pass"],1,7);
$myhash = md5($bb);
if(strlen($bb) >= 1){
@wsd_query("".WS_USERS." SET pass='$myhash' WSIS user='$usrname'","u");
ws_err("Your new wapside password is \"".$bb."\" you can chage this in your account settings when you log in");
} else {
ws_err("The answer to your question was incorrect!!");
}
$what = Array("sq","uname");
$with = Array($sq,$usrname);
ws_temp("ws_forgotpw2");
}
if($wsm=="rateme"){
$proid = ws_get_var("proid");
if(!empty($proid)){
$prouser = ws_userfromid($proid);
$rsql = wsd_query("* WSIN ".WS_USERS." WSIS id='$proid'","f");
$rating = $rsql["ratetotal"];
$votes = $rsql["rated"];
$what = Array("rating","votes","prouser","proid");
$with = Array($rating,$votes,$prouser,$proid);
ws_temp("rate");
} else {
ws_err("Error: profile not found!!");
}
}
if($wsm=="renamebudgroup"){
$listcatssql = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$uid'","n");
while($row = mysql_fetch_array($listcatssql)){
$budgroups .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$what = Array("budgroups");
$with = Array($budgroups);
ws_temp("ws_renamebudgorup");
}
if($wsm=="chatstats"){
$crooms = wsd_query("* WSIN ".WS_CROOMS."","c");
$cdtext = wsd_query("* WSIN ".WS_CTEXT."","c");
$what = Array("crooms","cprooms");
$with = Array($cdtext,$crooms);
ws_temp("chat_stats");
}
if($wsm=="forumstats"){
$forumtopics = wsd_query("* WSIN ".WS_POSTS." WSIS parent=''","c");
$forumrep = wsd_query("* WSIN ".WS_POSTS." WSIS parent!=''","c");
$forums = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='forum'","c");
$cats = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='cat'","c");
$what = Array("forumtopics","forumreps","forums","cats");
$with = Array($forumtopics,$forumrep,$forums,$cats);
ws_temp("forums_stats");
}
if($wsm=="accountstats"){
$regusers = wsd_query("* WSIN ".WS_USERS."","c");
$offtime = 300;
$lseen = time()-$offtime;
$online = wsd_query("* WSIN ".WS_USERS." WSIS lseen>=$lseen","c");
$admins = wsd_query("* WSIN ".WS_USERS." WSIS level='admin'","c");
$mods = wsd_query("* WSIN ".WS_USERS." WSIS level='mod'","c");
$what = Array("regusers","online","admins","mods");
$with = Array($regusers,$online,$admins,$mods);
ws_temp("account_stats");
}
if($wsm=="messagestats"){
$allpms = wsd_query("* WSIN ".WS_PMS."","c");
$newpms = wsd_query("* WSIN ".WS_PMS." WSIS new='1'","c");
$fromyou = wsd_query("* WSIN ".WS_PMS." WSIS fromid='$uid'","c");
$toyou = wsd_query("* WSIN ".WS_PMS." WSIS toid='$uid'","c");
$what = Array("allpms","newpms","fromyou","toyou");
$with = Array($allpms,$newpms,$fromyou,$toyou);
ws_temp("message_stats");
}
if($wsm=="sitestats"){
$members = wsd_query("* WSIN ".WS_USERS."","c");
$males = wsd_query("* WSIN ".WS_USERS." WSIS sex='m'","c");
$fmales = wsd_query("* WSIN ".WS_USERS." WSIS sex='f'","c");
$staff = wsd_query("* WSIN ".WS_USERS." WSIS level='admin' OR level='mod'","c");
$banned = wsd_query("* WSIN ".WS_USERS." WSIS banned='1'","c");
$bdays = wsd_query("* WSIN ".WS_USERS." WSIS bmonth = ".date(m)." and bday = ".date(d)."","c");
$browsers = wsd_query("DISTINCT client WSIN ".WS_USERS."","c");
$what = Array("members","males","fmales","staff","banned","bdays","browsers");
$with = Array($members,$males,$fmales,$staff,$banned,$bdays,$browsers);
ws_temp("ws_sitestats");
}
if($wsm=="additforum"){
ws_admincheck();
$listcatssql = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='cat'","n");
while($row = mysql_fetch_array($listcatssql)){
$listcats .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$what = Array("listcats");
$with = Array($listcats);
ws_temp("additforum");
}
if($wsm=="addbuddy"){
$mygroup = ws_get_var("group");
$proid = ws_get_var("proid");
if($tvar < 2){
if(empty($proid)){
$puname = "<postfield name=\"name\" value=\"$(uname)\"/>";
} else {
$puname = "<postfield name=\"name\" value=\"".ws_userfromid($proid)."\"/>";
}
}else{
if(empty($proid)){
$puname = "<input type=\"hidden\" name=\"name\" value=\"$(uname)\"/>";
} else {
$puname = "<input type=\"hidden\" name=\"name\" value=\"".ws_userfromid($proid)."\"/>";
}
}
$yesno = "";
if(empty($proid)){
$yesno .= "Username:<br/><input name=\"uname\" type=\"text\"/><br/>";
} else {
$yesno .= "<b>Username:</b>".ws_userfromid($proid)."<br/>";
}
$yesno .= "<b>Group:</b><br/>
<select name=\"thegroup\" multiple=\"false\">";
$listcatssql = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$uid'","n");
while($row = mysql_fetch_array($listcatssql)){
$yesno .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$yesno .= "</select><br/>";
$what = Array("group","yesno","uname");
$with = Array($mygroup,$yesno,$puname);
ws_temp("addbuddy");
}
if($wsm=="pass"){
$lid = ws_get_var("lid");
$what = Array("mcat","lid");
$with = Array($mcat,$lid);
ws_temp("pass");
}
if($wsm=="pmreply"){
$to = ws_idfromuser(ws_get_var("touser"));
$toname = ws_get_var("touser");
$what = Array("touser","toname");
$with = Array($to,$toname);
ws_temp("pmreply");
}
if($wsm=="updateprofile"){
$myproinfo = wsd_query("* WSIN ".WS_USERS." WSIS wsid='$wsid'","f");
$bbd = $myproinfo["bday"];
$bbm = $myproinfo["bmonth"];
$bby = $myproinfo["byear"];
$sex = $myproinfo["sex"];
$siginiture = $myproinfo["signiture"];
$site = $myproinfo["site"];
$email = $myproinfo["email"];
$photo = $myproinfo["photo"];
$what = Array("sex","bbd","bbm","bby","siginiture","site","email","photo");
$with = Array($sex,$bbd,$bbm,$bby,$siginiture,$site,$email);
ws_temp("updateprofile");
}
if($wsm=="addfolder"){
$type = ws_get_var("type");
$mid = ws_get_var("id");
$button = "<a href=\"".$self."".$mode."Vault\">Vault</a><br/>";
$what = Array("button","mid","type");
$with = Array($button,$mid,$type);
ws_temp("ws_addfolder");
}
if($wsm=="addclub"){
$listcats = "";
$limit = 10;
$listcatssql = wsd_query("* WSIN ".WS_CLUBS." WSIS type='cat'","n");
while($row = mysql_fetch_array($listcatssql)){
$listcats .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$what = Array("listcats");
$with = Array($listcats);
ws_temp("addclub");
}
if($wsm=="addclubcat"){
$listcats = "";
$limit = 10;
$listcatssql = wsd_query("* WSIN ".WS_CLUBS." WSIS type='cat'","n");
while($row = mysql_fetch_array($listcatssql)){
$listcats .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$what = Array("listcats");
$with = Array($listcats);
ws_temp("addclubcat");
}
if($wsm=="addshout"){
$iantiflood = wsd_query("note WSIN ".WS_SETTINGS." WSIS type='antiflood'","f");
$myantiflood = $iantiflood[0];
$mylast_shout = wsd_query("* WSIN ".WS_SHOUTS." WSIS id!='0' AND uid='$uid' ORDER BY id DESC","f");
$lastshout = $mylast_shout["time"];
$secs = ($lastshout + $myantiflood);
$seconds = $secs - time();
if($secs > $time){
ws_err("You Can't shout so soon after shouting please ".$seconds." seconds and shout again");
}
$cid = ws_get_var("cid");
$time = time();
$what = Array("mytime","cid");
$with = Array($time,$cid,);
ws_temp("shout");
}
if($wsm=="addquote"){
$cid = ws_get_var("cid");
$time = time();
$what = Array("mytime","cid");
$with = Array($time,$cid,);
ws_temp("addquote");
}
if($wsm=="pms"){
if($level=="admin"){
$reportedbox = "<a href=\"".$self."".$mode."pmbox&type=reported\">Admin: Reported Pms</a><br/>";
}
$what = Array("msg","reportedbox");
$with = Array($dellmess,$reportedbox);
ws_temp("wspm_inbox");
}
if($wsm=="cwrite"){
$cid = ws_get_var("cid");
if(empty($cid)){
ws_err("Error: room id was not found!");
}
$time = time();
$what = Array("time","cid");
$with = Array($time,$cid);
ws_temp("cwrite");
}
if($wsm=="adminuser"){
ws_admincheck();
$myuser = ws_get_var("myuser");
$mmyuser = ws_userfromid(ws_get_var("myuser"));
$what = Array("myuser","mmyuser");
$with = Array($myuser,$mmyuser);
ws_temp("adminuser");
}
if($wsm=="admincpass"){
ws_admincheck();
$myuser = ws_get_var("myuser");
$mmyuser = ws_userfromid(ws_get_var("myuser"));
$what = Array("myuser","mmyuser");
$with = Array($myuser,$mmyuser);
ws_temp("admincpass");
}
if($wsm=="admincuser"){
ws_admincheck();
$myuser = ws_get_var("myuser");
$mmyuser = ws_userfromid(ws_get_var("myuser"));
$what = Array("myuser","mmyuser");
$with = Array($myuser,$mmyuser);
ws_temp("admincuser");
}
if($wsm=="adminuprofile"){
ws_admincheck();
$myuser = ws_get_var("myuser");
$myproinfo = wsd_query("* WSIN ".WS_USERS." WSIS id='$myuser'","f");
$bbd = $myproinfo["bday"];
$bbm = $myproinfo["bmonth"];
$bby = $myproinfo["byear"];
$sex = $myproinfo["sex"];
$siginiture = $myproinfo["signiture"];
$site = $myproinfo["site"];
$email = $myproinfo["email"];
$photo = $myproinfo["photo"];
$what = Array("sex","bbd","bbm","bby","siginiture","site","email","photo","myuser");
$with = Array($sex,$bbd,$bbm,$bby,$siginiture,$site,$email,$muiser);
ws_temp("adminuprofile");
}
if($wsm=="adminhdreply"){
ws_admincheck();
$hid = ws_get_var("hid");
$to = "12345";
$toname = ws_get_var("touser");
$what = Array("touser","toname","hid");
$with = Array($to,$toname,$hid);
ws_temp("adminhdreply");
}
if($wsm=="delbudgroup"){
$listcatssql = wsd_query("* WSIN ".WS_BUDGROUPS." WSIS uid='$uid'","n");
while($row = mysql_fetch_array($listcatssql)){
$budgroups .= "<option value=\"".$row["id"]."\">".$row["name"]."</option>";
}
$what = Array("budgroups");
$with = Array($budgroups);
ws_temp("ws_delbudgorup");
}
if($wsm=="replyops"){
$tid = ws_get_var("tid");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$tid'","f");
$parent = $fidsql["parent"];
$arefidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$parent'","f");
$fid = $arefidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$fid'","f");
$clubid = $myfidsql["id"];
$reptxts = wsd_query("* WSIN ".WS_POSTS." WSIS id='$tid'","f");
$text = $reptxts["body"];
$pid = $reptxts["parent"];
if($level=="admin" || ws_is_clubadmin($clubid)=="1"){
if($tvar > 1){
$adminops = "<b>Edit Reply</b><br/><br/>
<form action=\"".$self."\" method=\"get\">
Text:<br/>
<input name=\"text\" type=\"text\" value=\"".$text."\"/> <br/>
<input type=\"submit\" value=\"Update\"/>
<input type=\"hidden\" name=\"s\" value=\"updatefreply\"/>
<input type=\"hidden\" name=\"w\" value=\"".$wsid."\"/>
<input type=\"hidden\" name=\"id\" value=\"".$tid."\"/>
<form><br/>
<a href=\"".$self."".$mode."deletefreply&id=".$tid."\">Delete Reply</a><br/>";
}else{
$adminops = "<b>Edit Reply</b><br/><br/>
Text:<br/>
<input name=\"text\" type=\"text\" value=\"".$text."\"/> <br/>
<anchor>Update
<go href=\"".$self."\" method=\"get\">
<postfield name=\"s\" value=\"updatefreply\"/>
<postfield name=\"w\" value=\"".$wsid."\"/>
<postfield name=\"id\" value=\"".$tid."\"/>
<postfield name=\"text\" value=\"$(text)\"/>
</go>
</anchor><br/><br/>
<a href=\"".$self."".$mode."deletefreply&id=".$tid."\">Delete Reply</a><br/>";
}
}
$postersql = wsd_query("uid WSIN ".WS_POSTS." WSIS id='$tid'","f");
$pos = $postersql[0];
$poster = ws_userfromid($pos);
$what = Array("tid","poster","proid","text","adminops","parent");
$with = Array($tid,$poster,$pos,$text,$adminops,$pid);
ws_temp("replyops");
}
if($wsm=="postops"){
$tid = ws_get_var("tid");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$tid'","f");
$fid = $fidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$fid'","f");
$clubid = $myfidsql["id"];
$reptxts = wsd_query("* WSIN ".WS_POSTS." WSIS id='$tid'","f");
$text = $reptxts["body"];
$title = $reptxts["title"];
if($reptxts["pinned"]=="1"){
$sticky = "Unstick";
$pin = "unpin";
} else {
$sticky = "Stick";
$pin = "pin";
}
if($level=="admin" || ws_is_clubadmin($clubid)=="1"){
if($tvar > 1){
$adminops = "<b>Edit Reply</b><br/><br/>
<form action=\"".$self."\" method=\"get\">
Ttitle:<br/>
<input name=\"title\" type=\"text\" value=\"".$title."\"/> <br/>
Message:<br/>
<input name=\"text\" type=\"text\" value=\"".$text."\"/> <br/>
<input type=\"submit\" value=\"Update\"/>
<input type=\"hidden\" name=\"s\" value=\"updatefpost\"/>
<input type=\"hidden\" name=\"w\" value=\"".$wsid."\"/>
<input type=\"hidden\" name=\"id\" value=\"".$tid."\"/>
<form><br/>
<a href=\"".$self."".$mode."deletefreply&id=".$tid."\">Delete Reply</a><br/>";
}else{
$adminops = "
<a href=\"".$self."".$mode."".$pin."fpost&id=".$tid."\">".$sticky." Post</a><br/><br/>
<b>Edit Reply</b><br/><br/>
Title:<br/>
<input name=\"title\" type=\"text\" value=\"".$title."\"/> <br/>
Text:<br/>
<input name=\"text\" type=\"text\" value=\"".$text."\"/> <br/>
<anchor>Update
<go href=\"".$self."\" method=\"get\">
<postfield name=\"s\" value=\"updatefpost\"/>
<postfield name=\"w\" value=\"".$wsid."\"/>
<postfield name=\"id\" value=\"".$tid."\"/>
<postfield name=\"text\" value=\"$(text)\"/>
<postfield name=\"title\" value=\"$(title)\"/>
</go>
</anchor><br/><br/>
<a href=\"".$self."".$mode."deletefpost&id=".$tid."\">Delete Post</a><br/>";
}
}
$postersql = wsd_query("uid WSIN ".WS_POSTS." WSIS id='$tid'","f");
$pos = $postersql[0];
$poster = ws_userfromid($pos);
$what = Array("tid","poster","proid","text","adminops");
$with = Array($tid,$poster,$pos,$text,$adminops);
ws_temp("postops");
}
if($wsm=="rsslist"){
$limit = 5;
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$rssid = ws_get_var("rssid");
if(empty($rssid)){
ws_err("Your rss id is missing!!");
}
$rsssql = wsd_query("* WSIN ".WS_RSS." WSIS id='$rssid' LIMIT 1","n");
$total = wsd_query("* WSIN ".WS_RSS." WSIS id='$rssid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($rsssql)){
$feedsite = $row["url"];
$fp = @fopen($feedsite,"r");
while(!feof($fp)) $raw .= @fgets($fp, 4096);
fclose($fp);
if(eregi("<item>(.*)</item>", $raw, $rawitems)){
$items = explode("<item>", $rawitems[0]);
$items = $items;
$start = $page * $limit;
$total = count($items);
if($start > $total) {
$list = ceil($total / $limit);
}
$show = ($total/$limit) + ($page*$limit);
for($i=$start; $i<$show;$i++){
eregi("<title>(.*)</title>",$items[$i+1], $title );
eregi("<link>(.*)</link>",$items[$i+1], $url );
eregi("<description>(.*)</description>",$items[$i+1], $description);
$clubs .= "<a href=\"".$self."".$mode."rssread&rssid=".$row["id"]."&id=".$i."\">$title[1]</a><br/>";
}
}
}
} else {
$clubs .= "There are no rss feed to display!<br/>";
}
$tots = $show+$limit;
$nav = ws_nav("&rssid=".$rssid."");
if($level=="admin"){
$admindelete = "<a href=\"".$self."".$mode."deleterss&id=".$rssid."\">Admin: Delete Feed</a><br/>";
}
$what = Array("online","nav","admindelete");
$with = Array($clubs,$nav,$admindelete);
ws_temp("rsslist");
}
if($wsm=="rssread"){
$rssid = ws_get_var("rssid");
$id = ws_get_var("id");
if(empty($rssid)){
ws_err("Rss is is missing!!");
}
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$clubs = "";
$limit = 10;
$start = ($page - 1) * $limit;
$rsssql = wsd_query("* WSIN ".WS_RSS." WSIS id='$rssid' LIMIT 1","n");
$total = wsd_query("* WSIN ".WS_RSS." WSIS id='$rssid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($rsssql)){
$site = $row["url"];
$fp = @fopen($site,"r");
while(!feof($fp)) $raw .= @fgets($fp, 4096);
fclose($fp);
if( eregi("<item>(.*)</item>", $raw, $rawitems ) ) {
$items = explode("<item>", $rawitems[0]);
for( $i =0; $i<1; $i++ ){
eregi("<title>(.*)</title>",$items[$id+1], $title);
eregi("<link>(.*)</link>",$items[$i+1],$url);
eregi("<description>(.*)</description>",$items[$id+1], $description);
$clubs .= "".strip_tags($title[1])."<br/>".strip_tags(str_replace(array(">", "<", """, "&"," "), array(">", "<", "\"", "&",""), $description[1]),"<br/>,<br>,<img>")."<br/>";
}
}
}
} else {
$clubs .= "No feed to display!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","admindelete");
$with = Array($clubs,$nav,$admindelete);
ws_temp("rssread");
}
if($wsm=="rss"){
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$clubs = "";
$limit = 10;
$start = ($page - 1) * $limit;
$clubssql = wsd_query("* WSIN ".WS_RSS." LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_RSS."","c");
if(!empty($total)){
while($row = mysql_fetch_array($clubssql)){
$clubs .= "<a href=\"".$self."".$mode."rsslist&rssid=".$row["id"]."\"><img src=\"./images/clubcat.gif\" alt=\"-\"/>".$row["name"]."</a><br/>";
}
} else {
$clubs .= "There are no rss feeds!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
if($page > 1){
$prev = ws_prev();
}
if($level=="admin"){
$adminadd = "<a href=\"".$self."".$mode."addclubcat\">Add Catergory</a><br/>";
}
$what = Array("online","nav","mybutton","adminadd","owner_delete");
$with = Array($clubs,$nav,$mybutton,$adminadd,$owner_delete);
ws_temp("rss");
}
if($wsm=="pass2"){
$listname = "Download";
$pass = ws_get_var("pass");
$lid = ws_get_var("lid");
$mcat = ws_get_var("cat");
if(empty($lid)){
ws_err("File id is not found please try again!");
}
$files = "";
$filessql = wsd_query("* WSIN ".WS_FILES." WSIS id='$lid' LIMIT 1","n");
while($row = mysql_fetch_array($filessql)){
if($row["filepass"]==$pass){
$files = "Password Authenticated!!<br/>";
$files .= "<a href=\"".$row["fileurl"]."\">".$row["filename"]."</a><br/>";
}else{
$files .= "Incorrect Password!!!<br/>";
}
}
$mybutton = "<a href=\"".$self."".$mode."lc&cat=".$mcat."\">Back to ".$catname."</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($files,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="vault"){
$listname = "Locker";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$files = "";
$limit = 10;
$start = ($page - 1) * $limit;
$filessql = wsd_query("* WSIN ".WS_FILECATS." LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FILECATS."","c");
if($level=="admin"){
$add = "<a href=\"".$self."".$mode."addfolder\">Add Folder</a><br/>";
}
if(!empty($total)){
while($row = mysql_fetch_array($filessql)){
if($level=="admin" || $row["uid"]==$uid){
$del = "-<a href=\"".$self."".$mode."deletefolder&id=".$row["id"]."\">[x]</a>-<a href=\"".$self."".$mode."addfolder&id=".$row["id"]."&type=updated&cat=".$cat."\">[E]</a>";
}
$files .= "<small><a href=\"".$self."".$mode."lc&cat=".$row["id"]."\"><img src=\"./images/vault.gif\" alt=\"-\"/>".$row["name"]."</a>".$del."</small><br/>";
}
} else {
$files .= "<b>There are no files folders!!</b><br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","mybutton","listname","add");
$with = Array($files,$nav,$mybutton,$listname,$add);
ws_temp("ws_vault");
}
////////////////////////////////////////
//All Lists
////////////////////////////////////////
if($wsm=="lc"){
$cat = ws_get_var("cat");
$cnsql = wsd_query("name WSIN ".WS_FILECATS." WSIS id='$cat'","f");
$catname = $cnsql[0];
$listname = $catname." Locker";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$files = "";
$limit = 10;
$start = ($page - 1) * $limit;
$filessql = wsd_query("* WSIN ".WS_FILES." WSIS cat='$cat' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FILES." WSIS cat='$cat'","c");
if(!empty($total)){
while($row = mysql_fetch_array($filessql)){
$ext = ws_file_ext($row["fileurl"]);
$img = ws_fileimg($ext);
if($level=="admin"){
$del = "-<a href=\"".$self."".$mode."deletefile&id=".$row["id"]."\">[x]</a>-<a href=\"".$self."".$mode."addfile&id=".$row["id"]."&type=updated&cat=".$cat."\">[E]</a>";
}
if(empty($row["filepass"])){
$files .= "<a href=\"".$row["fileurl"]."\"><img src=\"./images/".$img."\" alt=\"-\"/>".$row["filename"]."</a>".$del."<br/>";
}else{
$files .= "<a href=\"".$self."".$mode."pass&lid=".$row["id"]."&mcat=".$cat."\"><img src=\"./images/".$img."\" alt=\"-\"/>* ".$row["filename"]."</a>".$del."<br/>";
}
}
} else {
$files .= "<b>There are no files in ere!!</b><br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."vault\">Vault</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array("<a href=\"".$self."".$mode."addfile&cat=".$cat."\"><img src=\"./images/Add.gif\" alt=\"-\"/></a><br/><br/>".$files,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="cc"){
$listname = "Clubs";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$ucid = ws_get_var("cat");
$clubs = "";
$limit = 10;
$start = ($page - 1) * $limit;
$clubssql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS ucid='$ucid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_CLUBDATA." WSIS ucid='$ucid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($clubssql)){
$clubs .= "<a href=\"".$self."".$mode."viewclub&id=".$row["id"]."\"><img src=\"./images/clubcat.gif\" alt=\"-\"/>".$row["title"]."</a><br/><b><img src=\"./images/clubstar.gif\" alt=\"-\"/><small>".$row["desci"]."</small></b><br/><br/>";
}
} else {
$clubs .= "<b>No clubs exist in this catergory!</b><br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&cat=".$ucid."");
$mybutton = "<a href=\"".$self."".$mode."addclub\">Add Club</a><br/><a href=\"".$self."".$mode."clubs\">Clubs</a><br/>";
$what = Array("online","nav","mybutton","listname","adminadd");
$with = Array($clubs,$nav,$mybutton,$listname,$adminadd);
ws_temp("ws_list");
}
if($wsm=="males"){
$listname = "Males";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$malesql = wsd_query("* WSIN ".WS_USERS." WSIS sex='m' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS sex='m'","c");
if(!empty($total)){
while($row = mysql_fetch_array($malesql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."<br/>";
}
} else {
$online .= "No males registered<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="topshouters"){
$listname = "Top Shouters";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$shouts = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$shoutssql = wsd_query("* WSIN ".WS_USERS." WSIS shouts > 0 ORDER by shouts DESC LIMIT 10","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS shouts > 0 LIMIT 10","c");
if(!empty($total)){
while($row = mysql_fetch_array($shoutssql)){
$shouts .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."(".$row["shouts"].")<br/>";
}
} else {
$shouts .= "No top shouters!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($shouts,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="topchatters"){
$listname = "Top chatters";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$chatters = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$chatterssql = wsd_query("* WSIN ".WS_USERS." WSIS chatm > 0 ORDER by shouts DESC LIMIT 10","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS chatm > 0 LIMIT 10","c");
if(!empty($total)){
while($row = mysql_fetch_array($chatterssql)){
$chatters .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."(".$row["chatm"].")<br/>";
}
} else {
$posters .= "No top chatters!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "
<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/>
<a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>
";
$what = Array("online","nav","mybutton","listname");
$with = Array($chatters,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="topposters"){
$listname = "Top Shoutes";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$posters = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$posterssql = wsd_query("* WSIN ".WS_USERS." WSIS forumm > 0 ORDER by shouts DESC LIMIT 10","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS forumm > 0 LIMIT 10","c");
if(!empty($total)){
while($row = mysql_fetch_array($posterssql)){
$posters .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."(".$row["forumm"].")<br/>";
}
} else {
$posters .= "No top posters!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Side Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($posters,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="staff"){
$listname = "Staff Members";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$femalesql = wsd_query("* WSIN ".WS_USERS." WSIS level='admin' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS level='admin'","c");
if(!empty($total)){
while($row = mysql_fetch_array($femalesql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."(".$row["level"].")<br/>";
}
} else {
$online = "No are no staff at ".$sitename." !<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="bdays"){
$listname = "Birthdays";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$bdaysql = wsd_query("* WSIN ".WS_USERS." WSIS bmonth='".date(m)."' AND bday='".date(d)."' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS bmonth='".date(m)."' AND bday='".date(d)."'","c");
if(!empty($total)){
while($row = mysql_fetch_array($bdaysql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."(".$row["level"].")<br/>";
}
} else {
$online = "No one is celerbrating there birthday today!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="banned"){
$listname = "Banned";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$femalesql = wsd_query("* WSIN ".WS_USERS." WSIS banned='1' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS banned='1'","c");
if(!empty($total)){
while($row = mysql_fetch_array($femalesql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."<br/>";
}
} else {
$online .= "No members are banned!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="females"){
$listname = "Females";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$femalesql = wsd_query("* WSIN ".WS_USERS." WSIS sex='f' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS sex='f'","c");
if(!empty($total)){
while($row = mysql_fetch_array($femalesql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."<br/>";
}
} else {
$online .= "No females registerd!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="clients"){
$listname = "Browsers";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$clientssql = wsd_query("DISTINCT client WSIN ".WS_USERS." LIMIT $start, $limit","n");
$total = wsd_query("DISTINCT client WSIN ".WS_USERS."","c");
if(!empty($total)){
while($row = mysql_fetch_array($clientssql)){
$online .= $row["client"]."(".count_client($row["client"]).")<br/>";
}
} else {
$online .= "No devices detected yet!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="ops"){
$listname = "Operators";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$clientssql = wsd_query("DISTINCT ip WSIN ".WS_USERS." LIMIT $start, $limit","n");
$total = wsd_query("DISTINCT ip WSIN ".WS_USERS."","c");
if(empty($type)){
if(!empty($total)){
while($row = mysql_fetch_array($clientssql)){
$tot = wsd_query("* WSIN ".WS_USERS." WSIS ip='".$row["ip"]."'","c");
$myop = ws_getop($row["ip"]);
if(empty($myop)){
$myop = "Unknown";
}
$online .= "<a href=\"".$self."".$mode."ops&type=whoops&areip=".$row["ip"]."\">-".$myop."(".$tot.")</a><br/>";
}
} else {
$online .= "No operators detected yet!!<br/>";
}
}
if($type=="whoops"){
$areip = ws_get_var("areip");
$csql = wsd_query("* WSIN ".WS_USERS." WSIS ip='".$areip."' LIMIT $start, $limit","n");
$totalips = wsd_query("* WSIN ".WS_USERS." WSIS ip='".$areip."'","c");
if(!empty($totalips)){
while($row = mysql_fetch_array($csql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."<br/>";
}
} else {
$online .= "No one is using this operator!!<br/>";
}
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stat</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="members"){
$listname = "Members";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$memberssql = wsd_query("* WSIN ".WS_USERS." LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS."","c");
if(!empty($total)){
while($row = mysql_fetch_array($memberssql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."<br/>";
}
} else {
$online .= "We have no registered members!! arrgh what are doing here then!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">$sitename Stats</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="last24"){
$listname = "Last24 Hours";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 86400;
$now = time();
$lseen = time()-$offtime;
$lastsql = wsd_query("* WSIN ".WS_USERS." WSIS lseen>".$lseen." LIMIT $start, $limit","n");
while($row = mysql_fetch_array($lastsql)){
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."<br/>";
}
$total = wsd_query("* WSIN ".WS_USERS." WSIS lseen>$lseen","c");
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."sitestats\">Site Stats</a><br/><a href=\"".$self."".$mode."stats\">".$sitename." Stats</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="viewfcat"){
$listname = "Forums";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$fid = ws_get_var("fid");
$forums = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$forumssql = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='forum' AND cid='$fid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='forum' AND cid='$fid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($forumssql)){
$forums .= "<a href=\"".$self."".$mode."viewforum&fid=".$row["id"]."\"><img src=\"./images/sub_forum.gif\" alt=\"\"/>".$row["name"]."</a><br/>";
}
} else {
$forums .= "There are no forums to display!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav("&fid=".$fid."");
$mybutton = "<a href=\"".$self."".$mode."forums\">Forums</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($forums,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="forums"){
$listname = "Forums";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$cats = "";
$limit = 10;
$start = ($page - 1) * $limit;
$catssql = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='cat' ORDER BY id LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_FORUMCATS." WSIS type='cat'","c");
if(!empty($total)){
while($cat = mysql_fetch_array($catssql)){
$cats .= "<a href=\"".$self."".$mode."viewfcat&fid=".$cat["id"]."\"><img src=\"./images/forum.gif\" alt=\"".$cat["name"]."\"/>".$cat["name"]."</a><br/>";
}
} else {
$cats = "There are no forums!";
}
$tots = $limit * $page;
$nav = ws_nav();
$what = Array("online","nav","mybutton","listname");
$with = Array($cats,$nav,"",$listname);
ws_temp("ws_list");
}
if($wsm=="clubmembers"){
$listname = "Members";
$clubid = ws_get_var("cid");
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$memberssql = wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS cid='$clubid' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS cid='$clubid'","c");
if(!empty($total)){
while($row = mysql_fetch_array($memberssql)){
$online .= ws_prolink($row["uid"],ws_userfromid($row["uid"]))."<br/>";
}
} else {
$online .= "We have no registered members!! arrgh what are doing here then!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."viewclub&id=".$clubid."\">Back to club</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="clubstaff"){
$listname = "Members";
$clubid = ws_get_var("cid");
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 10;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$memberssql = wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS cid='$clubid' AND cadmin='1' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_CLUBMEMBERS." WSIS cid='$clubid' AND cadmin='1'","c");
if(!empty($total)){
while($row = mysql_fetch_array($memberssql)){
$online .= ws_prolink($row["uid"],ws_userfromid($row["uid"]))."<br/>";
}
} else {
$online .= "We have no registered staff!!<br/>";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "<a href=\"".$self."".$mode."viewclub&id=".$clubid."\">Back to club</a><br/>";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="gallery"){
$listname = "Gallery";
$mypage = ws_get_var("page");
$page = ws_page($mypage);
$online = "";
$limit = 5;
$start = ($page - 1) * $limit;
$offtime = 300;
$now = time();
$lseen = time()-$offtime;
$memberssql = wsd_query("* WSIN ".WS_USERS." WSIS photo!='' LIMIT $start, $limit","n");
$total = wsd_query("* WSIN ".WS_USERS." WSIS photo!=''","c");
if(!empty($total)){
while($row = mysql_fetch_array($memberssql)){
$online .= "<img src=\"ws_genimg.php?id=".$row["id"]."\" alt=\"".$row["user"]."\"/><br/>";
$online .= ws_prolink(ws_idfromuser($row["user"]),$row["user"])."<br/><br/>";
}
} else {
$online = "There are no photos in ere!";
}
$tots = $limit * $page;
$nav = ws_nav();
$mybutton = "";
$what = Array("online","nav","mybutton","listname");
$with = Array($online,$nav,$mybutton,$listname);
ws_temp("ws_list");
}
if($wsm=="promotecad"){
$myid = ws_get_var("cid");
$isadmin = ws_is_clubadmin($myid);
$ownersql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$myid'","f");
$owner = $ownersql["uid"];
if(!$isadmin==1 || !$uid==$owner){
ws_admincheck();
}
$usr = ws_get_var("usr");
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$what = Array("cid");
$with = Array($myid);
ws_temp("promote");
}
if($wsm=="promotecad2"){
$myid = ws_get_var("cid");
$isadmin = ws_is_clubadmin($myid);
$ownersql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$myid'","f");
$owner = $ownersql["uid"];
if(!$isadmin==1 || !$uid==$owner){
ws_admincheck();
}
$myuid = ws_idfromuser(ws_get_var("usr"));
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_CLUBMEMBERS." SET cadmin='1' WSIS uid='$myuid' AND cid='$myid'","u");
if($delsql){
$mmsg = "Selected user has been made club admin!";
}else{
$mmsg = "Error: sorry user could not been made club admin please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewclub&id=".$myid."\">Back to club</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="addrss2"){
$title = ws_get_var("title");
$url = ws_get_var("url");
$a = wsd_query("".WS_RSS." (name,url) VALUES ('$title','$url')","i");
if($a){
$message = "Your rss feed has been added!";
}else{
$message = "Error: your rss has not been added try again!";
}
$button = "<a href=\"".$self."".$mode."rss\">rss</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="reportfreply"){
$myid = ws_get_var("id");
$mypids = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$mypid = $mypids["parent"];
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_POSTS." SET reported='1' WSIS id='$myid';","i");
if($delsql){
$mmsg = "Selected reply has been reported!";
}else{
$mmsg = "Error: could not report reply please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$mypid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="reportfpost"){
$myid = ws_get_var("id");
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_POSTS." SET reported='1' WSIS id='$myid'","i");
if($delsql){
$mmsg = "Selected post has been reported!";
}else{
$mmsg = "Error: could not report post please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$myid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="pinfpost"){
$myid = ws_get_var("id");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$fid = $fidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$myid'","f");
$clubid = $myfidsql["id"];
if(ws_is_clubadmin($clubid)!=="1"){
ws_admincheck();
}
$myid = ws_get_var("id");
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_POSTS." SET pinned='1' WSIS id='$myid'","i");
if($delsql){
$mmsg = "Selected post has been made sticky!";
}else{
$mmsg = "Error: could not been made sticky please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$myid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="unpinfpost"){
$myid = ws_get_var("id");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$fid = $fidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$myid'","f");
$clubid = $myfidsql["id"];
if(ws_is_clubadmin($clubid)!=="1"){
ws_admincheck();
}
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_POSTS." SET pinned='' WSIS id='$myid'","u");
if($delsql){
$mmsg = "Selected post has been made normal!";
}else{
$mmsg = "Error: could not been made normal please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$myid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="updatemore2"){
$lookingfor = ws_get_var("lookingfor");
$relationshipstatus = ws_get_var("relationshipstatus");
$sexualorientation = ws_get_var("sexualorientation");
$religion = ws_get_var("religion");
$smoke = ws_get_var("smoke");
$drink = ws_get_var("drink");
$children = ws_get_var("children");
$education = ws_get_var("education");
$ethnicity = ws_get_var("ethnicity");
$bodytype = ws_get_var("bodytype");
$allabout = $lookingfor."[+]".$relationshipstatus."[+]".$sexualorientation."[+]".$religion."[+]".$smoke."[+]".$drink."[+]".$children."[+]".$education."[+]".$ethnicity."[+]".$bodytype;
$headline = ws_get_var("headline");
$b = wsd_query("".WS_USERS." SET allabout='".$allabout."' WSIS wsid='$wsid'","u");
if($a && $b){
$message = "Your more info has been updated and will apear on your profile!";
}else{
$message = "Error: Could not update more info please try again!";
}
$button = "<a href=\"".$self."".$mode."cpanel\">settings</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="rate2"){
$proid = ws_get_var("proid");
$prouser = ws_userfromid($proid);
$rateme = ws_get_var("rateme");
if(empty($proid)){
ws_err("Error: profile id not found!");
}
if(empty($rateme)){
ws_err("Error: rating not found!");
}
$a = wsd_query("".WS_USERS." SET ratetotal= ratetotal + $rateme, rated = rated+1 WSIS id='$proid'","u");
if($a){
$message = "You have rated ".$prouser." a score of ".$rateme."!";
}else{
$message = "Error: Could not rate please try again!";
}
$button = "<a href=\"".$self."".$mode."profile&proid=$proid\">back to profile</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="calc2"){
$type = ws_get_var("type");
$number1 = ws_get_var("number1");
$number2 = ws_get_var("number2");
if(!is_numeric($number1) | !is_numeric($number2) || empty($number1) || empty($number2)){
ws_err("Number 1 & 2 must be numbers!!");
}
if($type=="add"){
$result = $number1 + $number2;
$message = "The total of ".$number1." + ".$number2." is ".$result."";
}
if($type=="sub"){
$result = $number1 - $number2;
$message = "The total of ".$number1." - ".$number2." is ".$result."";
}
if($type=="div"){
$result =$number1 / $number2;
$message = "The total of ".$number1." / ".$number2." is ".$result."";
}
if($type=="multi"){
$result =$number1 * $number2;
$message = "The total of ".$number1." x ".$number2." is ".$result."";
}
if($type=="all"){
$result1 = $number1 + $number2;
$result2 = $number1 - $number2;
$result3 = $number1 / $number2;
$result4 = $number1 * $number2;
$message = "The total of ".$number1." + ".$number2." is ".$result1."<br/>";
$message .= "The total of ".$number1." - ".$number2." is ".$result2."<br/>";
$message .= "The total of ".$number1." / ".$number2." is ".$result3."<br/>";
$message .= "The total of ".$number1." x ".$number2." is ".$result4."<br/>";
}
$button = "<a href=\"".$self."".$mode."games\">Games</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="delbudgroup2"){
$thegroup = ws_get_var("thegroup");
$moveto = ws_get_var("moveto");
if(empty($thegroup)){
ws_err("Error: Group to delete not found!");
}
if(empty($moveto)){
ws_err("Error: Cant move friends to no where!");
}
$a = wsd_query("".WS_BUDDIES." SET grp='$moveto' WSIS uid='$uid' AND grp='$thegroup'","u");
$a = wsd_delete("".WS_BUDGROUPS." WSIS uid='$uid' AND id='$thegroup'");
if($a){
$message = "You have deleted the group and your friends have been moved!";
}else{
$message = "Error: Could not delete or move please try again!";
}
$button = "<a href=\"".$self."".$mode."budgroups\">Friends</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="renamebudgroup2"){
$thegroup = ws_get_var("thegroup");
$renameto = ws_get_var("renameto");
if(empty($thegroup)){
ws_err("Error: You didnt select a group!");
}
if(empty($renameto)){
ws_err("Error: Rename to box cannot be empty!");
}
$a = wsd_query("".WS_BUDGROUPS." SET name='$renameto' WSIS uid='$uid' AND id='$thegroup'","u");
if($a){
$message = "You have renamed the group!";
}else{
$message = "Error: Could not rename the group please try again!";
}
$button = "<a href=\"".$self."".$mode."budgroups\">Friends</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="acceptbud"){
$thegroup = ws_get_var("thegroup");
$mybid = ws_get_var("mybid");
if(empty($mybid)){
ws_err("Error: Buddy id not found!");
}
$a = wsd_query("".WS_BUDDIES." SET accepted='1' WSIS uid='$mybid' AND bid='$uid'","u");
$a = wsd_query("".WS_BUDDIES." (uid,bid,grp,accepted) VALUES ('$uid','$mybid','$thegroup','1')","i");
if($a){
$message = "Buddy has been added to your list and you have been added to theres!";
}else{
$message = "Error: Could not add to buddylist please try again!";
}
$button = "<a href=\"".$self."".$mode."budgroups\">Friends</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="declinebud"){
$bid = ws_get_var("mybid");
if(empty($bid)){
ws_err("Error: Buddy id not found!");
}
$a = wsd_delete("".WS_BUDDIES." WSIS uid='$bid' AND bid='$uid'");
if($a){
$message = "Buddy has been added to your list and you have been added to theres!";
}else{
$message = "Error: Could not add to buddylist please try again!";
}
$button = "<a href=\"".$self."".$mode."budgroups\">Friends</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="cpass2"){
$encsetpass = ws_get_var("setpass");
$encsetpass = md5(ws_get_var("setpass"));
if(empty($setpass)){
ws_err("Password cannot be empty!");
}
$a = wsd_query("".WS_USERS." SET pass='$encsetpass' WSIS wsid='$wsid'","u");
if($a){
$message = "Your password has been set to ".$setpass."!";
}else{
$message = "Error: your password was not set to ".$setpass." please try again!";
}
$button = "<a href=\"".$self."".$mode."cpanel\">settings</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="freply2"){
$fid = ws_get_var("fid");
$pid = ws_get_var("pid");
$body = ws_get_var("msg");
if(empty($fid)){
ws_err("Forum id no found!");
}
if(empty($body)){
ws_err("Error: Message cannot be empty!");
}
$title = "";
$time = time();
$parent = $fid;
$a = wsd_query("".WS_POSTS." (fid,uid,title,time,parent,body) VALUES ('$fid','$uid','$title','$time','$pid','$body')","i");
if($a){
wsd_query("".WS_USERS." SET forumm = forumm+1 WSIS id='$uid'","u");
$message = "Message has been Posted!";
}else{
$message = "Error: message was not posted please try again";
}
$button .= "<a href=\"".$self."".$mode."viewpost&pid=".$pid."\">View Post</a><br/>";
$button .= "<a href=\"".$self."".$mode."viewforum&fid=".$fid."\">back to forum</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="hdsend2"){
$id = "0";
$fromid = $uid;
$toid = "12345";
$subject = "...";
$message = ws_get_var("message");
$time = time();
$open = 1;
$parent = ws_get_var("hid");
if(empty($message)){
ws_err("Error: Message cannot be empty!");
}
if(empty($toid)){
ws_err("Error: to box cannot be empty!");
}
$a = wsd_query("".WS_HELPDESK."(id,fromid,toid,subject,message,time,open,parent) VALUES ('$id','$fromid','$toid','$subject','$message','$time','$oprn','$parent')","i");
if($a){
$message = "Message has been sent to the support team!";
}else{
$message = "Error: message was not sent to the support team please try again!";
}
$button = "<a href=\"".$self."".$mode."helpdesk\">Helpdesk</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="updateprofile2"){
$sex = ws_get_var("sex");
$location = ws_get_var("location");
$signiture = ws_get_var("signiture");
$site = ws_get_var("site");
$email = ws_get_var("email");
$photo = ws_get_var("photo");
$dob = ws_get_var("dob");
$ddays = explode("-",$dob);
$ud = $ddays[0];
$um = $ddays[1];
$uy = $ddays[2];
$a = wsd_query("".WS_USERS." SET sex='".$sex."', location='".$location."', signiture='".$signiture."', site='".$site."', email='".$email."', photo='".$photo."', bday='".$ud."' ,bmonth='".$um."' , byear='".$uy."' WSIS wsid='$wsid'","u");
if($a){
$message = "Your profile has been updated!";
}else{
$message = "Error: your profile has not been updated!";
}
$button = "<a href=\"".$self."".$mode."cpanel\">settings</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="adminupro"){
ws_admincheck();
$myuser = ws_get_var("myuser");
$sex = ws_get_var("sex");
$location = ws_get_var("location");
$signiture = ws_get_var("signiture");
$site = ws_get_var("site");
$email = ws_get_var("email");
$photo = ws_get_var("photo");
$dob = ws_get_var("dob");
$ddays = explode("-",$dob);
$ud = $ddays[0];
$um = $ddays[1];
$uy = $ddays[2];
$a = wsd_query("".WS_USERS." SET sex='".$sex."', signiture='".$signiture."', site='".$site."', email='".$email."', photo='".$photo."', bday='".$ud."' ,bmonth='".$um."' , byear='".$uy."' WSIS id='$myuser'","u");
if($a){
$message = "Users profile has been updated!";
}else{
$message = "Error: users profile has not been updated!";
}
$button = "<a href=\"".$self."".$mode."admin2k\">Admin Zone</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="pmsend2"){
$id = "0";
$fromid = $uid;
$to = ws_get_var("to");
$toid = ws_userfromid($to);
$subject = "Reply...";
$message = ws_get_var("message");
$time = time();
$new = 1;
$starred = 0;
$reported = 0;
$a = wsd_query("".WS_PMS." (id,fromid,toid,subject,message,time,new,starred,reported) VALUES ('$id','$fromid','$to','$subject','$message','$time','$new','$starred','$reported')","i");
if($a){
$message = "Message has been sent to ".$toid."!";
}else{
$message = "Error: message was not sent to ".$toid." please try again!";
}
$button = "<a href=\"".$self."".$mode."pms\">Inbox</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="delignore"){
$iid = ws_get_var("iid");
if(empty($iid)){
ws_err("Error: Ingonerd buddyid not found!!");
}
$buddyid = ws_idfromuser($usern);
$a = wsd_delete("".WS_IGNORED." WSIS bid='$iid'");
if($a){
$message = "".$usern." has been removed from your ignore list!";
}else{
$message = "".$usern." was not removed from your ignore list please try again!";
}
$button = "<a href=\"".$self."".$mode."ignored\">Ignored</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="ignore2"){
$usern = ws_get_var("name");
$buddyid = ws_idfromuser($usern);
if(empty($buddyid)){
ws_err("Name cant be empty!!");
}
if(empty($usern)){
ws_err("Name cant be empty!!");
}
$a = wsd_query("".WS_IGNORED." (id,uid,bid) VALUES (0,'$uid','$buddyid')","i");
if($a){
$message = "".$usern." has been added to you ignore list!";
}else{
$message = "".$usern." was not added to you ignore list please try again!";
}
$button = "<a href=\"".$self."".$mode."ignored\">Ignored</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="addfolder2"){
ws_admincheck();
$type = ws_get_var("type");
$name = ws_get_var("name");
$mid = ws_get_var("id");
$type = ws_get_var("type");
if($type=="updated"){
if(empty($mid)){
ws_err("Error: folder id is not found!");
}
if(empty($name)){
ws_err("folder name cant be empty!");
}
$a = wsd_query("".WS_FILECATS." SET name='$name' WSIS id='$mid'","u");
}
if(empty($type)){
if(empty($name)){
ws_err("folder name cant be empty!");
}
$a = wsd_query("".WS_FILECATS." (id,name) VALUES (0,'$name')","u");
}
if($a){
$message = "Folder added!";
}else{
$message = "Folder was not added please try again!";
}
$button = "<a href=\"".$self."".$mode."vault\">Vault</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="movebud2"){
$buddyid = ws_idfromuser(ws_get_var("bid"));
$newgrp = ws_get_var("newgroup");
if(empty($bid)){
ws_err("Error: You cant move no one!");
}
if(empty($newgrp)){
ws_err("That group doesnt exist!!!");
}
$a = wsd_query("".WS_BUDDIES." SET grp='$newgrp' WSIS uid='$uid' AND bid='$buddyid'","u");
if($a){
$message = "Buddy has been moved!";
}else{
$message = "buddy was not moved please try again!";
}
$button = "<a href=\"".$self."".$mode."budgroups\">Friends list</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="addbuddy2"){
$usern = ws_get_var("name");
$buddyid = ws_idfromuser($usern);
$group = ws_get_var("group");
if(empty($usern)){
ws_err("Name cant be empty!!");
}
if(empty($buddyid)){
ws_err("User ".$usern." does not exist!!");
}
if($buddyid==$uid){
ws_err("You cant add yourself to you buddylist!");
}
if(wsd_query("* WSIN ".WS_BUDDIES." WSIS bid='$buddyid' AND uid='$uid' OR uid='$buddyid' AND bid='$uid'","c") > 0){
ws_err("You have allready have ".$usern." on your buddy list!");
}
$a = wsd_query("".WS_BUDDIES." (uid,bid,grp,accepted) VALUES ('$uid','$buddyid','$group','0')","i");
if($a){
$message = "".$usern." has been sent your buddy request!";
}else{
$message = "".$usern." has been sent your buddy request please try again!";
}
$button = "
<a href=\"".$self."".$mode."buds&group=".$group."\">Friends Group</a><br/>
<a href=\"".$self."".$mode."budgroups\">Friends</a><br/>
";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="addbudgroup2"){
$name = ws_get_var("name");
$fg = ws_get_var("fg");
if(empty($name)){
ws_err("Group name cant be empty!!");
}
$a = wsd_query("".WS_BUDGROUPS." (id,name,uid,img) VALUES (0,'$name','$uid','$fg')","i");
if($a){
$message = "".$name." has been added to your groups!";
}else{
$message = "".$usern." was not added to your groups!";
}
$button = "<a href=\"".$self."".$mode."budgroups\">Friends</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="joinclub"){
$cid = ws_get_var("cid");
if(empty($cid)){
ws_err("Error: Club id not found");
}
$a = wsd_query("".WS_CLUBMEMBERS." VALUES (0,'$uid','$cid','0')","i");
if($a){
$message = "You are now a member of the club";
}else{
$message = "Sorry your not a member please try again!";
}
$button = "<a href=\"".$self."".$mode."clubs\">Clubs</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="addfile2"){
$mid = ws_get_var("id");
$cat = ws_get_var("cat");
$icatname = @wsd_query("name WSIN ".WS_FILECATS." WSIS id='$cat'","f");
$catname = $icatname[0];
$fname = ws_get_var("fname");
$furl = ws_get_var("furl");
$fpass = ws_get_var("fpass");
$time = time();
$type = ws_get_var("type");
if(empty($fname)){
ws_err("Error: File name cannot be empty!!");
}
if(empty($furl)){
ws_err("Error: File url cannot be empty!!");
}
if($type=="added"){
$a = wsd_query("".WS_FILES." (id,filename,fileurl,filepass,uid,time,cat) VALUES (0,'$fname','$furl','$fpass','$uid','$time','$cat')","i");
}
if($type=="updated"){
$a = wsd_query("".WS_FILES." SET filename='$fname', fileurl='$furl', filepass='$fpass' WSIS id='$mid'","u");
}
if($a){
$message = "File ".$fname." has been ".$type." in the locker!";
}else{
$message = "File ".$fname." was not ".$type." in the locker please try again";
}
$button = "<a href=\"".$self."".$mode."lc&cat=$cat\">Back to $catname</a><br/>";
$button .= "<a href=\"".$self."".$mode."vault\">Locker</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="closehd"){
$hid = ws_get_var("hid");
if(empty($hid)){
ws_err("Error:Ticket id not found");
}
if(wsd_query("".WS_HELPDESK." SET open='0' WSIS id='$hid'","u")){
$message = "Ticket #".$hid." has been closed!";
} else {
$message = "Error: Ticket #".$hid." was not closed please try again!";
}
$button = "<a href=\"".$self."".$mode."helpdesk\">Helpdesk</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="openhd"){
$hid = ws_get_var("hid");
if(empty($hid)){
ws_err("Error:Ticket id not found");
}
if(wsd_query("".WS_HELPDESK." SET open='1' WSIS id='$hid'","u")){
$message = "Ticket #".$hid." has been re-opened!";
} else {
$message = "Error: Ticket #".$hid." was not opened please try again!";
}
$button = "<a href=\"".$self."".$mode."helpdesk\">Helpdesk</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="fpost2"){
$fid = ws_get_var("fid");
$body = ws_get_var("msg");
$title = ws_get_var("title");
if(empty($fid)){
ws_err("Error: Forum id not found!");
}
if(empty($body)){
ws_err("Error: Message cannot be empty!!");
}
if(empty($title)){
ws_err("Error: The title cannot be empty!");
}
$time = time();
$a = wsd_query("".WS_POSTS." (id,fid,uid,title,time,body,parent) VALUES ('$id','$fid','$uid','$title','$time','$body','$pid')","i");
if($a){
$message = "Your message has been posted to the forums!<br/><br/>".$body."";
}else{
$message = "Error: your message was not posted to the forums please try again!";
}
$button = "<a href=\"".$self."".$mode."viewforum&fid=".$fid."\">Back to forum</a><br/>";
$what = Array("message","button","fid");
$with = Array($message,$button,$fid);
ws_temp("ws_msg");
}
if($wsm=="submittick2"){
$toid = "12345";
$id = "0";
$fromid = $uid;
$subject = ws_get_var("subject");
$message = ws_get_var("message");
if(empty($subject)){
ws_err("Error: subject Cannot be empty!");
}
if(empty($message)){
ws_err("Error: message Cannot be empty!");
}
$time = time();
$open = 1;
$a = wsd_query("".WS_HELPDESK." (id,fromid,toid,subject,message,time,open) VALUES ('$id','$fromid','$toid','$subject','$message','$time','$open')","i");
if($a){
$message = "Message has been sent to the support team!";
}else{
$message = "Error: message could not be sent to the support team please try again!";
}
$button = "<a href=\"".$self."".$mode."helpdesk\">Helpdesk</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="compose2"){
$iantiflood = wsd_query("note WSIN ".WS_SETTINGS." WSIS type='antiflood'","f");
$myantiflood = $iantiflood[0];
$mylast_pm = wsd_query("* WSIN ".WS_PMS." WSIS id!='0' AND fromid='$uid' ORDER BY id DESC","f");
$lastpm = $mylast_pm["time"];
$secs = ($lastpm + $myantiflood);
$seconds = $secs - time();
if($secs > $time){
ws_err("You Can't send pm so soon after sending a pm please wait ".$seconds." seconds and try again");
}
$to = ws_get_var("to");
$curr = base64_decode(ws_get_var("curr")."==");
$toid = ws_idfromuser($to);
ws_ignored($toid);
$id = "0";
$fromid = $uid;
$subject = "Quick Message";
$message = ws_get_var("message");
$time = time();
$new = 1;
$starred = 0;
$reported = 0;
if(empty($toid)){
ws_err("Error: User ".$to." does not exist!");
}
if(empty($message)){
ws_err("Error: Message cannot be empty!!");
}
$a = wsd_query("".WS_PMS." (id,fromid,toid,subject,message,time,new,starred,reported) VALUES ('$id','$fromid','$toid','$subject','$message','$time','$new','$starred','$reported')","i");
if($a){
$message = "Message has been sent to ".$to."!";
}else{
$message = "Error: Message could not be sent to ".$to." please try again!";
}
if(empty($curr)){
$button = "<a href=\"".$self."".$mode."pms\">Pm Inbox</a><br/>";
} else {
$button = "<a href=\"".$self."".$mode."".$curr."\">Close [x]</a><br/>";
}
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="addclub2"){
$clubi = wsd_query("* WSIN ".WS_CLUBDATA." ORDER BY id DESC LIMIT 1","f");
$myfid = $clubi["id"]+1;
$ncid = $wsid.rand(1,10).($uid*5).$myfid;
$desc = ws_get_var("desc");
$title = ws_get_var("title");
$rules = ws_get_var("rules");
$logo = ws_get_var("logo");
$language = ws_get_var("language");
$ucid = ws_get_var("cat");
$time = time();
if(empty($title)){
ws_err("Error: title cannot be empty!!");
}
if(empty($ucid)){
ws_err("Error: Cannot find catergory!");
}
$a = wsd_query("".WS_CLUBDATA." VALUES (0,'$uid','$ncid','$ncid','$desc','$title','$ucid','$logo','$rules','$time','$language','0')","i");
if($a){
$message = "Club ".$title." has been created!";
}else{
$message = "Club ".$title." was not created please try again!";
}
$button = "<a href=\"".$self."".$mode."clubs\">Clubs</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="editclub2"){
$clubeid = ws_get_var("clubeid");
$isadmin = ws_is_clubadmin($clubeid);
$ownersql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$clubeid'","f");
$owner = $ownersql["uid"];
if(!$isadmin==1 || !$uid==$owner){
ws_admincheck();
}
if(empty($clubeid)){
ws_err("Club id not found!");
}
$desc = ws_get_var("desc");
$title = ws_get_var("title");
$rules = ws_get_var("rules");
$logo = ws_get_var("logo");
$language = ws_get_var("language");
$ucid = ws_get_var("cat");
if(empty($clubeid)){
ws_err("Error: club id cannot be found!!");
}
if(empty($title)){
ws_err("Error: title cannot be empty!!");
}
if(empty($ucid)){
ws_err("Error: Cannot find catergory!");
}
$a = wsd_query("".WS_CLUBDATA." SET desci='".$desc."',title='".$title."',logo='".$logo."',rules='".$rules."',language='".$language."',ucid='".$cat."' WSIS id='".$clubeid."'","u");
if($a){
$message = "Club ".$title." has been updated!";
}else{
$message = "Club ".$title." was not created please try again!";
}
$button = "<a href=\"".$self."".$mode."viewclub&cid=".$clubeid."\">Back to club</a><br/>";
$button = "<a href=\"".$self."".$mode."clubs\">Clubs</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="addclubcat2"){
$title = ws_get_var("title");
if(empty($title)){
ws_err("Error: title cannot be empty!!");
}
$clubidsql = wsd_query("* WSIN ".WS_CLUBS." ORDER BY id DESC","f");
$club = $clubidsql["id"] + 1;
$a = wsd_query("".WS_CLUBS." VALUES (0,'$title','cat','$club')","i");
if($a){
$message = "Club Catergory ".$title." has been created!";
}else{
$message = "Error: Club Catergory ".$title." was not created please try again!";
}
$button = "<a href=\"".$self."".$mode."clubs\">Clubs</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="adminclear"){
ws_admincheck();
$mytype = ws_get_var("type");
if(empty($type)){
ws_err("Error: Clear type not found!");
}
if($mytype=="pm"){
ws_admincheck();
$a = wsd_delete("".WS_PMS." WSIS new='0'");
$smsg = "Old personal messages have been cleared!";
$emsg = "Error: Old Personal messages not cleared!";
}
if($mytype=="helpdesk"){
ws_admincheck();
$a = wsd_delete("".WS_HELPDESK." WSIS open='0'");
$smsg = "Closed helpdesk tickets have been cleared!";
$emsg = "Error: closed helpdesk tickets have not been cleared!";
}
if($mytype=="shouts"){
ws_admincheck();
$a = wsd_query("".WS_SHOUTS."","t");
$smsg = "Old shouts have been cleared!";
$emsg = "Error: old shouts have not been cleared!";
}
if($mytype=="shout"){
ws_admincheck();
$lshout = wsd_query("* WSIN ".WS_SHOUTS." WSIS id!='' ORDER BY id DESC","f");
$a = wsd_delete("".WS_SHOUTS." WSIS id='$lshout[0]'");
$smsg = "Shout Deleted!";
$emsg = "Error: Shout not deleted please try again!";
}
if($mytype=="sbshout"){
ws_admincheck();
$sh_id = ws_get_var("id");
$a = wsd_query("".WS_SHOUTS." WSIS id='$sh_id'","i");
$smsg = "Shout Deleted!";
$emsg = "Error: Shout not deleted please try again!";
}
if($a){
$message = $smsg;
}else{
$message = $emsg;
}
if($mytype=="sbshout"){
$button = "<a href=\"".$self."".$mode."shouts\">Shoutbox</a><br/>";
}
if($mytype!=="shout" || $mytype!=="sbshout"){
$button .= "<a href=\"".$self."".$mode."admindata\">Data Manager</a><br/>";
$button .= "<a href=\"".$self."".$mode."admin2k\">Admin</a><br/>";
}
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="additchat_2"){
ws_admincheck();
$name = ws_get_var("name");
if(empty($name)){
ws_err("Error: name cannot be empty!");
}
$inssql = wsd_query("".WS_CROOMS." (id,name) VALUES ('','$name')","i");
if($inssql){
$mmsg = "Chatroom \"".$name."\" has been added!";
}else{
$mmsg = "Error: Could not add chatroom \"".$name."\" please try again!";
}
$button = "<a href=\"".$self."".$mode."adminsite\">Admin Manager</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="deleteitchat_2"){
ws_admincheck();
$myfid = ws_get_var("fid");
if(empty($myfid)){
ws_err("Error: chatroom id cannot be found!");
}
$delsql = wsd_delete("".WS_CROOMS." WSIS id='$myfid'");
if($delsql){
$mmsg = "Selected chatrooms have been deleted!";
}else{
$mmsg = "Error: Could not delete selected chatroom please try again!";
}
$button = "<a href=\"".$self."".$mode."adminsite\">Admin Manager</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="deleteit_2"){
ws_admincheck();
$myfid = ws_get_var("fid");
$dtype = ws_get_var("type");
if(empty($myfid)){
ws_err("Error: forum id cannot be found!");
}
if($dtype=="forumcats"){
$delsql = wsd_delete("".WS_FORUMCATS." WSIS type='cat' AND id='$myfid'");
}
if($dtype=="forums"){
$delsql = wsd_delete("".WS_FORUMCATS." WSIS type='forum' AND id='$myfid'");
}
if($delsql){
$mmsg = "selected $dtype has been deleted!!";
}else{
$mmsg = "Error: selected $dtype has not deleted please try again!!";
}
$button = "<a href=\"".$self."".$mode."adminsite\">Admin Manager</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="addit_2"){
ws_admincheck();
$mcid = ws_get_var("mcid");
$dtype = ws_get_var("type");
$name = ws_get_var("name");
if(empty($name)){
ws_err("Error: name cannot be empty!");
}
if($dtype=="cat"){
$inssql = wsd_query("".WS_FORUMCATS." (id,name,type,cid) VALUES ('','$name','$dtype','$mcid')","i");
}
if($dtype=="forum"){
$inssql = wsd_query("".WS_FORUMCATS." (id,name,type,cid) VALUES ('','$name','$dtype','$mcid')","i");
}
if($inssql){
$mmsg = "selected $dtype \"".$name."\" has been deleted!";
}else{
$mmsg = "Error: Selected $dtype \"".$name."\" could not be deleted please try again!";
}
$button = "<a href=\"".$self."".$mode."adminsite\">Admin Manager</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="adminclosehd"){
ws_admincheck();
$hid = ws_get_var("hid");
if(empty($hid)){
ws_err("Error: Ticket id not found!");
}
if(wsd_query("".WS_HELPDESK." SET open='0' WSIS id='$hid'","u")){
$message = "Support ticket #".$hid." has been closed!";
} else {
$message = "Error: Support ticket #".$hid." could not be closed please try again!";
}
$button = "<a href=\"".$self."".$mode."adminhelpdesk\">Helpdesk</a><br/>";;
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="adminopenhd"){
ws_admincheck();
$hid = ws_get_var("hid");
if(empty($hid)){
ws_err("Error: Ticket id not found!");
}
if(wsd_query("".WS_HELPDESK." SET open='1' WSIS id='$hid'","u")){
$message = "Support ticket #".$hid." has been re-opend!";
} else {
$message = "Error: Support ticket #".$hid." could not be opened please try again!";
}
$button = "<a href=\"".$self."".$mode."adminhelpdesk\">Helpdesk</a><br/>";;
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="adminhdsend2"){
ws_admincheck();
$parent = ws_get_var("hid");
$message = ws_get_var("message");
if(empty($parent)){
ws_err("Error: ticket id is missing!");
}
if(empty($message)){
ws_err("Error: message cannot found!");
}
$time = time();
$a = wsd_query("".WS_HELPDESK." (fromid,toid,message,time,open,parent) VALUES ('$uid','12345','$message','$time','1','$parent')","i");
if($a){
$message = "Your message has been sent to the client!!";
}else{
$message = "Error: Your message could not be sent to the support please try again!";
}
$button = "<a href=\"".$self."".$mode."adminhelpdesk\">Helpdesk Manager</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="sitegeneral2"){
ws_admincheck();
$antif = ws_get_var("antiflood");
$regonoff = ws_get_var("registration");
$wnote = ws_get_var("welcomenote");
$a = wsd_query("".WS_SETTINGS." SET note='$wnote' WSIS type='welcomenote'","u");
$a = wsd_query("".WS_SETTINGS." SET note='$antif' WSIS type='antiflood'","u");
$a = wsd_query("".WS_SETTINGS." SET note='$regonoff' WSIS type='registration'","u");
if($regonoff=="1"){
$convregonoff = "On";
} else {
$convregonoff = "Off";
}
if($a){
$message = "Site Settings have been updated!<br/>
Antiflood:<br/>".$antif."<br/><br/>
Registration:<br/>".$convregonoff."<br/><br/>
Welcome note:<br/>".$wnote."<br/><br/>";
}else{
$message = "Site setting have not been updated please try again!";
}
$button = "<a href=\"".$self."".$mode."adminsite\">Site Manager</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="adminusr"){
ws_admincheck();
$proid = ws_get_var("myuser");
$mytype = ws_get_var("type");
if(empty($proid)){
ws_err("Error: User id not found!");
}
if(empty($mytype)){
ws_err("Error: Type not found!");
}
if($mytype=="removeuser"){
ws_admincheck();
$a = wsd_delete("".WS_BUDDIES." WSIS bid='$proid'");
$a = wsd_delete("".WS_BUDDIES." WSIS uid='$proid'");
$a = wsd_delete("".WS_IGNORED." WSIS bid='$proid'");
$a = wsd_delete("".WS_IGNORED." WSIS uid='$proid'");
$a = wsd_delete("".WS_CLUBDATA." WSIS uid='$proid'");
$a = wsd_delete("".WS_CLUBMEMBERS." WSIS uid='$proid'");
$a = wsd_delete("".WS_CTEXT." WSIS uid='$proid'");
$a = wsd_delete("".WS_FILES." WSIS uid='$proid'");
$a = wsd_delete("".WS_HELPDESK." WSIS fromid='$proid'");
$a = wsd_delete("".WS_HELPDESK." WSIS toid='$proid'");
$a = wsd_delete("".WS_PMS." WSIS fromid='$proid'");
$a = wsd_delete("".WS_PMS." WSIS toid='$proid'");
$a = wsd_delete("".WS_POSTS." WSIS uid='$proid'");
$a = wsd_delete("".WS_SHOUTS." WSIS uid='$proid'");
$a = wsd_delete("".WS_QUOTES." WSIS uid='$proid'");
$a = wsd_delete("".WS_USERS." WSIS id='$proid'");
}
if($mytype=="removeposts"){
ws_admincheck();
$a = wsd_delete("".WS_POSTS." WSIS uid='$proid'");
}
if($mytype=="banuser"){
ws_admincheck();
$a = wsd_query("".WS_USERS." SET banned='1' WSIS id='$proid'","u");
}
if($mytype=="cpass2"){
ws_admincheck();
$setpass = ws_get_var("setpass");
$a = wsd_query("".WS_USERS." SET pass='$setpass' WSIS id='$proid'","u");
}
if($mytype=="promote"){
ws_admincheck();
$setpass = ws_get_var("setpass");
$a = wsd_query("".WS_USERS." SET level='admin' WSIS id='$proid'","u");
}
if($mytype=="demote"){
ws_admincheck();
$setpass = ws_get_var("setpass");
$a = wsd_query("".WS_USERS." SET level='' WSIS id='$proid'","u");
}
if($mytype=="cuser2"){
ws_admincheck();
$setuser = ws_get_var("setuser");
$a = wsd_query("".WS_USERS." SET user='$setuser' WSIS id='$proid'","u");
}
if($mytype=="bootuser"){
ws_admincheck();
$a = wsd_query("".WS_USERS." SET wsid='',lseen='' WSIS id='$proid'","u");
}
if($mytype=="adminup"){
ws_admincheck();
$sex = ws_get_var("sex");
$location = ws_get_var("location");
$signiture = ws_get_var("signiture");
$site = ws_get_var("site");
$email = ws_get_var("email");
$photo = ws_get_var("photo");
$dob = ws_get_var("dob");
$ddays = explode("-",$dob);
$ud = $ddays[0];
$um = $ddays[1];
$uy = $ddays[2];
$a = wsd_query("".WS_USERS." SET sex='".$sex."', location='".$location."', signiture='".$signiture."', site='".$site."', email='".$email."', photo='".$photo."', bday='".$ud."' ,bmonth='".$um."' , byear='".$uy."' WSIS id='$proid'","u");
}
if($mytype=="promote"){
$mymtype = "User has been promoted to admin!";
$emymtype = "Error: User has been promoted to admin please try again!";
}
if($mytype=="demote"){
$mymtype = "User has been demoted back to user!";
$emymtype = "Error: User has been demoted to admin please try again!";
}
if($mytype=="removeposts"){
$mymtype = "Posts have been removed!";
$emymtype = "Error: Posts have not been removed!";
}
if($mytype=="banuser"){
$mymtype = "User has been banned!";
$emymtype = "Error: user has not been banned!";
}
if($mytype=="cpass2"){
$mymtype = "User password has been changed!";
$emymtype = "Error: user password has not been changed please try again!";
}
if($mytype=="cuser2"){
$mymtype = "Username has been changed!";
$emymtype = "Error: username has not been changed please try again!";
}
if($mytype=="bootuser"){
$mymtype = "User has been booted from the site!";
$emymtype = "Error: user could not be booted please try again!";
}
if($mytype=="removeuser"){
$mymtype = "User has been removed!";
$emymtype = "Error: user has not been removed please try again!";
}
if($mytype=="adminup"){
$mymtype = "Users Profile has been Updated!";
$emymtype = "Error: Users Profile has not been updated please try again!";
}
if($a){
$message = $mymtype;
}else{
$message = $emymtype;
}
$button .= "<a href=\"".$self."".$mode."admindata\">Data Manager</a><br/>";
$button .= "<a href=\"".$self."".$mode."admin2k\">Admin</a><br/>";
$what = Array("message","button");
$with = Array($message,$button);
ws_temp("ws_msg");
}
if($wsm=="deleteitclub_2"){
$myid = ws_get_var("clubid");
if(empty($myid)){
ws_err("Error: club id cannot be found!");
}
$isadmin = ws_is_clubadmin($myid);
$ownersql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS id='$myid'","f");
$owner = $ownersql["uid"];
$myfid = $ownersql["fid"];
if(!$isadmin==1 || !$uid==$owner){
ws_admincheck();
}
$delsql = wsd_delete("".WS_POSTS." WSIS fid='$myfid'");
$delsql = wsd_delete("".WS_CLUBDATA." WSIS id='$myid'");
$delsql = wsd_delete("".WS_CLUBMEMBERS." WSIS cid='$myid'");
if($delsql){
$mmsg = "Selected clubs have been deleted!!";
}else{
$mmsg = "Error: Could not deleted selected club please try again!!";
}
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="deletefile"){
$myid = ws_get_var("id");
if(empty($myid)){
ws_err("Error: file id cannot be found!");
}
$delsql = wsd_delete("".WS_FILES." WSIS id='$myid'");
if($delsql){
$mmsg = "Selected file has been deleted!";
}else{
$mmsg = "Error: Could not delete the selected please try again!";
}
$button = "<a href=\"".$self."".$mode."vault\">Back to Vault</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="deletefolder"){
ws_admincheck();
$myid = ws_get_var("id");
if(empty($myid)){
ws_err("Error: folder id cannot be found!");
}
$delsql = wsd_delete("".WS_FILECATS." WSIS id='$myid'");
if($delsql){
$mmsg = "Selected folder has been deleted!";
}else{
$mmsg = "Error: Could not deleted the folder please try again!!";
}
$button = "<a href=\"".$self."".$mode."vault\">Back to Vault</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="deleteclubcat"){
ws_admincheck();
$myid = ws_get_var("id");
if(empty($myid)){
ws_err("Error: folder id cannot be found!");
}
$delsql = wsd_delete("".WS_CLUBS." WSIS id='$myid'");
if($delsql){
$mmsg = "Selected folder has been deleted!";
}else{
$mmsg = "Error: Could not deleted the folder please try again!!";
}
$button = "<a href=\"".$self."".$mode."clubs\">Back to clubs</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="delq"){
ws_admincheck();
$myid = ws_get_var("id");
if(empty($myid)){
ws_err("Error: quote id cannot be found!");
}
$delsql = wsd_delete("".WS_QUOTES." WSIS id='$myid'");
if($delsql){
$mmsg = "Selected Quote has been deleted!";
}else{
$mmsg = "Error: Could not deleted the quote please try again!!";
}
$button = "<a href=\"".$self."".$mode."quotes\">Back to Quotes</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="deleterss"){
ws_admincheck();
$myid = ws_get_var("id");
if(empty($myid)){
ws_err("Error: rss feed id cannot be found!");
}
$delsql = wsd_delete("".WS_RSS." WSIS id='$myid'");
if($delsql){
$mmsg = "Selected feed has been deleted!";
}else{
$mmsg = "Error: Could not deleted the selected feed please try again!!";
}
$button = "<a href=\"".$self."".$mode."rss\">Back to rss</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="updatefreply"){
$myid = ws_get_var("id");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$fid = $fidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$myid'","f");
$clubid = $myfidsql["id"];
if(ws_is_clubadmin($clubid)!=="1"){
ws_admincheck();
}
$text = ws_get_var("text");
$mypids = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$mypid = $mypids["parent"];
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_POSTS." SET body='$text' WSIS id='$myid'","u");
if($delsql){
$mmsg = "Selected reply has been updated!";
}else{
$mmsg = "Error: Selected reply could not be updated please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$mypid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="updateflag2"){
$location = ws_get_var("location");
$delsql = wsd_query("".WS_USERS." SET location='$location' WSIS wsid='$wsid'","u");
if($delsql){
$mmsg = "Selected country was set!";
}else{
$mmsg = "Error: Selected country was not set please try again!";
}
$button = "<a href=\"".$self."".$mode."cpanel\">Settings</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="adminupdateflag2"){
$myuser = ws_get_var("myuser");
$location = ws_get_var("location");
$delsql = wsd_query("".WS_USERS." SET location='$location' WSIS id='$myuser'","u");
if($delsql){
$mmsg = "Selected country was set!";
}else{
$mmsg = "Error: Selected country was not set please try again!";
}
$button = "<a href=\"".$self."".$mode."admin2k\">Admin Zone</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="updatefpost"){
$myid = ws_get_var("id");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$fid = $fidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$myid'","f");
$clubid = $myfidsql["id"];
if(ws_is_clubadmin($clubid)!=="1"){
ws_admincheck();
}
$text = ws_get_var("text");
$title = ws_get_var("title");
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_POSTS." SET body='$text',title='$title' WSIS id='$myid'","u");
if($delsql){
$mmsg = "Selected reply has been updated!";
}else{
$mmsg = "Error: Selected reply could not be updated please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$myid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="deletefreply"){
$myid = ws_get_var("id");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$fid = $fidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$myid'","f");
$clubid = $myfidsql["id"];
if(ws_is_clubadmin($clubid)!=="1"){
ws_admincheck();
}
$text = ws_get_var("text");
$mypids = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$mypid = $mypids["parent"];
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_delete("".WS_POSTS." WSIS id='$myid'");
if($delsql){
$mmsg = "Selected reply has been deleted!";
}else{
$mmsg = "Error: Selected reply could not be deleted please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$mypid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="updatepost"){
ws_admincheck();
$myid = ws_get_var("id");
$text = ws_get_var("text");
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_query("".WS_POSTS." SET body='$text' WSIS id='$myid'","u");
if($delsql){
$mmsg = "Selected post has been updated!";
}else{
$mmsg = "Error: Selected post could not be updated please try again!!";
}
$button = "<a href=\"".$self."".$mode."viewpost&pid=".$myid."\">Back to post</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
if($wsm=="fpost"){
$fid = $_REQUEST["fid"];
$what = Array("fid");
$with = Array($fid);
ws_temp("fpost");
}
if($wsm=="freply"){
$fid = $_REQUEST["fid"];
$what = Array("pid");
$with = Array($pid);
ws_temp("freply");
}
if($wsm=="deletefpost"){
$myid = ws_get_var("id");
$fidsql = wsd_query("* WSIN ".WS_POSTS." WSIS id='$myid'","f");
$fid = $fidsql["fid"];
$myfidsql = wsd_query("* WSIN ".WS_CLUBDATA." WSIS fid='$myid'","f");
$clubid = $myfidsql["id"];
if(ws_is_clubadmin($clubid)!=="1"){
ws_admincheck();
}
$text = ws_get_var("text");
if(empty($myid)){
ws_err("Error: id cannot be found!");
}
$delsql = wsd_delete("".WS_POSTS." WSIS id='$myid'");
$delsql = wsd_delete("".WS_POSTS." WSIS parent='$myid'");
if($delsql){
$mmsg = "Selected post has been deleted!";
}else{
$mmsg = "Error: Selected post could not be deleted please try again!!";
}
$button = "<a href=\"".$self."".$mode."forums\">Back to forums</a><br/>";
$what = Array("message","button");
$with = Array($mmsg,$button);
ws_temp("ws_msg");
}
mysql_close($do_wsdc);
?>