function b1n_mapCheckDrinkFromPlayer($id) { global $sql, $lang; // Checking whether the target is at the same position as the biter if ($_SESSION['player']['pla_action_points'] >= 1) { $query = "\n SELECT \n pla_login, pla_exp\n FROM\n player\n WHERE\n pla_id = '" . $id . "' AND\n pla_pos_x = '" . $_SESSION['player']['pla_pos_x'] . "' AND\n pla_pos_y = '" . $_SESSION['player']['pla_pos_y'] . "'"; if ($ret = $sql->sqlSingleQuery($query)) { // Checking if the biter is trying to bite a player that it did already // and that the target didnt move since then $query = "\n SELECT\n log_add_dt > (\n SELECT CASE WHEN ((\n SELECT COUNT(log_id) FROM log WHERE\n pla_id = {$id} AND log_action = 'move') > 0)\n THEN (\n SELECT log_add_dt FROM log WHERE \n pla_id = {$id} AND log_action = 'move'\n ORDER BY log_add_dt DESC LIMIT 1\n )\n ELSE \n CURRENT_TIMESTAMP\n END AS log_add_dt\n ) AS did_bite\n FROM\n log\n WHERE\n pla_id = " . $_SESSION['player']['pla_id'] . " AND\n log_action = 'drink_from_player' AND\n log_vars LIKE 'pla_id:{$id};%'\n ORDER BY\n log_add_dt DESC"; $aux = $sql->sqlSingleQuery($query); if (b1n_checkTrue($aux['did_bite'])) { b1n_retMsg($lang['map_drink_not_again']); $ret = false; } } else { b1n_retMsg($lang['map_drink_invalid_target']); } } else { b1n_retMsg($lang['map_action_not_enough']); $ret = false; } return $ret; }
function b1n_permNewPlayer($login, $passwd, $email, $seccode, $master) { global $sql, $lang; $seccode = b1n_crypt($seccode); if (!b1n_cmp($seccode, $_SESSION['seccode'])) { $msg = b1n_decrypt($seccode); $msg .= ' != '; $msg .= b1n_decrypt($_SESSION['seccode']); b1n_retMsg($lang['login_err_wrong_code'], array('{code}' => $msg)); return false; } if (b1n_permCheckNewPlayer($login, $passwd, $email, $master)) { $query = ' SELECT func_newPlayer( ' . b1n_inBd($login) . ', ' . b1n_inBd(b1n_crypt($passwd)) . ', ' . b1n_inBd($email) . ', ' . b1n_inBd($master) . ') AS ret'; $rs = $sql->sqlSingleQuery($query); $rs['ret'] = b1n_checkTrue($rs['ret']); if ($rs['ret']) { b1n_retMsg($lang['unexpected']); } return $rs['ret']; } return false; }