Example #1
0
 $gd = getField("users", "gamedata", "where id={$id}");
 $ogd = $gd;
 $txt = gdDecode($gd);
 $txt = preg_replace("/tm_\\d_w\\d(vndr|vendor|cost) = \\d+\r\n/", "", $txt);
 //{
 $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}");
     }
     while (!$rs->EOF) {
         $o = $rs->FetchNextObj();
         $txt2 = gdDecode(getField("users", "gamedata", "where id=" . $o->id));
         $txt2 = preg_replace("/tm_\\d_w\\d(vndr|vendor|cost) = \\d+\r\n/", "", $txt2);
         //$txt2 = preg_replace("/\n/", "\n        ", $txt2);
         //echo "## class=".$o->class." id=".$o->id." ".$txt2;
         for ($i = 1; $i <= 4; $i++) {
             $m = array();
             $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++) {
Example #2
0
    ?>
		<br>
		<?php 
    if ($u->user_type == 's') {
        $t = new Table("s");
        $t->set("Game Data");
        $t->set("Tracking");
        $t->set("Progress");
        $t->nextrow();
        $gd = $u->gamedata;
        /*
        $l = strlen($gd) / 2;
        for($i = 0; $i < $l; $i++)
        	$txt .= chr(hexdec(substr($gd,$i*2, 2)));
        */
        $txt = gdDecode($gd);
        if ($txt == "") {
            //$txt = "[empty]";
        }
        //$txt = preg_replace("/\n/", "<font color=blue>&reg;</font>\n", $txt);
        $t->set("<pre>{$txt}</pre>", "left");
        $txt = "";
        foreach ($u->tracking as $k => $v) {
            $txt .= "{$k} = {$v}\n";
        }
        $t->set("<pre>{$txt}</pre>", "left");
        $txt = "";
        foreach ($u->progress as $k => $v) {
            $txt .= "{$k} = {$v}\n";
        }
        $t->set("<pre>{$txt}</pre>", "left");
Example #3
0
                                //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);
                                }
                                $record_count = $rs_clear->RecordCount();
                                echo "USER GAMEDATA ({$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);
                                    echo json_encode($data) . "\n\n";
                                }
                            } else {
                                auth_fail("Unrecognized action");
                            }
                        }
                    }
                }
            }
        }
    }
}
Example #4
0
function gdDecodeAssoc($gd)
{
    $gd = gdDecode($gd);
    $e = explode("\n", $gd);
    $a = array();
    foreach ($e as $l) {
        $ee = explode(" = ", $l);
        if (count($ee) == 2) {
            $a[trim($ee[0])] = trim($ee[1]);
        }
    }
    return $a;
}