Temos pavadinimas: WordPress, Shopify ir PHPFusion programuotojų bendruomenė :: Paramos printinimas (biški sugedes)

Parašė Reamis· 2008 Gru. 5 21:12:11
#1

Sveiki,

taigi darau tokį skriptą (tiksliau dedu iš dviejų vieną)
ir 74 eilutėi biški pasimečiau..
kaip man iš sumos "all_of_money" atimti tarkim 15lt?
meginau -1, bet jis padalina sumą per pus...
hėm, padėsit?

<meta http-equiv="content-type" content="text/html; charset=windows-1257">
<?php
function decode_user($tmp)
{
   $tmp = str_replace ("HOST 1 useris ", "", $tmp);
   $tmp = str_replace ("HOST 2 useris ", "", $tmp);
   $tmp = str_replace ("HOST 3 useris ", "", $tmp);
   $tmp = str_replace ("HOST 4 useris ", "", $tmp);
   $tmp = str_replace ("HOST 5 useris ", "", $tmp);
   $tmp = str_replace ("HOST 6 useris ", "", $tmp);
   $tmp = str_replace ("HOST 7 useris ", "", $tmp);
   $tmp = str_replace ("HOST 8 useris ", "", $tmp);
   $tmp = str_replace ("HOST 9 useris ", "", $tmp);
   $tmp = str_replace ("HOST 10 useris ", "", $tmp);

   $tmp = str_replace ("Host 1 useris ", "", $tmp);
   $tmp = str_replace ("Host 2 useris ", "", $tmp);
   $tmp = str_replace ("Host 3 useris ", "", $tmp);
   $tmp = str_replace ("Host 4 useris ", "", $tmp);
   $tmp = str_replace ("Host 5 useris ", "", $tmp);
   $tmp = str_replace ("Host 6 useris ", "", $tmp);
   $tmp = str_replace ("Host 7 useris ", "", $tmp);
   $tmp = str_replace ("Host 8 useris ", "", $tmp);
   $tmp = str_replace ("Host 9 useris ", "", $tmp);
   $tmp = str_replace ("Host 10 useris ", "", $tmp);
   return $tmp;
}

class getsms {
    var $user;
    var $pass;
    var $what = 'all';
    function getsms () {}
    function get () {
        $url = 'http://www.hostingas.in/usersms.php?user=' .
            urlencode($this->user) .
            '&pwd=' . urlencode(sha1($this->pass)) .
            '&what=' . urlencode($this->what);
        $link = fopen($url, "rb");
        $data = stream_get_contents($link);
        fclose($link);
        return unserialize($data);
        }
    }
?>
<?php
$obj=new getsms();
$obj->user="useris";//Jusu unikalus vartotojas
$obj->pass="passwordas";//Jusu unikalus slaptazodis
$obj->act="all";
$array = $obj->get();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Refresh" content="10" />
</head>
<center>
<table width="700" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center"><b>Data/Laikas</b></td>
<td width="100" align="center"><b>Suma</b></td>
<td width="300" align="center"><b>Pranešimas</b></td>
</tr>
<?php

$all_of_money = 0;
foreach( $array as $a)
{

$money = $a["suma"]/2;
$all_of_money = $all_of_money + $money;
$all_of_money = $all_of_money - 1;

?>
<tr>
<td align="center"><?php print $a["data"];?></td>
<td align="center"><?php print $money ?>Lt</td>
<td align="left"><?php print decode_user($a["txt"]); ?></td>
</tr>
<?
}
?>
</table>
</center>
</body>
</html>
<?
//@iSlams

$pavadinimas = "Iš viso paremta:"; //pavadinimas</span>
$max = 150;


//paveiksleliu nustatymai
$bg_pic = "http://img340.imageshack.us/img340/2239/loadbarbgnc2.gif"; //fono paveiksliukas (neaktyvi zona)
$nulis_pic = "http://img231.imageshack.us/img231/8220/nosounddh2.gif"; //rodomoas paveiksliukas jei rezultatas lygus 0% (pvz jei nera klausytoju)
$mazas_pic = "http://img340.imageshack.us/img340/456/loadbargreenyk1.gif"; //uzsidengiantis paveiksliukas (zalia)
$vidutinis_pic = "http://img230.imageshack.us/img230/3815/loadbaryellowue2.gif"; //Kai vidutine procentu israiska (geltona)
$didelis_pic = "http://img403.imageshack.us/img403/8008/loadbarreduh0.gif"; //Kai arti arba lygu 100 procentu (raudona)


//pagrindiniai veiksmai
$procentai = (int)round((100 * $all_of_money) / $max);
$width = $procentai; //paveiksliuko plotis procentaliai
if ($procentai <= 1) {$pic = $nulis_pic; $width = "100";}
elseif ($procentai <= 40) { $pic = $mazas_pic; }
elseif ($procentai <= 80) { $pic = $vidutinis_pic; }
elseif ($procentai <= 100) { $pic = $didelis_pic; }
else { $pic = $didelis_pic; $width = "100"; } //jei daugiau nei 100%

//atvaziduojam lentele su rezultatais
echo "<center><b>".$pavadinimas." ".$all_of_money." LT. </b><br><br><b>".$all_of_money." Lt iš <font color=\"red\">".$max." Lt.</b></font><br><table class=main border=0 width=100><tr><td style='padding: 0px; background-image: url(".$bg_pic."); background-repeat: repeat-x'>";
echo "<img height=15 width=\"".$width."%\" src=\"$pic\" alt='$all_of_money'><br><font size='1'><center>".$procentai."%</center></font></td></tr></table>";
?>