Core Function

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

    Core Function

    Help, im trying to make a core function for my Mailbox and buddies so i can easily post both options in the index or in any location id like to see those two.

    in my core function: i posted these lines:

    function mailbox($sid)
    {
    $tmsg = getpmcount(getuid_sid($sid));
    $umsg = getunreadpm(getuid_sid($sid));
    if($umsg==1)
    {
    echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbo x</a>($umsg new)
    ";
    }
    if($umsg>1)
    {
    echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbo x</a>($umsg new messages)
    ";
    }
    if($umsg==0)
    {
    echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbo x</a>($tmsg)
    ";
    }

    $uid = getuid_sid($sid);
    $mybuds = getnbuds($uid);
    $onbuds = getonbuds($uid);
    echo "<a href=\"lists.php?action=buds&amp;sid=$sid\">Friend s </a>($onbuds/$mybuds)";
    $reqs = getnreqs($uid);
    if($reqs>0)
    {

    echo ": <a href=\"lists.php?action=reqs&amp;sid=$sid\">$reqs</a>";
    }
    $isreq = mysql_fetch_array(mysql_query("SELECT rpen FROM chapel WHERE mid=&#39;".$uid."&#39;"));
    if($isreq[0]==&#39;1&#39;)
    {
    echo "
    <a href=\"chapel.php?action=main&amp;sid=$sid\">Get Wappied</a>";
    }
    return ?????;
    }



    ---i dont know the return function there. lol. call me studid, it&#39;s ok. am noob anyway. ops, by the way, i also included the chapel notice there, anyway, if someone would edit the code, tnx alot!

    #2
    put this in core.php

    Code:
    function mailbox($sid)
    {
    $tmsg = getpmcount(getuid_sid($sid));
      $umsg = getunreadpm(getuid_sid($sid));
      if($umsg==1)
      {
      echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbox</a>($umsg new)
    ";
      }
      if($umsg>1)
      {
      echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbox</a>($umsg new messages)
    ";
      }  
      if($umsg==0)
      {
      echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbox</a>($tmsg)
    ";
      } 
    
      $uid = getuid_sid($sid);
      $mybuds = getnbuds($uid);
      $onbuds = getonbuds($uid);
      echo "<a href=\"lists.php?action=buds&amp;sid=$sid\">Friends </a>($onbuds/$mybuds)";
      $reqs = getnreqs($uid);
      if($reqs>0)
      {
    
        echo ": <a href=\"lists.php?action=reqs&amp;sid=$sid\">$reqs</a>";
      }
    $isreq = mysql_fetch_array(mysql_query("SELECT rpen FROM chapel WHERE mid=&#39;".$uid."&#39;"));
    if($isreq[0]==&#39;1&#39;)
    {
    echo "
    <a href=\"chapel.php?action=main&amp;sid=$sid\">Get Wappied</a>";
    }
     
    }
    and put this in index.php

    Code:
    echo mailbox($sid);

    Comment


      #3
      put this in core.php

      Code:
      function mailbox($sid)
      {
      $tmsg = getpmcount(getuid_sid($sid));
        $umsg = getunreadpm(getuid_sid($sid));
        if($umsg==1)
        {
        echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbox</a>($umsg new)
      ";
        }
        if($umsg>1)
        {
        echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbox</a>($umsg new messages)
      ";
        }  
        if($umsg==0)
        {
        echo "<a href=\"inbox.php?action=main&amp;sid=$sid\">Mailbox</a>($tmsg)
      ";
        } 
      
        $uid = getuid_sid($sid);
        $mybuds = getnbuds($uid);
        $onbuds = getonbuds($uid);
        echo "<a href=\"lists.php?action=buds&amp;sid=$sid\">Friends </a>($onbuds/$mybuds)";
        $reqs = getnreqs($uid);
        if($reqs>0)
        {
      
          echo ": <a href=\"lists.php?action=reqs&amp;sid=$sid\">$reqs</a>";
        }
      $isreq = mysql_fetch_array(mysql_query("SELECT rpen FROM chapel WHERE mid=&#39;".$uid."&#39;"));
      if($isreq[0]==&#39;1&#39;)
      {
      echo "
      <a href=\"chapel.php?action=main&amp;sid=$sid\">Get Wappied</a>";
      }
       
      }
      and put this in index.php

      Code:
      echo mailbox($sid);
      [/b]



      salamat natasu! try ko po. wala ba talagang return function un?

      Comment


        #4
        also, i made a new page for my general menu. i guess i missed some codes here, it works well in opera 9.50 but not in default browsers of cellphones. here&#39;s my code.





        <?php

        include("config.php");
        include("core.php");
        //session_start();
        header("Content-type: text/vnd.wap.wml");
        header("Cache-Control: no-store, no-cache, must-revalidate");
        echo("<?xml version=\"1.0\"?>");
        echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\"". " \"http://www.wapforum.org/DTD/wml_1.1.xml\">";

        ?>

        <wml>


        <?php

        $bcon = connectdb();
        if (!$bcon)
        {
        echo "<card id=\"main\" title=\"site\">";
        echo "<p align=\"center\">";
        echo "<img src=\"images/exit.gif\" alt=\"*\"/>
        ";
        echo "ERROR! cannot connect to database

        ";
        echo "This error happens usually when backing up the database, please be patient, The site will be up any minute

        ";
        echo "Soon, we will offer services that doesn&#39;t depend on MySQL databse to let you enjoy our site, while the database is not connected
        ";
        echo "THANK YOU VERY MUCH";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        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);

        cleardata();
        if(isipbanned($uip,$ubr))
        {
        if(!isshield(getuid_sid($sid)))
        {
        echo "<card id=\"main\" title=\"site\">";
        echo "<p align=\"center\">";
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>
        ";
        echo "This IP address is blocked
        ";
        echo "
        ";
        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

        ";
        $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE penalty=&#39;2&#39; AND ipadd=&#39;".$uip."&#39; AND browserm=&#39;".$ubr."&#39; LIMIT 1 "));
        //echo mysql_error();
        $remain = $banto[0] - time();
        $rmsg = gettimemsg($remain);
        echo "Time to unblock the IP: $rmsg

        ";

        echo "</p>";
        echo "

        ";
        echo "UserID: <input name=\"loguid\" format=\"*x\" maxlength=\"30\"/>
        ";
        echo "Password: <input type=\"password\" name=\"logpwd\" maxlength=\"30\"/>
        ";
        echo "<anchor>LOGIN<go href=\"login.php\" method=\"get\">";
        echo "<postfield name=\"loguid\" value=\"$(loguid)\"/>";
        echo "<postfield name=\"logpwd\" value=\"$(logpwd)\"/>";
        echo "</go></anchor>";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        exit();
        }
        }
        if(($action != "") && ($action!="terms"))
        {
        $uid = getuid_sid($sid);
        if((islogged($sid)==false)||($uid==0))
        {
        echo "<card id=\"main\" title=\"site\">";
        echo "<p align=\"center\">";
        echo "You are not logged in
        ";
        echo "Or Your session has been expired

        ";
        echo "<a href=\"index.php\">Login</a>";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        exit();
        }



        }
        //echo isbanned($uid);
        if(isbanned($uid))
        {
        echo "<card id=\"main\" title=\"site\">";
        echo "<p align=\"center\">";
        echo "<img src=\"images/notok.gif\" alt=\"x\"/>
        ";
        echo "You are Banned
        ";
        $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_penalties WHERE uid=&#39;".$uid."&#39; AND penalty=&#39;1&#39;"));
        $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id=&#39;".$uid."&#39;"));

        $remain = $banto[0]- time();
        $rmsg = gettimemsg($remain);
        echo "Time to finish your penalty: $rmsg

        ";
        echo "Ban Reason: $banres[0]";
        //echo "<a href=\"index.php\">Login</a>";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        exit();
        }
        $res = mysql_query("UPDATE ibwf_users SET browserm=&#39;".$ubr."&#39;, ipadd=&#39;".$uip."&#39; WHERE id=&#39;".getuid_sid($sid)."&#39;");

        ////////////////////////////////////////MAIN PAGE
        if($action=="genm")
        {
        addonline(getuid_sid($sid),"General Menu","");
        echo "<card id=\"main\" title=\"Menu\">";
        echo "<p align=\"center\">";
        echo waphead($sid);
        echo "
        ";
        echo mailbox($sid);
        echo "

        ";
        echo getshoutbox($sid);
        echo "


        ";
        $tbday=mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users where month(`birthday`) = month(curdate()) and dayofmonth(`birthday`) = dayofmonth(curdate());"));
        echo "GENERAL MENU";
        echo "
        ";
        echo "</p>";
        echo "<a href=\"lists.php?action=bdy&amp;sid=$sid\">+ Today&#39;s Birthday ($tbday[0])</a>
        ";
        echo "

        ";
        echo "";
        echo "<a href=\"news/index.php?sid=$sid\">+ News</a>

        ";

        $chs = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_clubs"));
        echo "<a href=\"home.php?action=clmenu&amp;sid=$sid\">+ Clubs ($chs[0])</a>
        ";
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_blogs"));
        echo "<a href=\"lists.php?action=allbl&amp;sid=$sid\">+ Blogs ($noi[0])</a>
        ";
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE pollid>&#39;0&#39;"));
        echo "<a href=\"lists.php?action=polls&amp;sid=$sid\">+ Polls ($noi[0])</a>
        ";
        echo "<a href=\"genm.php?action=funm&amp;sid=$sid\">+ Fun Zone</a>
        ";
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_vault"));
        echo "<a href=\"lists.php?action=vault&amp;sid=$sid\">+ Vaults ($noi[0])</a>
        ";
        $noi = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_usergallery"));
        echo "<a href=\"usergallery.php?action=main&amp;sid=$sid\"> + User Gallery</a>($noi[0])
        ";
        echo "--------
        ";
        echo "<a href=\"help.php?sid=$sid\">+ Help Menu</a>
        ";
        echo "<a href=\"lists.php?action=faqs&amp;sid=$sid\">+ Faq&#39;s</a>
        ";
        echo "<a href=\"terms.php?action=terms&amp;sid=$sid\">+ Terms</a>
        ";

        echo "
        </p>";
        echo wapfoot($sid);

        echo "</card>";
        echo "</wml>";
        exit();
        }
        else if($action=="funm")
        {
        addonline(getuid_sid($sid),"Fun/Games Menu","");
        echo "<card id=\"viewforum\" title=\"Fun/Games Menu\">";
        echo "<p align=\"center\">";
        echo "<img src=\"images/roll.gif\" alt=\"*\"/>
        ";
        echo "Yeah! Lets have some fun!";
        echo "
        </p>";
        echo "

        ";


        ///echo "<a href=\"hangman/index.php?sid=$sid\">»Hangman</a>
        ";

        echo "<a href=\"games.php?action=fci&amp;sid=$sid\">»Fortun e Cookie</a>
        ";

        echo "-----";
        echo "
        ";

        echo "<a href=\"hilow.php?action=hilow&amp;sid=$sid\">»HiLo w</a>
        ";
        echo "<a href=\"hangman.php?action=hangman&amp;sid=$sid\">» Hangman</a>
        ";
        echo "<a href=\"hangman.php?action=scramble&amp;sid=$sid\"> »Twist</a>
        ";

        echo "<a href=\"games.php?action=guessgm&amp;sid=$sid\">»Gu ess The Number</a>
        ";
        echo "<a href=\"games.php?action=casinoi&amp;sid=$sid\">»Ca sino</a>
        ";
        echo "<a href=\"games.php?action=lottoi&amp;sid=$sid\">»Lot to</a>
        ";
        echo "-----
        ";
        echo "<a href=\"games.php?action=mixabud&amp;sid=$sid\">»Mi x a Buddy</a>
        ";
        echo "<a href=\"games.php?action=mixabudguy&amp;sid=$sid\"> »Mix a Guy (For Girls Only)</a>
        ";
        echo "<a href=\"games.php?action=mixabudgirl&amp;sid=$sid\" >»Mix a Girl (For Guys Only)</a>
        ";
        //echo "»Dares Box
        ";
        echo "
        </p>";
        echo "<p align=\"center\">";
        echo "";



        echo "
        ";
        echo "
        ";
        echo "<a href=\"home.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        exit();
        }
        else if($action=="partners")
        {
        addonline(getuid_sid($sid),"Partner List","");
        echo "<card id=\"viewforum\" title=\"Partners\">";
        echo "<p align=\"center\">";
        echo "Partner Sites

        ";
        echo "
        </p>";
        echo "

        ";
        echo "<a href=\"http://site.wen.ru\">Link</a>
        ";
        echo "<a href=\"http://site.org\">Link</a>
        ";
        echo "
        </p>";
        echo "<p align=\"center\">";
        echo "
        <a href=\"home.php?action=main&amp;sid=$sid\">";
        echo "Home</a>";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        exit();
        }

        else{
        addonline(getuid_sid($sid),"Lost in Games lol","");
        echo "<card id=\"main\" title=\"Inbox\">";
        echo "<p align=\"center\">";
        echo "I don&#39;t know how did you get into here, but there&#39;s nothing to show

        ";
        echo "<a href=\"home.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
        echo "Home</a>";
        echo "</p>";
        echo "</card>";
        echo "</wml>";
        exit();
        }

        ?>
        </wml>

        Comment

        Working...
        X