Пример #1
0
function game_status($playerid, $gameid)
{
    $query0 = "SELECT * FROM games WHERE gameid = '{$gameid}' ";
    $recordset = mysql_query($query0) or die(mysql_error());
    $row = mysql_fetch_array($recordset);
    //---game stats---//
    $gamecode = $row["gamecode"];
    $boss = $row["boss"];
    $bosshealth = $row["bosshealth"];
    $weather = $row["weather"];
    $story = $row["bossmove"];
    $gamestate = $row["gamestate"];
    $roundcount = $row["roundcount"];
    $arrayplayersid = explode(",", $row["players"]);
    array_pop($arrayplayersid);
    $bossmaxhealth = number("starting_boss_health_per_player") * count($arrayplayersid);
    //---player stats---//
    if ($playerid > 0) {
        $query1 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
        $recordset = mysql_query($query1) or die(mysql_error());
        $row = mysql_fetch_array($recordset);
        $name = $row["name"];
        $health = $row["health"];
        $strength = $row["strength"];
        $speed = $row["speed"];
        $playermove = $row["playermove"];
        $playerstate = $row["playerstate"];
        $playermaxhealth = number("starting_health");
        $arrayplayerid = array($playerid);
        $arrayplayersid = array_diff($arrayplayersid, $arrayplayerid);
    } else {
        $name = 0;
        $health = 0;
        $strength = 0;
        $speed = 0;
        $playermove = 0;
        $playerstate = 0;
        $playermaxhealth = 0;
    }
    if ($playerstate == "dead") {
        unset($_SESSION["playerid"]);
    }
    //---players list---//
    $arrayplayernames = array("");
    array_pop($arrayplayernames);
    foreach ($arrayplayersid as $playerid) {
        $query2 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
        $recordset = mysql_query($query2) or die(mysql_error());
        $row = mysql_fetch_array($recordset);
        $arrayplayername = array($row["name"]);
        $arrayplayernames = array_merge($arrayplayernames, $arrayplayername);
    }
    $playernames = "";
    foreach ($arrayplayernames as $playername) {
        $playernames = $playernames . $playername . ",";
    }
    $playernames = substr($playernames, 0, -1);
    return $gameid . ";" . $boss . ";" . $bosshealth . ";" . $weather . ";" . $gamestate . ";" . $roundcount . ";" . $story . ";" . $name . ";" . $health . ";" . $strength . ";" . $speed . ";" . $playermove . ";" . $playerstate . ";" . $playernames . ";" . $bossmaxhealth . ";" . $playermaxhealth . ";" . $gamecode;
    //16
}
Пример #2
0
function boss_attack_all($arrayplayersid)
{
    $target = "";
    foreach ($arrayplayersid as $playerid) {
        $target = $target . $playerid . ",";
    }
    $target = substr($target, 0, -1);
    $attack = mt_rand(number("boss_attack_one_min"), number("boss_attack_one_max"));
    return $target . ";" . $attack;
}
Пример #3
0
function log_action($user, $action) {
	if (!is_array($user) && strlen(number($user)) < 5)
		if ($u = user($user)) $user = $u;
	if (is_array($user)) $user = $user['phone'];
	redis()->lpush('actions', json_encode(array(
		'phone' => $user,
		'action' => $action,
		'time' => time(),
	)));
}
Пример #4
0
 /**
  * @param int $corporation_id
  *
  * @return mixed
  */
 public function getContractsData(int $corporation_id)
 {
     $contracts = $this->getCorporationContracts($corporation_id, false);
     return Datatables::of($contracts)->editColumn('issuerID', function ($row) {
         return view('web::partials.contractissuer', compact('row'))->render();
     })->editColumn('type', function ($row) {
         return view('web::partials.contracttype', compact('row'))->render();
     })->editColumn('price', function ($row) {
         return number($row->price);
     })->editColumn('reward', function ($row) {
         return number($row->reward);
     })->make('true');
 }
Пример #5
0
 /**
  * @param int $corporation_id
  *
  * @return mixed
  */
 public function getTransactionsData(int $corporation_id)
 {
     $transactions = $this->getCorporationWalletTransactions($corporation_id, false);
     return Datatables::of($transactions)->editColumn('transactionType', function ($row) {
         return view('web::partials.transactiontype', compact('row'))->render();
     })->editColumn('price', function ($row) {
         return number($row->price);
     })->addColumn('total', function ($row) {
         return number($row->price * $row->quantity);
     })->editColumn('clientName', function ($row) {
         return view('web::partials.transactionclient', compact('row'))->render();
     })->make(true);
 }
Пример #6
0
 function currency($amount)
 {
     $position = get('currency.position', 'before');
     $symbol = get('currency.symbol', '$');
     $str = '';
     if ($position === 'before') {
         $str .= $symbol;
     }
     $str .= number($amount);
     if ($position === 'after') {
         $str .= ' ' . $symbol;
     }
     return $str;
 }
Пример #7
0
function heal($playerid)
{
    $query1 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
    $recordset = mysql_query($query1) or die(mysql_error());
    $row = mysql_fetch_array($recordset);
    $gameid = $row["gameid"];
    //---build heal targets---//
    $query2 = "SELECT * FROM games WHERE gameid = '{$gameid}' ";
    $recordset = mysql_query($query2) or die(mysql_error());
    $row = mysql_fetch_array($recordset);
    $arraytargetsid = explode(",", $row["players"]);
    $arrayplayerid = array($playerid);
    $arraytargetsid = array_diff($arraytargetsid, $arrayplayerid);
    $healhealth = mt_rand(number("heal_health_min"), number("heal_health_max"));
    $healstrength = mt_rand(number("heal_strength_min"), number("heal_strength_max"));
    $healspeed = mt_rand(number("heal_speed_min"), number("heal_speed_max"));
    //---heal targets---//
    foreach ($arraytargetsid as $targetid) {
        $query3 = "SELECT * FROM players WHERE playerid = '{$targetid}' ";
        $recordset = mysql_query($query3) or die(mysql_error());
        $row = mysql_fetch_array($recordset);
        $health = $row["health"];
        $strength = $row["strength"];
        $speed = $row["speed"];
        if ($health > 0) {
            $newhealth = $health + $healhealth;
            $newstrength = $strength + $healstrength;
            $newspeed = $speed + $healspeed;
            if ($newhealth > number("starting_health")) {
                $newhealth = number("starting_health");
            }
            if ($newstrength > number("starting_strength")) {
                $newstrength = number("starting_strength");
            }
            if ($newspeed > number("starting_speed")) {
                $newspeed = number("starting_speed");
            }
            //---update stats---//
            $query2 = "UPDATE players SET health = ('{$newhealth}') WHERE playerid = '{$targetid}' ";
            mysql_query($query2) or die(mysql_error());
            $query3 = "UPDATE players SET strength = ('{$newstrength}') WHERE playerid = '{$targetid}' ";
            mysql_query($query3) or die(mysql_error());
            $query4 = "UPDATE players SET speed = ('{$newspeed}') WHERE playerid = '{$targetid}' ";
            mysql_query($query4) or die(mysql_error());
        }
    }
}
Пример #8
0
function get_wait_info($data)
{
    require_once 'common_natural_language.php';
    global $mysqli;
    $fork_key = $data['fork_key'];
    $sql = sprintf("select `Fork Key`,`Fork Result`,`Fork Scheduled Date`,`Fork Start Date`,`Fork State`,`Fork Type`,`Fork Operations Done`,`Fork Operations No Changed`,`Fork Operations Errors`,`Fork Operations Total Operations` from `Fork Dimension` where `Fork Key`=%d ", $fork_key);
    $res = $mysqli->query($sql);
    if ($row = $res->fetch_assoc()) {
        $result_extra_data = array();
        switch ($data['tag']) {
            case 'journals':
                $formated_tag = ' ' . ngettext('journal', 'journals', $row['Fork Operations Total Operations']);
                break;
            default:
                $formated_tag = ' ' . ngettext('record', 'records', $row['Fork Operations Total Operations']);
        }
        $etr = '';
        if ($row['Fork State'] == 'In Process') {
            //$msg=number($row['Fork Operations Done']+$row['Fork Operations Errors']+$row['Fork Operations No Changed']).'/'.$row['Fork Operations Total Operations'];
            $formated_status = _('In Process');
            $formated_progress = _('Processing') . ' ' . number($row['Fork Operations Done']) . ' ' . _('of') . ' ' . number($row['Fork Operations Total Operations']);
            $formated_progress .= $formated_tag;
            if ($row['Fork Operations Done'] > 1) {
                $etr = _('ETA') . ': ' . seconds_to_string(($row['Fork Operations Total Operations'] - $row['Fork Operations Done']) * (gmdate('U') - strtotime($row['Fork Start Date'])) / $row['Fork Operations Done']);
            }
        } elseif ($row['Fork State'] == 'Queued') {
            $formated_status = _('Queued');
            $formated_progress = _('Records to process') . ': ' . number($row['Fork Operations Total Operations']);
        } elseif ($row['Fork State'] == 'Finished') {
            $formated_status = _('Finished');
            $formated_progress = number($row['Fork Operations Done']) . $formated_tag . ' ' . _('processed');
        } elseif ($row['Fork State'] == 'Cancelled') {
            $formated_status = _('Cancelled');
            $formated_progress = number($row['Fork Operations Done']) . $formated_tag . ' ' . _('processed');
        } else {
            $formated_status = $row['Fork State'];
            $formated_progress = '';
        }
        $response = array('state' => 200, 'date' => gmdate('Y-m-d H:i:s'), 'fork_key' => $fork_key, 'fork_state' => $row['Fork State'], 'done' => number($row['Fork Operations Done']), 'no_changed' => number($row['Fork Operations No Changed']), 'errors' => number($row['Fork Operations Errors']), 'total' => number($row['Fork Operations Total Operations']), 'todo' => number($row['Fork Operations Total Operations'] - $row['Fork Operations Done']), 'result' => $row['Fork Result'], 'formated_status' => $formated_status, 'formated_progress' => $formated_progress . '<br>' . $etr, 'progress' => sprintf('%s/%s (%s)', number($row['Fork Operations Done']), number($row['Fork Operations Total Operations']), percentage($row['Fork Operations Done'], $row['Fork Operations Total Operations'])), 'tag' => $data['tag'], 'result_extra_data' => $result_extra_data, 'etr' => $etr);
        echo json_encode($response);
    } else {
        $response = array('state' => 400);
        echo json_encode($response);
    }
}
Пример #9
0
function new_player($name, $gameid, $browserinfo)
{
    $randomseed = substr(str_shuffle(str_repeat('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', mt_rand(1, 16))), 0, 16);
    $starting_health = number("starting_health");
    $starting_strength = number("starting_strength");
    $starting_speed = number("starting_speed");
    $query1 = "INSERT INTO players (name, gameid, health, strength, speed, playerstate, browserinfo) VALUES ('{$name}','{$gameid}','{$starting_health}','{$starting_speed}','{$starting_strength}','{$randomseed}','{$browserinfo}')";
    mysql_query($query1) or die(mysql_error());
    $query2 = "SELECT * FROM players WHERE name = '{$name}' AND playerstate = '{$randomseed}' ";
    $recordset = mysql_query($query2) or die(mysql_error());
    $row = mysql_fetch_array($recordset);
    $playerid = $row["playerid"];
    $query3 = "UPDATE players SET playerstate = ('setting up') WHERE playerid = '{$playerid}' AND playerstate = '{$randomseed}' ";
    mysql_query($query3) or die(mysql_error());
    $query4 = "UPDATE games SET players = CONCAT(players,'{$playerid},') WHERE gameid = '{$gameid}' ";
    mysql_query($query4) or die(mysql_error());
    return $playerid;
}
Пример #10
0
 /**
  * @param int $character_id
  *
  * @return mixed
  */
 public function getMarketData(int $character_id)
 {
     $orders = $this->getCharacterMarketOrders($character_id, false);
     $states = $this->getEveMarketOrderStates();
     return Datatables::of($orders)->addColumn('bs', function ($row) {
         return view('web::partials.marketbuysell', compact('row'))->render();
     })->addColumn('vol', function ($row) {
         return view('web::partials.marketvolume', compact('row'))->render();
     })->addColumn('state', function ($row) use($states) {
         return $states[$row->orderState];
     })->editColumn('price', function ($row) {
         return number($row->price);
     })->addColumn('total', function ($row) {
         return number($row->price * $row->volEntered);
     })->editColumn('typeName', function ($row) {
         return view('web::partials.markettype', compact('row'))->render();
     })->make(true);
 }
Пример #11
0
function boss_move($gameid)
{
    $query1 = "SELECT * FROM games WHERE gameid = '{$gameid}' ";
    $recordset = mysql_query($query1) or die(mysql_error());
    $row = mysql_fetch_array($recordset);
    $players = $row["players"];
    $arrayplayersid = explode(",", $players);
    array_pop($arrayplayersid);
    $randomnumber = mt_rand(0, 99);
    //---defend---//
    if ($randomnumber < number("percentage_boss_dodge")) {
        $move = "dodge";
    } elseif ($randomnumber > number("percentage_boss_dodge") - 1 and $randomnumber < number("percentage_boss_dodge") + number("percentage_boss_attack_all")) {
        $move = "attackall";
    } elseif ($randomnumber > 99 - number("percentage_boss_attack_one")) {
        $move = "attackone";
    }
    return $move;
}
Пример #12
0
function change_weather($weather)
{
    $randomchange = mt_rand(0, 99);
    if ($randomchange > number("percentage_weather_change")) {
        $newweather = $weather;
    } else {
        $randomweather = mt_rand(0, 99);
        if ($randomweather < number("percentage_weather_sunny")) {
            $newweather = "sunny";
        } elseif ($randomweather > number("percentage_weather_sunny") - 1 and $randomweather < number("percentage_weather_sunny") + number("percentage_weather_windy")) {
            $newweather = "windy";
        } elseif ($randomweather > number("percentage_weather_sunny") + number("percentage_weather_windy") - 1 and $randomweather < number("percentage_weather_sunny") + number("percentage_weather_windy") + number("percentage_weather_rainy")) {
            $newweather = "rainy";
        } elseif ($randomweather > 99 - number("percentage_weather_snowy")) {
            $newweather = "snowy";
        }
    }
    return $newweather;
}
Пример #13
0
function struk($pembelian, $bayar, $voucher = 0, $output = null)
{
    $recipe = new RecipeMaker(40);
    $recipe->center('NIMCO STORE')->breaks();
    $recipe->center('Jl. Cendrawasih No. 25')->breaks();
    $recipe->center('Demangan Baru Yogyakarta')->breaks();
    $recipe->center('Telp : ( 0274 ) 549827')->breaks();
    $recipe->breaks(' ');
    $recipe->left('TRNS-00001')->right('Nama Kasir')->breaks();
    $recipe->left(date('d-m-Y'))->right('Nama Member')->breaks();
    $recipe->breaks('-');
    $jual = 0;
    $total_diskon = 0;
    $grand_total = 0;
    foreach ($pembelian as $key => $value) {
        $value['sub_total'] = $value['harga'] * $value['qty'];
        $jual += $value['sub_total'];
        $recipe->left($value['kode'] . ' (' . $value['qty'] . ' x ' . number($value['harga']) . ')')->right(number($value['sub_total']))->sparator()->breaks();
        if ($value['diskon']) {
            $diskon = $value['diskon'] * $value['sub_total'] / 100;
            $recipe->left('- Diskon (' . $value['diskon'] . '%)')->right(number($diskon))->sparator()->breaks();
            $total_diskon += $diskon;
        }
    }
    $grand_total = $jual - ($total_diskon + $voucher);
    $kembali = $bayar - $grand_total;
    $recipe->breaks('-');
    $recipe->left('Harga Jual')->right(number($jual))->sparator()->breaks();
    $recipe->left('Total Diskon')->right(number($total_diskon))->sparator()->breaks();
    $recipe->left('Voucher')->right(number($voucher))->sparator()->breaks();
    $recipe->left('Grand Total')->right(number($grand_total))->sparator()->breaks();
    $recipe->left('Bayar')->right(number($bayar))->sparator()->breaks();
    $recipe->left('Kembali')->right(number($kembali))->sparator()->breaks();
    $recipe->breaks(' ');
    $recipe->center('Terima Kasih & Selamat Belanja Kembali')->breaks();
    $recipe->end();
    if ($output == 'HTML') {
        return $recipe->outputHTML();
    } else {
        return $recipe->output();
    }
}
Пример #14
0
function boss_attack_one($arrayplayersid)
{
    $arraytargets = array("");
    array_pop($arraytargets);
    foreach ($arrayplayersid as $playerid) {
        $query2 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
        $recordset = mysql_query($query2) or die(mysql_error());
        $row = mysql_fetch_array($recordset);
        $health = $row["health"];
        $arrayplayerid = array($playerid);
        $x = 0;
        while ($x < $health) {
            $arraytargets = array_merge($arraytargets, $arrayplayerid);
            $x = $x + 1;
        }
    }
    shuffle($arraytargets);
    $target = $arraytargets[0];
    $attack = mt_rand(number("boss_attack_one_min"), number("boss_attack_one_max"));
    return $target . ";" . $attack;
}
Пример #15
0
function start_game($gameid)
{
    $query1 = "UPDATE games SET gamestate=('playerturn') WHERE gameid = '{$gameid}' ";
    mysql_query($query1) or die(mysql_error());
    $query2 = "SELECT * FROM players WHERE gameid =('{$gameid}') ";
    $recordset = mysql_query($query2) or die(mysql_error());
    $arrayplayersid = array("");
    array_pop($arrayplayersid);
    while ($row = mysql_fetch_array($recordset)) {
        $playerid = $row["playerid"];
        $arrayplayerid = array($playerid);
        $arrayplayersid = array_merge($arrayplayersid, $arrayplayerid);
    }
    $bosshealth = 0;
    foreach ($arrayplayersid as $playerid) {
        $query3 = "UPDATE players SET playerstate =('playerturn') WHERE playerid = '{$playerid}' ";
        mysql_query($query3) or die(mysql_error());
        $bosshealth = $bosshealth + number("starting_boss_health_per_player");
    }
    $query4 = "UPDATE games SET bosshealth = ('{$bosshealth}') WHERE gameid = '{$gameid}' ";
    mysql_query($query4) or die(mysql_error());
    return $gameid;
}
Пример #16
0
 function print_link()
 {
     //generate template
     function number($i, $number)
     {
         //return ereg_replace("^(.*)%%number%%(.*)$","\\1$i\\2",$number);
         return preg_replace("/^(.*)%%number%%(.*)\$/", "({$i})", $number);
     }
     $print_link = false;
     if ($this->p["count"] > $this->p["baris"]) {
         // print prev
         if ($this->page > 1) {
             $print_link .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "&page=" . ($this->page - 1) . "\">" . $this->prev . "</a>\n";
         }
         // set number
         $this->p["bawah"] = $this->page - $this->p["langkah"];
         if ($this->p["bawah"] < 1) {
             $this->p["bawah"] = 1;
         }
         $this->p["atas"] = $this->page + $this->p["langkah"];
         if ($this->p["atas"] > $this->p["total_page"]) {
             $this->p["atas"] = $this->p["total_page"];
         }
         // print start
         if ($this->page != 1) {
             for ($i = $this->p["bawah"]; $i <= $this->page - 1; $i++) {
                 $print_link .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "&page={$i}\">" . number($i, $this->number) . "</a>\n";
             }
         }
         // print active
         if ($this->p["total_page"] > 1) {
             $print_link .= "<b>" . number($this->page, $this->number) . "</b>\n";
         }
         // print end
         for ($i = $this->page + 1; $i <= $this->p["atas"]; $i++) {
             $print_link .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "&page={$i}\">" . number($i, $this->number) . "</a>\n";
         }
         // print next
         if ($this->page < $this->p["total_page"]) {
             $print_link .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?" . $_SERVER["QUERY_STRING"] . "&page=" . ($this->page + 1) . "\">" . $this->next . "</a>\n";
         }
         return $print_link;
     }
 }
Пример #17
0
                    $value = $row["partition_values"][$key];
                    $partitions[] = "\n  PARTITION " . idf_escape($val) . " VALUES " . ($row["partition_by"] == 'RANGE' ? "LESS THAN" : "IN") . ($value != "" ? " ({$value})" : " MAXVALUE");
                    //! SQL injection
                }
            }
            $partitioning .= "\nPARTITION BY {$row['partition_by']}({$row['partition']})" . ($partitions ? " (" . implode(",", $partitions) . "\n)" : ($row["partitions"] ? " PARTITIONS " . +$row["partitions"] : ""));
        } elseif (support("partitioning") && preg_match("~partitioned~", $table_status["Create_options"])) {
            $partitioning .= "\nREMOVE PARTITIONING";
        }
        $message = lang('Table has been altered.');
        if ($TABLE == "") {
            cookie("adminer_engine", $row["Engine"]);
            $message = lang('Table has been created.');
        }
        $name = trim($row["name"]);
        queries_adminer_redirect(ME . (support("table") ? "table=" : "select=") . urlencode($name), $message, alter_table($TABLE, $name, $jush == "sqlite" && ($use_all_fields || $foreign) ? $all_fields : $fields, $foreign, $row["Comment"] != $table_status["Comment"] ? $row["Comment"] : null, $row["Engine"] && $row["Engine"] != $table_status["Engine"] ? $row["Engine"] : "", $row["Collation"] && $row["Collation"] != $table_status["Collation"] ? $row["Collation"] : "", $row["Auto_increment"] != "" ? number($row["Auto_increment"]) : "", $partitioning));
    }
}
page_header($TABLE != "" ? lang('Alter table') : lang('Create table'), $error, array("table" => $TABLE), h($TABLE));
if (!$_POST) {
    $row = array("Engine" => $_COOKIE["adminer_engine"], "fields" => array(array("field" => "", "type" => isset($types["int"]) ? "int" : (isset($types["integer"]) ? "integer" : ""))), "partition_names" => array(""));
    if ($TABLE != "") {
        $row = $table_status;
        $row["name"] = $TABLE;
        $row["fields"] = array();
        if (!$_GET["auto_increment"]) {
            // don't prefill by original Auto_increment for the sake of performance and not reusing deleted ids
            $row["Auto_increment"] = "";
        }
        foreach ($orig_fields as $field) {
            $field["has_default"] = isset($field["default"]);
Пример #18
0
    <p>Địa chỉ: ' . $_POST['add'] . '</p>
    <br />
    <hr />
    <p><strong>Nội dung:</strong></p>
    <br />';
        foreach ($_SESSION['shopcart'] as $id => $tol) {
            $product = @mysql_fetch_array(@mysql_query("SELECT product_code, product_name, product_price FROM cnt_products WHERE id = " . $id));
            $p_monney = $product['product_price'] * $tol;
            $monney += $p_monney;
            if ($i < 1) {
                $content = $id . ':' . $tol;
            } else {
                $content .= ',' . $id . ':' . $tol;
            }
            $i++;
            $mail .= '<p>' . $product['product_name'] . '<em>(' . $product['product_code'] . ')</em>: ' . number($product['product_price']) . ' VNĐ x ' . number($tol) . ' = ' . number($p_monney) . ' VNĐ</p>';
        }
        $mail .= '<p>--------------------------------</p>
    <p><strong>Tổng cộng: ' . number($monney) . ' VNĐ</strong></p>
</div>';
        @mysql_query("INSERT INTO cnt_bills (bill_name, bill_email, bill_phone, bill_fax, bill_add, bill_content, bill_user, bill_time) VALUES ('" . $_POST['name'] . "', '" . $_POST['email'] . "', '" . $_POST['phone'] . "', '" . $_POST['fax'] . "', '" . $_POST['add'] . "', '" . $content . "', " . ($_SESSION['user']['id'] ? $_SESSION['user']['id'] : 0) . ", " . time() . ")");
        $_SESSION['pay'] = true;
        unset($_SESSION['shopcart']);
        @mail($_POST['email'], get_option('name') . " | Đơn đặt hàng tại Website: " . get_option('url'), $mail . "<br />Vui lòng thanh toán để nhận được hàng sớm nhất.<br />-------------------------------------------------------<br />" . get_option('name') . "<br />Email: " . get_option('email') . "<br />Website: " . get_option('url'), "From: " . get_option('email') . "\r\nReply-To: " . get_option('email') . "\r\nContent-type:text/html; charset=UTF-8\r\n\n\\ ");
        header('Location: shopcart.html');
    } else {
        header('Location: shopcart.html');
    }
} else {
    echo "Hacking attempt";
}
Пример #19
0
 function get($key)
 {
     //print $key;
     if (array_key_exists($key, $this->data)) {
         return $this->data[$key];
     }
     switch ($key) {
         case 'Login Count':
         case 'Failed Login Count':
             return number($this->data['User ' . $key]);
             break;
         case 'Created ':
         case 'Last Failed Login':
         case 'Last Login':
             if ($this->data['User ' . $key] == '' or $this->data['User ' . $key] == '0000-00-00 00:00:00') {
                 return '';
             } else {
                 return strftime("%e %b %Y %H:%M %Z", strtotime($this->data['User ' . $key] . " +00:00"));
             }
             break;
         case 'User Pasword':
             return "******";
     }
 }
Пример #20
0
 } else {
     if ($planetinfo['facility_hydroponics'] == "Y" && $planetinfo['facility_research'] == "Y" && $planetinfo['facility_military'] == "Y" && $planetinfo['facility_medical'] == "Y" && $planetinfo['facility_solarplant'] == "Y" && $planetinfo['facility_shipyard'] == "Y" && $planetinfo['facility_bank'] == "Y") {
     } else {
         echo "You have a base on this planet.<br/><br/>FACILITIES NOT ACTIVE, ARE CURRENTLY IN STATISCIAL TEST MODE, YOU MAY BUILD THEM, BUT THATS ALL. This is to aid refining a new economy for use within the game, need to ensure its not too fast or too slow!<br/><br/>";
     }
     if ($planetinfo['facility_hydroponics'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_hydroponics>Build</a> a hydroponics facility <span class='planet-facilities-requiremenets'>(Requires: " . NUMBER($requirement_hydro_credits) . " Credits / Organics: " . NUMBER($requirement_hydro_organics) . " / Goods: " . NUMBER($requirement_hydro_goods) . " )</span><br/> <sub>Allows planet to generate food without requiring the colonists to farm food, also produces food required for your ships crew!</sub><br/>";
     }
     if ($planetinfo['facility_bank'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_bank>Build</a> a marketing facility <span class='planet-facilities-requiremenets'>(Requires: " . NUMBER($requirement_banking_creds) . " Credits / Military Facility)</span><br/> <sub>Allows your people to set up buisness, industry etc, supplies your empire with Rare Ores</sub><br/>";
     }
     if ($planetinfo['facility_shipyard'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_shipyard>Build</a> a shipyard facility <span class='planet-facilities-requiremenets'>(Requires: " . NUMBER($requirement_shipyard_credits) . " Credits / Goods: " . number($requirement_shipyard_goods) . " / Ore: " . NUMBER($requirement_shipyard_ore) . " / Military Facility)</span><br/> <sub>Builds parts required for upgrading your ship.</sub><br/>";
     }
     if ($planetinfo['facility_solarplant'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_solarplant>Build</a> a solarplant facility <span class='planet-facilities-requiremenets'>(Requires: " . NUMBER($requirement_solar_credits) . " Credits / Goods: " . number($requirement_solar_goods) . " / Ore: " . NUMBER($requirement_solar_ore) . ")</span><br/> <sub>Used to power planets shields and beams, also to produce organic energy cells (Cells).</sub><br/>";
     }
     if ($planetinfo['facility_medical'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_medical>Build</a> a medical facility <span class='planet-facilities-requiremenets'>(Requires: " . NUMBER($requirement_medical_credits) . " Credits / Goods: " . NUMBER($requirement_medical_goods) . " / Colonists: " . NUMBER($requirement_medical_cols) . " / Hydroponics Facility)</span><br/> <sub>Better healthcare for your colonists, significantly reduced chance of a zombie outbreak!</sub><br/>";
     }
     if ($planetinfo['facility_military'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_military>Build</a> a military facility <span class='planet-facilities-requiremenets'>(Requires: " . NUMBER($requirement_military_credits) . " Credits / Fighters: " . NUMBER($requirement_military_figs) . " / Torpedoes: " . NUMBER($requirement_military_torps) . " / Colonists: " . NUMBER($requirement_military_cols) . ")</span><br/> <sub>Strengthens your planets defences!</sub><br/>";
     }
     if ($planetinfo['facility_research'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_research>Build</a> a research facility <span class='planet-facilities-requiremenets'>(Requires: " . NUMBER($requirement_research_credits) . " Credits / Colonists: " . NUMBER($requirement_research_cols) . ")</span><br/> <sub>Increases the hacking ability of your ship!</sub><br/>";
     }
     if ($planetinfo['facility_homeworld'] == "N") {
         echo "<a href=planet.php?planet_id={$planet_id}&command=facility_homeworld>Build</a> a homeworld senate <span class='planet-facilities-requiremenets'>(Requires: Research Facility, Military Facility, Solar Plant Facility, Medical Facility, Shipyard Facility, Banking Facility, Hydrophonics Facility.)</span><br/> <sub>Allows you to assign a senator to the planet!</sub><br/>";
     }
 }
 echo "<br/><a href=log2.php>View</a> Players Log<br/>";
Пример #21
0
/**
 * ------------------------------
 * 把一个数组中的值转成number
 * ------------------------------
 * @param  array $arr
 * @return array
 */
function number($arr)
{
    if (is_array($arr)) {
        foreach ($arr as $k => $v) {
            $arr[$k] = number($v);
        }
        return $arr;
    }
    return ceil($arr);
}
Пример #22
0
function get_results($data)
{
    global $mysqli;
    $fork_key = $data['fork_key'];
    $result_data = array('compilant' => 0, 'no_compilant' => 0, 'total_no_compilant' => 0, 'green' => 0, 'gold' => 0, 'green_and_gold' => 0, 'error' => 0, 'ok' => 0);
    $sql = sprintf("select count(*) as number,`Result Type` from `Result Dimension` where `Fork Key`=%d group by `Result Type`", $fork_key);
    $res = $mysqli->query($sql);
    while ($row = $res->fetch_assoc()) {
        if ($row['Result Type'] == 'Ok') {
            $result_data['ok'] = number($row['number']);
        } elseif ($row['Result Type'] == 'Error') {
            $result_data['error'] = number($row['number']);
            $result_data['total_no_compilant'] = $row['number'];
        }
    }
    $sql = sprintf("select count(*) as number,`Compilance` from `Result Dimension` where `Fork Key`=%d and `Result Type`='Ok' group by `Compilance`", $fork_key);
    $res = $mysqli->query($sql);
    while ($row = $res->fetch_assoc()) {
        if ($row['Compilance'] == 'Yes') {
            $result_data['compilant'] = number($row['number']);
        } else {
            $result_data['no_compilant'] = number($row['number']);
            $result_data['total_no_compilant'] += $row['number'];
        }
    }
    $sql = sprintf("select count(*) as number,`Compilance Type` from `Result Dimension` where `Fork Key`=%d and `Compilance`='Yes' group by `Compilance Type`", $fork_key);
    $res = $mysqli->query($sql);
    while ($row = $res->fetch_assoc()) {
        if ($row['Compilance Type'] == 'Green') {
            $result_data['green'] = number($row['number']);
        } elseif ($row['Compilance Type'] == 'Gold') {
            $result_data['gold'] = number($row['number']);
        } elseif ($row['Compilance Type'] == 'GreenGold') {
            $result_data['green_and_gold'] = number($row['number']);
        }
    }
    $response = array('state' => 200, 'fork_key' => $fork_key, 'result_data' => $result_data);
    header('Content-Type: application/json');
    echo json_encode($response);
}
Пример #23
0
             }
             $tpl->assign('lb_paging', paging(get_option('paging'), $current_page, $total_b, 'index.php?m=14&sm=1', $modpage . '&page=', false));
             break;
         case '2':
             $bill = @mysql_fetch_array(@mysql_query("SELECT bill_name, bill_phone, bill_fax, bill_email, bill_add, bill_content, bill_time FROM cnt_bills WHERE id = " . $_GET['id']));
             $data = explode(',', $bill['bill_content']);
             $monney = 0;
             foreach ($data as $item) {
                 $item = explode(':', $item);
                 $product = @mysql_fetch_array(@mysql_query("SELECT product_code, product_name, product_price FROM cnt_products WHERE id = " . $item[0]));
                 $p_monney = $product['product_price'] * $item[1];
                 $monney += $p_monney;
                 $tpl->assign(array('product_name' => $product['product_name'], 'product_code' => $product['product_code'], 'product_price' => number($product['product_price']), 'product_total' => number($item[1]), 'monney' => number($p_monney)));
                 $tpl->parse('cart_product');
             }
             $tpl->assign(array('monney_total' => number($monney), 'bill_id' => $_GET['id'], 'bill_name' => $bill['bill_name'], 'bill_phone' => $bill['bill_phone'], 'bill_fax' => $bill['bill_fax'] ? $bill['bill_fax'] : 'Không có', 'bill_email' => $bill['bill_email'], 'bill_add' => $bill['bill_add'], 'bill_time' => formatTime($bill['bill_time'], 2)));
             break;
     }
     break;
 case '15':
     $this_menu = '| Tin nhắn';
     switch ($sub_menu) {
         case '0':
             $inbox_list = @mysql_query("SELECT id, message_from, message_title, message_read, message_time FROM cnt_messages WHERE message_to = " . $_SESSION['user']['id'] . " ORDER BY id DESC");
             while ($linbox = @mysql_fetch_array($inbox_list)) {
                 list($m_user) = @mysql_fetch_array(@mysql_query("SELECT user_nick FROM cnt_users WHERE id = " . $linbox['message_from']));
                 $tpl->assign(array('lmes_id' => $linbox['id'], 'lmes_from' => $m_user, 'lmes_title' => $linbox['message_title'], 'lmes_read' => $linbox['message_read'] == 1 ? '' : 'font-weight: bold;', 'lmes_time' => formatTime($linbox['message_time'], 1)));
                 $tpl->parse('list_inbox');
             }
             $this_menu .= ' | Tin nhắn đến';
             break;
Пример #24
0
<?php

/*-----------------------------------*\
|           Copyright © CNT           | 
|         Phone: 0986.901.797         |
|         Y!m: banmai_xanhmai         |
|       Website: CongNgheTre.Vn       |
|     Email: PeakOfMusic@Gmail.Com    |
\*-----------------------------------*/
define('CNT', true);
include 'cnt-includes/config.php';
include 'cnt-includes/functions.php';
if ($_POST['id']) {
    $_SESSION['shopcart'][$_POST['id']]++;
}
if (!$_SESSION['shopcart']) {
    echo '<p><strong>Chưa có sản phẩm</strong></p>';
} else {
    foreach ($_SESSION['shopcart'] as $id => $total) {
        $product = @mysql_fetch_array(@mysql_query("SELECT product_name, product_price FROM cnt_products WHERE id = " . $id));
        $monney += $product['product_price'] * $total;
        $sl += $total;
    }
    echo '<p style="font-size: 11px;"><strong>Số sản phẩm: ' . $sl . '<strong></p>';
    echo '<p style="font-size: 11px;"><strong>Tổng tiền: ' . number($monney) . ' VND<strong></p>';
    echo '<p align="center"><strong><a href="' . get_option('url') . '/shopcart.html">Xem giỏ hàng</a></strong></p>';
}
			<th>Summa</th>
			<th>Kommentar</th>
		</tr>
	</thead>
	<tbody>
		<? foreach(Delivery::selection(array('@order' => 'timestamp:desc')) as $delivery): ?>
			<tr>
				<td><a href="/view_delivery/<?php 
echo $delivery->id;
?>
"><?php 
echo $delivery->timestamp;
?>
</a></td>
				<td><?php 
echo $delivery->User;
?>
</td>
				<td class="numeric"><?php 
echo number(DeliveryContent::sum(array('cost', '*', 'count'), array('delivery_id' => $delivery->id)));
?>
 kr</td>
				<td class="pre"><?php 
echo $delivery->description;
?>
</td>
			</tr>
		<? endforeach ?>
	</tbody>
</table>
Пример #26
0
function sample_xset()
{
    return exercise_set(name('sample exercise set'), number(1), exercise(name('exercise 1'), filename('bolt_sample_exercise.php?n=1')));
}
    if ($medArray[$i]['DosageFrequencyDescription']) {
        $qint = sqlStatement("SELECT option_id FROM list_options WHERE list_id='drug_interval' AND title = ?", array($medArray[$i]['DosageFrequencyDescription']));
        $rint = sqlFetchArray($qint);
        if (sqlNumRows($qint) <= 0) {
            $rint = sqlQuery("SELECT option_id AS option_id FROM list_options WHERE list_id='drug_interval' ORDER BY ABS(option_id) DESC LIMIT 1");
            sqlQuery("INSERT INTO list_options (list_id,option_id,title,seq) VALUES ('drug_interval',?,?,?)", array($rint['option_id'] + 1, $medArray[$i]['DosageFrequencyDescription'], $rint['option_id'] + 1));
            $rint['option_id'] = $rint['option_id'] + 1;
        }
    }
    $check = sqlStatement("select * from prescriptions where prescriptionguid=? and patient_id=? and prescriptionguid is not null", array($medArray[$i]['PrescriptionGuid'], $medArray[$i]['ExternalPatientID']));
    $prescription_id = '';
    if (sqlNumRows($check) == 0) {
        $prescription_id = sqlInsert("insert into prescriptions \n        (\n            patient_id,provider_id,encounter,date_added,drug,drug_id,drug_info_erx,form,dosage,size,unit,route,`INTERVAL`,refills,note,`DATETIME`,\n            `USER`,site,prescriptionguid,erx_source,rxnorm_drugcode\n        )\n        values\n        (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,NOW(),?,?,?,'1',?)", array($medArray[$i]['ExternalPatientID'], $provider['id'], $encounter, substr($medArray[$i]['PrescriptionDate'], 0, 10), $medArray[$i]['DrugName'], $medArray[$i]['DrugID'], $medArray[$i]['DrugInfo'], $rin['option_id'], $medArray[$i]['DosageNumberDescription'], number($medArray[$i]['Strength']), $runit['option_id'], $rroute['option_id'], $rint['option_id'], $medArray[$i]['Refills'], $medArray[$i]['PrescriptionNotes'], $_SESSION['authUserID'], $medArray[$i]['SiteID'], $medArray[$i]['PrescriptionGuid'], $medArray[$i]['rxcui']));
        $j++;
    } else {
        sqlQuery("update prescriptions set \n        provider_id=?, drug=?, drug_id=?, drug_info_erx=?, form=?, dosage=?, size=? ,unit=?, route=?, `INTERVAL`=?, refills=?, note=?, \n        `DATETIME`=NOW(),`USER`=?, site=? ,erx_source='1', rxnorm_drugcode=?, active='1'\n        WHERE prescriptionguid=? AND patient_id=?\n        ", array($provider['id'], $medArray[$i]['DrugName'], $medArray[$i]['DrugID'], $medArray[$i]['DrugInfo'], $rin['option_id'], $medArray[$i]['DosageNumberDescription'], number($medArray[$i]['Strength']), $runit['option_id'], $rroute['option_id'], $rint['option_id'], $medArray[$i]['Refills'], $medArray[$i]['PrescriptionNotes'], $_SESSION['authUserID'], $medArray[$i]['SiteID'], $medArray[$i]['rxcui'], $medArray[$i]['PrescriptionGuid'], $medArray[$i]['ExternalPatientID']));
    }
    $result = sqlFetchArray($check);
    if ($result['id']) {
        $prescription_id = $result['id'];
    }
    processAmcCall('e_prescribe_amc', true, 'add', $medArray[$i]['ExternalPatientID'], 'prescriptions', $prescription_id);
}
if ($j != 0) {
    sqlQuery("update patient_data set soap_import_status=? where pid=?", array('2', $pid));
}
if ($xml_response_count == 0) {
    echo htmlspecialchars(xl("Nothing to import for Prescription"), ENT_NOQUOTES);
} elseif ($xml_response_count > 0) {
    echo htmlspecialchars(xl("Prescription History import successfully completed"), ENT_NOQUOTES);
}
Пример #28
0
//
//		echo  " <br> ";
//	}
?>



<?php 
if (isset($_POST['submit'])) {
    $num2 = $_POST['number'];
    function number($num1, $num2)
    {
        echo "Even numbers : ";
        for ($s = $num1; $s <= $num2; $s++) {
            if ($s % 2 == 0) {
                echo $s . " , ";
            }
        }
        echo "<br>" . " Odd numbers : ";
        for ($s = $num1; $s <= $num2; $s++) {
            if ($s % 2 != 0) {
                echo $s . " , ";
            }
        }
    }
    echo number(0, $num2);
}
?>
</body>
</html>
Пример #29
0
function game_move($gameid)
{
    $query1 = "SELECT * FROM games WHERE gameid = '{$gameid}' ";
    $recordset = mysql_query($query1) or die(mysql_error());
    $row = mysql_fetch_array($recordset);
    $gamestate = $row["gamestate"];
    $arrayplayersid = explode(",", $row["players"]);
    array_pop($arrayplayersid);
    $bosshealth = $row["bosshealth"];
    $boss = $row["boss"];
    $roundcount = $row["roundcount"];
    $weather = $row["weather"];
    //---prevent duplicative gameturns---//
    if ($gamestate == "calculating") {
        return "calculating";
    } else {
        $query2 = "UPDATE games SET gamestate = ('calculating') WHERE gameid = '{$gameid}' ";
        mysql_query($query2) or die(mysql_error());
        $story = "";
        //---attack the boss---//
        $totalattack = 0;
        foreach ($arrayplayersid as $playerid) {
            $query3 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
            $recordset = mysql_query($query3) or die(mysql_error());
            $row = mysql_fetch_array($recordset);
            $move = $row["playermove"];
            $raineffect = mt_rand(0, 99);
            $snoweffect = mt_rand(0, 99);
            if ($move == "attack" and $weather == "rainy" and $raineffect < number("percentage_rainy_miss")) {
                $story = $story . "Rain prevents @" . $playerid . "&'s attack.,";
                //story
            } elseif ($move == "attack" and $weather == "snowy" and $snoweffect < number("percentage_snowy_miss")) {
                $story = $story . "Snow prevents @" . $playerid . "&'s attack.,";
                //story
            } elseif ($move == "attack") {
                $attack = attack($playerid);
                $windeffect = mt_rand(0, 99);
                if ($weather == "windy" and $windeffect < number("percentage_windy_reduce")) {
                    $attack = $attack * number("windy_multiplier");
                    $story = $story . "Wind reduces @" . $playerid . "&'s attack to " . $attack . " damage.,";
                    //story
                } else {
                    $story = $story . "<i>@" . $playerid . "&" . storytime("attack") . "</i>,";
                    //storytime
                    $story = $story . "@" . $playerid . "& attacks for " . $attack . " damage.,";
                    //story
                }
                $totalattack = $totalattack + $attack;
            }
        }
        $bossmove = boss_move($gameid);
        //---boss dodges---//
        if ($bossmove == "dodge") {
            $totalattack = $totalattack * number("boss_dodge_multiplier");
            $story = $story . "The " . $boss . " dodges to escape some damage.,";
            //story
        }
        //---boss takes damage---//
        $story = $story . "The " . $boss . " takes " . $totalattack . " damage.,";
        //story
        $query4 = "SELECT * FROM games WHERE gameid = '{$gameid}' ";
        $recordset = mysql_query($query4) or die(mysql_error());
        $row = mysql_fetch_array($recordset);
        $bosshealth = $row["bosshealth"];
        $newbosshealth = $bosshealth - $totalattack;
        $query5 = "UPDATE games SET bosshealth = ('{$newbosshealth}') WHERE gameid = '{$gameid}' ";
        mysql_query($query5) or die(mysql_error());
        //---boss deals damage---//
        if ($newbosshealth > 0) {
            $windeffect2 = mt_rand(0, 99);
            $snoweffect2 = mt_rand(0, 99);
            //---weather: wind fail---//
            if (($bossmove == "attackone" or $bossmove == "attackall") and $weather == "windy" and $windeffect2 < number("percentage_windy_miss")) {
                $story = $story . "The wind causes the " . $boss . "'s attack to miss.,";
                //story
            } elseif (($bossmove == "attackone" or $bossmove == "attackall") and $weather == "snowy" and $snoweffect2 < number("percentage_snowy_miss")) {
                $story = $story . "The snow causes the " . $boss . "'s attack to miss.,";
                //story
            } elseif ($bossmove == "attackone") {
                $arraybossattack = explode(";", boss_attack_one($arrayplayersid));
                $target = $arraybossattack[0];
                $damage = $arraybossattack[1];
                $raineffect2 = mt_rand(0, 99);
                if ($weather == "rainy" and $raineffect2 < number("percentage_rainy_reduce")) {
                    $damage = $damage * number("rainy_multiplier");
                    $story = $story . "The rain reduces the " . $boss . "'s attack.,";
                    //story
                }
                $query6 = "SELECT * FROM players WHERE playerid = '{$target}' ";
                $recordset = mysql_query($query6) or die(mysql_error());
                $row = mysql_fetch_array($recordset);
                $currenthealth = $row["health"];
                //---player dodges---//
                $move = $row["playermove"];
                if ($move == "dodge") {
                    $story = $story . "@" . $target . "& dodges.,";
                    //story
                    $damage = $damage - dodge($target);
                    if ($damage < 0) {
                        $damage = 0;
                        $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . ",</i>";
                        //storytime
                        $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack and takes no damage.,";
                        //story
                    } else {
                        $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . ",</i>";
                        //storytime
                        $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack but takes " . $damage . " damage.,";
                        //story
                    }
                } else {
                    $story = $story . "<i>The " . $boss . storytime("boss") . ",</i>";
                    //storytime
                    $story = $story . "The " . $boss . " focuses an attack on @" . $target . "& for " . $damage . " damage.,";
                    //story
                }
                //---player takes damage---//
                $newhealth = $currenthealth - $damage;
                $query7 = "UPDATE players SET health = ('{$newhealth}') WHERE playerid = '{$target}' ";
                mysql_query($query7) or die(mysql_error());
            } elseif ($bossmove == "attackall") {
                $story = $story . "<i>The " . $boss . storytime("boss") . "</i>,";
                //storytime
                $story = $story . "The " . $boss . " attacks everyone.,";
                //story
                $arraybossattack = explode(";", boss_attack_all($arrayplayersid));
                $arraytargets = explode(",", $arraybossattack[0]);
                $damage = $arraybossattack[1];
                $raineffect2 = mt_rand(0, 99);
                if ($weather == "rainy" and $raineffect2 < number("percentage_rainy_miss")) {
                    $damage = $damage * number("rainy_multiplier");
                    $story = $story . "The rain reduces the " . $boss . "'s attack.,";
                    //story
                }
                foreach ($arraytargets as $target) {
                    $query8 = "SELECT * FROM players WHERE playerid = '{$target}' ";
                    $recordset = mysql_query($query8) or die(mysql_error());
                    $row = mysql_fetch_array($recordset);
                    $currenthealth = $row["health"];
                    //---player dodges---//
                    $move = $row["playermove"];
                    if ($move == "dodge") {
                        $damage = $damage - dodge($target);
                        if ($damage < 0) {
                            $damage = 0;
                            $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . "</i>,";
                            //storytime
                            $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack and takes no damage.,";
                            //story
                        } else {
                            $story = $story . "<i>@" . $playerid . "&" . storytime("dodge") . "</i>,";
                            //storytime
                            $story = $story . "@" . $target . "& dodges the " . $boss . "'s attack but takes " . $damage . " damage.,";
                            //story
                        }
                    } else {
                        $story = $story . "@" . $target . "& takes " . $damage . " damage from the " . $boss . " attack.,";
                        //story
                    }
                    //---player takes damage---//
                    $newhealth = $currenthealth - $damage;
                    $query9 = "UPDATE players SET health = ('{$newhealth}') WHERE playerid = '{$target}' ";
                    mysql_query($query9) or die(mysql_error());
                }
            }
        } else {
            $story = $story . "The " . $boss . " is defeated!,";
            $endgame = "victory";
        }
        //---players heal---//
        foreach ($arrayplayersid as $playerid) {
            $query10 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
            $recordset = mysql_query($query10) or die(mysql_error());
            $row = mysql_fetch_array($recordset);
            $move = $row["playermove"];
            if ($move == "heal") {
                heal($playerid);
                $story = $story . "<i>@" . $playerid . "&" . storytime("heal") . "</i>,";
                //storytime
                $story = $story . "@" . $playerid . "& heals the team to help them recover.,";
                //story
            }
        }
        //---players die---//
        $arraydead = array("");
        array_pop($arraydead);
        foreach ($arrayplayersid as $playerid) {
            $query11 = "SELECT * FROM players WHERE playerid = '{$playerid}' ";
            $recordset = mysql_query($query11) or die(mysql_error());
            $row = mysql_fetch_array($recordset);
            $health = $row["health"];
            if ($health == 0 or $health < 0) {
                $deadplayer = array($playerid);
                $arraydead = array_merge($arraydead, $deadplayer);
                if ($row["playerstate"] !== "dead") {
                    $story = $story . "<i>@" . $playerid . "&" . storytime("die") . "</i>,";
                    //storytime
                    $story = $story . "@" . $playerid . "& has died.,";
                    //story
                    $query12 = "UPDATE players SET health = '0' WHERE playerid = '{$playerid}' ";
                    mysql_query($query12) or die(mysql_error());
                }
            }
        }
        //---change weather---//
        $newweather = change_weather($weather);
        $story = $story . "The weather is " . $newweather . ".";
        //story
        $query13 = "UPDATE games SET weather = ('{$newweather}') WHERE gameid = '{$gameid}' ";
        mysql_query($query13) or die(mysql_error());
        //---replace id numbers with names in story---//
        if (strpos($story, "@") !== FALSE) {
            $input = $story;
            preg_match_all("~@(.*?)&~", $input, $output);
            $arraytagged = $output[1];
            foreach ($arraytagged as $taggedid) {
                $query14 = "SELECT * FROM players WHERE playerid = '{$taggedid}'";
                $recordset = mysql_query($query14) or die(mysql_error());
                $row = mysql_fetch_array($recordset);
                $name = $row["name"];
                if (isset($name)) {
                    $story = str_replace("@{$taggedid}&", "{$name}", $story);
                }
            }
        }
        //---reset gamestate---//
        foreach ($arrayplayersid as $playerid) {
            $query15 = "UPDATE players SET playermove = ('') WHERE playerid = '{$playerid}' ";
            mysql_query($query15) or die(mysql_error());
            $query16 = "UPDATE players SET playerstate = ('playerturn') WHERE playerid = '{$playerid}' ";
            mysql_query($query16) or die(mysql_error());
        }
        foreach ($arraydead as $playerid) {
            $query17 = "UPDATE players SET playerstate = ('dead') WHERE playerid = '{$playerid}' ";
            mysql_query($query17) or die(mysql_error());
        }
        $slashstory = addslashes($story);
        $query18 = "UPDATE games SET bossmove = ('{$slashstory}') WHERE gameid = '{$gameid}' ";
        mysql_query($query18) or die(mysql_error());
        $roundcount = $roundcount + 1;
        $query19 = "UPDATE games SET roundcount = ('{$roundcount}') WHERE gameid = '{$gameid}' ";
        mysql_query($query19) or die(mysql_error());
        //---game over?---//
        if (isset($endgame) and $endgame == "victory") {
            $query20 = "UPDATE games SET gamestate = ('victory') WHERE gameid = '{$gameid}' ";
            mysql_query($query20) or die(mysql_error());
            foreach ($arrayplayersid as $playerid) {
                $query21 = "UPDATE players SET playerstate = ('victory') WHERE playerid = '{$playerid}' ";
                mysql_query($query21) or die(mysql_error());
            }
            return "victory";
        } elseif ($arrayplayersid == $arraydead) {
            $query22 = "UPDATE games SET gamestate = ('defeat') WHERE gameid = '{$gameid}' ";
            mysql_query($query22) or die(mysql_error());
            return "defeat";
        } else {
            $query23 = "UPDATE games SET gamestate = ('playerturn') WHERE gameid = '{$gameid}' ";
            mysql_query($query23) or die(mysql_error());
            return "continue";
        }
    }
}
Пример #30
0
     flag($edit && $access >= $level_set_noop, (int) $channel->flags & 0x40000, " No Op", "noop", "Y");
     flag($edit && $access >= $level_set_novoice, (int) $channel->flags & 0x800000, " No Voice", "novoice", "Y");
     flag($edit && $access >= $level_set_autotopic, (int) $channel->flags & 0x80000, " Auto Topic", "autotopic", "Y");
     //flag($edit && $access>=$level_set_oponly,(int)$channel->flags & 0x00100000," Op Only","oponly","Y");
     flag($edit && $access >= $level_set_autojoin, (int) $channel->flags & 0x200000, " Auto Join", "autojoin", "Y");
     $cpurged = 0;
 } else {
     if ($channel->registered_ts == 0) {
         echo "<font size=-1>Purged</font>&nbsp;<img src=images/protect.gif border=0><br>\n";
         $cpurged = 1;
     } else {
         $cpurged = 0;
     }
 }
 number($edit && $access >= $level_set_massdeoppro, $channel->mass_deop_pro, "Mass Deop Protection", "massdeop");
 number($edit && $access >= $level_set_floodpro, $channel->flood_pro, "Flood Protection", "floodpro");
 if ($edit && $access >= $level_set_url) {
     if ($channel->url != "" && !ereg("^http://", $channel->url)) {
         echo "<b>Channel Homepage: </b><input type=text size=50 name=url maxlength=75 value=\"http://" . $channel->url . "\"><br>\n";
     } else {
         echo "<b>Channel Homepage: </b><input type=text size=50 name=url maxlength=75 value=\"" . $channel->url . "\"><br>\n";
     }
 } else {
     if ($channel->url != "" && !ereg("^http://", $channel->url)) {
         echo "<b>Channel Homepage: </b><a href=\"http://" . $channel->url . "\" target=\"_blank\">http://" . htmlspecialchars($channel->url) . "</a><br>\n";
     } else {
         echo "<b>Channel Homepage: </b><a href=\"" . $channel->url . "\" target=\"_blank\">" . htmlspecialchars($channel->url) . "</a><br>\n";
     }
 }
 if ($edit && $access >= $level_set_desc) {
     echo "<b>Description: </b><input type=text name=desc size=50 maxlength=80 value=\"" . $channel->description . "\"><br>\n";