Jump to content

Recommended Posts

This is my current script

<?php
$iFile = "accounts.txt"; //Put your list lagger's info in this txt file in the same directory as this script. Format is UserID(space)AuthKey

$login = file($iFile, FILE_SKIP_EMPTY_LINES);

if(!is_file($iFile)) echo "The logins file couldn't be found...".sleep(999999);

foreach($login as $line_num => $line)
{
$login = explode(" ", htmlspecialchars(str_replace("    "," ",$line)));
////////////////
//////////////
///////////
/////////
if(stristr($login[1], "\n")) $login[1] = substr($login[1], 0, strlen($login[1])-2);

$MobLink = "http://mobsters-fb-apache-dynamic-lb.playdom.com/mob_fb/";
$RefreshStat = file_get_contents($MobLink."refresh_stat?user_id=".$login[1]."&auth_key=".$login[0]);


$Mob_Name = explode("<mob_name>", $RefreshStat);
$Mob_Name = explode("<", $Mob_Name[1]);
$Name = $Mob_Name[0];
$Cash = explode("<cash>", $RefreshStat);
$Cash = explode("<", $Cash[1]);
$CurrentCash = $Cash[0];
echo $Name."-$".number_format($CurrentCash)." - ".$login[1]."\n";
}







sleep(99999);






?>


The Script runs through for 100 different accounts, is it possible to add all the Cash values that get echo'd?

 

Link to comment
https://forums.phpfreaks.com/topic/222264-adding-numbers/
Share on other sites

For something simple as adding all the values of an array.

 

<?php
$cash_array = array(234,34,876,21,21,324);
foreach ($cash_array as $cash) {
$total_cash = array_sum($cash_array);
}
echo "Total cash = ".$total_cash."<br>"; 
?>

 

I suppose if need to show the process can make $cash into a new array as  $cash[] and in a loop do a $cash + $cash, is just like doing regular math.

 

I believe $CurrentCash is already the array.

 

$cash[]

Link to comment
https://forums.phpfreaks.com/topic/222264-adding-numbers/#findComment-1149741
Share on other sites

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.