public static function get($variable, $default) { $s = database::select("variables", array("variable_value"), "variable_name='%var'", array("%var" => $variable)); if (($b = database::fetch($s, PDO::FETCH_COLUMN)) != null) { return json_decode($b, true); } else { return $default; } }
public function Auth($email, $password) { $database = new database(); $result = $database->query("SELECT * FROM member WHERE email = '{$email}'and password = '******'"); if ($result) { $userSet = $database->fetch($result); } return isset($userSet) ? $userSet : FALSE; }
public function fetchByPicId($id) { $database = new database(); $result = $database->query("SELECT * FROM personal_pic where member_id = {$id}"); if ($result) { $userSet = $database->fetch($result); } return isset($userSet) ? $userSet : FALSE; }
public static function list_command($nick, $ircdata = array()) { $term = $ircdata[0]; $limit = $ircdata[1]; $mode = isset($ircdata[2]) ? strtolower($ircdata[2]) : ''; if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED); return false; } // they've gotta be identified and opered.. if (trim($term) == '' || trim($limit) == '' || isset($mode) && !in_array($mode, array('', 'suspended'))) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'LIST')); return false; } // invalid syntax if (!preg_match('/([0-9]+)\\-([0-9]+)/i', $limit)) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'LIST')); return false; } // invalid syntax $total = database::select('users', array('id')); $total = database::num_rows($total); $nicks = self::_find_match($term, $mode, $limit); // try and find a match if (database::num_rows($nicks) == 0) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_BOTTOM, array('num' => 0, 'total' => $total)); return false; } // no nicks? services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_TOP); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_TOP2); // top of list. while ($user = database::fetch($nicks)) { $false_nick = $user->display; if (!isset($user->display[18])) { $y = strlen($user->display); for ($i = $y; $i <= 17; $i++) { $false_nick .= ' '; } } // this is just a bit of fancy fancy, so everything displays neat if ($user->suspended == 0) { $hostmask = explode('!', $user->last_hostmask); $info = $hostmask[1]; } else { $info = $user->suspend_reason; } services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_ROW, array('nick' => $false_nick, 'info' => $info)); } // loop through the nicks services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_LIST_BOTTOM, array('num' => database::num_rows($nicks) == 0 ? 0 : database::num_rows($nicks), 'total' => $total)); }
public static function list_command($nick, $ircdata = array()) { $term = $ircdata[0]; $limit = $ircdata[1]; $mode = isset($ircdata[2]) ? strtolower($ircdata[2]) : ''; if (!core::$nicks[$nick]['ircop'] || services::user_exists($nick, true, array('display', 'identified')) === false) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_ACCESS_DENIED); return false; } // they've gotta be identified and opered.. if (trim($term) == '' || trim($limit) == '' || isset($mode) && !in_array($mode, array('', 'suspended'))) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'INFO')); return false; } // invalid syntax if (!preg_match('/([0-9]+)\\-([0-9]+)/i', $limit)) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'LIST')); return false; } // invalid syntax $total = database::select('chans', array('id')); $total = database::num_rows($total); $chans = self::_find_match($term, $mode, $limit); // try and find a match if (database::num_rows($chans) == 0) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_BOTTOM, array('num' => 0, 'total' => $total)); return false; } // no channels? services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_TOP); services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_TOP2); // top of the list while ($channel = database::fetch($chans)) { $false_chan = $channel->channel; if (!isset($channel->channel[18])) { $y = strlen($channel->channel); for ($i = $y; $i <= 17; $i++) { $false_chan .= ' '; } } // this is just a bit of fancy fancy, so everything displays neat if ($channel->suspended == 0) { $info = chanserv::get_flags($channel->channel, 'd'); } else { $info = $channel->suspend_reason; } // suspend reason, or description? services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_ROW, array('chan' => $false_chan, 'info' => $info)); } // loop through the channels services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LIST_BOTTOM, array('num' => database::num_rows($chans) == 0 ? 0 : database::num_rows($chans), 'total' => $total)); }
public static function node_load($nid) { if (!self::node_exist($nid)) { return false; } $node = database::fetch(database::select("node", array(), "nid='%nid'", array('%nid' => $nid))); $nt = self::load_node_type($node->type); $table_node = $nt->table_name; $fields = database::fetch(database::select($table_node, array(), "nid='%nid'", array('%nid' => $nid)), PDO::FETCH_ASSOC); if ($fields != false) { foreach ($fields as $k => $v) { $node->{$k} = $v; } } return $node; }
<?php require 'libraries/database.php'; $email = $_REQUEST['email']; $password = $_REQUEST['matKhau']; $data = new database("timphongtro"); $sql = "SELECT * FROM taikhoan WHERE email='{$email}' AND MatKhau='{$password}'"; $data->query($sql); header('Content-type: text/xml'); echo "<result>"; if ($data->num_rows() == 0) { echo "false"; } else { $result = $data->fetch(); echo $result['IDTaiKhoan']; } echo "</result>";
public static function get_flags($chan, $flag) { if ($flag == 'd') { $param_field = 'desc'; } elseif ($flag == 'u') { $param_field = 'url'; } elseif ($flag == 'e') { $param_field = 'email'; } elseif ($flag == 'w') { $param_field = 'welcome'; } elseif ($flag == 'm') { $param_field = 'modelock'; } elseif ($flag == 't') { $param_field = 'topicmask'; } else { return false; } // translate. some craq. $chan_flags_q = database::select('chans_flags', array('id', 'channel', 'flags', $param_field), array('channel', '=', $chan)); $chan_flags = database::fetch($chan_flags_q); // get our flags records return $chan_flags->{$param_field}; }
public static function get_block($blockname) { return database::fetch(database::select("blocks", array(), "block=%block", array("%block" => $blockname))); }
public static function is_enabled($module_name) { $res = database::fetch(database::select("module_manager", array("module_enabled"), "module_name = '%module'", array("%module" => $module_name)), PDO::FETCH_COLUMN); if ($res) { return $res == 1; } return false; }
public static function set_flag($nick, $chan, $target, $flag, $param = '') { $mode = $flag[0]; $r_flag = $flag[1]; // get the real flag, eg. V, v and mode if (chanserv::check_levels($target, $chan, array($r_flag), false, false, false, false)) { $user_flag_q = database::select('chans_levels', array('id', 'channel', 'target', 'flags'), array('channel', '=', $chan, 'AND', 'target', '=', $target)); if ($mode == '-') { if ($nick == $target && $r_flag == 'F') { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_LEVELS_BAD_FLAG, array('flag' => $flag)); return false; } // someone is trying to de-founder themselves? if (strpos(self::$set[$target], '-') === false) { self::$set[$target] .= '-'; } // ok, no - ? $user_flag = database::fetch($user_flag_q); // get the flag record $new_user_flags = str_replace($r_flag, '', $user_flag->flags); if ($new_user_flags == '') { database::delete('chans_levels', array('channel', '=', $chan, 'AND', 'target', '=', $target)); } else { database::update('chans_levels', array('flags' => $new_user_flags), array('channel', '=', $chan, 'AND', 'target', '=', $target)); } // check if it's empty, if it is just delete the row self::$set[$target] .= $r_flag; // some magic :O return true; } else { self::$already_set[$target] .= $r_flag; // some magic :O return false; } // the user has the flag, so, if it's - remove it, if it is + // we send a message back. } else { $user_flag_q = database::select('chans_levels', array('id', 'channel', 'target', 'flags'), array('channel', '=', $chan, 'AND', 'target', '=', $target)); if ($mode == '+') { if (strpos(self::$set[$target], '+') === false) { self::$set[$target] .= '+'; } // ok, no + ? if (database::num_rows($user_flag_q) > 0) { $user_flag = database::fetch($user_flag_q); $new_user_flags = $user_flag->flags . $r_flag; if ($r_flag == 'b' && $mode == '+') { database::update('chans_levels', array('flags' => $new_user_flags, 'reason' => $param), array('channel', '=', $chan, 'AND', 'target', '=', $target)); } else { database::update('chans_levels', array('flags' => $new_user_flags), array('channel', '=', $chan, 'AND', 'target', '=', $target)); } // update. self::$set[$target] .= $r_flag; // some magic :O return true; } else { if ($r_flag == 'b' && $mode == '+') { database::insert('chans_levels', array('channel' => $chan, 'target' => $target, 'flags' => $r_flag, 'reason' => $param)); } else { database::insert('chans_levels', array('channel' => $chan, 'target' => $target, 'flags' => $r_flag)); } // insert. self::$set[$target] .= $r_flag; // some magic :O return true; } } else { self::$not_set[$target] .= $r_flag; // some magic :O return false; } // the user doesn't have the flag, so if it's + add it, if it is - // we send a message back, basically the opposite of above. } }
require './lib/perms.php'; require './lib/user.php'; require './lib/modlet.php'; require './lib/xmlparser.php'; if (!$set['installed']) { header('Location: ./install/index.php'); } set_error_handler('error'); error_reporting(E_ALL); set_magic_quotes_runtime(0); // Open connection to database $db = new database($set['db_host'], $set['db_user'], $set['db_pass'], $set['db_name'], $set['db_port'], $set['db_socket']); if (!$db->connection) { error(QUICKSILVER_ERROR, 'A connection to the database could not be established and/or the specified database could not be found.', __FILE__, __LINE__); } $settings = $db->fetch("SELECT settings_data FROM {$set['prefix']}settings LIMIT 1"); $set = array_merge($set, unserialize($settings['settings_data'])); $modules = array_merge($set['optional_modules'], array('help', 'mod', 'post', 'register', 'login', 'forum', 'topic')); if (!isset($_GET['a']) || !in_array($_GET['a'], $modules)) { $module = 'board'; } else { $module = $_GET['a']; } require './func/' . $module . '.php'; $qsf = new $module(); $qsf->pre = $set['prefix']; $qsf->db = $db; $qsf->get['a'] = $module; $qsf->sets = $set; if ($qsf->sets['output_buffer'] && isset($qsf->server['HTTP_ACCEPT_ENCODING']) && stristr($qsf->server['HTTP_ACCEPT_ENCODING'], 'gzip')) { ob_start('ob_gzhandler');
$champX = "pseudo"; $equipeX = "joueur"; $equipesX = "joueurs"; $EquipeX = "Joueur"; $EquipesX = "Joueurs"; $show = "show_joueur"; $nom_participant = "nom_joueur"; } } /*** chargement de la variable des 'gardes' de l'utilisateur ***/ if ($s_joueur) { $db->select("id,grade"); $db->from("{$dbprefix}joueurs"); $db->where("id = {$s_joueur}"); $res = $db->exec(); while ($grade_ch = $db->fetch($res)) { // A est 'le' chef if (eregi('a', $grade_ch->grade)) { $grade['a'] = 'a'; } // B peut tout faire sauf modifier 'le chef' if (eregi('b', $grade_ch->grade)) { $grade['b'] = 'b'; } // C peut modifier la configuration (mods comprit) if (eregi('c', $grade_ch->grade)) { $grade['c'] = 'c'; } // D gère les downloads if (eregi('d', $grade_ch->grade)) { $grade['d'] = 'd';
public static function identify_command($nick, $ircdata = array()) { $password = $ircdata[0]; if (trim($password) == '') { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'IDENTIFY')); return false; } // wrong syntax damit! if ($user = services::user_exists($nick, false, array('display', 'pass', 'identified', 'validated', 'salt', 'vhost'))) { if ($user->validated == 0) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_AWAITING_VALIDATION); return false; } elseif ($user->identified == 1) { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ALREADY_IDENTIFIED); return false; } else { if ($user->pass == sha1($password . $user->salt)) { timer::remove(array('ns_identify', 'secured_callback', array($nick))); // remove the secured timer. if there is one ircd::on_user_login($nick); // registered mode database::update('users', array('identified' => 1, 'last_hostmask' => core::get_full_hostname($nick), 'last_timestamp' => 0), array('display', '=', $nick)); services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_IDENTIFIED); // right, standard identify crap core::alog(core::$config->nickserv->nick . ': ' . core::get_full_hostname($nick) . ' identified for nick ' . core::$nicks[$nick]['nick']); // logchan if ($user->vhost != '' && isset(modules::$list['os_vhost'])) { if (substr_count($user->vhost, '@') == 1) { $new_host = explode('@', $user->vhost); $ident = $new_host[0]; $host = $new_host[1]; ircd::setident(core::$config->operserv->nick, $user->display, $ident); ircd::sethost(core::$config->operserv->nick, $user->display, $host); } else { ircd::sethost(core::$config->operserv->nick, $user->display, $user->vhost); } } // first thing we do, check if they have a vhost, if they do, apply it. $failed_attempts = database::select('failed_attempts', array('nick', 'mask', 'time'), array('nick', '=', $nick)); if (database::num_rows($failed_attempts) > 0) { services::communicate(core::$config->nickserv->nick, $nick, '' . database::num_rows($failed_attempts) . ' failed login(s) since last login.'); while ($row = database::fetch($failed_attempts)) { services::communicate(core::$config->nickserv->nick, $nick, 'Failed login from: ' . $row->mask . ' on ' . date("F j, Y, g:i a", $row->time) . ''); } // loop through the failed attempts messaging them to the user database::delete('failed_attempts', array('nick', '=', $nick)); // clear them now that they've been seen } // we got any failed attempts? HUMM $hostname = core::get_full_hostname($nick); // generate a hostname. if (core::$config->settings->mode_on_id == 'yes' && isset(modules::$list['cs_levels'])) { foreach (core::$chans as $chan => $cdata) { $access_array = cs_levels::get_access($chan); // get the access array if ($nick == core::$config->chanserv->nick) { continue; } // skip us :D $hostname = core::get_full_hostname($nick); // get the hostname ready. foreach ($access_array as $target => $access) { if ($target == $nick) { $remove_access = false; // don't remove access cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S'))); // give them access continue 2; // continue to next loop cause we've found a match } elseif (strpos($target, '@') !== false && services::match($hostname, $target)) { $remove_access = false; // don't remove access cs_levels::give_access($chan, $nick, $access, chanserv::check_flags($chan, array('S'))); // give them access continue 2; // continue to next loop cause we've found a match } elseif (strpos(core::$chans[$chan]['users'][$nick], 'o') !== false) { $remove_access = true; // set remove access to true continue 1; // continue to next loop to check other access records } else { continue 1; // continue to next loop to check other access records } // we check if the user has access, if they do break; // we also check if they dont have access and have op, if they do remove it. } // loop through the access records } // loop through channels, check if they are in any } // check if mode_on_id is set, also cs_access is enabled, and lets do a remote access gain :D } else { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSWORD); core::alog(core::$config->nickserv->nick . ': Invalid password from ' . core::get_full_hostname($nick)); // some logging stuff database::insert('failed_attempts', array('nick' => $nick, 'mask' => core::get_full_hostname($nick), 'time' => core::$network_time)); core::$nicks[$nick]['failed_attempts']++; // ooh, we have something to log :) if (core::$nicks[$nick]['failed_attempts'] == 5) { ircd::kill(core::$config->nickserv->nick, $nick, 'Maxmium FAILED login attempts reached.'); } // have they reached the failed attempts limit? we gonna f*****g KILL mwhaha } // invalid password? HAX!! } // are they already identifed? } else { services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED); return false; // doesn't even exist.. } // right now we need to check if the user exists, and password matches }
<?php require 'libraries/database.php'; $idN = $_REQUEST['idN']; $data = new database("timphongtro"); $sql1 = "select * from taikhoan_o_phongtro where IDTaiKhoan='{$idN}'"; $data->query($sql1); if ($data->num_rows() != 0) { $result1 = $data->fetch(); $idP = $result1['IDPhongTro']; $sql2 = "select * from phongtro where IDPhongTro='{$idP}'"; $data->query($sql2); $result2 = $data->fetch(); $sql3 = "select * from taikhoan_o_phongtro, taikhoan where taikhoan_o_phongtro.IDTaiKhoan=taikhoan.IDTaiKhoan and IDPhongTro='{$idP}'"; $data->query($sql3); $result3 = $data->fetchAll('user'); header('Content-type: text/xml'); echo "<result>"; echo "<idP>" . $idP . "</idP>"; echo "<dienTich>" . $result2['DienTich'] . "</dienTich>"; echo "<gia>" . $result2['GiaPhong'] . "</gia>"; echo "<khuVuc>" . $result2['KhuVuc'] . "</khuVuc>"; echo "<diaChi>" . $result2['DiaChi'] . "</diaChi>"; echo "<boSung>" . $result2['ThongTinBoSung'] . "</boSung>"; echo "<tinhTrang>" . $result2['TinhTrang'] . "</tinhTrang>"; echo "<soNguoiO>" . $result2['SoNguoiTrongPhong'] . "</soNguoiO>"; echo "<danhSachNguoiO>"; foreach ($result3 as $index => $user) { if (is_array($user)) { foreach ($user as $key => $value) { echo "<" . $key . ">";
public static function get_flags($nick, $flag) { if ($flag == 'e') { $param_field = 'email'; } elseif ($flag == 'u') { $param_field = 'url'; } elseif ($flag == 'm') { $param_field = 'msn'; } else { return false; } // translate. some craq. $nick_flags_q = database::select('users_flags', array('id', 'nickname', 'flags', $param_field), array('nickname', '=', $nick)); $nick_flags = database::fetch($nick_flags_q); // get our flags records return $nick_flags->{$param_field}; }
} else { echo "<script>alert('You do not have permission to send a message right now.');</script>"; } exit; } $uploaddir = './uploads/'; $file = $uploaddir . basename($_FILES['uploadfile']['name']); $file = str_replace(" ", "", $file); $_FILES['uploadfile']['name'] = str_replace(" ", "", $_FILES['uploadfile']['name']); $fileext = strtolower(substr(strrchr($_FILES['uploadfile']['name'], '.'), 1)); if ($fileext == 'jpg' || $fileext == 'jpeg' || $fileext == 'png' || $fileext == 'gif') { if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { $pic_info = getimagesize($file); $pic_wdth = $pic_info[0]; $pic_ht = $pic_info[1]; if ($pic_ht > 200) { $pic_ht = '200px'; } if ($pic_wdth > 200) { $pic_wdth = '180px'; } $wall = '<a href=uploads/' . $_FILES['uploadfile']['name'] . ' title=Download target="_blank"><img src=uploads/' . $_FILES['uploadfile']['name'] . ' height=' . $pic_ht . ' width=' . $pic_wdth . ' ></a>'; $ui = $db->query("select * from login where name='" . $_SESSION["name"] . "'"); $uidd = $db->fetch($ui); $insert = $db->query("INSERT INTO {$messages} (message,uid_fk,created) VALUES ('{$wall}','" . $uidd[uid] . "','{$dat}')"); echo '<script>alert("photo sent successfully.");</script>'; echo '<script>window.location="indes.php?talk=' . $frnd . '";</script>'; } } else { echo "error: Please select a jpg, png, jpeg or gif type picture to upload."; }
$bl = database::query("select * from message where tid='" . $m . "'"); $blrow = mysql_fetch_assoc($bl); $b = $blrow['block']; $bid = $blrow['blocker_id']; if ($b == '0') { if ($bid == $_SESSION["uid"]) { echo "<script>alert('You must first unblock the user to send a message.');</script>"; } else { echo "<script>alert('You do not have permission to send a message right now.');</script>"; } exit; } if (isset($_REQUEST["fbwall"])) { $wall = trim(mysql_real_escape_string($_REQUEST["fbwall"])); $ui = $db->query("select * from login where name='" . $_SESSION["name"] . "'"); $uidd = $db->fetch($ui); $insert = $db->query("INSERT INTO {$messages} (message,uid_fk,created) VALUES ('{$wall}','" . $uidd[uid] . "','{$dat}')"); if ($insert) { $select = $db->query("select * from {$messages} as m join login as l on m.uid_fk=l.uid ORDER BY `msg_id` DESC"); while ($view = $db->fetch($select)) { ?> <div id="display"> <div id="leftdisplay"> <img src="arun.jpg" width="35" height="35"/> </div><br/><br/><br/><br/> <div id="rightdisplay"> <p class="triangle-border left"> <?php echo $query["name"] . ':' . $view["message"]; ?> </p> </div>
public static function get_default_theme() { return database::fetch(database::select("theme_manager", array(), "theme_default=1")); }
public static function _list_users($nick) { $check_nick_q = database::select('ignored_users', array('who', 'time')); if (database::num_rows($check_nick_q) > 0) { services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_IGNORE_LIST_T); services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_IGNORE_LIST_T2); // t-o-l while ($ignored = database::fetch($check_nick_q)) { $false_nick = $ignored->who; if (!isset($ignored->who[18])) { $y = strlen($ignored->who); for ($i = $y; $i <= 17; $i++) { $false_nick .= ' '; } } // this is just a bit of fancy fancy, so everything displays neat services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_IGNORE_LIST, array('nick' => $false_nick, 'time' => date("F j, Y, g:i a", $ignored->time))); } // loop through the records } else { services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_IGNORE_EMPTY); // empty list. } }
public static function info_command($nick, $ircdata = array()) { $chan = core::get_chan(&$ircdata, 0); // get the channel. if ($chan == '' || $chan[0] != '#') { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'INFO')); return false; // wrong syntax } // make sure they've entered a channel if (!($channel = services::chan_exists($chan, array('channel', 'timestamp', 'last_timestamp', 'suspended', 'suspend_reason')))) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_UNREGISTERED_CHAN, array('chan' => $chan)); return false; } // make sure the channel exists if ($channel->suspended == 1) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_SUSPENDED_1, array('chan' => $channel->channel)); services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_SUSPENDED_2, array('reason' => $channel->suspend_reason)); } else { $founder = database::select('chans_levels', array('id', 'channel', 'target', 'flags'), array('channel', '=', $chan)); $founders = ''; while ($f_row = database::fetch($founder)) { if (strpos($f_row->flags, 'F') !== false) { $founders .= $f_row->target . ', '; } } // get the founder(s) services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_1, array('chan' => $channel->channel)); services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_2, array('nicks' => substr($founders, 0, -2))); $desc = chanserv::get_flags($channel->channel, 'd'); if ($desc != null) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_3, array('desc' => $desc)); } // description? if (core::$chans[$chan]['topic'] != '') { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_4, array('topic' => core::$chans[$chan]['topic'])); } // topic $email = chanserv::get_flags($channel->channel, 'e'); if ($email != null) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_5, array('email' => $email)); } // is there an email? $url = chanserv::get_flags($channel->channel, 'u'); if ($url != null) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_6, array('url' => $url)); } // or a url? services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_7, array('time' => date("F j, Y, g:i a", $channel->timestamp))); services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_8, array('time' => date("F j, Y, g:i a", $channel->last_timestamp))); $modelock = chanserv::get_flags($channel->channel, 'm'); if ($modelock != null) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_9, array('mode_lock' => $modelock)); } // is there a mode lock? $entrymsg = chanserv::get_flags($channel->channel, 'w'); if ($entrymsg != null) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_10, array('entrymsg' => $entrymsg)); } // is there an entry msg? $list = ''; if (chanserv::check_flags($channel->channel, array('T'))) { $list .= 'Topiclock, '; } if (chanserv::check_flags($channel->channel, array('K'))) { $list .= 'Keeptopic, '; } if (chanserv::check_flags($channel->channel, array('G'))) { $list .= 'Guard, '; } if (chanserv::check_flags($channel->channel, array('S'))) { $list .= 'Secure, '; } if (chanserv::check_flags($channel->channel, array('F'))) { $list .= 'Fantasy'; } if (substr($list, -2, 2) == ', ') { $list = substr($list, 0, -2); } // compile our list of options if ($list != '') { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_11, array('options' => $list)); } // if our list doesn't equal '', eg. empty show the info. if (core::$nicks[$nick]['ircop'] && services::user_exists($nick, true, array('display', 'identified')) !== false && core::$config->chanserv->expire != 0) { $expiry_time = core::$config->chanserv->expire * 86400; services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INFO_12, array('time' => date("F j, Y, g:i a", $channel->last_timestamp + $expiry_time))); } // if the nick in question has staff powers, we show the expiry times. } }
public static function set_flag($nick, $chan, $flag, $param) { $mode = $flag[0]; $r_flag = $flag[1]; // get the real flag, eg. V, v and mode if (in_array($r_flag, str_split(self::$p_flags)) && $param == '' && $mode == '+') { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_FLAGS_NEEDS_PARAM, array('flag' => $flag)); return false; } // are they issuing a flag, that HAS to have a parameter? // only if mode is + and parameter is empty. if ($r_flag == 'd') { $param_field = 'desc'; } if ($r_flag == 'u') { $param_field = 'url'; } if ($r_flag == 'e') { $param_field = 'email'; } if ($r_flag == 'w') { $param_field = 'welcome'; } if ($r_flag == 'm') { $param_field = 'modelock'; } if ($r_flag == 't') { $param_field = 'topicmask'; } // translate. some craq. if (in_array($r_flag, str_split(self::$p_flags)) && $mode == '+') { if ($r_flag == 'e' && services::valid_email($param) === false) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_FLAGS_INVALID_E, array('flag' => $flag)); return false; } // is the email invalid? if ($r_flag == 't' && strpos($param, '*') === false) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_FLAGS_INVALID_T, array('flag' => $flag)); return false; } // is the topicmask invalid? if ($r_flag == 'm') { $mode_string = explode(' ', $param); if (strstr($mode_string[0], 'r') || strstr($mode_string[0], 'q') || strstr($mode_string[0], 'a') || strstr($mode_string[0], 'o') || strstr($mode_string[0], 'h') || strstr($mode_string[0], 'v') || strstr($mode_string[0], 'b')) { services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_FLAGS_INVALID_M, array('flag' => $flag)); return false; } } // is the modelock invalid? } // check for invalid values if (chanserv::check_flags($chan, array($r_flag))) { $chan_flag_q = database::select('chans_flags', array('id', 'channel', 'flags'), array('channel', '=', $chan)); if ($mode == '-') { if (strpos(self::$set[$target], '+') === false) { self::$set[$target] .= '+'; } // ok, no + ? $chan_flag = database::fetch($chan_flag_q); // get the flag record $new_chan_flags = str_replace($r_flag, '', $chan_flag->flags); if (in_array($r_flag, str_split(self::$p_flags))) { database::update('chans_flags', array('flags' => $new_chan_flags, $param_field => $param), array('channel', '=', $chan)); // update the row with the new flags. } else { database::update('chans_flags', array('flags' => $new_chan_flags), array('channel', '=', $chan)); // update the row with the new flags. } self::$set[$chan] .= $r_flag; // some magic :O return true; } if ($mode == '+') { if (!in_array($r_flag, str_split(self::$p_flags))) { self::$already_set[$chan] .= $r_flag; // some magic :O return false; } if (strpos(self::$set[$target], '+') === false) { self::$set[$target] .= '+'; } // ok, no + ? $chan_flag = database::fetch($chan_flag_q); // get the flag record database::update('chans_flags', array($param_field => $param), array('channel', '=', $chan)); // update the row with the new flags. self::$set[$chan] .= $r_flag; // some magic :O return true; } // the flag IS set, so now we check whether they are trying to -, or + it // if they are trying to - it, go ahead, error if they are trying to + it. } else { $chan_flag_q = database::select('chans_flags', array('id', 'channel', 'flags'), array('channel', '=', $chan)); if ($mode == '+') { if (strpos(self::$set[$target], '+') === false) { self::$set[$target] .= '+'; } // ok, no + ? $chan_flag = database::fetch($chan_flag_q); // get the flag record $new_chan_flags = $chan_flag->flags . $r_flag; if (!in_array($r_flag, str_split(self::$p_flags))) { database::update('chans_flags', array('flags' => $new_chan_flags), array('channel', '=', $chan)); // update the row with the new flags. self::$set[$chan] .= $r_flag; // some magic :O return true; } else { database::update('chans_flags', array('flags' => $new_chan_flags, $param_field => $param), array('channel', '=', $chan)); // update the row with the new flags. self::$set[$chan] .= $r_flag; // some magic :O return true; } } // the flag ISNT set, so now we check whether they are trying to -, or + it // if they are trying to + it, go ahead, error if they are trying to _ it. if ($mode == '-') { self::$not_set[$chan] .= $r_flag; // some magic :O return false; } } // check if the flag is already set? }
echo "<khuVuc>" . $result1['KhuVuc'] . "</khuVuc>"; echo "<dienTich>" . $result1['DienTich'] . "</dienTich>"; echo "<gia>" . $result1['GiaPhong'] . "</gia>"; echo "</phong>"; echo "</result>"; } else { header('Content-type: text/xml'); echo "<result>" . "false" . "</result>"; } } $sql2 = "select * from phongdexuat where IDPhongDeXuat='{$idP}'"; $data2->query($sql2); $n2 = $data2->num_rows(); if ($kieuPhong == "deXuat") { if ($n2 != 0) { $result2 = $data2->fetch(); header('Content-type: text/xml'); echo "<result>"; echo "<phong>"; echo "<idP>" . $idP . "</idP>"; echo "<kieu>" . "deXuat" . "</kieu>"; echo "<khuVuc>" . $result2['KhuVuc'] . "</khuVuc>"; echo "<dienTich>" . $result2['DienTich'] . "</dienTich>"; echo "<gia>" . $result2['GiaPhong'] . "</gia>"; echo "</phong>"; echo "</result>"; } else { header('Content-type: text/xml'); echo "<result>" . "false" . "</result>"; } }
static function check_mask_ignore($nick) { $ignored_user = database::select('ignored_users', array('who')); $hostname = core::get_full_hostname($nick); // we generate the hostname if (database::num_rows($ignored_user) > 0) { while ($ignore = database::fetch($ignored_user)) { if ($nick == $ignore->who) { return true; } elseif (strpos($ignore->who, '@') && self::match($hostname, $ignore->who)) { return true; } // we've found a match! } // loop through records, on the first match we instantly break the loop. } else { return false; } // there are records }
/** * Get config value from database directly, if not return false. */ function inst_get_config($name) { global $SQL, $dbprefix; if (!$SQL) { global $dbserver, $dbuser, $dbpass, $dbname; if (!isset($dbserver)) { return false; } $SQL = new database($dbserver, $dbuser, $dbpass, $dbname); } if (!$SQL) { return false; } $sql = "SELECT value FROM `{$dbprefix}config` WHERE `name` = '" . $name . "'"; $result = $SQL->query($sql); if ($SQL->num($result) == 0) { return false; } else { $current_ver = $SQL->fetch($result); return $current_ver['value']; } }
public static function has_permission($perm, $group) { return is_object(database::fetch(database::select("permission_role", array(), "permission='%perm' AND gid='%group'", array("%perm" => $perm, "%group" => $group)))); }
require_once BASEDIR . 'lib/functions.php'; require_once BASEDIR . 'lib/class.database.php'; define('PRE', $set['mysql_pre']); $db = new database($set['mysql_server'], $set['mysql_user'], $set['mysql_pwd'], $set['mysql_db'], $set['mysql_utf8']); //Wenn kein Fehler aufgetreten ist, dann wird ein Leerpixel ausgegeben function cron_finish() { if (DEBUG != true) { ob_end_clean(); header('Content-type: image/gif'); readfile('cronimage.dat'); } exit; } //Auf Cronjobs prüfen $crons = $db->fetch("SELECT * FROM " . PRE . "_cron WHERE hash='" . addslashes($_REQUEST['hash']) . "'"); if (!count($crons)) { cron_finish(); } $cronfuncs = array(); $loadmodules = array(); foreach ($crons as $res) { $cronfuncs[] = array($res['funcname'], $res['lastexec']); $loadmodule[] = $res['module']; $diff = floor((time() - $res['lastexec']) / $res['period']) * $res['period']; if (DEBUG != true) { $db->query("UPDATE " . PRE . "_cron SET lastexec=lastexec+'" . $diff . "',hash='' WHERE funcname='" . addslashes($res['funcname']) . "' AND hash='" . addslashes($_REQUEST['hash']) . "' LIMIT 1"); } } /////////////////////////////////////////////////////////////////////////////////////////////////// //Weitere Dateien nachladen
$SQL = new database($dbserver, $dbuser, $dbpass, $dbname); unset($dbpass); #$tpl = new kleeja_style; $usrcp = $user = new user(); $cache = new cache(); $plugin = new plugins(); #return to the default user system if this given if (defined('DISABLE_INTR')) { $config['user_system'] = 1; } #load cached data include PATH . 'includes/cache_data.php'; #getting dynamic configs $query = array('SELECT' => 'c.name, c.value', 'FROM' => "{$dbprefix}config c", 'WHERE' => 'c.dynamic = 1'); $result = $SQL->build($query); while ($row = $SQL->fetch($result)) { $config[$row['name']] = $row['value']; } $SQL->free($result); #check user or guest $usrcp->kleeja_check_user(); #+ configs of the current group $config = array_merge($config, (array) $d_groups[$user->data['group_id']]['configs']); #no tpl caching in dev stage #if(defined('DEV_STAGE')) #{ #$tpl->caching = false; #} #admin path !defined('ADMIN_PATH') ? define('ADMIN_PATH', $config['siteurl'] . 'admin/') : null; #Admin style name
<?php if ($_GET['del'] == '1') { echo '<img src="loader.gif" alt="ALL MESSAGES DELETED" title="Please wait..">'; } else { echo '<img src=delete1.png height=30 width=45 alt="Delete all messages">'; } ?> </a> <br><br> <div id="container"> <!--- <div id="viewpost"> ---> <?php $queyr = $db->query("select * from {$messages} as m join login as l on m.uid_fk=l.uid ORDER BY `msg_id` DESC"); $quw = $db->query("select * from login where name='" . $_SESSION["name"] . "'"); $qu = $db->fetch($quw); $tab1 = mysql_fetch_assoc(database::query("select * from {$messages} where uid_fk='" . $_SESSION["uid"] . "' ORDER BY `msg_id` DESC LIMIT 1")); if ($tab1['seen'] != NULL) { echo '<div><font size=1 color="#BDBCDB" style="float:right;">✔ seen on ' . date('F j, g:i:s a', strtotime($tab1['seen']) + 19800) . '</font></div><br>'; } while ($query = $db->fetch($queyr)) { $tm = date('Y-m-d H:i:s'); $tab = mysql_fetch_assoc(database::query("select * from {$messages} where uid_fk!='" . $_SESSION["uid"] . "' ORDER BY `msg_id` DESC LIMIT 1")); if ($tab['seen'] == NULL) { database::query("Update {$messages} Set seen=now() Where msg_id='" . $tab['msg_id'] . "'"); } $sel = database::query("select * from login where name='" . $query[name] . "'"); $row = mysql_fetch_assoc($sel); $u = 's' . $_SESSION["uid"]; if (isset($_GET["del"])) { $id = $query["msg_id"];
public static function optimize() { $tablesResult = mysql_query("SHOW TABLES FROM " . core::$config->database->name); $tname = "Tables_in_" . core::$config->database->name; while ($row = database::fetch($tablesResult)) { mysql_query("OPTIMIZE TABLE `" . $row->{$tname} . "`"); } // loop through our tables core::alog(core::$config->operserv->nick . ': database optimization complete'); core::alog('optimize(): database optimization complete.', 'BASIC'); }