Пример #1
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");
                            }
                        }
                    }
                }
            }
        }
    }
}
Пример #2
0
                                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++) {
                                    $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;
                        //}
                        $result = gdLineByLineToAssoc($txt);
                        echo json_encode($result);
                    } else {
                        auth_fail("Unrecognized action");
                    }
                }
            }
        }
    }
}