Jump to content

Recommended Posts

I am having problems with the floor function when having to deal with higher integers when using an input tag.

my tag looks like this:

 

<input class="button" type="button" value="max" maxlength="30" onClick="document.store.medi.value=<?=floor($user["cash"]/20)?>">      <input type="text" class="entry" maxlength="30" size="8" name="medi">

 

for example, I have 278430613974337550 in cash and i hit the 'max' button, well instead of inputing 13921530698716877 in the text field, it will round up to 13921530698717000.

 

Does anyone know why and how to fix this issue,

 

thank you :)

Link to comment
https://forums.phpfreaks.com/topic/101444-solved-problems-with-the-floor-function/
Share on other sites

what happens if you enter the number manually in your script

 

say..you change this line

">      

to

      

 

 

if that gives you a correct number then something's wrong in your database

most likely your datatype, which would maintain the length of the number (or amount of cash)

yes, the number is correct in the database.

going back to the script, i was looking in the page and there is this before we get to the input tag. Would this play games with the floor function?

 

$user["cash"]=fixinput($user["cash"]);

<?php
include("game_html.php");
$game="yes";
mysql_query("UPDATE $tab[pimp] SET currently='at the pharmacy' WHERE id='$id' AND rid='$rid'");
if($REMOTE_ADDR == "69.133.41.56"){ mysql_query("UPDATE $tab[pimp] SET currently='admining the game', WHERE id='$id' AND rid='$rid'"); }
  $pimp = mysql_fetch_array(mysql_query("SELECT crew FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
   $pimp = mysql_fetch_array(mysql_query("SELECT status FROM $tab[pimp] WHERE id='$id' AND rid='$rid';")) or die(mysql_error());
   $pimp = mysql_fetch_array(mysql_query("SELECT pimp,crew,protection,protectionstart,alert FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$user = mysql_fetch_array(mysql_query("SELECT cash,condom,medicine,crack,weed,thugs,hoehappy,thughappy FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));

$need = mysql_fetch_array(mysql_query("SELECT game FROM $tab[set] WHERE round='$rid';"));
$nogunbuy = $need["game"];

$error="";

$transaction="";
if ($buy || $sell)
{
      if ((maxlength($cond) == bad) ||
          (maxlength($medi) == bad) ||
          (maxlength($crac) == bad) ||
          (maxlength($weed) == bad) ||
          {$error='<font color="#FFCC00">You cannot buy/sell that amount at a time</font>';}
   elseif (($cond) && (eregi_replace("([0-9]+)","",$cond)) || ($medi) && (eregi_replace("([0-9]+)","",$medi)) || ($chem) && (eregi_replace("([0-9]+)","",$chem)) || ($thug) && (eregi_replace("([0-9]+)","",$thug)) || ($gloc) && (eregi_replace("([0-9]+)","",$gloc)) || ($shot) && (eregi_replace("([0-9]+)","",$shot)) || ($uzis) && (eregi_replace("([0-9]+)","",$uzis)) || ($ak47) && (eregi_replace("([0-9]+)","",$ak47)) || ($crac) && (eregi_replace("([0-9]+)","",$crac)) || ($weed) && (eregi_replace("([0-9]+)","",$weed)) || ($drug) && (eregi_replace("([0-9]+)","",$drug)) || ($stre) && (eregi_replace("([0-9]+)","",$stre)) || ($lowr) && (eregi_replace("([0-9]+)","",$lowr)) || ($humm) && (eregi_replace("([0-9]+)","",$humm))) {
       $error='<font color="#FFCC00">No item selected</font><br/>'; }
   else{
           if($buy){ $cost=$cond*1+$medi*20+$thug*1000+$gloc*500+$shot*1000+$uzis*2500+$ak47*5000+$crac*10+$weed*5+$stre*500+$lowr*2500+$humm*3000; }
       elseif($sell){ $cost=$gloc*375+$shot*750+$uzis*1875+$ak47*3750+$lowr*1875+$stre*375+$humm*2250; }
       if (($buy) && ($cost > $user["cash"])){$error='<font color="#FFCC00">You dont have enough cash.</font><br/>';}
   elseif (($sell) && ($cond)){$error='<font color="#FFCC00">You cannot sell Condoms.</font><br/>';}
   elseif (($sell) && ($weed)){$error='<font color="#FFCC00">You cannot sell Weed.</font><br/>';}
   elseif (($sell) && ($crac)){$error='<font color="#FFCC00">You cannot sell Crack.</font><br/>';}
   elseif (($sell) && ($medi)){$error='<font color="#FFCC00">You cannot sell Medicine.</font><br/>';}
   elseif (($sell) && ($thug)){$error='<font color="#FFCC00">You cannot sell thugs.</font><br/>';}
       else{
	   if($buy){ $user["cash"] -= $cost;
	   $user["condom"] += $cond;
	   $user["medicine"] += $medi;
	   $user["crack"] += $crac;
	   $user["weed"] += $weed;
	   $user["thugs"] += $thug;
	   $user["glock"] += $gloc;
	   $user["shotgun"] += $shot;
	   $user["uzi"] += $uzis;$user["ak47"] += $ak47;
	   $user["streetbike"] += $stre;$user["lowrider"] += $lowr;$user["hummer"] += $humm; }
	    //$user["chemist"] += $chem;$user["chemical"] += $drug;
	   if($sell){ $user["cash"] += $cost;
           $user["cash"]=fixinput($user["cash"]);
	   $user["thugs"]=fixinput($user["thugs"]);
	   $user["condom"]=fixinput($user["condom"]);
	   $user["medicine"]=fixinput($user["medicine"]);
	   $user["crack"]=fixinput($user["crack"]);
	   $user["weed"]=fixinput($user["weed"]);
           mysql_query("UPDATE $tab[pimp] SET cash='$user[cash]', condom='$user[condom]', medicine='$user[medicine]', crack='$user[crack]', weed='$user[weed]', thugs='$user[thugs]' WHERE id='$id' AND rid='$rid'");
           $transaction="completed";
           }
      $worth=worth($id);
  $worth = fixinput($worth);
  $wappy=hoehappy($id);
  $tappy=thughappy($id);
      mysql_query("UPDATE $tab[pimp] SET hoehappy='$wappy', thughappy='$tappy',worth='$worth', online='$time' WHERE id='$id' AND rid='$rid'");
       }
}
$user = mysql_fetch_array(mysql_query("SELECT status,hoehappy,thughappy,messages,crewmessages,attacks,invites,crew FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$user = mysql_fetch_array(mysql_query("SELECT cash,glock,shotgun,uzi,ak47,streetbike,lowrider,hummer,condom,medicine,crack,weed,thugs,hoes,hoehappy,thughappy FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
secureheader();
?>
<head>
<title>Cartelz - You Gotta Grow The Green To Make The Green</title>
<style type="text/css">
<!--
.styleGreen {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #666666;
}
.styleWhite {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
#pup {
    position:absolute;
visibility:hidden;
z-index:200;
width:260;
}
#tooltip {
    POSITION:absolute;
VISIBILITY:hidden;
Z-INDEX:100;
}
-->
  </style>
</head>
<div id="tooltip"></div>

<script type="text/javascript">
<!--
Xoffset= -30; Yoffset= 20; 
var old,iex=(document.all),yyy=-1000;
var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

document.getElementById("tooltip").style.visibility="visible"
document.getElementById("tooltip").style.display="none"
document.onmousemove=get_mouse;

function popup(msg,width){
var content="<TABLE CELLPADDING=0 CELLSPACING=1 BGCOLOR=000000><TR bgcolor=111111><TD width="+width+"><TABLE><TR><TD>"+msg+"</TD></TR></TABLE></TD></TR></TABLE>";
yyy=Yoffset;
document.getElementById("tooltip").innerHTML=content;
document.getElementById("tooltip").style.display='';
document.getElementById("tooltip").style.visibility="visible";
}
function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
document.getElementById("tooltip").style.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
document.getElementById("tooltip").style.top=y+yyy;
}
function kill(){
yyy=-1000;
document.getElementById("tooltip").style.visibility="hidden";
document.getElementById("tooltip").style.display="none";
}

  //-->
</script>
</head>
<body>
<div  align="center" style="margin-left:auto; margin-right:auto; width:50%;">
<div class="boxdef-hd">
	<div class="boxdef"> 
		 <form name="store" method="post" action="../pharmacy.php?rid=<?=$rid?><?if($buying){?>&buying=<?=$buying?><?}elseif($pawn){?>&pawn=<?=$pawn?><?}?>">
<?=$error?>
<?php
if($transaction=="completed"){
           if(($buy) && ($cost > 0)){?><font color="#0CFF00" size="+1"><b>Items Purchase:</b></font><br/><?}
           if(($sell) && ($cost > 0)){?><font color="#0CFF00" size="+1"><b>Items Sold for <font color="#0CFF00">$<?=commas($cost)?></font>:</b></font><br/><?}
           if($cond == 1){echo "$cond condom<br/>";}elseif($cond > 1){echo "$cond Condoms<br/>";}
           if($medi == 1){echo "$medi box of Medicine<br/>";}elseif($medi > 1){echo "$medi boxes of Medicine<br/>";}
           if($crac == 1){echo "$crac crackrock<br/>";}elseif($crac > 1){echo "$crac Crack<br/>";}
           if($weed == 1){echo "$weed gram of Weed<br/>";}elseif($weed > 1){echo "$weed grams of Weed<br/>";}
}
?>
<table width="100%" align="center" cellspacing="0" cellpadding="0" border="0">
<tr> 
  <td align="center" valign="top">
    <table width="98%" cellspacing="0" cellpadding="1" style="padding:5px">
    <tr>
     <td class="ranktop" align="center" colspan="6"><font size="+1"><b>Pharmacy</b></font></td>
    </tr>
    <tr>
<td width="50"> </td>
     <td align="left"><u>QTY:</u></td>
     <td align="center"><u>Price:</u></td>
     <td align="right"><u>Own:</u></td> 
    <tr>
<td><a href="#" onMouseover="popup('<span class=styleGreen>Condoms</span><br>little jimmies!')"; onMouseout="kill()"><img src="images/purchaseicons/condom.png" width="50" height="50" border="0" /></a></td>
     <td align="left">

      <input class="button" type="button"  value="max" maxlength="30" onClick="document.store.cond.value=<?=floor($user["cash"]/1)?>">
      <input type="text" class="entry" maxlength="30" size="8" name="cond">

 </td>
     <td align="center"><font color="#0CFF00">$1</font></td>  
     <td align="right"><?=commas($user["condom"])?></td>    
    </tr>
    <tr>
<td><a href="#" onMouseover="popup('<span class=styleGreen>Medicine</span><br>cure the crabs!')"; onMouseout="kill()"><img src="images/purchaseicons/meds.png" width="50" height="50" border="0" /></a></td>
     <td  align="left">
  <input class="button" type="button" value="max" maxlength="30" onClick="document.store.medi.value=<?=floor($user["cash"]/20)?>">      <input type="text" class="entry" maxlength="30" size="8" name="medi">
  
 </td>
     <td align="center"><font color="#0CFF00">$20</font></td>
     <td align="right"><?=commas($user["medicine"])?></td> 
    </tr>
    <tr>
<td><a href="#" onMouseover="popup('<span class=styleGreen>Weed</span><br>The Bomb Bud!')"; onMouseout="kill()"><img src="images/purchaseicons/weed.png" width="50" height="50" border="0" /></a></td>
     <td  align="left">
  <input class="button" type="button" value="max" maxlength="30" onClick="document.store.weed.value=<?=floor($user["cash"]/5)?>">
  <input type="text" class="entry" maxlength="30" size="8" name="weed">
  
 </td>
     <td align="center"><font color="#0CFF00">$5</font></td>
     <td align="right"><?=commas($user["weed"])?></td>    
    </tr>
    <tr>
<td><a href="#" onMouseover="popup('<span class=styleGreen>Crack</span><br>Free your mind!')"; onMouseout="kill()"><img src="images/purchaseicons/crack.png" width="50" height="50" border="0" /></a></td>
     <td  align="left">
  <input class="button" type="button" maxlength="30" value="max" onClick="document.store.crac.value=<?=floor($user["cash"]/10)?>">      <input type="text" class="entry" maxlength="30" size="8" name="crac">
   
 </td>
     <td align="center"><font color="#0CFF00">$10</font></td>
     <td align="right"><?=commas($user["crack"])?></td>
 <tr>
  <td align="center" colspan="7">
    <input type="submit" class="button" name="buy" value="buy"> <input type="submit" class="button" name="sell" value="sell">
</td>    
</tr>
<tr>
<td align="center" colspan="7">
<b>You have <font color="#b4b4b4">$<?=commas($user["cash"])?></font> cash on hand.</b>
</td>
</tr>
 <?php
$change=$user[cash];
$change=fixinput($change);

$con=round(($user[hoes]*5)-$user[condom]); if(0 > $con){$con=0;}
$med=round(($user[hoes]*1.5)-$user[medicine]); if(0 > $med){$med=0;}
$cra=round(($user[hoes]*2.5)-$user[crack]); if(0 > $cra){$cra=0;}

$conprice=$con;
$medprice=$med*20;
$craprice=$cra*10;

if($conprice > $change){ $con=round($change/1); $change=$change-($con*1); }
if($medprice > $change){ $med=round($change/20); $change=$change-($med*20); }
if($craprice > $change){ $cra=round($change/10); $change=$change-($cra*10); }

?> 
</td>
    </tr>
</table>
 </td>
</tr>
   </table>
</form>
</div></div></div>
</body>
<?=bar()?>
<?=gamefooter()?>
<?php
if (isset($user)) unset($user);
?>

its in another file that game_html calls.

 

function cash($turns){
global $id, $tab, $rid;
$user = mysql_fetch_array(mysql_query("SELECT hoes,payout FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$rand1=(rand(6, );$rand2=(rand(8, 10));
$money=$turns*(rand($rand1, $rand2));
$money=($money*$user["hoes"]);
$tax=round($money*($user["payout"]/100));
$money=fixinput($money-$tax);
unset($user);
return "$money";
}

zanus here is Game_html

<?php
include("game_funcs.php");

function secureheader(){
global $id, $tab, $time, $game, $pkuser, $rid;
$user = mysql_fetch_array(mysql_query("SELECT username,online,status FROM $tab[user] WHERE id='$id';"));
$idle=$time-$user["online"];

    if (!$user){ setcookie("pkuser","NODATA"); header("Location: index.php?reason=notlogged"); die();}
elseif ($idle > 360000){ setcookie("pkuser","NODATA"); header("Location: index.php?reason=idle"); die();}
elseif ($user["status"] == 0){ setcookie("pkuser","NODATA"); header("Location: index.php?reason=disabled&user=$user[username]"); die();}

//mysql_query("UPDATE $tab[user] SET online='$time' WHERE id='$id';");

   if($game){ 
     if((!$rid) || (!fetch("SELECT pimp FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"))){ header("Location: play.php"); }
    $pimp = mysql_fetch_array(mysql_query("SELECT status FROM $tab[pimp] WHERE id='$id' AND rid='$rid';")) or die(mysql_error());
     if ($pimp["status"] == 0){ header("Location: play.php?reason=disabled&rid=$rid"); die(); }
     gameheader(); 
     unset($pimp);
     }
else{ siteheader(); }

  unset($user);
}
$bt=mysql_fetch_array(mysql_query("SELECT bonusturntime FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$site2 = mysql_query("SELECT cron24hour,cron10min,cron5min,game,ends FROM $tab[set] WHERE round='$rid';");
     while ($t = mysql_fetch_array($site2))
 {
       if($t["game"]>=1)
   {
     $targetdateends=$t["ends"];
         $targetdatefive=($t["cron5min"]+300);
         $targetdateten=($t["cron10min"]+600);
	 $targetdatebonus=$bt["bonusturntime"];
	}
 }

function siteheader(){
global $id, $tab, $time, $chat,$pkuser, $rid;
$user2 = mysql_fetch_array(mysql_query("SELECT messages,crewmessages,attacks,invites,crew,attacksin,attacksout,status,pimp FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$user = mysql_fetch_array(mysql_query("SELECT id,online,status,username FROM $tab[user] WHERE id='$id';"));

$idle=$time-$user["online"];
if (($user) && ($user["status"] != 0) && ($idle < 3600)) { $logged="yes"; }
   if(!isset($logged)) $logged="no";

$idle = $time-360;
$get = mysql_query("SELECT round FROM $tab[set] WHERE starts<$time and ends>$time ORDER BY starts ASC;");
  while ($game = mysql_fetch_array($get)){

  $getattacking = fetch("SELECT COUNT(id) FROM $tab[pimp] WHERE lastattacked>$idle AND rid='$game[round]';");
  $getonline = fetch("SELECT COUNT(id) FROM $tab[pimp] WHERE online>$idle AND rid='$game[round]';");
  if (!isset($attacking)) $attacking=0;
  $attacking = $attacking+$getattacking;
  if (!isset($online)) $online=0;
  $online = $online+$getonline;

  }

mysql_free_result($get);

$reg = fetch("SELECT COUNT(id) FROM $tab[user];");

$idle2 = $time-604800;
$real = fetch("SELECT COUNT(id) FROM $tab[user] WHERE online>$idle2;");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Thu, 01 Jan 1970 00:00:00 GMT");
?>
<!--<?=$real?>!-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<head>
   <title>Cartelz - Pimp Game. RPG, Gotta Grow the Green To Make The Green Pimp Game</title>
   <meta name="verify-v1" content="iul2WMHR/MNjuPlJW74ACAwpXcM5+JyyLOUaRc6fWl8=" />
  <META NAME="Description" CONTENT="Cartelz is a massive, online, multiplayer text based game. Here you are a Drug Lord on a quest for money, power and respect. This game is simple, highly addictive and very fun!">
  <META NAME='KEYWORDS' CONTENT='Cartelz, pimp games, online games, pimp game, grow, pimp, role play, guns, text based, game, drugs, drug lords, money, hoes, thugs, addictive, fun, ak47s, glocks, shotguns, pimps, ranks'>
<META name="author" content="2 Days Away">
<POLICY-REFERENCES>
    <POLICY-REF about="w3c/privacy.xml">
       <COOKIE-INCLUDE name="*" value="*" domain="*" path="*"/>
    </POLICY-REF>
</POLICY-REFERENCES>
</META>
<link rel="P3Pv1" href="/w3c/p3p.xml">
  <link rel="shortcut icon" href="favicon.ico" >
    <link href="bubble.css?version=1" rel="stylesheet" type="text/css" media="screen" />
    <link rel="stylesheet" type="text/css" href="trupimps.css?version=1" />
    <link rel="alternate stylesheet" type="text/css" media="screen" title="blue-theme" href="trupimps2.css?version=1" />
    <link rel="alternate stylesheet" type="text/css" media="screen" title="brown-theme" href="trupimps3.css?version=1" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="black-theme" href="trupimps4.css?version=1" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="pink-theme" href="trupimps5.css?version=1" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="blood-theme" href="trupimps6.css?version=1" />
<script src="styleswitch.js" type="text/javascript">
/***********************************************
* Style Sheet Switcher v1.1- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
</head>
<div class="container">
  <div class="bgheader"></div>
   <div class="boxdef-hd2">
     <script type="text/javascript">
 <!--
        google_ad_client = "pub-2747086263456341";
        //728x90, created 12/23/07
         google_ad_slot = "7382992630";
         google_ad_width = 728;
         google_ad_height = 90;
      //-->
  </script>
      <script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

  <div class="boxdef">
  	<div class="boxdef-hd">
      <div class="boxdef">
  <? }
          function sitefooter(){
          global $id, $time, $tab;
          $user = mysql_fetch_array(mysql_query("SELECT online,status FROM $tab[user] WHERE id='$id';"));
          $idle=$time-$user["online"];
          if (($user) && ($user["status"] != 0) && ($idle < 3600)) { $logged="yes"; }
         ?>
   <?=copyright();?>	
      </div>
    </div>
  </div>
</div>	
</div>
</html>        
<?php
if (isset($connect)) mysql_close($connect);
unset($user);
}

function gameheader(){
global $id, $tab, $time, $rid;

$site = mysql_fetch_array(mysql_query("SELECT starts,ends FROM $tab[set] WHERE round='$rid';"));

if($time > $site["ends"]){ header("Location: myaccount.php"); }
if($site["starts"] > $time){ header("Location: myaccount.php"); }

$pimp = mysql_fetch_array(mysql_query("SELECT pimp,crew,protection,protectionstart,alert FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$user = mysql_fetch_array(mysql_query("SELECT bgimage FROM $tab[user] WHERE id='$id';"));
$crew = mysql_fetch_array(mysql_query("SELECT name FROM $tab[crew] WHERE id='$pimp[crew]' AND rid='$rid';"));

$protect=$pimp["protection"]+$pimp["protectionstart"]-$time;
if($protect < 0){$protect=0;}

$idle = $time-360;
$online = fetch("SELECT COUNT(id) FROM $tab[pimp] WHERE online>$idle AND rid='$rid';");
   $reg = fetch("SELECT COUNT(id) FROM $tab[user];");
$attacking=fetch("SELECT COUNT(id) FROM $tab[pimp] WHERE lastattacked>$idle AND rid='$rid';");

header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Expires: Thu, 01 Jan 1970 00:00:00 GMT");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
  <title>Cartelz - You Gotta Grow The Green To Make The Green</title>
  <meta http-equiv="pragma" CONTENT="no-cache">
  <meta http-equiv="cache-control" content="no-cache">
  <link rel="stylesheet" type="text/css" href="trupimps.css?version=1" />
   <link rel="alternate stylesheet" type="text/css" media="screen" title="blue-theme" href="trupimps2.css?version=1" />
    <link rel="alternate stylesheet" type="text/css" media="screen" title="brown-theme" href="trupimps3.css?version=1" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="black-theme" href="trupimps4.css?version=1" />
<link rel="alternate stylesheet" type="text/css" media="screen" title="pink-theme" href="trupimps5.css?version=1" />
  <link rel="alternate stylesheet" type="text/css" media="screen" title="blood-theme" href="trupimps6.css?version=1" />
<script src="styleswitch.js" type="text/javascript">
/***********************************************
* Style Sheet Switcher v1.1- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more
***********************************************/
</script>
   <script langauge="JavaScript">
   <!-- Hide
   function MM_jumpMenu(targ,selObj,restore){ //v3.0
    eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
    if (restore) selObj.selectedIndex=0;
   }

   function MM_displayStatusMsg(msgStr) { //v1.0
    status=msgStr;
    document.MM_returnValue = true;
   }

   function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
    }

   <?if($protect>0){?>
   function display(){
    rtime=etime-ctime;
    if (rtime>60)
    m=parseInt(rtime/60);
    else{
    m=0;
    }
    s=parseInt(rtime-m*60);
    if(s<10)
    s=""+s
    window.status="You have "+s+" seconds of protection left!"
    window.setTimeout("checktime()",1000)
   }

   function settimes(){
    var time= new Date();
    secs= time.getSeconds();
    etime=secs;
    etime+=<?=$protect?>;
    checktime();
   }

   function checktime(){
    var time= new Date();
    secs= time.getSeconds();
    ctime=secs
    if(ctime>=etime){
    expired();
   }
   else
   display();
   }

   function expired(){ window.status="You have ran out of protection!!!"; }
   <?}?> 

   <?php
   global $db;
   if (!isset($showbull)) $showbull=0;
   if($pimp["alert"]){?>alert ("<?=str_replace('"', '', $pimp["alert"])?>");<? mysql_db_query($db["name"],"UPDATE $tab[pimp] SET alert='' WHERE id='$id' AND rid='$rid'") or die ("Error : " . mysql_error());}?>
    // Done hiding -->
   </script>
<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">

<!-- PreLoad Wait - Script -->
<!-- This script and more from http://www.rainbow.arch.scriptmania.com 

function waitPreloadPage() { //DOM
if (document.getElementById){
document.getElementById('prepage').style.visibility='hidden';
}else{
if (document.layers){ //NS4
document.prepage.visibility = 'hidden';
}
else { //IE4
document.all.prepage.style.visibility = 'hidden';
}
}
}
// End -->
</SCRIPT>
<script type="text/javascript">

/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

</script>

<script language=javascript>
<!--chat room script
function popUp(N) {
newWindow = window.open(N, 'popD','toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,location=no,width=600,height=500');
}
//-->
</script>
  </head>
   <body <?if($protect>0){?>onLoad="settimes()"<?}?>>
<div class="container">
  <div class="bgheader"> 
    <span style="position:absolute; left:10px; top:10px;text-align:left;">
     <a href="http://myspace.com/growthegreen" title="Cartelz Myspace" target="_blank">
 <font color="#FF9900" size="1"><blink>Join Cartelz at Myspace</blink></font></a></span>
 <span style="position:absolute; right:10px; top:10px;text-align:left;"><font color="#FFFFFF">
     <small><blink>
 <a href="http://www.2daysaway.com/cartelz.swf" onClick="return popitup('http://www.2daysaway.com/cartelz.swf')">Watch The Cartelz Movie!</a>
  </blink></small>
  </font></span>
  </div>
  <div class="rounds">
   <div class="newsheader">
         <?php
    // This reads all available news
    $newsinfo =  mysql_fetch_array(mysql_query("SELECT title,id,time FROM $tab[news] ORDER BY id DESC LIMIT 2;"));
    ?>
     <tr>
  <th align="left">Cartelz Latest News: <B><a href="cartelznews.php?rid=<?=$rid?>" title="cartelznews"><?=$newsinfo["title"]?></a></B></th>     
  <th align='right'><small><?=countdown($newsinfo["time"])?></small></th>
 </tr>
   </div>
   <div class="content1"><?=include("round.php")?></div>
  </div>
<?php include("topnavbar.php");?>
<?php $user = mysql_fetch_array(mysql_query("SELECT lastturn,status,hoehappy,thughappy,messages,crewmessages,boardmessages,attacks,invites,crew FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));?> 
<?php include("shapbar.php");?>			 
<div class="boxdef-hd3">	
  <div class="boxdef">
  	<div class="boxdef-blue-hd">
      <div class="boxdef-blue"> 
    <div class="bd">
	<?php include("invite_crew_popupbar.php");?>
	<div id="contentarea">
               <?php
                 mysql_free_result($get);
			 }

                function gamefooter(){
                global $id, $tab, $rid;
                $pimp = mysql_fetch_array(mysql_query("SELECT crew FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
               ?>
		   </div>
        </div>
      </div>
    </div>
  </div>
</div>			
<? include("bottomnavbar.php");?>       
<div class="bottomdarkbg">
  <div class="content"><script type="text/javascript" src="jst.js"></script>
    <ul><script type="text/javascript">new imageclock.display()</script></ul>
    <ul><?=copyright();?></ul>
  </div>
</div>
</div>
</body>
</html>
<?
unset($pimp);
}

function bar(){
global $id, $tab, $rid;
$user = mysql_fetch_array(mysql_query("SELECT turn,cash,crack,condom,hoes,thugs,weed FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$site = mysql_fetch_array(mysql_query("SELECT cron10min,speed,turnmax FROM $tab[set] WHERE round='$rid';"));
?>
<? include("sitefooter.php");?> 

<?if($site["cron10min"] > 0){?><?}
}

function contacts(){
global $tab, $id, $rid;
$pimp = mysql_fetch_array(mysql_query("SELECT pimp FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
?>
<select class="headertext" name="contact" onChange="MM_jumpMenu('parent',this,0,this.options[this.selectedIndex].value,'_main','toolbar=yes,location=yes,status=yes,resizable=yes,scrollbars=yes')">
<option selected>select one</option>
<option>--bitches--</option>
<?
$bitches = mysql_query("SELECT contact FROM $tab[clist] WHERE pimp='$pimp[pimp]' AND type=2 AND rid='$rid' ORDER BY id ASC;");
  while ($bitch = mysql_fetch_array($bitches)){
        ?><option value="pimp.php?pmp=<?=$bitch["contact"]?>&rid=<?=$rid?>"><?=$bitch["contact"]?></option><?
        }
  mysql_free_result($bitches);
?>
<option>--contacts--</option>
<?
$contacts = mysql_query("SELECT contact FROM $tab[clist] WHERE pimp='$pimp[pimp]' AND type=1 AND rid='$rid' ORDER BY id ASC;");
  while ($contact = mysql_fetch_array($contacts)){
        ?><option value="pimp.php?pmp=<?=$contact["contact"]?>&rid=<?=$rid?>"><?=$contact["contact"]?></option><?
        }
  mysql_free_result($contacts);
?>
</select>
<?}

?>

And here is game_funcs

<?php
include("game_setup.php");

function censor_replace($input){ return $output = str_repeat("*", (strlen($input))); }
function fetch ($query){ $data = mysql_fetch_row(mysql_query($query)); return $data[0]; }
function fixinput ($input){ return number_format(($input),0,",",""); }
function commas ($str){ return number_format(floor($str)); }
function stri_replace($old, $new, $haystack){ return preg_replace('/'.quotemeta($old).'/i', $new, $haystack); }
function getlast($toget){$pos=strrpos($toget,".");$lastext=substr($toget,$pos+1);return $lastext;}
function maxlength($input){
@preg_match_all('/.{1,1}/s', $input, $matches);
if(sizeof($matches[0]) > 40) {
        return bad;
  }
}

function esttime(){
putenv('TZ=America/New_York');
echo date("Y-m-d h:i:sa", time());
}

function preptab($round){
global $tab;
if ($round>0) $pre='r'.$round.'_';
$tab["awards"]=$pre."awards";
$tab["board"]=$pre."board";
$tab["clist"]=$pre."contacts";
$tab["crew"]=$pre."crews";
$tab["find"] =$pre."recentsearches";
$tab["ignore"]=$pre."ignorelist";
$tab["invite"]=$pre."invites";
$tab["mail"]= $pre."messages";
$tab["pimp"]=$pre."pimps";
}

function filter($input){
$input = wordwrap($input, 30, " ", 1);
$input = strip_tags($input, "");
    $input = str_replace("\n","<br>", $input);
return $input;
}

function censor($input,$all=false) {
// The file function loads the file into an array...
// example: echo $words[0]; Outputs: shit
$words = @file('swearwords.txt'); $censors = Array();
// This empty and count makes sure the $words variable is not empty.
// It may be empty if the file doesn't exist or there are no censored words.
if (empty($words)||count($words)<1) return $input;
// This foreach statement loops through the array.
// It makes a list of censors for the words based on $all.
// If $all is true, it censors the complete word, otherwise, only partially.
foreach ($words as $word) {
if (!$all) $censors[] = substr($word,0,1).str_repeat('*',strlen($word)-2).substr($word,-1);
else $censors[] = str_repeat('*', strlen($word));
}
// This replaces all the censored words.
// It will even replace partial words.
// Example: googlearkinex -> googlea*****x
$input = str_replace($words, $censors, $input);
return $input;
}

function ordinal($number) {
$number = number_format($number);
     if ((ereg("(1)+$",$number)) && (!ereg("(11)+$",$number))) { $suffix = "st"; }
elseif ((ereg("(2)+$",$number)) && (!ereg("(12)+$",$number))) { $suffix = "nd"; }
elseif ((ereg("(3)+$",$number)) && (!ereg("(13)+$",$number))) { $suffix = "rd"; }
   else { $suffix = "th"; }
return "$number<small>$suffix</small>";
}

function createPass(){    
$chars = "abcdefghijkmnopqrstuvwxyz023456789";
srand((double)microtime()*1000000);
$i=0;$pass='';    
while ($i <= 7){        
       $num=rand()%33;        
       $tmp=substr($chars,$num,1);        
       $pass=$pass.$tmp;$i++;    
}    
return $pass;
}

function logip($id,$ip){
global $time, $tab;

   if(fetch("SELECT COUNT(uid) FROM $tab[ips] WHERE uid='$id';") > 4){
      $getlog = mysql_query("SELECT time FROM $tab[ips] WHERE uid='$id' ORDER BY time ASC limit 1;");  
      while ($log = mysql_fetch_array($getlog)){
            mysql_query("DELETE FROM $tab[ips] WHERE time='$log[time]'"); 
            }
   }
   mysql_query("INSERT INTO $tab[ips] (uid,ip,time) VALUES ('$id','$ip','$time');");
}

function mail_1 ($subject, $message, $email){
mail("$email", "$subject", $message,
     "From: CARTELZ.COM <jfunk1@cinci.rr.com>\n"
    ."Reply-To: jfunk1@cinci.rr.com\r\n"
    ."X-Mailer: PHP/" . phpversion());
}

function mail_2 ($subject, $message, $email){
$fd = popen("/usr/sbin/sendmail -t", 'w');
fputs($fd, "To: $email\n");
fputs($fd, "Subject: $subject\n");
fputs($fd, "X-Mailer: PHP4\n");
if ($headers)
  fputs($fd, "$headers\n");
fputs($fd, "\n");
fputs($fd, $message);
pclose($fd);
} 

function copyright(){
echo "<TABLE border=0 align='center' cellPadding=0 cellSpacing=0><tbody><TR>";
echo "<TD rowspan='2' align=center><a href='http://2daysaway.com' target='_blank'><b>2 Days Away</b></a> 
                  Productions 2005 ©</TD>";
echo "</tr></table>";
}

function losecash($id){
global $tab, $rid;
$user = mysql_fetch_array(mysql_query("SELECT cash FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$formula=round($user["cash"]*.15);
$formula = fixinput($formula);
unset($user);
return $formula;
}

function useresources($turns){
global $id, $tab, $rid;
$user = mysql_fetch_array(mysql_query("SELECT condom,crack,weed,hoes,thugs FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));

$usecondom=round(($user["condom"]-($user["hoes"]*0.08)*$turns));
if($usecondom <= 0) $usecondom=0;
$usecondom = fixinput($usecondom);

$usecrack=round(($user["crack"]-($user["hoes"]*0.08)*$turns));
if($usecrack <= 0) $usecrack=0;
$usecrack = fixinput($usecrack);

$useweed=round(($user["weed"]-($user["thugs"]*0.08)*$turns));
if($useweed <= 0) $useweed=0;
$useweed = fixinput($useweed);

unset($user);
mysql_query("UPDATE $tab[pimp] SET weed='$useweed', condom='$usecondom', crack='$usecrack' WHERE id='$id' AND rid='$rid'");
}

//labels helper status to pimp name
function helper(){
global $id, $tab, $rid;
$hlp = mysql_fetch_array(mysql_query("SELECT helper FROM $tab[user] WHERE id='$id';"));	
if ($hlp["helper"] == 1){
mysql_query("UPDATE $tab[pimp] SET helperstatus = '1'
WHERE id='$id' AND rid='$rid'");
}
}
			   
 // This function displays the admin bar on the main page 
function adminbar(){
global $id, $tab, $rid;
$adminview = mysql_fetch_array(mysql_query("SELECT * FROM $tab[user] WHERE id='$id';"));
if ($adminview["adminlevel"] == 10){
echo "<table border='1' align='center'><tr background='images/1x60.gif'><td background='images/1x60.gif'>";
echo "<a href='giveturns.php'>giveturns</a></td>";
echo "<td background='images/1x60.gif'><a href='iplog.php'>iplog</a></td>";
echo "<td background='images/1x60.gif'><a href='cartelznews.php?rid=$rid'>news</a></td>";
echo "<td background='images/1x60.gif'><a href='admin/adm-poller.php'>poll</a></td>";
echo "</tr></table>";
}
}

function medicine ($turns){
global $tab, $id, $rid, $infected;
$user = mysql_fetch_array(mysql_query("SELECT condom,medicine,hoes FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
if($user["condom"] <= 0){
    $figrand=round(($user["hoes"]*0.0005)*$turns);
    $infected=rand(0, $figrand);
    if($infected > $user["medicine"]){ $infected=$user["medicine"]; }
    $medsused=$user["medicine"]-$infected;
$medsused = fixinput($medsused);
    if($medsused <= 0){$medsused=0;}
    mysql_query("UPDATE $tab[pimp] SET medicine='$medsused' WHERE id='$id' AND rid='$rid'");
   }
unset($user);
return "$infected";
}

function nomedicine ($turns){
global $tab, $id, $rid, $killhoe;
$user = mysql_fetch_array(mysql_query("SELECT condom,medicine,hoes FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));

if($user["condom"] <= 0){
  if($user["medicine"] <= 0){
    $killrand=round(($user["hoes"]*0.0005)*$turns);
    $killhoe=rand(0, $killrand);
    $killhoe=round($killhoe);
    if($killhoe >= $user["hoes"]){$killhoe=$user["hoes"];}
    }
  }
unset($user);
return "$killhoe";
}

function cash($turns){
global $id, $tab, $rid;
$user = mysql_fetch_array(mysql_query("SELECT hoes,payout FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$rand1=(rand(6, );$rand2=(rand(8, 10));
$money=$turns*(rand($rand1, $rand2));
$money=($money*$user["hoes"]);
$tax=round($money*($user["payout"]/100));
$money=fixinput($money-$tax);
unset($user);
return "$money";
}
function unhappy($hoethug,$turns,$bonus){
global $id, $tab, $rid;
if($hoethug=="thugs"){$happy="thughappy"; $num=20;}
if($hoethug=="hoes"){$happy="hoehappy"; $num=15;}
$user = mysql_fetch_array(mysql_query("SELECT $happy,$hoethug FROM
$tab[pimp] WHERE id='$id' AND rid='$rid';"));

if($user[$happy] < 80){
  $maxleave=round($turns*.25); $leaverand=rand(0, $maxleave);
  $leave=round($leaverand*(($bonus/$num)+5));
  if($leave >= $user[$hoethug]){$leave=$user[$hoethug];}
  }
unset($user);
return "$leave";
}

function hoehappy($id){
global $tab, $rid;
$hap = mysql_fetch_array(mysql_query("SELECT thugs,condom,crack,medicine,payout,hoes,attacksout FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$thu=$hap["thugs"];$con=$hap["condom"];$cra=$hap["crack"];$med=$hap["medicine"];$pay=$hap["payout"];$hoe=$hap["hoes"];

  if($hoe == 0){ $hoe=1; }
  $tak1=(($hoe/15)+2);
  if($tak1 > 50){
     $cond=round((($con*0.75)/$hoe)*50);
     if($cond >= 51){ $cond=50; }
    }
else{
     $cond=round(((($con*0.99)/$hoe)*100)-$tak1);
     if($cond >= 80){$cond=100-$tak1;}
    }

$thug=round((($thu*0.50)/$hoe)*50); if($thug >=5){$thug=5;}
$crac=round((($cra*0.75)/$hoe)*25); if($crac >=22){$crac=22;}
$medi=round((($med*0.99)/$hoe)*25); if($medi >=20){$medi=21;}
$payo=round(($pay*0.01)*10); if($payo >=10){$payo=10;}
$whap=round($payo+$cond+$crac+$medi+$thug);

if($whap>100){$whap=100;}
$attackout=$hap["attacksout"]/4;
$whap=$whap-$attackout;
if(0 > $whap){ $whap=0; }
unset($hap);
return "$whap";
}

function thughappy ($id){
global $tab, $rid;
$hap = mysql_fetch_array(mysql_query("SELECT glock,shotgun,uzi,ak47,weed,thugs FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));

$thu=$hap["thugs"];if($thu == 0){$thu=1;}$wmax=($thu+($thu*0.25));
$glo=$hap["glock"];if($glo > $wmax){$glo=$wmax;}
$sho=$hap["shotgun"];if($sho > $wmax){$sho=$wmax;}
$uzi=$hap["uzi"];if($uzi > $wmax){$uzi=$wmax;}
$ak4=$hap["ak47"];if($ak4 > $wmax){$ak4=$wmax;}
$wee=$hap["weed"];

$weed=round((($wee*0.75)/$thu)*50); if($weed >=25){$weed=25;}

$gloc=round((($glo*0.86)/$thu)*80); if($gloc >=100){$gloc=100;}
$shot=round((($sho*0.88)/$thu)*80); if($shot >=100){$shot=100;}
$uzi=round((($uzi*0.90)/$thu)*80);  if($uzi >=100) {$uzi=100;}
$ak47=round((($ak4*0.92)/$thu)*80); if($ak47 >=100){$ak47=100;}
$guns=round($gloc+$shot+$uzi+$ak47);

if($weed > $guns){$weed=$guns;}
$thughappy=round($weed+$guns);
if($thughappy>100){$thughappy=100;}
if(0 > $thughappy){ $thughappy=0; }
return "$thughappy";
}
//define("BIGINT_DIVIDER", 9223372036854776000 + 1);
function worth($id){
global $tab, $rid;
$user = mysql_fetch_array(mysql_query("SELECT hoes,thugs,hoeskilled,thugskilled,hoesteals,thugsteals,glock,shotgun,uzi,ak47,cash, condom,medicine,bank,crack,weed,bank,bank1,streetbike,lowrider,hummer,informant FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$worth=($user["hoes"]*4+$user["thugs"]*1+$user["hoeskilled"]*4+$user["thugskilled"]*1+$user["hoesteals"]*4+$user["thugsteals"]*1+$user["glock"]*1+$user["shotgun"]*2+$user["uzi"]*3+$user["ak47"]*4); 

//mysql_query("INSERT INTO $tab[pimp] (lower,upper) VALUES ('$lower','$upper') WHERE id='$id' AND rid='$rid'");
$worth=number_format(($worth),0,",","");
return "$worth";
}



//function split2Int(&$upper, &$lower, $worth) {
  //$lower = intval($worth % BIGINT_DIVIDER);
  //$upper = intval(($worth - $lower) / BIGINT_DIVIDER);
//}

function bigInt2float($upper, $lower) {
  global $tab, $rid, $id;
  return $upper * BIGINT_DIVIDER + $lower;
} 

function supporter(){
global $id, $tab;
$user = mysql_fetch_array(mysql_query("SELECT status FROM $tab[user] WHERE id='$id';"));
if($user[0] == 3){ header("Location: play.php"); }
}

function dayhour ($online){
global $time;
$difference=$online-$time;
$num = $difference/86400;
$days = intval($num);
$num2 = ($num - $days)*24;
$hours = intval($num2);
if($days != 0){echo"$days days, ";}if($hours != 0){echo"$hours hours. ";}
}


$rvng=array();
$rvng[sts]=0;
$rvng[bck]=time()-(24*3600);

function revenge($eid){
global $tab, $rid, $rvng, $id;
if ($row=mysql_fetch_array(mysql_query("SELECT * FROM $tab[mail] WHERE id='$id' AND rid='$rid AND rvng=0 AND inbox=1 AND time>$rvng[bck] ORDER BY time ASC LIMIT 1"))){
	$rvng[sts]=1;
	$rvng[tm]=$row[time];
	return true;
	exit;
	}
return false;
}
function countdown ($online){
global $time;
$difference=$time-$online;$num = $difference/86400;$days = intval($num);$num2 = ($num - $days)*24;$hours = intval($num2);$num3 = ($num2 - $hours)*60;$mins = intval($num3);$num4 = ($num3 - $mins)*60;$secs = intval($num4);
if($days != 0){?><font color="#FFFFFF"><?=$days?></font> day<?if($days > 1){?>s<?} if($hours){?>, <?}}
if($hours != 0){?><font color="#FFFFFF"><?=$hours?></font> hour<?if($hours > 1){?>s<?} if($days==0){?>, <?}}
if($days == 0){ if($mins != 0){?><font color="#FFFFFF"><?=$mins?></font> min<?if($mins > 1){?>s<?} if(($hours == 0) && ($days == 0)){?>, <?} } }
if(($hours == 0) && ($days == 0)){?><font color="#FFFFFF"><?=$secs?></font> sec<?if($secs > 1){?>s<?} }
}

function countup ($online){
global $time;
$difference=$online-$time;$num = $difference/86400;$days = intval($num);$num2 = ($num - $days)*24;$hours = intval($num2);$num3 = ($num2 - $hours)*60;$mins = intval($num3);$num4 = ($num3 - $mins)*60;$secs = intval($num4);
if($days != 0){?><font color="#ffffff"><?=$days?></font> day<?if($days > 1){?>s<?} if($hours){?>, <?}}
if($hours != 0){?><font color="#ffffff"><?=$hours?></font> hour<?if($hours > 1){?>s<?} if($days==0){?>, <?}}
if($days == 0){ if($mins != 0){?><font color="#ffffff"><?=$mins?></font> min<?if($mins > 1){?>s<?} if(($hours == 0) && ($days == 0)){?>, <?} } }
if(($hours == 0) && ($days == 0)){?><font color="#ffffff"><?=$secs?> </font>sec<?if($secs > 1){?>s<?} }
}
function sounds(){
global $id, $tab, $site, $rid;
$pimp = mysql_fetch_array(mysql_query("SELECT messages,attacks FROM $tab[pimp] WHERE id='$id' AND rid='$rid';"));
$user = mysql_fetch_array(mysql_query("SELECT sounds FROM $tab[user] WHERE id='$id';"));
if($user["sounds"]  == 0){
       if($pimp["attacks"] >= 1){?><embed src="Img/attack.swf" loop="false" quality="high" width="1" height="1" menu="false" type="application/x-shockwave-flash" pluginpage="http://www.macromedia.com/go/getflashplayer"></embed><?}
   elseif($pimp["messages"] >= 1){?><embed src="Img/message.swf" loop="false" quality="high" width="1" height="1" menu="false" type="application/x-shockwave-flash" pluginpage="http://www.macromedia.com/go/getflashplayer"></embed><?}
   }
}

?>

deafolt precision in php is 14 digits

in your calculation you use number biger then maximal integer can be

your number is convert to float

number 278430613974337550 is converted to 2.78430613974337550E17 but in 14 digit precision is 2.7843061397433E17 (it is integer 278430613974330000) after / 20 and convert to integer resul is 13921530698717000

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.