Beispiel #1
0
     }
     $record_count = $rs_clear->RecordCount();
     if ($record_count == 0) {
         auth_fail("No users needed cleaning.");
     }
     echo "USERS CHANGED ({$record_count}):\n\n";
     while (!$rs_clear->EOF) {
         $o = $rs_clear->FetchNextObj();
         $id = $o->id;
         echo $o->username . "\n\n";
         $gamedata_in = $o->gamedata;
         $txt_in = gdDecode($gamedata_in);
         $data = gdLineByLineToAssoc($txt_in);
         $data["week_changed"] = false;
         $txt_out = gdAssocToLineByLine($data);
         $gamedata_out = gdEncode($txt_out);
         $sql = "update users set gamedata='{$gamedata_out}' where id={$id}";
         $rs = $db->Execute($sql);
         if (!$rs) {
             auth_sqlfail($db, $sql);
         }
         echo json_encode($data) . "\n\n";
         //echo $txt."\n\n";
     }
 } else {
     if ($action == "show_gamedata") {
         // NOTE: hex: '7765656b5f6368616e676564203d2031' == string: 'week_changed = 1'
         $sql = "select id,username,gamedata from users";
         $rs_clear = $db->Execute($sql);
         if (!$rs_clear) {
             auth_sqlfail($db, $sql);
Beispiel #2
0
                            $vn = 0;
                            $mstr = "|w" . (int) $i . "vendor = ([0-9]+)|";
                            //echo "mstr=$mstr\n";
                            if (preg_match($mstr, $txt2, $m)) {
                                $vn = (int) $m[1];
                            }
                            $add .= "tm_" . $o->class . "_w" . $i . "vendor = " . $vn . "\r\n";
                        }
                        $trk = tracking_rec($o->id);
                        for ($i = 1; $i <= 3; $i++) {
                            $vn = $trk["w" . $i . "cost"];
                            $add .= "tm_" . $o->class . "_w" . $i . "cost = " . $vn . "\r\n";
                        }
                    }
                }
                //$add .= "tm_added = 1\r\n";
                $txt .= $add;
                //print($txt); exit;
                //}
                $gd = gdEncode($txt);
                //print($ogd."\n");
                //print($gd."\n"); exit;
                echo "result ok\n";
                echo "gamedata {$gd}\n";
                //echo "txt ".gdDecode($gd)."\n";
            } else {
                auth_fail("Unrecognized action");
            }
        }
    }
}
Beispiel #3
0
         // get the date from the config field
         // old if( getField("users", "count(id)", "where active=1 and user_type='t' and teacher_code=$tc and created < '2013-02-13 0:0:0' limit 1") > 0 ) {
         if (getField("users", "count(id)", "where active=1 and user_type='t' and teacher_code={$tc} and created < '{$bonus_date}' limit 1") > 0) {
             // The teacher for this user registered on or before 3 Oct 2012
             // Thus, they are eligible for the bonus cash
             // add bonus cash to playercash value
             $playercash = 0;
             if (preg_match("/playercash = (\\d+)/", $txt, $m)) {
                 $playercash = (int) $m[1];
             }
             $playercash += 500;
             // replace value in decode game data string with new value
             $txt = preg_replace("/playercash = \\d+/", "playercash = {$playercash}", $txt);
         }
         // resave the game data
         $gdresave = gdEncode($txt);
         $sql = "update users set bonus_check=1, gamedata='{$gdresave}' where id={$id}";
         $rs = $db->Execute($sql);
         if (!$rs) {
             auth_sqlfail($db, $sql);
         }
     }
 }
 //{
 $add = "";
 if ($gid != 0) {
     $sql = "select id,class from users where active=1 and user_type='s' and group_id={$gid} order by class";
     $rs = $db->Execute($sql);
     $c = $rs->RecordCount();
     if ($c < 1 || $c > 4) {
         auth_fail("Error 49581: {$gid}, {$c}");