Core Function

Started on the old forum in July 2008 · view the original in the archive · old links redirect here

3 replies · 768 views · started 18 years ago · 1 min read

2 participants
Brontok Newbie · 3 posts #1

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&sid=$sid">Mailbox</a>($umsg new) "; } if($umsg>1) { echo "<a href="inbox.php?action=main&sid=$sid">Mailbox</a>($umsg new messages) "; }
if($umsg==0) { echo "<a href="inbox.php?action=main&sid=$sid">Mailbox</a>($tmsg) "; }

$uid = getuid_sid($sid); $mybuds = getnbuds($uid); $onbuds = getonbuds($uid); echo "<a href="lists.php?action=buds&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='".$uid."'")); if($isreq[0]=='1') { echo " <a href="chapel.php?action=main&sid=$sid">Get Wappied</a>"; } return ?????; }

---i dont know the return function there. lol. call me studid, it'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!

thanatos Senior · 261 posts #2

put this in core.php

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

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

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

and put this in index.php

echo mailbox($sid);
Brontok Newbie · 3 posts #3

put this in core.php

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

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

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

and put this in index.php

echo mailbox($sid);

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

Brontok Newbie · 3 posts #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'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 " "; 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't depend on MySQL databse to let you enjoy our site, while the database is not connected "; echo "**THANK YOU VERY MUCH**"; echo " "; 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 " "; 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='2' AND ipadd='".$uip."' AND browserm='".$ubr."' LIMIT 1 ")); //echo mysql_error(); $remain = $banto[0] - time(); $rmsg = gettimemsg($remain); echo "Time to unblock the IP: $rmsg "; echo " "; 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 " "; 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 " "; echo "You are not logged in "; echo "Or Your session has been expired "; echo "<a href=\"index.php\">Login</a>"; echo " "; echo "</card>"; echo "</wml>"; exit(); } } //echo isbanned($uid); if(isbanned($uid)) { echo "<card id=\"main\" title=\"site\">"; echo " "; 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='".$uid."' AND penalty='1'")); $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'")); $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 " "; echo "</card>"; echo "</wml>"; exit(); } $res = mysql_query("UPDATE ibwf_users SET browserm='".$ubr."', ipadd='".$uip."' WHERE id='".getuid_sid($sid)."'"); ////////////////////////////////////////MAIN PAGE if($action=="genm") { addonline(getuid_sid($sid),"General Menu",""); echo "<card id=\"main\" title=\"Menu\">"; echo " "; 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 " "; echo "<a href=\"lists.php?action=bdy&amp;sid=$sid\">+ Today'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>'0'")); 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's</a> "; echo "<a href=\"terms.php?action=terms&amp;sid=$sid\">+ Terms</a> "; echo " "; 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 " "; echo "<img src=\"images/roll.gif\" alt=\"*\"/> "; echo "Yeah! Lets have some fun!"; echo " "; echo " "; ///echo "<a href=\"hangman/index.php?sid=$sid\">»Hangman</a> "; echo "<a href=\"games.php?action=fci&amp;sid=$sid\">»Fortune Cookie</a> "; echo "-----"; echo " "; echo "<a href=\"hilow.php?action=hilow&amp;sid=$sid\">»HiLow</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\">»Guess The Number</a> "; echo "<a href=\"games.php?action=casinoi&amp;sid=$sid\">»Casino</a> "; echo "<a href=\"games.php?action=lottoi&amp;sid=$sid\">»Lotto</a> "; echo "----- "; echo "<a href=\"games.php?action=mixabud&amp;sid=$sid\">»Mix 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 " "; echo " "; echo ""; echo " "; echo ""; echo "<a href=\"home.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>Home</a>"; echo " "; echo "</card>"; echo "</wml>"; exit(); } else if($action=="partners") { addonline(getuid_sid($sid),"Partner List",""); echo "<card id=\"viewforum\" title=\"Partners\">"; echo " "; echo "Partner Sites "; echo " "; echo " "; echo "<a href=\"http://site.wen.ru\">Link</a> "; echo "<a href=\"http://site.org\">Link</a> "; echo " "; echo " "; echo " <a href=\"home.php?action=main&amp;sid=$sid\">"; echo "Home</a>"; echo " "; echo "</card>"; echo "</wml>"; exit(); } else{ addonline(getuid_sid($sid),"Lost in Games lol",""); echo "<card id=\"main\" title=\"Inbox\">"; echo " "; echo "I don't know how did you get into here, but there's nothing to show "; echo "<a href=\"home.php?action=main&amp;sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>"; echo "Home</a>"; echo " "; echo "</card>"; echo "</wml>"; exit(); } ?> </wml>

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close