iMacros: Pauze after x amount of loops (Javascript)

What I’ve read so far is that pausing in between loops is only
possible in javascript. I have a hard time getting my code to work in

What i want my code to execute:
Go to a website and click a button.
Loop trough the sites different sub domains via my datasource text file.
I want to run 90 loops (going trough 90 sub domains) pause for 1 hour, continue the loop for another 90 and pause again for 1 hour etc etc.. (my datasource text file consists of 1000+ sub domains).

This i my code:

SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*10 + 2); randomNumber;") /*after a button is pushed wait for a random number of seconds*/ 
SET !DATASOURCE data_list.txt
WAIT SECONDS={{!var1}}

This works fine i can put an x amount of loops and the code Will run just fine. But i can’t / don’t know how to pause after 90 loops in javascript.

This is how far i got in converting my code to javascript:

var macro;
var rand = "Math.floor(Math.random()*10 + 2)"; /*after a button is pushed wait for a random number of seconds*/ 
macro =  "CODE:";
macro +=  "SET !TIMEOUT_PAGE 120" + "n"; 
macro +=  "SET !TIMEOUT_TAG 0" + "n"; 
macro +=  "SET !ERRORIGNORE YES" + "n"; 
macro +=  "SET !DATASOURCE ACCOUNTS_NO.txt" + "n"; 
macro +=  "SET !DATASOURCE_COLUMNS 1" + "n"; 
macro +=  "SET !DATASOURCE_LINE {{!LOOP}}" + "n"; 
macro +=  "URL GOTO={{!COL1}}" + "n"; 
macro +=  "TAG POS=1 TYPE=BUTTON ATTR=TXT:Button" + "n"; 
macro +=  "WAIT SECONDS = {{rand}}" + "n"; /***this does not seem to work in javascript*/**

The random number in javascript does not work. Also the code to loop for 90 times, pause for 1 hour and continue still needs to be added.

Can anybody please help out?

Source: stackoverflow-javascript

Iterating through a javascript object to get key-value pairs

Here’s my code:

obj = {"TIME":123,"DATE":456}


for (var key in obj) {

It prints as the following:


Why does console.log(obj.key) print as undefined?

I want my code to print out the following, using obj.key to print out the value for each key:


How do I do so?

Source: stackoverflow-javascript

Looping queries to an API is really slow

I’ve heard that it is possible to loop JSON datas by using only one query and not doing querries for every loop. Any ideas how to make this from this code?
I really need to do it because it takes up to 3 minutes to successfully load the page..

* PHP *

<?php foreach ($return as $user) {

                        $link = "$devkey&steamids=$user->SteamID";
                        $json = file_get_contents($link);
                        $decoding = json_decode($json);
                        $avatar = $decoding->response->players[0]->avatar;
                        <td id="addme"><img src="<?php echo $avatar; ?>" width="32" height="32"></td>
                        <td><?php echo $user->DisplayName; ?></td>
                        <td><?php echo $user->SteamID; ?>  <a href="<?php echo $user->SteamID; ?>/" target="_blank"><span class="glyphicon glyphicon-new-window" id="gotosteamprofile"></span></a></td>
                        $ipredc = substr($user->Address, 0, -6);
                        echo $ipredc; ?></td>
                        $toconver = $user->ConnectedSeconds;
                        $hours = floor($toconver / 3600);
                        $mins = floor($toconver / 60 % 60);
                        $secs = floor($toconver % 60);
                        $timeFormat = sprintf('%02d:%02d:%02d', $hours, $mins, $secs);
                        echo $timeFormat;


Source: stackoverflow-php

How can I order a table in a loop depending on the highest number in a specific <td>

How can I order lines of a table depending on the highest number in a loop like this :

while ($d = $data->fetch()) {
$champs_files = fopen("champions/".$champion."_".$d['user_id'].".txt", "r");
$mastery_points = fread($champs_files,filesize("champions/".$champion."_".$d['user_id'].".txt"));
    <td><?= $rank += 1 ?></td>

        <td><?= $d['user_name'] ?></td>

        <td><?= $mastery_points ?></td>

        <td><?= $d['user_region'] ?></td>


I want to put at the top the line who has the biggest $mastery_points .

I can’t use MySql cause I have limited number of tables thats why I use files .

Source: stackoverflow-php

PHP, for <= not expected results with decimals

When I run this PHP (5.4.31, running on 32-bit windows xp) code I get the result I’d expect:

for($i = 0; $i <= 10; $i = $i + 0.5)
    echo $i .' ';

But if I move the decimal point over as so:

for($i = 0; $i <= 1; $i = $i + 0.05)
    echo $i .' ';

despite the <= clause, the loop quits at 0.95 instead of at 1.

I’m aware that there is an imprecise nature to floating point numbers, but this seems kind of extreme.

Source: stackoverflow-php

How can I submit form data from a foreach loop?

This is my form:

<form action="update.php" method="post">
<button type="submit"> Submit</button> </form>

I insert data via Ajax:

     url: "data.php",
     data: {
         id: id,
     type: "POST",
     success: function(data) {


$pdo = $db->prepare("SELECT * FROM data WHERE id = ?");
while ($row = $pdo->fetch(PDO::FETCH_ASSOC))
   <input name="id[]" type="text" value="<?php echo $row['id'];?>">
   <input name="name[]" type="text" value="<?php echo $row['name'];?>">

As an Output I have for example:

2  Jim
3  Alan
5  Bob

Now in my update.php I want to update my data in the mySQL database:

foreach($_POST['id'] as $key => $value) {
    $id = $_POST['id'][$key];
    $name = $_POST['name'][$key];
    $pdo = $db->prepare("UPDATE data SET name=?, WHERE id=?;");
        echo $id." ".$name;

As a result I expect to get again:

2  Jim
3  Alan
5  Bob

But what happens, I get only:

2  Jim

Source: stackoverflow-php

How to dynamically loop through different arrays in PHP?

If I want to loop through both of these arrays:

array (size=3)
  0 => 
    array (size=1)
      'email' => string '' (length=17)
  1 => 
    array (size=1)
      'name' => string 'Joe' (length=3)
  2 => 
    array (size=1)
      'lastName' => string 'Doe' (length=3)


array (size=2)
  'email' => string '' (length=18)
  'name' => string 'Jay' (length=3)

The reason I am showing both arrays is I am trying to write a function to handle both arrays. I understand how to loop through the second array as I have been using in my function:

foreach($inserts as $colName => $colValue)

However, its the first array that I am struggling with, how can I handle looping through the first array while still supporting looping through the second array as my function could be passed both types of arrays that I showed above?

I did try and have a go with two foreach loops for the first array but I am wondering if there is a way where I can just have one loop to handle both types of arrays and if there is a way to detect the first type of array as I need to do something if the first type of array is passed in?

Source: stackoverflow-php