Wapdesire v1 Editing Help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Wapdesire v1 Editing Help

    I am Learning Php And choosed to edit and learn from wapdesire v1 script
    I have edited index.php and removed main function from it and pasted it on main.php
    Now the thing is that it contain some error codes like sql not connected and ip bans
    I want to remove them from main.php and add them to error.php this is my main.php code Below

    PHP Code:
    include("../blocked.php");
    include("config.php");
    include("core.php");
    header("Cache-Control: no-cache, must-revalidate");            // Prevent caching, HTTP/1.1
    header("Pragma: no-cache");
    //header('Content-type: application/vnd.wap.xhtml+xml'); 
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <?php
    $bcon 
    connectdb();
    if (!
    $bcon)
    {
        echo 
    "<head>";
        echo 
    "<title>Error!!!</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
        echo 
    "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
        echo 
    "This error happens usually when backing up the database, please be patient...";
        echo 
    "</p>";
        echo 
    "</body>";
        echo 
    "</html>";
        exit();
    }

    $brws explode("/",$HTTP_USER_AGENT);
    $ubr $brws[0];
    $uip getip();
    $action $_GET["action"];
    $sid $_GET["sid"];
    $page $_GET["page"];
    $who $_GET["who"];
    $uid getuid_sid($sid);
    $theme mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
    $sitename mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
    $sitename $sitename[0];
    cleardata();

    if(
    isipbanned($uip,$ubr))
      {
    if(!
    isshield(getuid_sid($sid)))
      {
      echo 
    "<head>";
      echo 
    "<title>Ip Block!</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
      echo 
    "</head>";
      echo 
    "<body>";
      echo 
    "<p align=\"center\">";
      echo 
    "<div><img src=\"../images/notok.gif\" alt=\"!\"/></div>";
      echo 
    "<b>This IP address is blocked!!!</b><br/>";
      echo 
    "<br/>";
      echo 
    "How ever we grant a shield against IP-Ban for our great users, you can try to see if you are shielded by trying to log-in, if you kept coming to this page that means you are not shielded, so come back when the ip-ban period is over<br/><br/>";
      
    $banto mysql_fetch_array(mysql_query("SELECT  timeto FROM ibwf_penalties WHERE  penalty='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 "));
      
    $remain =  $banto[0] - time();
      
    $rmsg gettimemsg($remain);
      echo 
    "<b>Time Left: </b>$rmsg<br/>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\"><form action=\"login.php\" method=\"get\">";
      echo 
    "<b>Username:</b><br/><input align=\"center\" name=\"loguid\" style=\"-wap-input-format: '*x'\" size=\"12\" maxlength=\"12\"/><br/>";
      echo 
    "<b>Password:</b><br/><input align=\"center\" type=\"password\" name=\"logpwd\" size=\"10\" maxlength=\"10\"/><br/>";
      echo 
    "<input name=\"LOGIN\" type=\"submit\" value=\"Login!\"></form></p>";
      echo 
    "<p align=\"center\"><br/>Not registered yet? <br/><a href=\"register.php\">Sign-Up</a><br/>";
      echo 
    "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      
    $onu getnumonline();
      echo 
    "Members Inside: $onu<br/><br/>";
      echo 
    "<a href=\"../wap/index.php\">Wap 1.0(wml) Version</a></p>";
      echo 
    mobads();
      echo 
    "<div><b>©2006-2007<br/>$sitename</b></div>";
      echo 
    "</body>";
      echo 
    "</html>";
      exit();
      }
    }

    if((
    $action != "") && ($action!="terms"))
      {
        
    $uid getuid_sid($sid);
        if((
    islogged($sid)==false)||($uid==0))
        {
          echo 
    "<head>";
          echo 
    "<title>Error!!!</title>";
          echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
          echo 
    "</head>";
          echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "You are not logged in<br/>";
          echo 
    "Or Your session has been expired<br/><br/>";
          echo 
    "<a href=\"index.php\">Login</a>";
          echo 
    "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }            
     }

    //echo isbanned($uid);
    if(isbanned($uid))
        {
          echo 
    "<head>";
          echo 
    "<title>Error!!!</title>";
          echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
          echo 
    "</head>";
          echo 
    "<body>";
          echo 
    "<p align=\"center\">";
          echo 
    "<img src=\"../images/notok.gif\" alt=\"x\"/><br/>";
          echo 
    "<b>You are Banned</b><br/><br/>";
          
    $banto mysql_fetch_array(mysql_query("SELECT timeto, pnreas, exid FROM ibwf_penalties WHERE uid='".$uid."' AND penalty='1' OR uid='".$uid."' AND penalty='2'"));
        
    $banres mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));
          
    $remain $banto[0]- time();
          
    $rmsg gettimemsg($remain);
          echo 
    "<b>Time Left: </b>$rmsg<br/>";
          
    $nick getnick_uid($banto[2]);
        echo 
    "<b>By: </b>$nick<br/>";
        echo 
    "<b>Reason: </b>$banto[1]";
          
    //echo "<a href=\"index.php\">Login</a>";
          
    echo "</p>";
          echo 
    "</body>";
          echo 
    "</html>";
          exit();
        }
    $res mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'");

    ////////////////////////////////////////MAIN PAGE
    if($action=="main")
    {
      
    addvisitor();
      
    addonline(getuid_sid($sid),"Main Menu","index.php?action=$action");
      
    //saveuinfo($sid);
      
    $nick getnick_sid($sid);
      echo 
    "<head>";
      echo 
    "<title>$sitename</title>";
      echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
      echo 
    "</head>";
      echo 
    "<body>";
      
    $time time() - (60 60);
      
    $newtime date("H:i",$time);
      
    $date strtotime('-9 hours');
      
    $newdate date('D jS M y',$date);

      echo 
    "<div><img src=\"../images/logo.gif\" alt=\"logo\"/><br/>";
      echo 
    "".$newtime." - ".$newdate."</div>";
      echo 
    popup($sid);
      
    $nick getnick_sid($sid);
      echo 
    "<p align=\"center\">You are logged in as $nick <a accesskey=\"0\" href=\"index.php?action=logout&amp;sid=$sid&amp;who=$uid\">Logout</a></p>";
      
    $fmsg getbbcode(getfmsg(), $sid0);
      echo 
    "<b>Site News";
      echo 
    "<p align=\"center\">$fmsg</p>";
      echo 
    "<p align=\"center\">";  
      echo 
    getshoutbox($sid);
      echo 
    "</p>";

      echo 
    "<p align=\"center\">";
      
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
      
    $memid mysql_fetch_array(mysql_query("SELECT id, name  FROM ibwf_users ORDER BY regdate DESC LIMIT 0,1"));
      echo 
    "We Have $norm[0]<br/>Registered Members<br/><a href=\"index.php?action=viewuser&amp;who=$memid[0]&amp;sid=$sid\">$memid[1]</a><br/>has now joined<br/>$sitename :o)<br/><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate());"));
      if(
    $noi[0]!=0){
      
    $sql mysql_fetch_array(mysql_query("SELECT id, name, birthday  FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate()) ORDER BY RAND() LIMIT 1"));
      
    $uage getage($sql[2]);
      
    $lnk "Happy Birthday<br/><a href=\"index.php?action=viewuser&amp;who=$sql[0]&amp;sid=$sid\">$sql[1]</a>";
      echo 
    "$lnk<br/>Hope U have A Wonderful Day<br/><br/>";
      }
    if(
    isowner(getuid_sid($sid)))
      {
      echo 
    "<a href=\"ownercp.php?action=ownercp&amp;sid=$sid\">Owner Tools</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE validated='0'"));
    if(
    $noi[0]>0)
      {
      echo 
    "<a href=\"ownercp.php?action=validatelist&amp;sid=$sid\">Validate List($noi[0])</a><br/>";
      }
      }
    if(
    isheadadmin(getuid_sid($sid)))
      {
      echo 
    "<a href=\"headadmincp.php?action=headadmincp&amp;sid=$sid\">Head Admin Tools</a><br/>";
      
    $noi mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE validated='0'"));
    if(
    $noi[0]>0)
      {
      echo 
    "<a href=\"headadmincp.php?action=validatelist&amp;sid=$sid\">Validate List($noi[0])</a><br/>";
      }
      }
      if(
    ismod($uid))
      {
      if(!
    isowner(getuid_sid($sid)))
      {
    if(!
    isheadadmin(getuid_sid($sid)))
      {
      echo 
    "<a href=\"admincp.php?action=admincp&amp;sid=$sid\">Admin Tools</a><br/>";
      }
      }
      }
      if(
    ismod($uid))
      {
      
    $adminclub "1";
      
    $ismem mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND uid='".$uid."'"));
      if(
    $ismem[0]==0)
      {
      echo 
    "<a href=\"genproc.php?action=reqjc&amp;sid=$sid&amp;clid=$adminclub\">Join Admin Club Now!</a><br/>";
      }else{
      
    $clinfo mysql_fetch_array(mysql_query("SELECT name, owner, description, rules, logo, plusses, created FROM ibwf_clubs WHERE id='".$adminclub."'"));
      
    $clnm htmlspecialchars($clinfo[0]);
      
    $fid mysql_fetch_array(mysql_query("SELECT id FROM ibwf_forums WHERE clubid='".$adminclub."'"));
      
    $rid mysql_fetch_array(mysql_query("SELECT id FROM ibwf_rooms WHERE clubid='".$adminclub."'"));
      
    $tps mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$fid[0]."'"));
      
    $pss mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$fid[0]."'"));
      
    $cango mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND uid='".$uid."' AND accepted='1'"));
      if((
    $cango[0]>0)||(isheadadmin($uid))||(isowner($uid)))
      {
      
    $noa mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_announcements WHERE clid='".$adminclub."'"));
      echo 
    "<a href=\"lists.php?action=annc&amp;sid=$sid&amp;clid=$adminclub\">Announcements($noa[0])</a><br/>";
      
    $noa mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chat WHERE rid='".$rid[0]."'"));
      
    $chs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline WHERE rid='".$rid[0]."'"));
      echo 
    "<a href=\"chat.php?sid=$sid&amp;rid=$rid[0]\">$clnm Chat($chs[0])</a><br/>";
      echo 
    "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$fid[0]\">$clnm Forum($tps[0]/$pss[0])</a><br/>";
      if(
    $clinfo[1]==$uid)
      {
      
    $mems mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubmembers WHERE clid='".$adminclub."' AND accepted='0'"));
      if(
    $mems[0]>0)
      {
      echo 
    "<a href=\"lists.php?action=clreq&amp;sid=$sid&amp;clid=$adminclub\">Requests($mems[0])</a><br/>";
      }
      }
      }
      }
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_private WHERE reported='1'"));
        
    $tot $tnor[0];
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_popups WHERE reported='1'"));
        
    $tot += $tnor[0];
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts WHERE reported='1'"));
        
    $tot += $tnor[0];
        
    $tnor mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE reported='1'"));
        
    $tot += $tnor[0];
        
    $tnol mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_mlog"));
        
    $tol $tnol[0];
        if(
    $tol+$tot>0)
        {
        echo 
    "<a href=\"modcp.php?action=main&amp;sid=$sid\">Reports/Logs($tot/$tol)</a><br/><br/>";
        }
      }

    echo 
    "<b>1 </b><a accesskey=\"1\" href=\"index.php?action=online&amp;sid=$sid\">Online Users(".getnumonline().")</a><br/>";
      
    $tmsg getpmcount(getuid_sid($sid));
      
    $umsg getunreadpm(getuid_sid($sid));
      echo 
    "<b>2 </b><a accesskey=\"2\" href=\"inbox.php?action=main&amp;sid=$sid\">Inbox($umsg/$tmsg)</a><br/>";
      
    $reqs getnreqs($uid);
      if(
    $reqs>0)
      {

        
    $request "! <a href=\"lists.php?action=reqs&amp;sid=$sid\">$reqs</a>";
      }
      
    $uid getuid_sid($sid);
      
    $mybuds getnbuds($uid);
      
    $onbuds getonbuds($uid);
      echo 
    "<b>3 </b><a accesskey=\"3\" href=\"lists.php?action=buds&amp;sid=$sid\">Buddylist($onbuds/$mybuds)</a>$request<br/>";
      
    $chs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
      echo 
    "<b>4 </b><a accesskey=\"4\" href=\"index.php?action=clmenu&amp;sid=$sid\">Clubs($chs[0])</a><br/>";
      if(
    getfview()==0)
      {
      
    $topics mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics"));
      
    $posts mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts"));
      echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=forumindx&amp;sid=$sid\">Forums($topics[0]/$posts[0])</a><br/>";
      }
      
    $fcats mysql_query("SELECT id, name FROM ibwf_fcats ORDER BY position, id");
      while(
    $fcat=mysql_fetch_array($fcats))
      {
        
    $forums mysql_query("SELECT id, name FROM ibwf_forums WHERE cid='".$fcat[0]."' AND clubid='0' ORDER BY position, id, name");

        if(
    getfview()==1)
        {
        echo 
    "<b>$fcat[1]</b><br/>";
        while(
    $forum=mysql_fetch_array($forums))
            {
          if(
    canaccess(getuid_sid($sid),$forum[0]))
          {
          echo 
    "<a href=\"index.php?action=viewfrm&amp;sid=$sid&amp;fid=$forum[0]\">$forum[1]</a><br/>";
          }
        }
        }else if(
    getfview()==2)
        {
        
    $topics mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics a INNER JOIN ibwf_forums b ON a.fid = b.id WHERE b.cid='".$fcat[0]."'"));
        
    $posts mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id INNER JOIN ibwf_forums c ON b.fid = c.id WHERE c.cid='".$fcat[0]."'"));
        echo 
    "<b>5 </b><a accesskey=\"5\" href=\"index.php?action=viewcat&amp;sid=$sid&amp;cid=$fcat[0]\">$fcat[1]($topics[0]/$posts[0])</a><br/>";
        }else if(
    getfview()==3)
        {
      echo 
    "<form action=\"index.php\" method=\"get\">";
      echo 
    "<b>$fcat[1]</b><br/><select name=\"fid\">";
      while(
    $forum=mysql_fetch_array($forums))
      {
    if(
    canaccess(getuid_sid($sid),$forum[0]))
      {
      
    $topics mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_topics WHERE fid='".$forum[0]."'"));
      
    $posts mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_posts a INNER JOIN ibwf_topics b ON a.tid = b.id WHERE b.fid='".$forum[0]."'"));
      echo 
    "<option value=\"$forum[0]\">$forum[1]($topics[0]/$posts[0])</option>";
      }
      }
      echo 
    "</select><br/>";
      echo 
    "<input type=\"hidden\" name=\"action\" value=\"viewfrm\"/>";
      echo 
    "<input type=\"hidden\" name=\"sid\" value=\"$sid\"/>";
      echo 
    "<input type=\"hidden\" name=\"fid\" value=\"$(fid)\"/>";
      echo 
    "<input type=\"submit\" value=\"[view]\"/>";
      echo 
    "</form>";
        }
      }
      
    $chs mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_chonline"));
      echo 
    "<b>6 </b><a accesskey=\"6\" href=\"index.php?action=chat&amp;sid=$sid\">Chat($chs[0])</a><br/>";

    if(!(
    $dp opendir("../pics/"))) die ("Cannot open ./");
    $files = array(); 
    while (
    $pics readdir ($dp))
        {
        if(
    substr($pics,0,1) != '.' and $pics!= "index.php")
            {
            
    $files[] =  $pics;
            }
        }
    $file_count count ($files);
    sort ($files);
      echo 
    "<b>7 </b><a accesskey=\"7\" href=\"../pics/index.php?action=pics&amp;sid=$sid&amp;script=xhtml\">Gallery($file_count)</a><br/>";
      
    //echo "<a href=\"shop.php?action=shop&amp;sid=$sid\">»Plusses Shop</a><br/>";
      
    echo "<b>8 </b><a accesskey=\"8\" href=\"linksites.php?sid=$sid\">Links</a><br/>";
      echo 
    "<b>9 </b><a accesskey=\"9\" href=\"settings/settings.php?action=cpanel&amp;sid=$sid\">Settings</a><br/>";
      echo 
    "<b>0 </b><a accesskey=\"0\" href=\"logout.php?action=logout&amp;sid=$sid&amp;who=$uid\">Logout</a>";
      echo 
    "</p>";
      echo 
    "<p align=\"center\">";
      echo 
    "<a href=\"quiz.php?action=quiz&amp;sid=$sid\">Quiz</a><br/>";
      echo 
    "<a href=\"index.php?action=search&amp;sid=$sid\">Search</a><br/>";
      echo 
    "<a href=\"lists.php?action=smilies&amp;sid=$sid\">Smilies List</a><br/>";
      
    $downloads mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_uploads"));
      echo 
    "<a href=\"../uploaded/index.php?sid=$sid&amp;site=web\">Downloads($downloads[0])</a><br/>";
      echo 
    "<a href=\"index.php?action=funm&amp;sid=$sid\">Fun n Games</a><br/>";
      
    $norm mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users"));
      echo 
    "Members:<a href=\"lists.php?action=members&amp;sid=$sid\">$norm[0]</a><br/>";
      
    $noi2 mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE perm>'0'"));
      
    $timeout 300;
      
    $timeon time()-$timeout;
      
    $noi mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE perm>'0' AND lastact>'".$timeon."'"));
      echo 
    "Staff List: <a href=\"index.php?action=stfol&amp;sid=$sid\">".$noi[0]."/$noi2[0]</a></p>";
      echo 
    "<p align=\"center\"><img src=\"../images/banner.gif\" alt=\"banner\"/></p>";
      echo 
    "<p align=\"center\">";  
    if(
    ismod($uid))
      {
      echo 
    "<p align=\"center\"><a href=\"staffinfo.php?sid=$sid\">Staff Rules and Info</a><br/>";
      }
      echo 
    "<a href=\"index.php?action=terms&amp;sid=$sid\">Site Rules</a><br/>";
      echo 
    "<a href=\"index.php?action=stats&amp;sid=$sid\">Site Stats</a></p>";
      echo 
    mobads();
      echo 
    "<center><a href=\"hosting.php?sid=$sid\">Hosting</a></center>";
      echo 
    "<div><b>©2007<br/>$sitename</b></div>";
      echo 
    "</body>";
    }
    I want to remove these code from it to add to error.php
    PHP Code:
    if (!$bcon)
    {
        echo 
    "<head>";
        echo 
    "<title>Error!!!</title>";
        echo 
    "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/white_medium.css\">";
        echo 
    "</head>";
        echo 
    "<body>";
        echo 
    "<p align=\"center\">";
        echo 
    "<img src=\"../images/notok.gif\" alt=\"!\"/><br/>";
        echo 
    "<b><strong>Error! Cannot Connect To Database...</strong></b><br/><br/>";
        echo 
    "This error happens usually when backing up the database, please be patient...";
        echo 
    "</p>";
        echo 
    "</body>";
        echo 
    "</html>";
        exit();

    Hoping i will get some help regarding this
    plz dont say to not use this script as i know its unsecure i am just editing it for fun and learnings
    thnx
    ComputerForumz - Latest Tech News


    Mobbest.tk-Free Mobile Downloads

    #2
    i can do it for u pm me

    Comment

    Working...
    X