#!/usr/bin/php id); define("INTERNAL_USER_USERNAME", $me->username); $chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ'; $charsLength = strlen($chars); $c = 0; $db = FronkDB::singleton(); $res = $db->query("SELECT id FROM Preorder WHERE oaid IS NOT NULL ORDER BY RAND()"); /*while($data = $db->fetch_object($res)) { if($c > 1000) break; $preorder = new Preorder($data->id); if(!$preorder->oaid) { echo "no oaid ".$preorder->id."\n"; } $oaid = $preorder->oaid; $ucode = ''; for($i = 0; $i < 20; $i++) { $ucode .= $chars[rand(0, $charsLength - 1)]; } echo "$oaid;$ucode\n"; $c++; }*/ $stati = PreorderstatusModel::getAll(); while($data = $db->fetch_object($res)) { if($c > 1000) break; $preorder = new Preorder($data->id); if(!$preorder->oaid) { echo "no oaid ".$preorder->id."\n"; } $oaid = $preorder->oaid; $r = rand(0, count($stati)-1); $new_status = $stati[$r]; if(!$new_status->code) { fwrite(STDERR, "status not found\n"); continue; } echo "$oaid;".$new_status->code."\n"; $c++; }