function index(){
		if (!$this->sub){
			return array(
			'name'=>'微游戏',
			'subkeywords'=>1,
			'sublinks'=>1,
			);
		}else {
			$game=new game();
			$items=M('Games')->where(array('token'=>$this->token))->select();
			$arr=array(
			'name'=>'微游戏',
			'subkeywords'=>array(
			),
			'sublinks'=>array(
			),
			);
			if ($items){
				foreach ($items as $v){
					$link=$game->getLink($v,'{wechat_id}');
					$arr['subkeywords'][$v['id']]=array('name'=>$v['title'],'keyword'=>$v['keyword']);
					$arr['sublinks'][$v['id']]=array('name'=>$v['title'],'link'=>$link);
				}
			}
			return $arr;
		}
		
	}
 public function process()
 {
     $user = user::getInstance();
     $db = db::getInstance();
     include './models/game.class.php';
     include './models/grid.class.php';
     // récupérer le gameid
     $this->gameid = isset($_REQUEST['gameid']) ? intval($_REQUEST['gameid']) : false;
     if ($this->gameid === false) {
         trigger_error('Game not found', E_USER_ERROR);
     }
     // lecture de l'objet game
     $game = new game();
     $game->read($this->gameid);
     // création d'une nouvelle grille
     $gridtype = GRIDTYPE_ALLWORDS;
     $grid = new grid();
     $gridid = $grid->create($gridtype);
     // ajout de la grille au game
     $game->assign_grid($gridid);
     $game->start_grid($gridid);
     // enrichissement du retour json
     $res = $grid->get();
     $res->gameid = $this->gameid;
     $res->gametype = GAMETYPE_PRACTICE_ALLWORDS;
     header('Content-Type: application/json');
     echo json_encode($res);
     die;
 }
示例#3
0
 public function index()
 {
     $thisItem = $this->item;
     $game = new game();
     $link = $game->getLink($thisItem, $this->wechat_id);
     return array(array(array($thisItem['title'], $thisItem['intro'], $thisItem['picurl'], $link)), 'news');
 }
示例#4
0
	public function myDynamic()
	{
		$vhost = 'http://www.meihua.com';
		$wxinfo = M('Wxuser')->where(array('uid' => intval(session('uid')), 'token' => $this->token))->find();
		$PData = array('uname' => $this->token, 'domain' => $_SERVER['HTTP_HOST'], 'email' => $wxinfo['qq'], 'gzh' => $wxinfo['wxid'], 'gzhname' => $wxinfo['wxname']);
		$key = 'Y@2T&9i3l#m8u';
		$tmp = array();

		foreach ($PData as $kk => $vv) {
			$tmp[] = md5($kk . trim($vv) . $key);
		}

		$game = new game();
		$key = base64_encode(implode('_', $tmp));
		$PData['key'] = $key;
		$request_url = $vhost . '/index.php?m=Index&c=login&a=verifyUser';
		$tmpdata = $game->api_notice_increment($request_url, $PData, 'POST');

		if ($tmpdata == '') {
			$tmpdata = $game->api_notice_increment($request_url, $PData, 'POST');
		}

		$type = $this->_get('type', 'trim');
		unset($_GET['token']);
		$iframeUrl = $vhost . '/index.php?m=Index&c=login&a=loginNoPwd&logkey=' . $tmpdata . '&' . http_build_query($_GET);
		$this->assign('iframeUrl', $iframeUrl);
		$this->display();
	}
示例#5
0
	public function link()
	{
		$id = $this->_get("id");
		$wecha_id = $this->wecha_id;
		$siteUrl = $this->_get("siteurl");
		$item = M("Games")->where(array("id" => $id))->find();

		if ($item) {
			$game = new game();
			$url = $game->getLink($item, $wecha_id, $siteUrl);
			header("Location:" . $url);
		}
	}
 public function process()
 {
     $db = db::getInstance();
     $user = user::getInstance();
     include './models/game.class.php';
     // récupérer le gameid si il existe
     $game = false;
     $this->gameid = isset($_REQUEST['gameid']) ? intval($_REQUEST['gameid']) : false;
     if ($this->gameid !== false) {
         $game = new game();
         if (!$game->read($this->gameid)) {
             $this->gameid = false;
             trigger_error('Game not found!', E_USER_ERROR);
         }
         if (!isset($game->userids[$user->id])) {
             $this->gameid = false;
             trigger_error('Not your game!', E_USER_ERROR);
         }
     }
     /*// fermer toute grille en cours pour cet utilisateur
     		$sql = 'UPDATE gamesstatus
     					SET gridstatus = ' . intval(GRIDSTATUS_FINISHED) . '
     					WHERE userid = ' . intval($user->id) . '
     						AND gridstatus = ' . intval(GRIDSTATUS_STARTED);
     		$db->query($sql);*/
     // déterminer le type de partie à partir du mode
     $gametype = false;
     switch ($this->mode) {
         case 'game.launch.practice.allwords':
             $gametype = GAMETYPE_PRACTICE_ALLWORDS;
             break;
         case 'game.launch.practice.longest':
             $gametype = GAMETYPE_PRACTICE_LONGEST;
             break;
         case 'game.launch.practice.constraints':
             $gametype = GAMETYPE_PRACTICE_CONSTRAINTS;
             break;
         case 'game.launch.practice.full':
             $gametype = GAMETYPE_PRACTICE_FULL;
             break;
     }
     // créer une nouvelle partie
     if (!$this->gameid) {
         $userids = array($user->id);
         $game = new game();
         $this->gameid = $game->create($userids, $gametype, $user->get_lang());
     }
     return $this->display();
 }
    /** Send en bestemt artikkel på e-post */
    protected function send_email($row)
    {
        $this->email->text('Hei,

Siden du ikke lengre er med i avisfirmaet "' . $row['ff_name'] . '" har din artikkel blitt slettet fordi den ikke tilhørte noen utgivelse. I tilfelle du kanskje ønsker å beholde teksten fra artikkelen, sender vi den på e-post.

Avisfirma: ' . $row['ff_name'] . ' <' . ess::$s['path'] . '/ff/?ff_id=' . $row['ff_id'] . '>

Tittel: ' . $row['ffna_title'] . '
Opprettet: ' . ess::$b->date->get($row['ffna_created_time'])->format(date::FORMAT_SEC) . ($row['ffna_updated_time'] ? '
Sist oppdatert: ' . ess::$b->date->get($row['ffna_updated_time'])->format(date::FORMAT_SEC) : '') . ($row['ffna_published'] ? '
Publisert: ' . ess::$b->date->get($row['ffna_published_time'])->format(date::FORMAT_SEC) : '') . '
Pris: ' . game::format_cash($row['ffna_price']) . '

Innhold:

-- START --
' . $row['ffna_text'] . '
-- SLUTT --

--
Kofradia.no
Denne e-posten er sendt til ' . $row['u_email'] . ' som ' . ($row['up_access_level'] == 0 ? 'tidligere tilhørte' : 'tilhører') . ' ' . $row['up_name'] . '
' . ess::$s['path']);
        $this->email->format();
        mailer::add_emails($this->email, $row['u_email'], "Din tidligere artikkel: {$row['ffna_title']} - Kofradia", true);
        putlog("CREWCHAN", "AVISARTIKKEL SLETTET: E-post planlagt for utsendelse. %c4Mailer scriptet må kjøres!");
    }
    public function process()
    {
        $db = db::getInstance();
        $user = user::getInstance();
        include './models/game.class.php';
        include './models/grid.class.php';
        // récupérer le gameid
        $this->gameid = isset($_REQUEST['gameid']) ? intval($_REQUEST['gameid']) : false;
        if ($this->gameid === false) {
            trigger_error('Game not found', E_USER_ERROR);
        }
        // lecture de l'objet game
        $game = new game();
        $game->read($this->gameid);
        // lire les grilles terminées pour trouver le prochain type de grille
        $sql = 'SELECT COUNT(gridid) AS count_gridid
					FROM gamesstatus
					WHERE gameid = ' . intval($this->gameid) . '
						AND userid = ' . intval($user->id) . '
						AND gridstatus = ' . intval(GRIDSTATUS_FINISHED);
        $result = $db->query($sql);
        $grid_count = ($row = $result->fetch_assoc()) ? intval($row['count_gridid']) : 0;
        // déterminer le prochain type de grille
        switch ($grid_count) {
            case 0:
                $gridtype = GRIDTYPE_ALLWORDS;
                break;
            case 1:
                $gridtype = GRIDTYPE_LONGEST;
                break;
            case 2:
                $gridtype = GRIDTYPE_CONSTRAINTS;
                break;
        }
        // création d'une nouvelle grille
        $grid = new grid();
        $gridid = $grid->create($gridtype);
        // ajout de la grille au game
        $game->assign_grid($gridid);
        $game->start_grid($gridid);
        $res = $grid->get();
        $res->gameid = $this->gameid;
        $res->gametype = GAMETYPE_PRACTICE_FULL;
        header('Content-Type: application/json');
        echo json_encode($res);
        die;
    }
示例#9
0
 public function test()
 {
     $username = "******";
     $password = "******";
     $email = "*****@*****.**";
     $username2 = "bla2";
     $password2 = "pass2";
     $email2 = "*****@*****.**";
     user::create_new_user($username, $password, $email);
     $this->assertEquals(1, user::getNumberOfUsers(), "number of users is not correct after adding a new user");
     user::create_new_user($username2, $password2, $email2);
     $this->assertEquals(2, user::getNumberOfUsers(), "number of users is not correct after adding a new user");
     $user1ID = user::getUserByUsername($username)['id'];
     $user2ID = user::getUserByUsername($username2)['id'];
     $game_size = 6;
     $this->assertTrue(game::add_new_game($user1ID, $game_size, $user1ID, $user2ID), "failed to add a new game");
     $game_id1 = game::$last_inserted_id;
     $this->assertTrue(game::add_new_game($user2ID, $game_size, $user2ID, $user1ID), "failed to add a new game");
     $game_id2 = game::$last_inserted_id;
     //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
     //message::get_all_messages_for_game_id($game_id)
     //message::add_new_message($game_id,$user_id,$message)
     $message = "helllo";
     $this->assertNull(message::get_all_messages_for_game_id($game_id1), "null should be returned because no messages added for the given game_id [get_all_messages_for_game_id()]");
     $this->assertNull(message::get_all_messages_for_game_id("rr"), "null should be returned because an invalid game_id was passed [get_all_messages_for_game_id()]");
     $this->assertFalse(message::add_new_message("hhh", $user1ID, $message), "false should be reutnred because an invalid game_id was passed [add_new_message()]");
     $this->assertFalse(message::add_new_message($game_id1, "blla", $message), "false should be reutnred because an invalid user_id was passed [add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id1, $user1ID, $message), "falied to add new message [add_new_message()]");
     $this->assertEquals(1, count(message::get_all_messages_for_game_id($game_id1)), "expecting to get an array with one message [get_all_messages_for_game_id()]");
     $messages = message::get_all_messages_for_game_id($game_id1);
     $this->assertEquals($message, $messages[0]['message_text'], "[add_new_message()]");
     $this->assertEquals($game_id1, $messages[0]['gameID'], "[add_new_message()]");
     $this->assertEquals($user1ID, $messages[0]['userID'], "[add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id2, $user1ID, "yolooo"), "falied to add new message [add_new_message()]");
     $message2 = "where are you";
     $this->assertTrue(message::add_new_message($game_id1, $user2ID, $message2), "falied to add new message [add_new_message()]");
     $this->assertEquals(2, count(message::get_all_messages_for_game_id($game_id1)), "expecting to get an array with two messages [get_all_messages_for_game_id()]");
     //message::get_message_count($game_id)
     $this->assertEquals(2, message::get_message_count($game_id1), "[message::get_message_count()]");
     $this->assertEquals(-1, message::get_message_count("asdasdasd"), "providing an invalid game_id so it should be rejected[message::get_message_count()]");
     message::clear_table();
     $this->assertEquals(0, message::get_message_count($game_id1), "[message::get_message_count()]");
     $this->assertTrue(message::add_new_message($game_id1, $user1ID, $message), "falied to add new message [add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id1, $user2ID, $message2), "falied to add new message [add_new_message()]");
     $this->assertTrue(message::add_new_message($game_id2, $user1ID, "yolooo"), "falied to add new message [add_new_message()]");
     $this->assertEquals(1, message::get_message_count($game_id2), "[message::get_message_count()]");
     $messages = message::get_all_messages_for_game_id($game_id1);
     //message::get_all_messages_after_given_date($game_id,$date)
     $this->assertNull(message::get_all_messages_after_given_date(0, 0), "get_all_messages_after_given_date()");
     $this->assertNull(message::get_all_messages_after_given_date($messages[1]['gameID'], $messages[1]['date']), "get_all_messages_after_given_date()");
     $this->assertEquals(1, count(message::get_all_messages_after_given_date($messages[0]['gameID'], $messages[0]['date'])), "get_all_messages_after_given_date()");
     $this->assertEquals(2, count(message::get_all_messages_after_given_date($messages[0]['gameID'], $messages[0]['date'] - 0.1)), "get_all_messages_after_given_date()");
     //message::delete_message($message_id)
     $this->assertFalse(message::delete_message("dddd"), "[delete_message()]");
     $this->assertTrue(message::delete_message($messages[0]['id']), "[delete_message()]");
     $this->assertEquals(1, count(message::get_all_messages_after_given_date($messages[0]['gameID'], $messages[0]['date'] - 0.1)), "get_all_messages_after_given_date()");
     //$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 }
示例#10
0
 /**
  * Purpose: default constructor
  * Preconditions: none
  * Postconditions: parent object started
  **/
 function hangman()
 {
     /**
      * instantiate the parent game class so this class
      * inherits all of the game class's attributes 
      * and methods
      **/
     game::start();
 }
示例#11
0
 /**
  * Hent beste ranker siste 24 timer
  */
 public function action_bestranker()
 {
     $stats = new \Kofradia\Users\Stats();
     $players = $stats->getBestRankers();
     if (count($players) == 0) {
         return \Kofradia\View::forgeTwig('users/login/helpers/best_ranker', array("player" => null));
     }
     $player = reset($players);
     return \Kofradia\View::forgeTwig('users/login/helpers/best_ranker', array("player" => $player, "img" => \player::get_profile_image_static($player['up_profile_image_url']), "rank" => new \Kofradia\Game\Player\Rank($player['up_points'], $player['upr_rank_pos'], $player['up_access_level']), "profile_link" => \game::profile_link($player['up_id'], $player['up_name'], $player['up_access_level'])));
 }
示例#12
0
 /**
  * Load settings and save to cache
  */
 public static function reload()
 {
     $result = \Kofradia\DB::get()->query("SELECT id, name, value FROM settings");
     \game::$settings = array();
     while ($row = $result->fetch()) {
         \game::$settings[$row['name']] = array("id" => $row['id'], "value" => $row['value']);
     }
     // keep for 1 hour
     \cache::store("settings", \game::$settings, 3600);
 }
示例#13
0
 public function counterFilter($time, $redirect_to)
 {
     $rel = (string) $time;
     if ($redirect_to) {
         if ($redirect_to === true) {
             $rel .= ",refresh";
         } else {
             $rel .= "," . htmlspecialchars($redirect_to);
         }
     }
     return '<span class="counter" rel="' . $rel . '">' . \game::timespan($time, \game::TIME_FULL, 5) . '</span>';
 }
示例#14
0
 public static function add_new_move($game_id, $x, $y, $edgePosition, $player_id)
 {
     $date = microtime(true);
     //TEST:
     //game_id is valid
     //player_id is valid
     //consistent $x and $y coordinates with the game size
     //valid edgePosition (it has to be one of the values: 1 (NORTH), 2 (SOUTH), 3 (EAST) , 4 (WEST) )
     //secure the input
     if (safe_input::is_number($game_id) && safe_input::is_number($x) && safe_input::is_number($y) && safe_input::is_number($edgePosition) && safe_input::is_number($player_id)) {
         //validate game_id
         $game_info = game::getGameById($game_id);
         if ($game_info == false) {
             return false;
             //no game exists with the given id
         }
         $other_player_id = -1;
         //check if player_id is a player in the game
         if ($player_id == $game_info['player1ID']) {
             $other_player_id = $game_info['player2ID'];
         } elseif ($player_id == $game_info['player2ID']) {
             $other_player_id = $game_info['player1ID'];
         } else {
             return false;
             //ERROR!! (player tring to play is not part of the game
         }
         //check if it is the player's turn
         if ($player_id != $game_info['currentTurnPlayerID']) {
             return false;
             //it is not the player's turn!
         }
         //check coordinates consistency
         if ($x > $game_info['size'] || $y > $game_info['size'] || $x < 1 || $y < 1) {
             return false;
             //invalid move coordinates
         }
         //check edigePosition
         if ($edgePosition != 1 && $edgePosition != 2 && $edgePosition != 3 && $edgePosition != 4) {
             return false;
             //invalid edgePosition value!
         }
         //add the move
         $db = new database();
         $query[] = "INSERT INTO `move` (`gameID`, `date`, `x`, `y`, `edgePosition`, `playerID`) VALUES ( '{$game_id}', '{$date}', '{$x}', '{$y}', '{$edgePosition}' , '{$player_id}');";
         $query[] = "UPDATE  `game` SET  `currentTurnPlayerID` =  '{$other_player_id}' , `lastActivityDate` = '{$date}' WHERE  `id` = '{$game_id}'";
         $res = $db->execute_transaction($query);
         return $res;
     } else {
         return false;
         //ERROR!!!! (invalid input!!)
     }
 }
示例#15
0
 function show_link()
 {
     $ret = array();
     for ($i = 0; $i < func_num_args(); $i++) {
         $arg = func_get_arg($i);
         if (!$this->exists($arg)) {
             trigger_error("Fant ikke elementet med ID {$arg}!", E_USER_ERROR);
         }
         $type = $this->types[$this->elms[$arg]['type']];
         // aktiv?
         $active = $this->active == $arg ? 1 : 0;
         $ret[] = '<a href="' . htmlspecialchars(game::address($this->address, $_GET, array($this->sort_name), array($this->sort_name => $arg))) . '" class="op50"><img src="' . $type[$active] . '" alt="' . htmlspecialchars($this->elms[$arg]['title']) . '" /></a>';
         #if ($active == 1) return end($ret);
     }
     return implode("", $ret);
 }
示例#16
0
 protected function get_text($name, $sub, $data)
 {
     switch ($name) {
         case "rank":
         case "rank_kill":
             return ucfirst(game::$ranks['items_number'][$sub]['name']);
         case "familie":
             return 'Broderskap';
         case "familie_rank":
             return game::format_num($data['ff_points_sum']) . ' poeng';
         case "ff_owner":
             return ucfirst(ff::$types[$sub]['typename']);
         case "cash_num":
             return hall_of_fame::get_cash_pos($sub);
     }
 }
示例#17
0
 function format_size($bytes)
 {
     // GB
     if ($bytes >= 1073741824) {
         return game::format_number(round($bytes / 1073741824, 3), 3) . " GB";
     }
     // MB
     if ($bytes >= 1048576) {
         return game::format_number(round($bytes / 1048576, 2), 2) . " MB";
     }
     // KB
     if ($bytes >= 1024) {
         return game::format_number(round($bytes / 1024, 2), 2) . " KB";
     }
     // bytes
     return $bytes . " bytes";
 }
示例#18
0
文件: crewet.php 项目: Kuzat/kofradia
function visliste($name, $where)
{
    global $_base;
    $result = \Kofradia\DB::get()->query("SELECT up_id, up_name, up_access_level, up_last_online FROM users_players WHERE {$where} ORDER BY up_name");
    // hopp over hvis det ikke finnes noen
    if ($result->rowCount() == 0) {
        return;
    }
    echo '
		<h2 class="bg1">' . $name . '<span class="left2"></span><span class="right2"></span></h2>
		<div class="bg1">
			<dl class="dd_right">';
    while ($row = $result->fetch()) {
        echo '
				<dt>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</dt>
				<dd>' . game::timespan($row['up_last_online'], game::TIME_ABS | game::TIME_NOBOLD) . '</dd>';
    }
    echo '
			</dl>
		</div>';
}
示例#19
0
<?php

include_once './include/table_user.php';
include_once './include/table_game.php';
include_once './include/table_message.php';
include_once './include/table_log.php';
include_once './include/table_pending_game.php';
include_once './include/table_session.php';
include_once './include/table_move.php';
//drop the tables:
$successful = True;
$successful = move::drop_table() && $successful;
$successful = session::drop_table() && $successful;
$successful = pending_game::drop_table() && $successful;
$successful = log::drop_table() && $successful;
$successful = message::drop_table() && $successful;
$successful = game::drop_table() && $successful;
$successful = user::drop_table() && $successful;
if (!$successful) {
    echo "Failed to delete tables";
} else {
    echo "OK";
}
示例#20
0
include 'include/text_races.php';
include 'include/text_planets.php';
include 'include/ship_data.php';
include 'include/race_data.php';
include 'include/sql.php';
include 'include/functions.php';
// #############################################################################
// SQL-Object for Database connection
$db = new sql($config['server'] . ":" . $config['port'], $config['game_database'], $config['user'], $config['password']);
// create sql-object for db-connection
if (isset($_GET['sql_debug'])) {
    $db->debug = true;
}
// #############################################################################
// Game-Object
$game = new game();
// #############################################################################
// Config load and evaluate
$game->load_config();
$ACTUAL_TICK = $NEXT_TICK = 0;
$ACTUAL_TICK = $game->config['tick_id'];
$NEXT_TICK = $game->config['tick_time'] - $game->TIME;
$LAST_TICK_TIME = $game->config['tick_time'] - 5 * 60;
// #############################################################################
// Session-System
include 'include/session.php';
if ($game->config['game_stopped'] == 1 && $game->player['user_auth_level'] != STGC_DEVELOPER) {
    message(GENERAL, $game->config['stop_message']);
}
$game->init_player();
if (isset($_POST['user_notepad'])) {
示例#21
0
 /** Hent statistikk info */
 public function stat_info($field)
 {
     // seperator?
     if ($field == "-") {
         return array("&nbsp;", "&nbsp;");
     }
     // ukjent?
     if (!isset($this->xml->{$field})) {
         return array("ukjent", "ukjent felt: " . htmlspecialchars($field));
     }
     global $_base, $_whatpulse;
     // har vi tittel?
     if (isset($_whatpulse['fields_text'][$field])) {
         $title = htmlspecialchars($_whatpulse['fields_text'][$field]);
     } else {
         $title = htmlspecialchars($field);
     }
     // finn verdi
     $value = $this->xml->{$field};
     $types = $_whatpulse['types'];
     $type = isset($types[$field]) ? $types[$field] : 0;
     switch ($type) {
         // Number
         case 1:
             $value = game::format_number($value);
             break;
             // DateTime
         // DateTime
         case 2:
             $value = $_base->date->get(strtotime($value))->format();
             break;
             // Date
         // Date
         case 3:
             $value = $_base->date->get(strtotime($value))->format(date::FORMAT_NOTIME);
             break;
             // Precision (2)
         // Precision (2)
         case 4:
             $value = game::format_number($value, 2);
             break;
             // Miles
         // Miles
         case 5:
             $value = game::format_number($value * 1.609344, 1) . " km";
             break;
             // TeamName
         // TeamName
         case 6:
             $value = $this->xml->Team->Name;
             // Tekst
         // Tekst
         default:
             $value = htmlspecialchars($value);
     }
     return array($title, $value);
 }
示例#22
0
				</noscript>
			</div>
			<p>Denne listen viser hvem som har vært aktive i løpet av siste ' . game::timespan($time, game::TIME_FULL) . '</p>
		</form>';
// hent brukerne
$result = \Kofradia\DB::get()->query("SELECT up_id, up_name, up_access_level FROM users_players WHERE up_last_online >= " . (time() - $time) . " ORDER BY up_name");
// sett opp alfabetisk liste
$liste = array();
while ($row = $result->fetch()) {
    $liste[mb_strtolower(mb_substr($row['up_name'], 0, 1))][] = game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']);
}
echo '
		<table class="table tablemb">
			<thead>
				<tr>
					<th colspan="2">Spillere pålogget - ' . game::format_number($result->rowCount()) . ' spiller' . ($result->rowCount() == 1 ? '' : 'e') . '</th>
				</tr>
			</thead>
			<tbody>';
foreach ($liste as $char => $rows) {
    echo '
				<tr>
					<th>' . htmlspecialchars($char) . '</th>
					<td>' . implode(", ", $rows) . '</td>
				</tr>';
}
echo '
			</tbody>
		</table>
	</div>
</div>';
示例#23
0
文件: Option.php 项目: Kuzat/kofradia
 /**
  * Try to attack a specific player
  *
  * @param array Data about the player
  * @param int Cash to get
  * @return bool|null True on success
  */
 protected function handleSuccessPlayer($player, $cash)
 {
     $rank = \Kofradia\Game\Rank\Points::getRank($player['up_points']);
     $affect = $this->ut->getAffectedTable($rank);
     // can not have too little energy
     if ($player['up_energy'] < $affect['energy'] * 2) {
         return;
     }
     // now take money
     $a = \Kofradia\DB::get()->prepare("\n\t\t\tUPDATE users_players\n\t\t\tSET up_bank = IF(up_cash < ?, up_bank - ?, up_bank),\n\t\t\t\tup_cash = IF(up_cash >= ?, up_cash - ?, up_cash)\n\t\t\tWHERE up_id = ? AND (up_cash >= ? OR up_bank >= ?)");
     if (!$a->execute(array($cash, $cash, $cash, $cash, $player['up_id'], $cash, $cash))) {
         // did not succeed
         return;
     }
     $this->result->up = \player::get($player['up_id']);
     $this->result->cashLost = $cash;
     $this->result->fromBank = $this->result->up->data['up_cash'] < $cash;
     // TODO: this cannot be checked this way?
     // notify victim
     $this->result->up->add_log("utpressing", $this->ut->up->id, $cash);
     // log
     putlog("SPAMLOG", "%c11%bUTPRESSING:%b%c %u{$this->ut->up->data['up_name']}%u presset %u{$this->result->up->data['up_name']}%u for %u" . \game::format_cash($cash) . "%u" . ($this->result->fromBank ? ' (fra bankkonto)' : ''));
     \Kofradia\DB::get()->prepare("\n\t\t\tINSERT INTO utpressinger\n\t\t\tSET\n\t\t\t\tut_action_up_id = ?,\n\t\t\t\tut_affected_up_id = ?,\n\t\t\t\tut_b_id = ?,\n\t\t\t\tut_time = ?")->execute(array($this->ut->up->id, $this->result->up->id, $this->ut->up->data['up_b_id'], time()));
     // the victim always looses energy
     // but only health if the money comes from the hand
     // (don't really know why we made it this way)
     $this->result->up->energy_use($affect['energy']);
     if (!$this->result->fromBank) {
         $this->result->attack = $this->result->up->health_decrease($affect['health'], $this->ut->up, \player::ATTACK_TYPE_UTPRESSING);
     }
     return true;
 }
示例#24
0
function my_autoload($pClassName)
{
    include __DIR__ . "/classes/" . $pClassName . ".php";
}
spl_autoload_register("my_autoload");
/*
 * Statuses
 * 0 - Free spot
 * 1 - Ship
 * 2 - Miss
 * 3 - Hit
 * 4 - Sank
 */
session_start();
$game = new game();
if (isset($_GET['y']) && isset($_GET['x'])) {
    $game->makeShot($_GET['y'], $_GET['x']);
}
$currentMap = $game->map;
if ($game->targetsLeft() == 0) {
    echo "<h1>You WON!</h1>";
}
echo "<table border='1'>";
echo "<tr><td></td><td>A</td><td>B</td><td>C</td><td>D</td><td>E</td><td>F</td><td>G</td><td>H</td><td>I</td><td>J</td></tr>";
for ($i = 0; $i < 10; $i++) {
    echo "<tr>";
    echo "<td width='10' height='10'>{$i}</td>";
    for ($j = 0; $j < 10; $j++) {
        if ($currentMap[$i][$j] === 1) {
            echo "<td class='" . $i . " " . $j . "' width='10' height='10' style='cursor: pointer;' onclick='location.href = \"?y=" . $i . "&x=" . $j . "\";'>&nbsp;</td>";
示例#25
0
$count = 0;
if (($handle = @fopen('mapcounter.txt', "rt")) != true) {
} else {
    $count = fread($handle, filesize('mapcounter.txt'));
    fclose($handle);
}
$count = (int) $count + 1;
if (($handle = @fopen('mapcounter.txt', "wt")) != true) {
} else {
    fwrite($handle, $count);
    fclose($handle);
}
// create sql-object for db-connection
$db = new sql($config['server'] . ":" . $config['port'], $config['game_database'], $config['user'], $config['password']);
// Load player parameters
$game = new game();
$game->load_config();
$ACTUAL_TICK = $NEXT_TICK = 0;
$ACTUAL_TICK = $game->config['tick_id'];
$NEXT_TICK = $game->config['tick_time'] - time();
//$game->TIME;
$LAST_TICK_TIME = $game->config['tick_time'] - TICK_DURATION * 60;
include 'include/session.php';
// load player parameters
// Check map size request
if ($_GET['size'] < 1) {
    $_GET['size'] = 1;
}
if ($_GET['size'] > 8) {
    $_GET['size'] = 8;
}
示例#26
0
文件: lock.php 项目: Kuzat/kofradia
    /**
     * Behandle ny spiller
     */
    protected function solve_player()
    {
        ess::$b->page->add_title("Ny spiller");
        redirect::store($_SERVER['REQUEST_URI']);
        // sjekk om vi allerede har en spiller fra før som ikke er den aktive
        $result = \Kofradia\DB::get()->query("SELECT up_id, up_name, up_created_time, up_last_online, up_access_level FROM users_players WHERE up_u_id = " . login::$user->id . " AND up_access_level != 0");
        if ($result->rowCount() > 0) {
            // sett opp liste over spillere
            $players = array();
            while ($row = $result->fetch()) {
                $players[$row['up_id']] = $row;
            }
            // velge aktiv spiller?
            if (isset($_POST['select']) && isset($_POST['up_id']) && validate_sid()) {
                $up_id = (int) $_POST['up_id'];
                if (!isset($players[$up_id])) {
                    ess::$b->page->add_message("Fant ikke spillere.", "error");
                    redirect::handle();
                }
                // sett som aktiv spiller
                \Kofradia\DB::get()->exec("UPDATE users SET u_active_up_id = {$up_id} WHERE u_id = " . login::$user->id);
                ess::$b->page->add_message('Du har valgt <user="******" /> som din aktive spiller.');
                redirect::handle("min_side");
            }
            echo '
<div class="bg1_c xmedium">
	<h1 class="bg1">Ny spiller<span class="left2"></span><span class="right2"></span></h1>
	<p class="h_left"><a href="' . htmlspecialchars($this->url) . '">Tilbake</a></p>
	<div class="bg1">
		<form action="" method="post">
			<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
			<p>Du har allerede en annen spiller som er i live. Du må enten deaktivere spilleren eller velge å bruke den som din aktive spiller.</p>
			<table class="table center">
				<thead>
					<tr>
						<th>ID</th>
						<th>Spiller</th>
						<th>Opprettet</th>
						<th>Sist aktiv</th>
						<th>Deaktiver</th>
					</tr>
				</head>
				<tbody>';
            foreach ($players as $row) {
                echo '
					<tr class="box_handle">
						<td><input type="radio" name="up_id" value="' . $row['up_id'] . '" />' . $row['up_id'] . '</td>
						<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
						<td>' . ess::$b->date->get($row['up_created_time'])->format() . '</td>
						<td>' . ess::$b->date->get($row['up_last_online'])->format() . '</td>
						<td><a href="min_side?up_id=' . $row['up_id'] . '&amp;a=deact">Deaktiver</a></td>
					</tr>';
            }
            echo '
				</tbody>
			</table>
			<p class="c">' . show_sbutton("Velg som aktiv spiller", 'name="select"') . '</p>
		</form>
	</div>
</div>';
            ess::$b->page->load();
        }
        // opprette ny spiller?
        if (isset($_POST['name']) && !isset($_POST['abort']) && validate_sid()) {
            $name = trim($_POST['name']);
            $bydel = postval("bydel");
            if (!isset(game::$bydeler[$bydel]) || !game::$bydeler[$bydel]['active']) {
                $bydel = false;
            }
            // kontroller navnet
            $result1 = \Kofradia\DB::get()->query("SELECT " . \Kofradia\DB::quoteNoNull($name) . " REGEXP regex AS m, error FROM regex_checks WHERE (type = 'reg_user_special' OR type = 'reg_user_strength') HAVING m = 1");
            $where = ALLOW_SAME_PLAYERNAME ? " AND (up_u_id != " . login::$user->id . " OR up_access_level != 0)" : "";
            $result2 = \Kofradia\DB::get()->query("SELECT up_id FROM users_players WHERE up_name = " . \Kofradia\DB::quote($name) . $where);
            $result3 = \Kofradia\DB::get()->query("SELECT id FROM registration WHERE user = "******"Spillernavnet var ikke gyldig:<ul>" . implode("", $feil) . "</ul>", "error");
            } elseif (empty($name)) {
                ess::$b->page->add_message("Du må skrive inn et navn du ønsker at din nye spiller skal ha.", "error");
            } elseif ($result2->rowCount() > 0) {
                ess::$b->page->add_message("Spillernavnet er allerede tatt! Velg et annet.", "error");
            } elseif ($result3->rowCount() > 0) {
                ess::$b->page->add_message("Noen holder allerede på å registrere seg med dette spillernavnet. Velg et annet.", "error");
            } else {
                // godkjent?
                if (isset($_POST['confirm'])) {
                    // finne tilfeldig bydel?
                    if (!$bydel) {
                        // finn en tilfeldig bydel
                        $result = \Kofradia\DB::get()->query("SELECT id FROM bydeler WHERE active = 1 ORDER BY RAND()");
                        $bydel = $result->fetchColumn(0);
                    }
                    \Kofradia\DB::get()->beginTransaction();
                    // opprett spiller og tilknytt brukeren
                    \Kofradia\DB::get()->exec("INSERT INTO users_players SET up_u_id = " . login::$user->id . ", up_name = " . \Kofradia\DB::quote($name) . ", up_created_time = " . time() . ", up_b_id = {$bydel}");
                    $up_id = \Kofradia\DB::get()->lastInsertId();
                    // sett opp riktig rank plassering
                    #\Kofradia\DB::get()->exec("UPDATE users_players AS main, (SELECT COUNT(users_players.up_id)+1 AS pos, ref.up_id FROM users_players AS ref LEFT JOIN users_players ON users_players.up_points > ref.up_points AND users_players.up_access_level < ".ess::$g['access_noplay']." AND users_players.up_access_level != 0 WHERE ref.up_id = $up_id GROUP BY ref.up_id) AS rp SET main.up_rank_pos = rp.pos WHERE main.up_id = rp.up_id");
                    \Kofradia\DB::get()->exec("INSERT INTO users_players_rank SET upr_up_id = {$up_id}");
                    ranklist::update();
                    // sett spilleren som den aktive spilleren for brukerne
                    \Kofradia\DB::get()->exec("UPDATE users SET u_active_up_id = {$up_id} WHERE u_id = " . login::$user->id);
                    \Kofradia\DB::get()->commit();
                    // hent antall medlemmer
                    $result = \Kofradia\DB::get()->query("SELECT COUNT(up_id) FROM users_players WHERE up_access_level < " . ess::$g['access_noplay'] . " AND up_access_level != 0");
                    putlog("INFO", "%bNY SPILLER:%b (#{$up_id} - Nummer %b" . $result->fetchColumn(0) . "%b) %u{$name}%u registrerte seg! " . ess::$s['path'] . "/p/" . rawurlencode($name));
                    ess::$b->page->add_message("Du har opprettet en ny spiller med navnet <b>" . htmlspecialchars($name) . "</b>!");
                    redirect::handle("min_side");
                }
                echo '
<div class="bg1_c xxsmall">
	<h1 class="bg1">Bekreft ny spiller<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">
		<form action="" method="post">' . ($bydel ? '
			<input type="hidden" name="bydel" value="' . $bydel['id'] . '" />' : '') . '
			<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
			<input type="hidden" name="name" value="' . htmlspecialchars($name) . '" />
			<p>Du er i ferd med å opprette følgende spiller:</p>
			<dl class="dd_right">
				<dt>Spillernavn</dt>
				<dd><b>' . htmlspecialchars($name) . '</b></dd>
				<dt>Bydel</dt>
				<dd>' . ($bydel ? htmlspecialchars(game::$bydeler[$bydel]['name']) : 'Tilfeldig valgt') . '</dd>
			</dl> 
			<p>Du kan ikke bytte dette spillernavnet senere uten og opprette en ny spiller.</p>
			<p class="c">' . show_sbutton("Opprett spiller", 'name="confirm"') . ' ' . show_sbutton("Avbryt", 'name="abort"') . '</p>
		</form>
	</div>
</div>';
                ess::$b->page->load();
            }
        }
        ess::$b->page->add_css('
#name_validate { color: #AAA }
#name_validate_ok { color: #CCFF00 }
#name_validate_loading img { vertical-align: text-bottom; margin: -2px 0 }
#name_validate_taken { color: #900000 }
');
        ess::$b->page->add_js_domready('
	var status = function(val)
	{
		if (val == "") $("name_validate").removeClass("hide"); else $("name_validate").addClass("hide");
		if (val == "taken") $("name_validate_taken").removeClass("hide"); else $("name_validate_taken").addClass("hide");
		if (val == "ok") $("name_validate_ok").removeClass("hide"); else $("name_validate_ok").addClass("hide");
		if (val == "loading") $("name_validate_loading").removeClass("hide"); else $("name_validate_loading").addClass("hide");
	};
	var change_last = null, change_timer;
	var change = function()
	{
		if (this.get("value") == change_last) return; change_last = this.get("value");
		if (this.get("value") == "") { status(""); return; }
		
		$clear(change_timer);
		change_timer = this.search.delay(500, this, true);
		
		status("loading");
	};
	
	$("name_enter").addEvents({
		"keyup": change,
		"change": change
	}).focus();
	var xhr;
	$("name_enter").search = function()
	{
		if (!xhr)
		{
			xhr = new Request({"url": relative_path + "/ajax/find_user"});
			xhr.addEvent("success", function(text, xml)
			{
				if (xmlGetValue(xml, "user"))
					status("taken");
				else
					status("ok");
			});
			xhr.addEvent("failure", function(x)
			{
				alert("En feil oppsto.");
			});
		}
		xhr.send({"data": {"q": $("name_enter").get("value").trim()' . (ALLOW_SAME_PLAYERNAME ? ', "is": true' : '') . '}});
	};
	if ($("name_enter").get("value") != "") $("name_enter").search.run(null, $("name_enter"));
	else status("");
	change_last = $("name_enter").get("value");');
        echo '
<div class="bg1_c xsmall">
	<h1 class="bg1">Ny spiller<span class="left2"></span><span class="right2"></span></h1>
	<p class="h_left"><a href="' . htmlspecialchars($this->url) . '">Tilbake</a></p>
	<div class="bg1">
		<form action="" method="post">
			<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
			<p>Du er nå i ferd med å opprette en ny spiller. Du kan også se informasjon for din tidligere spiller <a href="min_side?up_id=' . login::$user->player->id . '">' . htmlspecialchars(login::$user->player->data['up_name']) . '</a>.</p>
			<p>Du kan ikke bytte spillernavnet du velger å opprette her uten og opprette en ny spiller.</p>
			<dl class="dd_right" style="overflow: hidden">
				<dt>Nytt spillernavn</dt>
				<dd><input type="text" id="name_enter" name="name" class="styled w120" value="' . htmlspecialchars(postval("name")) . '" /></dd>
				<dt>Status:
					<span class="name_v hide" id="name_validate_loading"><img src="' . STATIC_LINK . '/other/loading-black.gif" /></span>
					<span class="name_v hide" id="name_validate">Skriv inn ønsket navn</span>
					<span class="name_v hide" id="name_validate_ok">Ledig</span>
					<span class="name_v hide" id="name_validate_taken">Opptatt</span>
				</dt>
			</dl>
			<dl class="dd_right">
				<dt>Bydel</dt>
				<dd>
					<select name="bydel">';
        $active = postval("bydel");
        if (!isset(game::$bydeler[$active]) || !game::$bydeler[$active]['active']) {
            $active = false;
        }
        echo '
						<option' . (!$active ? ' selected="selected"' : '') . '>Velg tilfeldig</option>';
        foreach (game::$bydeler as $bydel) {
            if (!$bydel['active']) {
                continue;
            }
            echo '
						<option value="' . $bydel['id'] . '"' . ($active == $bydel['id'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($bydel['name']) . '</option>';
        }
        echo '
					</select>
				</dd>
			</dl>
			<p class="c">' . show_sbutton("Fortsett") . '</p>
		</form>
	</div>
</div>';
    }
示例#27
0
文件: angrip.php 项目: Kuzat/kofradia
    /**
     * Våpentrening
     */
    protected function page_training_show()
    {
        // sett opp og test for anti-bot
        $this->training_antibot = new antibot(login::$user->id, "training", 7);
        if (MAIN_SERVER) {
            $this->training_antibot->check_required();
        }
        // sett opp skjema
        $this->training_form = \Kofradia\Form::getByDomain("training", login::$user);
        // ventetid?
        $wait = max(0, login::$user->player->data['up_weapon_training_next'] - time());
        // skal vi trene våpenet?
        if (isset($_POST['wt']) && $this->training_form->validateHashOrAlert(null, "Våpentrening")) {
            // kan vi ikke trene nå?
            if ($wait > 0) {
                redirect::handle();
            }
            // finnes ikke valget?
            $id = (int) postval("training_id");
            if (!isset(self::$trainings[$id])) {
                ess::$b->page->add_message("Du må velge et alternativ.", "error");
                redirect::handle();
            }
            $opt = self::$trainings[$id];
            // lagre valget for neste gang
            ess::session_put("training_id", $id);
            // har ikke nok cash?
            if ($opt['price'] > login::$user->player->data['up_cash']) {
                ess::$b->page->add_message("Du har ikke nok penger til å utføre våpentreningen.");
                redirect::handle();
            }
            $f = self::TRAINING_MAX * $opt['percent'];
            $next_old = login::$user->player->data['up_weapon_training_next'] ? ' = ' . login::$user->player->data['up_weapon_training_next'] : ' IS NULL';
            // utfør våpentrening
            $a = \Kofradia\DB::get()->exec("\n\t\t\t\tUPDATE users_players\n\t\t\t\tSET up_weapon_training = up_weapon_training + (1 - up_weapon_training) * {$f}, up_weapon_training_next = " . (time() + $opt['wait']) . ", up_cash = up_cash - {$opt['price']}\n\t\t\t\tWHERE up_id = " . login::$user->player->id . " AND up_cash >= {$opt['price']} AND up_weapon_training_next{$next_old}");
            // ikke oppdatert?
            if ($a == 0) {
                ess::$b->page->add_message("Kunne ikke utføre våpentrening.", "error");
            } else {
                $this->training_antibot->increase_counter();
                ess::$b->page->add_message("Du trente opp våpenet ditt og våpentreningen økte med " . game::format_num((1 - login::$user->player->data['up_weapon_training']) * $f * 100, 2) . " %.");
            }
            redirect::handle();
        }
        $training = login::$user->player->data['up_weapon_training'] * 100;
        echo '
<div class="bg1_c xsmall">
	<h1 class="bg1">Våpentrening<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">';
        if ($wait > 0) {
            echo '
		<p class="c">Du må vente ' . game::counter($wait, true) . ' før du kan trene våpenet på nytt.</p>';
        } else {
            // vis alternativene
            echo '
		<form action="" method="post">
			' . $this->training_form->getHTMLInput() . '
			<table class="table tablemt center">
				<thead>
					<tr>
						<th>Pris</th>
						<th>Ventetid</th>
					</tr>
				</thead>
				<tbody>';
            $i = 0;
            $match = ess::session_get("training_id") ?: 0;
            foreach (self::$trainings as $id => $row) {
                echo '
					<tr class="box_handle' . (++$i % 2 == 0 ? ' color' : '') . '">
						<td class="r"><input type="radio" name="training_id"' . ($match == $id ? ' checked="checked"' : '') . ' value="' . $id . '" />' . game::format_cash($row['price']) . '</td>
						<td class="r">' . game::timespan($row['wait']) . '</td>
					</tr>';
            }
            echo '
				</tbody>
			</table>
			<p class="c">' . show_sbutton("Utfør", 'name="wt"') . '</p>
		</form>';
        }
        echo '
		<div class="progressbar p' . ($training < 28 ? ' levelcrit' : ($training < 35 ? ' levelwarn' : '')) . '">
			<div class="progress" style="width: ' . round(min(100, $training)) . '%">
				<p>Våpentrening: ' . ($training == 100 ? '100' : game::format_num($training, 2)) . ' %</p>
			</div>
		</div>
		<p>Du har en <b>' . htmlspecialchars(login::$user->player->weapon->data['name']) . '</b> med <b>' . game::format_num(login::$user->player->data['up_weapon_bullets']) . '</b> ' . fword('kule', 'kuler', login::$user->player->data['up_weapon_bullets']) . '.</p>
		<p>Våpentreningen din synker jevnlig i løpet av dagen, og du er nødt til å trene for å holde oppe våpentreningen din. Hvis våpentreningen din faller under 25 %, risikerer du å miste våpenet ditt.</p>
		<p>Bedre våpentrening fører til:</p>
		<ul class="spacer">
			<li>Du forbedrer treffsikkerheten din</li>
			<li>Du øker skuddtakten samtidig som treffsikkerheten forblir den samme</li>
		</ul>
	</div>
</div>';
    }
示例#28
0
/**
 * Created by PhpStorm.
 * User: Julien
 * Date: 26/04/2015
 * Time: 14:53
 */
// action type?
if (!isset($_GET['action'])) {
    rollbackAndDie();
}
$action = htmlspecialchars($_GET['action']);
include_once "../classes/Game.php";
include_once "../classes/Team.php";
include_once "../classes/Params.php";
include_once "../classes/SPDO.php";
$game = new game();
$team = new Team();
// clear inputs
if (isset($_GET['gameId'])) {
    $gameId = htmlspecialchars($_GET['gameId']);
} else {
    $gameId = '';
}
if (isset($_GET['gameToken'])) {
    $gameToken = htmlspecialchars($_GET['gameToken']);
} else {
    $gameToken = '';
}
if (isset($_GET['teamId'])) {
    $teamId = htmlspecialchars($_GET['teamId']);
} else {
示例#29
0
		<input type="submit" value="VIS" />
	</p>
</form>
<table class="table center tablemb">
	<thead>
		<tr>
			<th>&nbsp;</th>
			<th>Når</th>
			<th>Dato</th>
			<th>Antall brukere</th>
			<th>Antall hits</th>
		</tr>
	</thead>
	<tbody>';
$i = 0;
while ($row = $result->fetch()) {
    $i++;
    $time = floor((time() - $row['timestamp']) / 86400);
    echo '
		<tr>
			<td align="right">#' . $i . '</td>
			<td align="right">' . ($time == 1 ? '<b>I går</b>' : ($time > 0 ? '<b>' . $time . '</b> dager' : '<b>I dag</b>')) . '</td>
			<td>' . $row['date'] . '</td>
			<td align="right">' . game::format_number($row['users']) . '</td>
			<td align="right">' . game::format_number($row['hits']) . '</td>
		</tr>';
}
echo '
	</tbody>
</table>';
$_base->page->load();
示例#30
0
        echo '
		<table class="table tablemb">
			<thead>
				<tr>
					<th>Bruker</th>
					<th>E-post</th>
					<th>Sist pålogget</th>
					<th>&nbsp;</th>
				</tr>
			</thead>
			<tbody>';
        $i = 0;
        while ($row = $result->fetch()) {
            echo '
				<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
					<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
					<td>' . htmlspecialchars($row['u_email']) . '</td>
					<td>' . $_base->date->get($row['up_last_online'])->format(date::FORMAT_SEC) . '</td>
					<td><form action="" method="post"><input type="hidden" name="up_id" value="' . $row['up_id'] . '" />' . show_sbutton("Velg") . '</form></td>
				</tr>';
        }
        echo '
			</tbody>
		</table>';
    }
    echo box_end();
}
show_search_form();
$_base->page->load();
function like_search($value)
{