コード例 #1
0
ファイル: lib_grouping.php プロジェクト: reillo/ninjawars
function add_enemy($enemy_id)
{
    if (!is_numeric($enemy_id)) {
        throw new Exception('Enemy id to add must be present to succeed.');
    }
    remove_enemy($enemy_id);
    DatabaseConnection::getInstance();
    $query = 'INSERT INTO enemies (_player_id, _enemy_id) VALUES (:pid, :eid)';
    $statement = DatabaseConnection::$pdo->prepare($query);
    $statement->bindValue(':pid', self_char_id());
    $statement->bindValue(':eid', $enemy_id);
    $statement->execute();
}
コード例 #2
0
ファイル: enemies.php プロジェクト: ninjajerry/ninjawars
    $recent_attackers = $sql->FetchAll();
    return $recent_attackers;
}
$active_ninja = render_active(5, $alive_only = true);
// Display the currently active ninjas
$match_string = in('enemy_match', null, 'no filter');
$add_enemy = in('add_enemy', null, 'toInt');
$remove_enemy = in('remove_enemy', null, 'toInt');
$enemy_limit = 20;
$max_enemies = false;
$enemy_list = get_setting('enemy_list');
if ($match_string) {
    $found_enemies = render_enemy_matches($match_string);
}
if (is_numeric($remove_enemy)) {
    remove_enemy($remove_enemy);
    $enemy_list = get_setting('enemy_list');
    // Update to new enemy list.
}
if (is_numeric($add_enemy)) {
    add_enemy($add_enemy);
    $enemy_list = get_setting('enemy_list');
    // Update to new enemy list.
}
$enemy_section = render_current_enemies($enemy_list);
if (count($enemy_list) > $enemy_limit - 1) {
    $max_enemies = true;
}
$recent_attackers_section = render_recent_attackers();
$parts = get_certain_vars(get_defined_vars());
echo render_template('enemies.tpl', $parts);
コード例 #3
0
ファイル: blacklist.php プロジェクト: jwest00724/mccodefree
check_level();
$fm = money_formatter($ir['money']);
$cm = money_formatter($ir['crystals'], '');
$lv = date('F j, Y, g:i a', $ir['laston']);
$h->userdata($ir, $lv, $fm, $cm);
$h->menuarea();
if ($ir['donatordays'] == 0) {
    die("This feature is for donators only.");
}
print "<h3>Black List</h3>";
switch ($_GET['action']) {
    case "add":
        add_enemy();
        break;
    case "remove":
        remove_enemy();
        break;
    case "ccomment":
        change_comment();
        break;
    default:
        black_list();
        break;
}
function black_list()
{
    global $ir, $c, $userid;
    print "<a href='blacklist.php?action=add'>&gt; Add an Enemy</a><br />\nThese are the people on your black list. ";
    $q_y = mysql_query("SELECT * FROM blacklist WHERE bl_ADDED={$userid}", $c);
    print mysql_num_rows($q_y) . " people have added you to their list.<br />Most hated: [";
    $q2r = mysql_query("SELECT u.username,count( * ) as cnt,bl.bl_ADDED FROM blacklist bl LEFT JOIN users u on bl.bl_ADDED=u.userid GROUP BY bl.bl_ADDED ORDER BY cnt DESC LIMIT 5", $c) or die(mysql_error());