示例#1
0
function sum_gw_data($src, $key_idx, $amt_idx)
{
    $t_pay_sum = 0;
    $t_refund_sum = 0;
    $t_sum = array();
    for ($r_i = 1; $r_i < count($src); $r_i++) {
        $t_ary = explode(',', trim($src[$r_i]));
        $t_key = trim($t_ary[$key_idx]);
        $t_amt = trim($t_ary[$amt_idx]) + 0;
        if (!empty($t_key) and !empty($t_amt)) {
            switch (CHECK_OPTION) {
                case 'BOTH':
                    // 購退票都檢查
                    if ($t_amt > 0) {
                        $t_pay_sum += $t_amt;
                    } else {
                        $t_refund_sum += $t_amt;
                    }
                    $t_sum[$t_key] += $t_amt;
                    break;
                case 'PAY':
                    // 只檢查購票
                    if ($t_amt > 0) {
                        $t_pay_sum += $t_amt;
                        $t_sum[$t_key] += $t_amt;
                    }
                    break;
                default:
            }
        }
    }
    disp('綠界 pay:' . $t_pay_sum . ', refund:' . $t_refund_sum);
    return $t_sum;
}
示例#2
0
function sortbyname($arr)
{
    $n = count($arr);
    for ($i = 0; $i < $n - 1; $i++) {
        for ($j = $i + 1; $j < $n; $j++) {
            if ($arr[$j][0] < $arr[$i][0]) {
                $t = $arr[$j];
                $arr[$j] = $arr[$i];
                $arr[$i] = $t;
            }
        }
    }
    disp($arr);
}
function getFacebookAuthorization($a = 1)
{
    global $fbo, $key, $urlAccess, $urlAuth;
    if ($a == 1) {
        printHelp("You must give your athorization code.\nVisit http://www.facebook.com/code_gen.php?v=1.0&api_key={$key} to get one for php_batch_uploader.\n\n");
        die;
    }
    try {
        $auth = $fbo->do_get_session($a);
        if (empty($auth)) {
            throw new Exception('Empty Code.');
        }
        $fbReturn = $fbo->api_client->users_getInfo($fbo->api_client->users_getLoggedInUser(), array('name'));
        $name = $fbReturn[0]["name"];
    } catch (Exception $e) {
        disp("Invalid auth code or could not authorize session.\nPlease check your auth code or generate a new one at: {$urlAuth}\n\nIf you removed php_batch_uploader from your privacy settings, you will need to reauthoize it at {$urlAccess}", 1);
    }
    disp("Executed facebook authorization.", 5);
    // Store authorization code in authentication array
    $auth['code'] = $a;
    // Save to users home directory
    file_put_contents(getenv('HOME') . "/.facebook_auth", serialize($auth));
    disp("You are now authenticated {$name}! Re-run php_batch_uploader with a list of directories you would like uploaded to facebook.", 1);
}
示例#4
0
    while ($cur = $ret->fetchArray(SQLITE3_ASSOC)) {
        if (strlen($cur['PACKAGE'])) {
            echo '<LI><a href="' . $scriptdir . $cur['XKEY'] . '" title="' . htmlentities(strip_tags($cur['SHORTDESC'])) . '">';
            echo $cur['TITLE'];
            echo '</a></li>';
        }
    }
    echo '</UL>';
} else {
    if (strlen($page['CHILDREN'])) {
        ?>
<H3>Subtopics</H3>
       <DL>
       <?php 
        $childs = explode(',', $page['CHILDREN']);
        for ($i = 1; $i < count($childs); $i++) {
            $cur = lookup_by_xkey($childs[$i]);
            echo '<DT><a href="' . $scriptdir . $cur['XKEY'] . '?path=' . $path . '">';
            echo $cur['TITLE'];
            echo '</a></dt><dd>';
            disp($cur['SHORTDESC']);
            echo '</dd>';
        }
    }
}
$db->close();
?>
  </div>
</div>
</body>
</html>
示例#5
0
 public function actionCheckemail()
 {
     /*echo CController::createAbsoluteUrl('user/verify', array(
               'key' => "LL",
               'email' => "LL"
           ));
       //sendMail('*****@*****.**', "tesWWt", "just a test");*/
     $model = Video::model()->findByPk(4);
     disp($model->details);
 }
示例#6
0
?>
    </div>
    <br/>
    <span class="hint"> Time Format MM:SS, 24 hour format</span>
</div>
<div class="row">
    <style>
        #Video_runOnTemp {
            display: inline-block;
        }
    </style>
    <?php 
echo $form->labelEx($model, 'runOn', array("style" => 'float:left; margin-right:8px;'));
?>
    <?php 
disp($model->runOnTemp);
?>
    <?php 
echo CHtml::checkBoxList('Video[runOnTemp]', explode('|', $model->runOn), array("MO" => "Monday", "TU" => "Tuesday", "WE" => "Wednesday", "TH" => "Thursday", "FR" => "Friday", "SA" => "Saturday", "SU" => "Sunday"), array("checkAll" => "Everyday", "style" => "display:inline-block;", "labelOptions" => array("style" => "display:inline;")));
?>
</div>
<div class="row">
    <div style="display: inline-block;">
        <?php 
echo $form->labelEx($model, 'repeat', array("style" => "margin-bottom: -0%;"));
?>
        <?php 
echo $form->dropDownList($model, 'repeat', array("0" => "Never(Disable video)", '1' => "Always Show Video", "2" => "Specific Number"));
?>
    </div>
    <div id="times_repeat_row" style="display: inline-block;width:80%;">
     * @param      string $path CSV 路徑
     * @version    1.0
     */
    public function loadCsv($path)
    {
        // 讀取來源檔
        $rows = file($path, FILE_IGNORE_NEW_LINES);
        if (count($rows) < 1) {
            throw new Exception('13');
        }
        return $rows;
    }
}
try {
    $ctcb_bin = new CtcbBin();
    $csv = new BinCsv($new_csv_file_path);
    // 讀取來源檔
    $rows = $csv->loadCsv($csv_file_path);
    // 取得內容
    foreach ($rows as $row) {
        list($bin_code, $bank_name, $remark) = explode(',', $row);
        $card_type = $ctcb_bin->getCardType($bank_name);
        $new_row = $csv->genNewRow([$bin_code, $bank_name, $card_type, '']);
        // 產生內容
        $csv->saveCsv($new_row);
        // 寫入標題列
    }
    disp('finish');
} catch (Exception $e) {
    disp('Exception: ' . $e->getMessage());
}
/**
 *  比對測試結果資料是否為空
 *
 * @author     Shawn Chang <*****@*****.**>
 * @category   test
 * @param      String $mActual_Content 實際內容
 * @version    1.0
 */
function assert_empty($mActual_Content, $sFunction_Name = "")
{
    if (empty($mActual_Content)) {
        disp($sFunction_Name . " 測試通過");
    } else {
        disp($sFunction_Name . " 測試失敗");
    }
}
示例#9
0
文件: rnd_key.php 项目: sac071213/dev
<?php

include '../tpl/header.php';
include '../lib/html_common.inc';
include '../lib/misc.inc';
$key_len = 8;
if (isset($_GET['l']) and $_GET['l'] > 0) {
    $key_len = $_GET['l'];
}
$M = new misc();
$key = $M->rndKey($key_len);
disp($key);
include '../tpl/footer.php';
示例#10
0
<?php

include '../tpl/header.php';
include '../lib/html_common.inc';
include '../lib/misc.inc';
$src_path = 'D:/Allpay/allpay_service/cart_dev/payment/allPay_HikaShop_v1.0.1_UTF8_Release02xx/allpay_webatm/';
$des_path = 'C:/wamp/www/jml_3_4/plugins/hikashoppayment/allpay_webatm/';
$file_list = scandir($src_path);
$ignore_files = array('.', '..');
foreach ($file_list as $file_name) {
    if (!in_array($file_name, $ignore_files)) {
        $src_file_path = $src_path . $file_name;
        $des_file_path = $des_path . $file_name;
        disp('copy ' . $src_file_path . ' to ' . $des_file_path);
        copy($src_file_path, $des_file_path);
    }
}
include '../tpl/footer.php';
示例#11
0
<?php

define('WEB_ROOT', 'C:/wamp/www/dev');
include WEB_ROOT . '/tpl/header.php';
include WEB_ROOT . '/lib/html_common.inc';
include WEB_ROOT . '/lib/misc.inc';
disp('_GET');
disp($_GET);
disp('_POST');
disp($_POST);
include WEB_ROOT . '/tpl/footer.php';
function getConverter($path = NULL)
{
    disp("Finding image converter.", 5);
    global $converter;
    # If a path isn't specified.
    if (is_null($path)) {
        # Attempt to find graphics magic and image magick
        $gm = exec("which gm");
        $im = exec("which convert");
        # Specify converter, prefer graphics magick.
        if (!empty($gm)) {
            $converter = "{$gm} convert";
            disp("Found GraphicsMagic, using {$gm}", 3);
        } elseif (!empty($im)) {
            $converter = $im;
            disp("Found ImageMagick, using {$im}", 3);
        } else {
            disp("No suitable image converter found. Specify one with -c on the command line or\ninstall Image or GraphicsMagick and make sure that the executable location is added to your PATH.", 1);
        }
    } else {
        # If path isn't executable
        if (!is_executable($path)) {
            # Return an error.
            disp("{$path} is not executable. Please specify one with -c", 1);
        }
        $ex = pathinfo($path, PATHINFO_FILENAME);
        if ($ex == "gm") {
            $converter = "{$path} convert";
        } else {
            $converter = $path;
        }
    }
    # In case it has spaces in the name.
    $converter = escapeshellcmd($converter);
}
示例#13
0
                            $gen_file_path = str_replace($src_dir_path, $gen_dir_path, $new_name);
                            if (file_exists($gen_file_path)) {
                                unlink($gen_file_path);
                            }
                            disp('from ' . $src_file_path . ' to ' . $gen_file_path);
                            $file_cont = file_get_contents($src_file_path);
                            $gen_file_cont = str_replace($lazy_from, $lazy_to, $file_cont);
                            file_put_contents($gen_file_path, $gen_file_cont);
                            break;
                        default:
                            # do nothing
                    }
                }
            }
        }
        disp('<hr />');
    }
}
# zip files
$zip_file_list = scandir($gen_dir_path);
chdir($gen_dir_path);
$ignore_files = array('.', '..');
foreach ($zip_file_list as $file_name) {
    if (!in_array($file_name, $ignore_files)) {
        exec('"C:\\Program Files\\7-Zip\\7z.exe" a -tzip ' . $file_name . '.zip ' . $file_name);
    }
}
function recurciveScan($abs_dir_path)
{
    global $gen_file_list;
    $ignore_files = array('.', '..');
function getCaption($image)
{
    global $root_dir, $mode, $glue;
    $root_dir = substr($root_dir, -1) == "/" ? $root_dir : $root_dir . "/";
    if ($mode == 1) {
        // In Mode 1 (where each (sub)directory gets its own album, just use the file name
        $caption = pathinfo($image, PATHINFO_FILENAME);
    } elseif ($mode == 2) {
        // Replace the root directory with nothing.
        $dir_structure = explode(DIRECTORY_SEPARATOR, str_replace($root_dir, "", $image));
        // Generate a caption based on the folder's relative
        $caption = pathinfo(implode($glue, $dir_structure), PATHINFO_FILENAME);
    } else {
        disp("Invalid Mode", 1);
    }
    // Trim off excess white spaces.
    $caption = trim($caption);
    disp("Got Caption: {$caption} for {$image}", 5);
    return $caption;
}
示例#15
0
        $disp_dir_name = $_GET['dd'];
        if (!preg_match('/^((\\\\|\\/){1}[a-zA-Z0-9_\\-\\.\\s]+)+$/', $disp_dir_name)) {
            throw new Exception('Invaild display directory name.');
        }
    }
    # 取得目錄檔案內容
    $src_dir_path = $_SERVER["DOCUMENT_ROOT"] . '/dev/file/' . $dir_name;
    $scan_file_list = array();
    recurciveScan($src_dir_path);
    # 顯示目錄檔案內容
    $disp_file_list = array();
    foreach ($scan_file_list['file'] as $file_path) {
        disp(str_replace($src_dir_path, $disp_dir_name, $file_path));
    }
} catch (Exception $e) {
    disp($e->getMessage());
}
include '../tpl/footer.php';
function recurciveScan($abs_dir_path)
{
    global $scan_file_list;
    $ignore_files = array('.', '..');
    $file_list = scandir($abs_dir_path);
    foreach ($file_list as $file_name) {
        if (!in_array($file_name, $ignore_files)) {
            $abs_file_path = $abs_dir_path . '/' . $file_name;
            if (is_dir($abs_file_path)) {
                $scan_file_list['dir'][] = $abs_file_path;
                recurciveScan($abs_file_path);
            } else {
                $scan_file_list['file'][] = $abs_file_path;
示例#16
0
<?php

define('ROOT_PATH', 'C:/wamp/www');
$dev_root_path = ROOT_PATH . '/dev';
include $dev_root_path . '/tpl/header.php';
include $dev_root_path . '/lib/html_common.inc';
include $dev_root_path . '/lib/misc.inc';
$query_url = 'https://payment-stage.allpay.com.tw/Cashier/QueryTradeInfo';
$params = array('MerchantID' => '2000214', 'MerchantTradeNo' => '20160216173620', 'TimeStamp' => time());
$gen_code_url = 'https://payment-stage.allpay.com.tw/AioHelper/GenCheckMacValue';
$check_mac_value = ServerPost($params, $gen_code_url);
$params['CheckMacValue'] = $check_mac_value;
$query_res_str = ServerPost($params, $query_url);
$query_res = array();
parse_str($query_res_str, $query_res);
disp(print_r($query_res, true), true);
function ServerPost($parameters, $url)
{
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, FALSE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_POST, TRUE);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($parameters));
    $rs = curl_exec($ch);
    curl_close($ch);
    return $rs;
}
include $dev_root_path . '/tpl/footer.php';
示例#17
0
        $disp .= '<tr>';
        for ($j = 0; $j < $degree; $j++) {
            $disp .= '<td width="40px" height="40px">' . $square[$i][$j] . '</td>';
        }
        $disp .= '</tr>';
    }
    $disp .= '</table>';
    return $disp;
}
?>
    <div id="header"><h1>MAGIC SQUARE</h1></div>
    <div id="body">
    	<div id="left">
        <div style="height: 460px"></div>
        <form method="post" action="">
            <?php 
echo $html;
?>
            <input type="submit" value="Display" />
        </form>
        </div>
        <div id="right">
        <?php 
// display MS
echo disp($square);
?>
        </div>
    </div>
</center>
</body>
</html>
示例#18
0
function irc($command)
{
    global $XUSER, $SERVER, $ROOMS, $OPERATOR, $CS, $PERMISSIONS;
    // The following IRC commands are implemented
    // unban
    // devoice
    // join
    // mdeop
    // names
    // unignore
    // voice
    // kick
    // mkick
    // op
    // away
    // back
    // ignore
    // wallchop
    // ban
    // deop
    // invite
    // topic
    // wallchan
    // msg
    // admin
    // deadmin
    //       mode
    //  // +-s,+-p = Private, Public
    //  // +-m = moded
    //  // +-l <number> = user limit, number if +
    //  // +-b = ban
    //  // +-v = voice
    //  // +-o = op
    //  // +-i = ignore
    //  // +-a = Admin/noadmin
    $command = eregi_replace("/", "", $command);
    $commando = eregi_replace("/", "", $command);
    $i = 0;
    while ($token = strtok($command, " ")) {
        $command = @eregi_replace("{$token}", "", $command);
        $cmd[$i] = $token;
        $i++;
    }
    $command2 = "6439547" . $commando;
    $token = strtok($command2, " ");
    $command2 = @eregi_replace("{$token} ", "", $command2);
    if ($cmd[0] != "wallchop" && $cmd[0] != "topic" && $cmd[0] != "wallchan" && $cmd[0] != "mode" && $cmd[0] != "join" && $cmd[0] != "me") {
        $command2 = "6439547" . $command2;
        $token = strtok($command2, " ");
        $command2 = @eregi_replace("{$token}", "", $command2);
    }
    $cmd[3] = $command2;
    $cmd[1] = strip($cmd[1]);
    $qa = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}users WHERE username='******'1']}'");
    $rowa = do_Fetch_row($qa);
    if ($rowa[4] == 4 || $rowa[4] == 5) {
        $wuza = 1;
    }
    $noauth = 0;
    if ($XUSER['LEVEL'] < 3) {
        $noauth = 1;
    }
    // Start looking for the command the user ran
    if ($cmd[0] == "unban" && $noauth != 1) {
        mnotice($cmd[1], 9);
        if (eregi(".*\\..*\\..*\\..*", $cmd[1])) {
            $isip = 1;
        }
        if (isset($isip)) {
            DoQuery("DELETE FROM {$SERVER['TBL_PREFIX']}bans WHERE room='{$ROOMS['IN_ROOM_NAME']}' && ip='{$cmd['1']}'");
        } else {
            DoQuery("DELETE FROM {$SERVER['TBL_PREFIX']}bans WHERE room='{$ROOMS['IN_ROOM_NAME']}' && name='{$cmd['1']}'");
        }
    } elseif ($cmd[0] == "devoice" && $noauth != 1 && !isset($wuza)) {
        $q = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}online WHERE username='******'1']}'");
        $row = Do_Fetch_Row($q);
        if ($row[3] == $ROOMS['IN_ROOM_NAME']) {
            $q = DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET voice='' WHERE username='******'1']}'");
            mnotice($cmd[1], 6);
        }
    } elseif ($cmd[0] == "join") {
        sendsysmsgto("To join {$cmd['3']} <a href=\"../index.php?changeroom=set&room={$cmd['3']}\" target=\"_parent\">Click Here</a>.", "{$XUSER['NAME']}:PRIV");
    } elseif ($cmd[0] == "help") {
        function disp($mess_txt)
        {
            global $CS, $XUSER;
            $mess_txt = eregi_replace("\r\n", "", $mess_txt);
            $mess_txt = eregi_replace("\n", "", $mess_txt);
            sendsysmsgto("{$mess_txt}", "{$XUSER['NAME']}:PRIV");
        }
        if ($cmd[1] == "") {
            disp("This server accepts the following commands: ");
            disp("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n<tr>\n<td width=\"75\">unban</td>\n<td width=\"75\">devoice</td>\n<td width=\"75\">join</td>\n<td width=\"75\">mdeop</td>\n<td width=\"75\">names</td>\n<td width=\"75\">unignore</td>\n</tr>\n<tr>\n<td width=\"75\">voice</td>\n<td width=\"75\">kick</td>\n<td width=\"75\">mkick</td>\n<td width=\"75\">op</td>\n<td width=\"75\">away</td>\n<td width=\"75\">back</td>\n</tr>\n<tr>\n<td width=\"75\">ignore</td>\n<td width=\"75\">wallchop</td>\n<td width=\"75\">ban</td>\n<td width=\"75\">deop</td>\n<td width=\"75\">invite</td>\n<td width=\"75\">topic</td>\n</tr>\n<tr>\n<td width=\"75\">wallchan</td>\n<td width=\"75\">msg</td>\n<td width=\"75\">admin</td>\n<td width=\"75\">deadmin</td>\n<td width=\"75\">mode</td>\n<td width=\"75\">list</td>\n</tr>\n<tr>\n<td width=\"75\">me</td>\n<td width=\"75\">&nbsp;</td>\n<td width=\"75\">&nbsp;</td>\n<td width=\"75\">&nbsp;</td>\n<td width=\"75\">&nbsp;</td>\n<td width=\"75\">&nbsp;</td>\n</tr>\n</table>");
            disp("For more information type /help <i>command</i>");
            disp("Certain Commands may not be accepted if you do not have correct authorization.");
        } elseif ($cmd[1] == "unban") {
            disp("Command: unban<Br>\nSyntax: /unban <i>username</i><Br>\nAction: Unbans a username or IP address from the chat room.");
        } elseif ($cmd[1] == "devoice") {
            disp("Command: devoice<Br>\nSyntax: /devoice <i>username</i><Br>\nAction: Takes away a users voice so they can no longer send messages in a moderated chat room.");
        } elseif ($cmd[1] == "join") {
            disp("Command: join<Br>\nSyntax: /join <i>room name</i><Br>\nAction: Gives you a link to change to room <i>room name</i>.");
        } elseif ($cmd[1] == "mdeop") {
            disp("Command: mdeop<Br>\nSyntax: /mdeop<Br>\nAction: Mass De-Ops the entire room.  De-Ops all other ops but you.");
        } elseif ($cmd[1] == "names") {
            disp("Command: names<Br>\nSyntax: /names<Br>\nAction: Prints the usernames of people in chat with you.");
        } elseif ($cmd[1] == "unignore") {
            disp("Command: unignore<Br>\nSyntax: /unignore <i>username</i><Br>\nAction: Unignores the user with username <i>username</i>.");
        } elseif ($cmd[1] == "voice") {
            disp("Command: voice<Br>\nSyntax: /voice <i>username</i><Br>\nAction: Gives user <i>username</i> a voice.  This allows them to send messages to a moderated chat room");
        } elseif ($cmd[1] == "kick") {
            disp("Command: kick<Br>\nSyntax: /kick <i>username</i><Br>\nAction: This will kick (remove) a user from chat.");
        } elseif ($cmd[1] == "mkick") {
            disp("Command: mkick<Br>\nSyntax: /mkick<Br>\nAction: This kicks all users in the chat room out except for you.");
        } elseif ($cmd[1] == "op") {
            disp("Command: op<Br>\nSyntax: /op <i>username</i><Br>\nAction: Gives <i>username</i> operator status in the current chat room.");
        } elseif ($cmd[1] == "away") {
            disp("Command: away<Br>\nSyntax: /away<Br>\nAction: Sets your current status as away.");
        } elseif ($cmd[1] == "back") {
            disp("Command: back<Br>\nSyntax: /back<Br>\nAction: Sets your current stats as present.");
        } elseif ($cmd[1] == "ignore") {
            disp("Command: ignore<Br>\nSyntax: /ignore <i>username</i><Br>\nAction: Ignores <i>username</i>, you will no longer recieve messages from <i>username</i>");
        } elseif ($cmd[1] == "wallchop") {
            disp("Command: wallchop<Br>\nSyntax: /wallchop <i>message</i><Br>\nAction: Sends <i>message</i> to all the operators in the current chat room.");
        } elseif ($cmd[1] == "ban") {
            disp("Command: ban<Br>\nSyntax: /ban <i>username</i><Br>\nAction: Bans a username or IP address from the chat room.  The user will no longer be able to access this chat room.");
        } elseif ($cmd[1] == "deop") {
            disp("Command: deop<Br>\nSyntax: /deop <i>username</i><Br>\nAction: Takes operator status from a user.");
        } elseif ($cmd[1] == "invite") {
            disp("Command: invite<Br>\nSyntax: /invite <i>username</i><Br>\nAction: Invites a username to join the current chat room.");
        } elseif ($cmd[1] == "topic") {
            disp("Command: topic<Br>\nSyntax: /topic <i>topic</i><Br>\nAction: Sets the chat rooms topic to <i>topic</i>.");
        } elseif ($cmd[1] == "wallchan") {
            disp("Command: wallcan<Br>\nSyntax: /wallchan <i>message</i><Br>\nAction: Sends a message to all channels on current server.");
        } elseif ($cmd[1] == "msg") {
            disp("Command: msg<Br>\nSyntax: /msg <i>username</i> <i>message</i><Br>\nAction: Sends a private message, <i>message</i>, to <i>username</i>.");
        } elseif ($cmd[1] == "admin") {
            disp("Command: admin<Br>\nSyntax: /admin <i>username</i><Br>\nAction: Grants <i>username</i> administrator access.");
        } elseif ($cmd[1] == "deadmin") {
            disp("Command: deadmin<Br>\nSyntax: /deadmin <i>username</i><Br>\nAction: Takes <i>username</i>'s administrator access.");
        } elseif ($cmd[1] == "list") {
            disp("Command: list<Br>\nSyntax: /list<Br>\nAction: Displays list of rooms on the server.");
        } elseif ($cmd[1] == "me") {
            disp("Command: me<Br>\nSyntax: /me <i>action</i><Br>\nAction: Makes you do an action.");
        } elseif ($cmd[1] == "mode") {
            disp("Command: mode<Br>\nSyntax: /mode <i>mode</i> [<i>username</i>]<Br>\nAction: Preforms <i>mode</i> on <i>username</i>.  If <i>mode</i> is a channel\nmode then <i>username</i> may be ommited.  Placing a + in front of a mode applys it and placing\na - in from of a mode removes it.<Br><br>User Modes:<Br>\n[+|-]b: [Bans|Unbans] a user from the current chat room.<Br>\n[+|-]v: [Give Voice To|Take Voice From] a user in the current chat room.<Br>\n[+|-]o: [Ops|Deops] a user in the current chat room.<Br> \n[+|-]i: [Ignores|Unignores] a user.<Br>\n[+|-]a: [Admins|Deadmins] a user.<Br>\n<Br>Channel Modes<br>\n+p: Makes current chat room private.  Replace <i>username</i> with the password for the room.<br>\n-p: Makes a chat room public.  <i>username</i> may be ommited.<Br>\n+m: Makes a chat room moderated.  <i>username</i> may be ommited.<Br>\n-m: Makes a chat room unmoderated.  <i>username</i> may be ommited.<Br>\n+l: Sets the user limit for the current chat room.  Replace <i>username</i> with the maximum amount of users for the room.<br>\n-l: Removes the user limit from current chat room.  <i>username</i> may be ommited.<Br>\n\n");
        } else {
            disp("Sorry no help is available for that command.");
        }
    } elseif ($cmd[0] == "mdeop" && $noauth != 1) {
        $q = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}online WHERE roomname='{$ROOMS['IN_ROOM_NAME']}'");
        while ($row = Do_Fetch_row($q)) {
            $q2 = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}users WHERE username='******'1']}'");
            $row = Do_Fetch_row($q2);
            if ($row[4] == "3{$ROOMS['id']}" && $row[1] != $XUSER['NAME']) {
                irc("/deop {$row['1']}");
            }
        }
    } elseif ($cmd[0] == "names") {
        sendsysmsgto("Users in chat with you:", "{$XUSER['NAME']}:PRIV");
        $q = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}online WHERE roomname='{$ROOMS['IN_ROOM_NAME']}'");
        while ($row = Do_Fetch_row($q)) {
            sendsysmsgto("{$row['1']}", "{$XUSER['NAME']}:PRIV");
        }
    } elseif ($cmd[0] == "unignore") {
        DoQuery("DELETE FROM {$SERVER['TBL_PREFIX']}ignore WHERE user='******'NAME']}' AND toignore='{$cmd['1']}'");
    } elseif ($cmd[0] == "voice" && $noauth != 1 && !isset($wuza)) {
        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET voice='{$ROOMS['id']}' WHERE username='******'1']}'");
        mnotice($cmd[1], 5);
    } elseif ($cmd[0] == "kick" && $noauth != 1 && !isset($wuza) && $PERMISSIONS['Kick'] != 1) {
        mnotice($cmd[1], 7);
        $time = time();
        DoQuery("INSERT INTO {$SERVER['TBL_PREFIX']}bans VALUES('0','{$ROOMS['IN_ROOM_NAME']}','{$cmd['1']}','','{$time}','60')");
    } elseif ($cmd[0] == "mkick" && $noauth != 1) {
        $q = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}online WHERE roomname='{$ROOMS['IN_ROOM_NAME']}'");
        while ($row = Do_Fetch_row($q)) {
            if ($row[1] != $XUSER['NAME']) {
                irc("/kick {$row['1']}");
            }
        }
    } elseif ($cmd[0] == "op" && $noauth != 1 && !isset($wuza)) {
        $q = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}users WHERE username='******'1']}'");
        $row = Do_Fetch_Row($q);
        if (strlen($XUSER['LEVEL']) == 1) {
            $isop = 0;
        } elseif (strlen($row[4]) > 1) {
            $isop = 1;
        }
        if ($isop == 0) {
            $q = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}online WHERE username='******'1']}'");
            $row = Do_Fetch_Row($q);
            if ($row[3] == $ROOMS['IN_ROOM_NAME']) {
                DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET level='3{$ROOMS['id']}' WHERE username='******'1']}'");
                mnotice($cmd[1], 3);
            }
        }
    } elseif ($cmd[0] == "away") {
        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET status=2 WHERE username='******'NAME']}'");
    } elseif ($cmd[0] == "back") {
        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET status='' WHERE username='******'NAME']}'");
    } elseif ($cmd[0] == "ignore") {
        $time = time();
        DoQuery("INSERT INTO {$SERVER['TBL_PREFIX']}ignore VALUES('0','{$XUSER['NAME']}','{$cmd['1']}','{$time}','')");
    } elseif ($cmd[0] == "msg") {
        $cmd[3] = strip($cmd[3]);
        sendprivatemsg($cmd[3], $cmd[1]);
    } elseif ($cmd[0] == "wallchop") {
        $cmd[3] = strip($cmd[3]);
        $q = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}online WHERE roomname='{$ROOMS['IN_ROOM_NAME']}'");
        while ($row = do_fetch_row($q)) {
            $q2 = DoQuery("SELECT * FROM {$SERVER['TBL_PREFIX']}users WHERE username='******'1']}'");
            $row2 = do_Fetch_row($q2);
            if ($row2[4] == "3{$ROOMS['id']}") {
                sendprivatemsg($cmd[3], $row[1]);
            }
        }
    } elseif ($cmd[0] == "ban" && $noauth != 1 && !isset($wuza) && $PERMISSIONS['Ban'] != 1) {
        $time = time();
        mnotice($cmd[1], 8);
        DoQuery("INSERT INTO {$SERVER['TBL_PREFIX']}bans VALUES('0','{$ROOMS['IN_ROOM_NAME']}','{$cmd['1']}','','{$time}','0')");
    } elseif ($cmd[0] == "deop" && $noauth != 1 && !isset($wuza)) {
        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET level='1' WHERE username='******'1']}'");
        mnotice($cmd[1], 4);
    } elseif ($cmd[0] == "roll") {
        global $XUSER, $SERVER, $ROOMS;
        $SERVER['CURRENT_TIME'] = time();
        $ran1 = rand(1, 6);
        $ran2 = rand(1, 6);
        if (@$cmd[1] == 2) {
            $message = "{$XUSER['NAME']} rolls two dice and gets a {$ran1} and a {$ran2}";
        } else {
            $message = "{$XUSER['NAME']} rolls a dice and gets a {$ran1}";
        }
        DoQuery("INSERT INTO {$SERVER['TBL_PREFIX']}messages \nVALUES('0','{$ROOMS['IN_ROOM_NAME']}','System','{$SERVER['CURRENT_TIME']}','0','{$message}')");
    } elseif ($cmd[0] == "me") {
        global $XUSER, $SERVER, $ROOMS;
        $SERVER['CURRENT_TIME'] = time();
        if ($cmd[1] != "") {
            DoQuery("INSERT INTO {$SERVER['TBL_PREFIX']}messages \nVALUES('0','{$ROOMS['IN_ROOM_NAME']}','System','{$SERVER['CURRENT_TIME']}','0','{$XUSER['NAME']} {$cmd['3']}')");
        }
    } elseif ($cmd[0] == "invite") {
        $SERVER['CURRENT_TIME'] = time();
        DoQuery("INSERT INTO {$SERVER['TBL_PREFIX']}messages \nVALUES('0','{$cmd['1']}:PRIV','System','{$SERVER['CURRENT_TIME']}','0','{$XUSER['NAME']} has invited you to join the chatroom <a href=\"../index.php?changeroom=set&room={$ROOMS['IN_ROOM_NAME']}\" target=\"_parent\">{$ROOMS['IN_ROOM_NAME']}</a>')");
    } elseif ($cmd[0] == "topic" && $noauth != 1) {
        $cmd[3] = strip($cmd[3]);
        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET topic='{$cmd['3']}' WHERE name='{$ROOMS['IN_ROOM_NAME']}'");
        mnotice($cmd[3], 12);
    } elseif ($cmd[0] == "wallchan" && $PERMISSIONS['Send_Sys_Message'] == 1) {
        sendsysmsg($cmd[3]);
    } elseif ($cmd[0] == "admin" && $PERMISSIONS['Make_Admins'] == 1) {
        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET level='4',time='0' WHERE username='******'1']}'");
        mnotice($cmd[1], 1);
    } elseif ($cmd[0] == "deadmin" && $PERMISSIONS['Make_Admins'] == 1) {
        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}users SET level='1',time='0' WHERE username='******'1']}'");
        mnotice($cmd[1], 2);
    } elseif ($cmd[0] == "list") {
        $r = listrooms("dark");
        $r = eregi_replace("\r\n", "", $r);
        sendsysmsgto($r, "{$XUSER['NAME']}:PRIV");
    } elseif ($cmd[0] == "mode") {
        $error = 0;
        if (eregi("-", $cmd[1], $match)) {
            $type = "-";
        } else {
            $type = "+";
        }
        if ($cmd[3] == $cmd[1]) {
            $cmd[3] = "";
        }
        $temp = eregi_replace("\\+", "\\+", $cmd[1]);
        $temp = eregi_replace("\\-", "\\-", $temp);
        $cmd[3] = eregi_replace("{$temp}", "", $cmd[3]);
        $cmd[3] = eregi_replace("^ ", "", $cmd[3]);
        $cmd[3] = eregi_replace(" \$", "", $cmd[3]);
        if (eregi("p", $cmd[1], $match)) {
            if ($XUSER['LEVEL'] > 2) {
                if ($type == "-") {
                    DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET type='1' WHERE name='{$ROOMS['IN_ROOM_NAME']}'");
                    mnotice("", 11);
                } else {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode +p <i>password</i>";
                    } else {
                        if ($PERMISSIONS['CR_Private'] == 1) {
                            $error = "The administrator of this server has disabled private rooms.";
                        } else {
                            DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET type='2',password='******'3']}' WHERE name='{$ROOMS['IN_ROOM_NAME']}'");
                            mnotice("", 10);
                        }
                    }
                }
            } else {
                $error = 1;
            }
        }
        if (eregi("m", $cmd[1], $match)) {
            if ($XUSER['LEVEL'] > 2) {
                if ($type == "-") {
                    DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET moderated='0' WHERE name='{$ROOMS['IN_ROOM_NAME']}'");
                    mnotice("", 15);
                } else {
                    if ($PERMISSIONS['CR_Moderated'] == 1) {
                        $error = "The administrator of this server has disabled the creation of moderated rooms.";
                    } else {
                        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET moderated='1' WHERE name='{$ROOMS['IN_ROOM_NAME']}'");
                        mnotice("", 14);
                    }
                }
            } else {
                $error = 1;
            }
        }
        if (eregi("l", $cmd[1], $match)) {
            if ($XUSER['LEVEL'] > 2) {
                if ($type == "-") {
                    DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET maxusers='0' WHERE name='{$ROOMS['IN_ROOM_NAME']}'");
                    mnotice("Unlimited", 13);
                } else {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode +l <i>max users</i>";
                    } else {
                        if ($cmd[3] < 2) {
                            $cmd[3] = 2;
                        }
                        DoQuery("UPDATE {$SERVER['TBL_PREFIX']}rooms SET maxusers='{$cmd['3']}' WHERE name='{$ROOMS['IN_ROOM_NAME']}'");
                        mnotice($cmd[3], 13);
                    }
                }
            } else {
                $error = 1;
            }
        }
        if (eregi("b", $cmd[1], $match)) {
            if ($XUSER['LEVEL'] > 2) {
                if ($type == "-") {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode -b <i>username</i>";
                    } else {
                        irc("/unban {$cmd['3']}");
                    }
                } else {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode +b <i>username</i>";
                    } else {
                        irc("/ban {$cmd['3']}");
                    }
                }
            } else {
                $error = 1;
            }
        }
        if (eregi("v", $cmd[1], $match)) {
            if ($XUSER['LEVEL'] > 2) {
                if ($type == "-") {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode -v <i>username</i>";
                    } else {
                        irc("/devoice {$cmd['3']}");
                    }
                } else {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode +v <i>username</i>";
                    } else {
                        irc("/voice {$cmd['3']}");
                    }
                }
            } else {
                $error = 1;
            }
        }
        if (eregi("o", $cmd[1], $match)) {
            if ($XUSER['LEVEL'] > 2) {
                if ($type == "-") {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode -o <i>username</i>";
                    } else {
                        irc("/deop {$cmd['3']}");
                    }
                } else {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode +o <i>username</i>";
                    } else {
                        irc("/op {$cmd['3']}");
                    }
                }
            } else {
                $error = 1;
            }
        }
        if (eregi("i", $cmd[1], $match)) {
            if ($type == "-") {
                if ($cmd[3] == "") {
                    $error = "Usage: /mode -i <i>username</i>";
                } else {
                    irc("/unignore {$cmd['3']}");
                }
            } else {
                if ($cmd[3] == "") {
                    $error = "Usage: /mode +i <i>username</i>";
                } else {
                    irc("/ignore {$cmd['3']}");
                }
            }
        }
        if (eregi("a", $cmd[1], $match)) {
            if ($PERMISSIONS['Make_Admins'] == 1) {
                if ($type == "-") {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode -a <i>username</i>";
                    } else {
                        irc("/deadmin {$cmd['3']}");
                    }
                } else {
                    if ($cmd[3] == "") {
                        $error = "Usage: /mode +a <i>username</i>";
                    } else {
                        irc("/admin {$cmd['3']}");
                    }
                }
            } else {
                $error = 1;
            }
        }
        if ($error == 1) {
            sendsysmsgto("You do not have permission to use that command.", "{$XUSER['NAME']}:PRIV");
        } elseif ($error != "0") {
            sendsysmsgto($error, "{$XUSER['NAME']}:PRIV");
        }
    } else {
        $message = "Unknown Command {$cmd['0']}";
        if (isset($wuza)) {
            $message = "Sorry, You may not preform this action on this user.";
        }
        sendsysmsgto($message, "{$XUSER['NAME']}:PRIV");
    }
}
function recursiveUpload($dir)
{
    global $fbo, $no_recurse;
    // Start the recursive upload.
    disp("Recursively uploading: {$dir}", 5);
    // Scan the folder for directories and images
    $result = folderScan($dir);
    // If the number of images in directory is greater than 1.
    if (count($result['images']) > 0) {
        // Get album base name.
        $albumBase = getAlbumBase($result['images'][0]);
        // Get current albums associated with the base name.
        $imageAlbums = getImageAlbums($albumBase);
        uploadImages($result["images"], $imageAlbums);
    }
    // For each directory. Recursively upload photos
    if ($no_recurse) {
        disp("No Recursion, stopping.", 0);
    }
    foreach ($result['directories'] as $dir) {
        recursiveUpload($dir);
    }
}
示例#20
0
$sRead_Data = file_get_contents($sSrc_File);
$sTrans_Data = str_replace($aSearch_List, $aReplace_List, $sRead_Data);
$iFile_Bytes = file_put_contents($sTrans_File, $sTrans_Data);
if ($iFile_Bytes > 0) {
    disp($sTrans_File . ' created.');
}
$bCopy_Result = copy($sTrans_File, $sDest_File);
if ($bCopy_Result) {
    disp('copy ' . $sTrans_File . ' to ' . $sDest_File);
} else {
    disp('fail to copy ' . $sTrans_File . ' to ' . $sDest_File);
}
unset($sSrc_File, $sTrans_File, $aSearch_List, $aReplace_List, $sRead_Data, $sTrans_Data, $iFile_Bytes, $bCopy_Result, $sTrans_File, $sDest_File);
// Sample transfer
$aSample_List = array('sample_BGCvsCreateShippingOrder.php', 'sample_BGHomeCreateShippingOrder.php', 'sample_CancelUnimartLogisticsOrder.php', 'sample_CheckFamilyB2CLogistics.php', 'sample_CreateFamilyB2CReturnOrder.php', 'sample_CreateHomeReturnOrder.php', 'sample_CvsCreateShippingOrder.php', 'sample_CvsMap.php', 'sample_HomeCreateShippingOrder.php', 'sample_PrintFamilyC2CBill.php', 'sample_PrintTradeDoc.php', 'sample_PrintUnimartC2CBill.php', 'sample_QueryLogisticsInfo.php', 'sample_UpdateUnimartLogisticsInfo.php', 'sample_UpdateUnimartStore.php');
$sSrc_Dir = __DIR__ . '/file/sample/allpay/';
$sTrans_Dir = __DIR__ . '/file/sample/ecpay/';
$aSearch_List = array('allPay ', 'AllPay.Logistics.Integration', 'AllpayLogistics', 'allpayForm');
$aReplace_List = array('ECPay ', 'ECPay.Logistics.Integration', 'ECPayLogistics', 'ECPayForm');
foreach ($aSample_List as $sSample_Name) {
    $sSrc_File = $sSrc_Dir . $sSample_Name;
    $sTrans_File = $sTrans_Dir . $sSample_Name;
    $sRead_Data = file_get_contents($sSrc_File);
    $sTrans_Data = str_replace($aSearch_List, $aReplace_List, $sRead_Data);
    $iFile_Bytes = file_put_contents($sTrans_File, $sTrans_Data);
    if ($iFile_Bytes > 0) {
        disp($sTrans_File . ' created.');
    }
    unset($sSrc_File, $sTrans_File, $sRead_Data, $sTrans_Data, $iFile_Bytes);
}
unset($aSample_List, $sSrc_Dir, $sTrans_Dir, $aSearch_List, $aReplace_List);
示例#21
0
文件: to_csv.php 项目: sac071213/dev
function disp($sContent)
{
    echo $sContent . PHP_EOL;
}
$sSrc_Dir = __DIR__ . '/file';
// $sSrc_File_Name = 'bin_table_201608.csv';
$sSrc_File_Name = 'bin_table_161103_01.csv';
$sSrc_File_Path = $sSrc_Dir . '/' . $sSrc_File_Name;
$sDest_File_Name = 'bin_table_' . date('ymd') . '.csv';
$sDest_File_Path = $sSrc_Dir . '/' . $sDest_File_Name;
$aCSV_Rows = file($sSrc_File_Path);
$sNew_CSV_Rows = 'bin_num,bin_bank,bin_type' . PHP_EOL;
// 第 1 行為標題,略過
for ($iIdx = 1; $iIdx < count($aCSV_Rows) - 1; $iIdx++) {
    list($sTmp_BIN_Num, $sTmp_BIN_Bank, $sTmp_Remark) = explode(',', $aCSV_Rows[$iIdx]);
    $sNew_Row = trim($sTmp_BIN_Num) . ',' . trim($sTmp_BIN_Bank) . ',';
    if (substr_count('中國信託', $sTmp_BIN_Bank) > 0 or substr_count('中信', $sTmp_BIN_Bank) > 0) {
        $sNew_Row .= '自行卡';
    } else {
        $sNew_Row .= '他行卡';
    }
    $sNew_CSV_Rows .= $sNew_Row . ',' . PHP_EOL;
    unset($sTmp_BIN_Num, $sTmp_BIN_Bank, $sTmp_Remark, $sNew_Row);
}
$iFile_Bytes = file_put_contents($sDest_File_Path, $sNew_CSV_Rows);
if ($iFile_Bytes > 0) {
    disp($sDest_File_Path . ' created.');
} else {
    disp($sDest_File_Path . ' created failed.');
}
unset($sSrc_Dir, $sSrc_File_Name, $sSrc_File_Path, $sDest_File_Name, $sDest_File_Path, $aCSV_Rows, $sNew_CSV_Rows, $iFile_Bytes);
示例#22
0
<?php

include '../tpl/header.php';
include '../lib/html_common.inc';
include '../lib/misc.inc';
$src_str = 'update o_auth set close=1,clsamt=clsamt+$amount where remsg="已授權" and sr="$sel_ary[0]" limit 1 ';
$src_list = array('select', 'insert', 'update', 'delete', 'from', 'set', 'where', 'and', 'limit', '"', '\'');
$replace_list = array('SELECT', 'INSERT', 'UPDATE', 'DELETE', 'FROM', 'SET', 'WHERE', 'AND', 'LIMIT', '\'', '"');
$replaced_str = str_replace($src_list, $replace_list, $src_str);
disp($replaced_str);
include '../tpl/footer.php';
示例#23
0
$aParse_Type = $aRecord_Type_List[$sParse_Type];
$aLength_List = array('F' => array('HEADER' => array(1, 9, 5, 5, 9, 8, 8, 1, 54), 'DETAIL' => array(1, 2, 9, 16, 2, 8, 8, 8, 8, 6, 2, 17, 1, 12), 'TRAILER' => array(1, 6, 9)), 'U' => array('HEADER' => array(1, 99), 'DETAIL' => array(1, 1, 15, 1, 19, 1, 6, 1, 8, 1, 7, 1, 8, 1, 8, 1, 3, 5, 1, 11, 1), 'TRAILER' => array(1, 99)), 'G' => array('HEADER' => array(1, 6, 9, 1, 8, 10, 8, 10, 1, 40, 1, 1, 4, 60), 'DETAIL' => array(1, 6, 16, 3, 2, 6, 10, 25, 1, 1, 8, 20, 1, 15, 40, 5), 'TRAILER' => array(1, 6, 8, 145)));
$aParse_Length = $aLength_List[$sParse_Type];
$aCtcb_Rows = explode("\n", $sCtcb_Content);
foreach ($aCtcb_Rows as $sTmp_Row) {
    $sTmp_1_Chr = substr($sTmp_Row, 0, 1);
    switch ($sTmp_1_Chr) {
        case $aParse_Type['HEADER']:
            // HEADER
            $aLength = $aParse_Length['HEADER'];
            break;
        case $aParse_Type['DETAIL']:
            // DETAIL
            $aLength = $aParse_Length['DETAIL'];
            break;
        case $aParse_Type['TRAILER']:
            // TRAILER
            $aLength = $aParse_Length['TRAILER'];
            break;
    }
    $iStart_Idx = 0;
    foreach ($aLength as $sTmp_Len) {
        $sTmp_String = substr($sTmp_Row, $iStart_Idx, $sTmp_Len);
        disp(str_replace(' ', '@', $sTmp_String));
        $iStart_Idx += $sTmp_Len;
    }
    $sTmp_String = substr($sTmp_Row, $iStart_Idx);
    disp('rest: ' . str_replace(' ', '@', $sTmp_String));
    disp('');
}
include '../tpl/footer.php';
示例#24
0
function showresults($q, $qtype)
{
    global $qdata, $qsids, $qsdata;
    eval(interpret('control', $qtype, $qsdata[$qsids[$q]][1]));
    if ($qtype == 'choices' || $qtype == 'multans' || $qtype == 'multipart') {
        if (isset($choices) && !isset($questions)) {
            $questions =& $choices;
        }
        if ($qtype == 'multipart') {
            if (!is_array($anstypes)) {
                $anstypes = explode(',', $anstypes);
            }
            foreach ($anstypes as $i => $type) {
                if ($type == 'choices' || $type == 'multans') {
                    if (isset($questions[$i])) {
                        $ql = $questions[$i];
                    } else {
                        $ql = $questions;
                    }
                    if ($type == 'multans') {
                        if (is_array($answers)) {
                            $al = $answers[$i];
                        } else {
                            $al = $answers;
                        }
                    } else {
                        if ($type == 'choices') {
                            if (is_array($answer)) {
                                $al = $answer[$i];
                            } else {
                                $al = $answer;
                            }
                        }
                    }
                    disp($q, $type, $i, $al, $ql);
                } else {
                    if (is_array($answer)) {
                        $al = $answer[$i];
                    } else {
                        $al = $answer;
                    }
                    disp($q, $type, $i, $al);
                }
            }
        } else {
            if ($qtype == 'multans') {
                $al = $answers;
            } else {
                if ($qtype == 'choices') {
                    $al = $answer;
                }
            }
            disp($q, $qtype, -1, $al, $questions);
        }
    } else {
        disp($q, $qtype, -1, $answer);
    }
}