Esempio n. 1
0
 public static function update_list()
 {
     database::delete("permission");
     foreach (self::list_of_existing_permissions() as $perm => $descr) {
         database::insert("permission", array("permission" => $perm, "description" => $descr));
     }
 }
Esempio n. 2
0
 public static function set($variable, $value)
 {
     $v = json_encode($value);
     if (!self::exists($variable)) {
         database::insert("variables", array("variable_name" => $variable, "variable_value" => $v));
     } else {
         database::update("variables", array("variable_value" => $v), "variable_name='%var'", array("%var" => $variable));
     }
 }
Esempio n. 3
0
 function insert()
 {
     $this->onInsert();
     if (!$this->validate($errors)) {
         return false;
     }
     $db = new database();
     $db->drop($this);
     $db->table = $this->__table;
     return $db->insert();
 }
Esempio n. 4
0
 public static function register_command($nick, $ircdata = array())
 {
     $chan = core::get_chan(&$ircdata, 0);
     $desc = core::get_data_after(&$ircdata, 1);
     // get the channel.
     if ($user = services::user_exists($nick, true, array('display', 'id'))) {
         if (trim($desc) == '' || $chan == '' || $chan[0] != '#' || stristr($channel, ' ')) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'INFO'));
             // wrong syntax
             return false;
         }
         if (services::chan_exists($chan, array('channel')) !== false) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_REGISTERED_CHAN, array('chan' => $chan));
             return false;
         }
         // check if its registered?
         if (!strstr(core::$chans[$chan]['users'][$nick], 'o')) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_NEED_CHAN_OP, array('chan' => $chan));
             return false;
         }
         // we need to check if the user trying to register it has +o
         // if not we tell them to GET IT!
         $chan_info = array('channel' => $chan, 'timestamp' => core::$network_time, 'last_timestamp' => core::$network_time, 'topic' => core::$chans[$chan]['topic'], 'topic_setter' => core::$chans[$chan]['topic_setter']);
         $rflags = core::$config->chanserv->default_flags;
         $rflags = str_replace('d', '', $rflags);
         $rflags = str_replace('u', '', $rflags);
         $rflags = str_replace('e', '', $rflags);
         $rflags = str_replace('w', '', $rflags);
         $rflags = str_replace('m', '', $rflags);
         $rflags = str_replace('t', '', $rflags);
         // ignore parameter flags
         database::insert('chans', $chan_info);
         database::insert('chans_levels', array('channel' => $chan, 'target' => $user->display, 'flags' => 'Ftfrsqao'));
         database::insert('chans_flags', array('channel' => $chan, 'flags' => $rflags . 'd', 'desc' => $desc));
         // create the channel! WOOOH
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_CHAN_REGISTERED, array('chan' => $chan));
         core::alog(core::$config->chanserv->nick . ': ' . $chan . ' registered by ' . core::get_full_hostname($nick));
         // logchan
         core::alog('register_command(): ' . $chan . ' registered by ' . core::get_full_hostname($nick), 'BASIC');
         // log what we need to log.
         if ($channel = services::chan_exists($chan, array('channel', 'topic', 'suspended'))) {
             chanserv::_join_channel(&$channel);
             // join the channel
         }
         // does the channel exist?
     } else {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_UNREGISTERED);
         return false;
         // ph00s aint even registered..
     }
 }
Esempio n. 5
0
 public static function suspend_command($nick, $ircdata = array())
 {
     $chan = core::get_chan(&$ircdata, 0);
     $reason = core::get_data_after(&$ircdata, 1);
     $chan_info = array();
     // get the channel.
     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 ($chan == '' || $chan[0] != '#') {
         services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_INVALID_SYNTAX_RE, array('help' => 'SUSPEND'));
         return false;
         // wrong syntax
     }
     // make sure they've entered a channel
     if (trim($reason) == '') {
         $reason = 'No reason';
     }
     // is there a reason? if not we set it to 'No Reason'
     if ($channel = services::chan_exists($chan, array('channel', 'suspended'))) {
         if ($channel->suspended == 1) {
             services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_2, array('chan' => $chan));
             return false;
             // channel is already suspended lol
         } else {
             database::update('chans', array('suspended' => 1, 'suspend_reason' => $reason), array('channel', '=', $channel->channel));
             // channel isn't suspended, but it IS registered
         }
     } else {
         $chan_info = array('channel' => $chan, 'timestamp' => core::$network_time, 'last_timestamp' => core::$network_time, 'suspended' => 1, 'suspend_reason' => $reason);
         database::insert('chans', $chan_info);
         database::insert('chans_flags', array('channel' => $chan, 'flags' => 'd', 'desc' => $reason));
         // if the channel isn't registered, we register it, with a founder value of 0
         // so we can check when it's unsuspended THAT if the founder value is 0, we'll
         // just drop it as well, this way nobody actually gets the founder status.
     }
     services::communicate(core::$config->chanserv->nick, $nick, &chanserv::$help->CS_SUSPEND_3, array('chan' => $chan, 'reason' => $reason));
     core::alog(core::$config->chanserv->nick . ': ' . $nick . ' SUSPENDED ' . $chan . ' with the reason: ' . $reason);
     ircd::globops(core::$config->chanserv->nick, $nick . ' SUSPENDED ' . $chan);
     if (!empty(core::$chans[$chan]['users'])) {
         foreach (core::$chans[$chan]['users'] as $user => $boolean) {
             if (!core::$nicks[$nick]['ircop']) {
                 ircd::kick(core::$config->chanserv->nick, $user, $chan, $reason);
             }
         }
     }
     // any users in the channel? KICK EM!! RAWR
 }
Esempio n. 6
0
 public static function suspend_command($nick, $ircdata = array())
 {
     $unick = core::get_nick(&$ircdata, 0);
     $reason = core::get_data_after(&$ircdata, 1);
     $user_info = array();
     // get the nick etc.
     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 (services::is_root($unick) && !services::is_root($nick)) {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ACCESS_DENIED);
         return false;
     }
     // is a non-root trying to drop a root?
     if (trim($reason) == '') {
         $reason = 'No reason';
     }
     // is there a reason? if not we set it to 'No Reason'
     if ($user = services::user_exists($unick, false, array('display', 'suspended'))) {
         if ($user->suspended == 1) {
             services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_2, array('nick' => $unick));
             return false;
             // channel is already suspended lol
         } else {
             database::update('users', array('suspended' => 1, 'suspend_reason' => $reason), array('display', '=', $user->display));
             // channel isn't suspended, but it IS registered
         }
     } else {
         $user_info = array('display' => $unick, 'last_timestamp' => core::$network_time, 'timestamp' => core::$network_time, 'identified' => 0, 'real_user' => 0, 'suspended' => 1, 'suspend_reason' => $reason);
         // setup the user info array.
         database::insert('users', $user_info);
         // insert it into the database.
     }
     services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_SUSPEND_3, array('nick' => $unick, 'reason' => $reason));
     core::alog(core::$config->nickserv->nick . ': ' . $nick . ' SUSPENDED ' . $unick . ' with the reason: ' . $reason);
     ircd::globops(core::$config->nickserv->nick, $nick . ' SUSPENDED ' . $unick);
     if (isset(core::$nicks[$unick])) {
         $random_nick = 'Unknown' . rand(10000, 99999);
         services::communicate(core::$config->nickserv->nick, $unick, &nickserv::$help->NS_SUSPEND_1, array('nick' => $unick));
         services::communicate(core::$config->nickserv->nick, $unick, &nickserv::$help->NS_NICK_CHANGE, array('nick' => $random_nick));
         ircd::svsnick($unick, $random_nick, core::$network_time);
     }
     // is the nick in use? we need to force change it.
 }
Esempio n. 7
0
 public function add()
 {
     // First, add the new school_year to [school_years] table:
     $columns = array('school_year');
     $table = new simple_table_ops();
     $table->set_table_name('school_years');
     $table->set_table_column_names($columns);
     $table->add();
     // then, gets the last inserted id (not through lastInsertedId function, because it may be buggy:
     /*
     SELECT article, dealer, price
     FROM   shop
     WHERE  price=(SELECT MAX(price) FROM shop);
     */
     $sql = "SELECT school_year_id, school_year\n                FROM school_years\n                WHERE school_year_id=(SELECT MAX(school_year_id) FROM school_years)\n                ";
     $school_years_handle = new database();
     $new_school_year_result = $school_years_handle->query($sql);
     $new_school_year_id = $new_school_year_result[0]['school_year_id'];
     $new_school_year = $new_school_year_result[0]['school_year'];
     /* Populate automatically [courses] table with values from level_id and $_SESSION['current_school_year_id'] */
     $levels_handler = new database();
     $sql = "SELECT level_id FROM levels";
     $result = $levels_handler->query($sql);
     $insert_sql = "INSERT INTO courses (school_year_id, level_id) VALUES (?, ?)";
     foreach ($result as $row) {
         foreach ($row as $value) {
             // insert $value into courses and $_SESSION['current_school_year_id']
             $data = array($new_school_year_id, $value);
             $levels_handler->insert($insert_sql, $data);
         }
     }
     // Update current_school_year_id to the newly added school_year:
     $_SESSION['current_school_year_id'] = $new_school_year_id;
     $_SESSION['current_school_year'] = $new_school_year;
     header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index");
 }
Esempio n. 8
0
 public function acl_add()
 {
     if (isset($_POST['checkbox_array'])) {
         $selected_controllers = $_POST['checkbox_array'];
         $profile_id = $_POST['profile_id'];
         $active_id = $_POST['active_id'];
         $columns = 'controller_id, profile_id, active_id';
         $sql = "INSERT INTO acl (" . $columns . ") VALUES (?, ?, ?)";
         $connection = new database();
         foreach ($selected_controllers as $controller_id) {
             $data[] = array($controller_id, $profile_id, $active_id);
             //$connection->insert($sql, $data);
         }
         $connection->insert($sql, $data);
     }
     header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=acl_index");
     $columns = array('controller_id', 'profile_id', 'active_id');
     $table = new simple_table_ops();
     $table->set_table_name('acl');
     $table->set_table_column_names($columns);
     $table->add();
     header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=acl_index");
 }
Esempio n. 9
0
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = new database();
    $value_pc = array("name" => trim($_POST['name']), "codename" => trim($_POST['codename']), "created" => date('Y-m-d H:i:s'));
    $query_pc = $db->insert("product_categories", $value_pc);
    if ($query_pc == TRUE) {
        header("location:" . $baseUrl . "/back/productcategorie");
    }
    mysql_close();
}
Esempio n. 10
0
<?php

require base_path() . "/library/uploadimg.php";
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $db = new database();
    if (checkimg() == TRUE) {
        $filename = date('YmdHis') . rand(0, 9);
        $type = end(explode(".", $_FILES["image"]["name"]));
        $image = $filename . "." . $type;
        $path = base_path() . "/upload/product/";
        uploadimg($filename, 600, 600, $path);
        uploadimg("thumb_" . $filename, 400, 400, $path);
        uploadimg("md_" . $filename, 150, 150, $path);
        uploadimg("sm_" . $filename, 70, 70, $path);
    } else {
        $image = "ecimage.jpg";
    }
    $value_pd = array("name" => trim($_POST['name']), "price" => trim($_POST['price']), "brandname" => trim($_POST['brandname']), "detail" => trim($_POST['detail']), "created" => date('Y-m-d H:i:s'), "image" => $image, "product_categorie_id" => trim($_POST['product_categorie_id']));
    $query_pd = $db->insert("products", $value_pd);
    if ($query_pd == TRUE) {
        header("location:" . $baseUrl . "/back/product");
    }
    mysql_close();
}
Esempio n. 11
0
if ($exten == "s") {
    $res = $db->query("SELECT * FROM user_settings WHERE name='phone_main_incomming' AND value='true' GROUP BY user_id");
} elseif (substr($exten, 0, 3) == '101') {
    $exten_orig = $exten;
    $exten = substr($exten, 3);
    $res = $db->query("SELECT * FROM user_settings WHERE name='phone_extention' AND value='{$exten}' GROUP BY user_id");
    echo "SELECT * FROM user_settings WHERE name='phone_extention' AND value='{$exten}' GROUP BY user_id";
}
//$action = "RING";
$phone_number = substr($phone_number, -10);
while ($row = $db->fetch_assoc($res)) {
    $user_id = $row['user_id'];
    switch (strtoupper($action)) {
        case "RING":
            $db->query("DELETE FROM currentcalls WHERE user_id = '{$user_id}'");
            $db->insert("currentcalls", array("direction" => $direction, "call_id" => $call_id, "user_id" => $row['user_id'], 'phone_number' => $phone_number, 'exten' => $exten, 'status' => 'RING', 'ip_address' => $ip));
            $ok = "OK";
            break;
        case "ANSWER":
            //$db->query("DELETE FROM currentcalls WHERE call_id='$call_id' AND user_id <> '$user_id'");
            $sql = "UPDATE currentcalls SET status = 'ANSWER', exten = '{$exten}' WHERE call_id = '{$call_id}' AND user_id = '{$user_id}'";
            echo $sql . "\n";
            $db->query($sql);
            $ok = "OK";
            break;
        case "HANGUP":
            $db->query("DELETE FROM currentcalls WHERE call_id = '{$call_id}' AND user_id = '{$user_id}'");
            $ok = "OK";
            break;
    }
}
Esempio n. 12
0
 /**
  * 
  * @param type $data (agent_id, ads_pin, subject, from, type, amount, date_release, date, remarks, f)
  * @return type boolean
  */
 private static function addCommission($data)
 {
     $db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
     $result = $db->insert("user_commissions", $data);
     return $result;
 }
Esempio n. 13
0
 public function move()
 {
     // receives array from input form
     // if (isset($_POST['students'])) {
     //      $selected_students = $_POST['students'];
     //      foreach ($selected_students as $student_id) {
     //          echo $student_id.'<br>';
     //      }
     // }
     // builds array (
     if (isset($_POST['checkbox_array'])) {
         $course_id = $_POST['course_id'];
         $selected_students = $_POST['checkbox_array'];
         $columns = 'course_id, student_id';
         $sql = "INSERT INTO classes (" . $columns . ") VALUES (?, ?)";
         $connection = new database();
         foreach ($selected_students as $student_id) {
             $data[] = array($course_id, $student_id);
             //$connection->insert($sql, $data);
         }
         $connection->insert($sql, $data);
     }
     header("Location: http://" . WEBSITE_URL . "/index.php?controller={$_GET['controller']}&action=index");
 }
Esempio n. 14
0
        $dbm4 = new database();
        $dbm4->debug($m4dbdebug);
        $dbm4->connect($m4dbhost, $m4dbuser, $m4dbpass, $m4dbname);
        $db->select("id, tag");
        $db->from("{$dbprefix}equipes, {$dbprefix}participe");
        $db->where("{$dbprefix}equipes.id = {$dbprefix}participe.equipe");
        $db->where("tournois = {$s_tournois}");
        $db->order_by("id");
        $res = $db->exec();
        while ($equipes = $db->fetch($res)) {
            /*** suppression de l'equipe dans m4 (eviter les conflits d'id) ***/
            $dbm4->delete("m4_clan");
            $dbm4->where("numero = {$equipes->id}");
            $dbm4->exec();
            /*** insertion de l'equipe inscrites dans m4 ***/
            $dbm4->insert("m4_clan (numero,nom)");
            $dbm4->values("{$equipes->id},'{$equipes->tag}'");
            $dbm4->exec();
        }
    }
    /*** redirection ***/
    if (type_tournois($s_tournois) == 'E') {
        js_goto("?page=finales&op=admin");
    } else {
        js_goto("?page=poules&op=admin");
    }
} elseif ($op == "valider_poules") {
    /*** test de la session ***/
    if (empty($s_tournois)) {
        js_goto("?page=index");
    }
Esempio n. 15
0
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $pay_date_explode = explode("/", trim($_POST['pay_date']));
    $pay_date = $pay_date_explode[2] . "-" . $pay_date_explode[1] . "-" . $pay_date_explode[0] . " " . trim($_POST['pay_time']);
    $db = new database();
    $value_pm = array("pay_money" => trim($_POST['pay_money']), "pay_date" => $pay_date, "detail" => trim($_POST['detail']), "order_id" => $_POST['order_id']);
    $query_pm = $db->insert("payments", $value_pm);
    if ($query_pm == TRUE) {
        $db->update("orders", array("order_status" => "payments"), "id='{$_POST['order_id']}'");
        header("location:" . $baseUrl . "/back/order");
    }
    mysql_close();
}
Esempio n. 16
0
 public static function insert_block($fields = array())
 {
     database::insert("blocks", $fields);
 }
Esempio n. 17
0
 $fileTypesImage = array('jpg', 'jpeg', 'gif', 'png');
 // File extensions
 $fileTypesDocument = array('doc', 'docx', 'xls', 'pdf', 'txt');
 // File extensions
 $fileParts = pathinfo($_FILES['Filedata']['name']);
 $filenameAlias = $fileParts["filename"] . uniqid() . "." . $fileParts["extension"];
 $insertData = array();
 if (in_array($fileParts['extension'], $fileTypesImage)) {
     $targetPathImage = $_SERVER['DOCUMENT_ROOT'] . $targetFolderImage;
     $targetFile = rtrim($targetPathImage, '/') . '/' . $filenameAlias;
     if (move_uploaded_file($tempFile, $targetFile)) {
         $insertData["name"] = $_FILES['Filedata']['name'];
         $insertData["alias"] = $filenameAlias;
         $insertData["type"] = "Image";
         $insertData["size"] = $_FILES['Filedata']['size'];
         $db->insert("asset_unit_files", $insertData);
     }
     echo '1';
     //echo $targetPath;
 } else {
     if (in_array($fileParts['extension'], $fileTypesDocument)) {
         $targetPathDocument = $_SERVER['DOCUMENT_ROOT'] . $targetFolderDocument;
         $targetFile = rtrim($targetPathDocument, '/') . '/' . $_FILES['Filedata']['name'];
         if (move_uploaded_file($tempFile, $targetFile)) {
             $insertData["name"] = $_FILES['Filedata']['name'];
             $insertData["alias"] = $filenameAlias;
             $insertData["type"] = "Document";
             $insertData["size"] = $_FILES['Filedata']['size'];
             $db->insert("asset_unit_files", $insertData);
         }
         echo '1';
Esempio n. 18
0
 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.
     }
 }
Esempio n. 19
0
<?php

require __DIR__ . '/database.class.php';
define('DB_HOST', 'localhost');
define('DB_PORT', '5432');
define('DB_USER', 'postgres');
define('DB_PASS', '123');
define('DB_DBNAME', 'Slimshop');
$db = new database();
try {
    $this->{$db};
} catch (PDOException $e) {
    return $e->getMessage();
}
return true;
$res = $db->insert('users', ['username' => 'Vuhoanggiang123', 'fullname' => 'omgomgomg123', 'email' => '*****@*****.**']);
if ($res === true) {
    echo $db->lastInserId('users_id_seq');
} else {
    var_dump($res);
    echo $res;
}
?>


Esempio n. 20
0
 public static function add_permission($perm, $group)
 {
     database::insert("permission_role", array("permission" => $perm, "gid" => $group));
 }
Esempio n. 21
0
    public static function register_command($nick, $ircdata = array())
    {
        $password = $ircdata[0];
        $email = $ircdata[1];
        if (trim($password) == '' || trim($email) == '') {
            services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'REGISTER'));
            return false;
        }
        // wrong syntax
        if (strtolower($password) == strtolower($nick)) {
            services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_PASSWORD_NICK);
            return false;
        }
        // are they using a reasonable password, eg. != their nick, lol.
        if (services::valid_email($email) === false) {
            services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_EMAIL);
            return false;
        }
        // is the email valid?
        if ($user = services::user_exists($nick, false, array('display', 'id'))) {
            services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_ALREADY_REGISTERED);
            return false;
        }
        // are we registered?
        // apprently not, let's move on!
        $check_e = database::select('users_flags', array('email'), array('email', '=', $email));
        if (database::num_rows($check_e) > 0) {
            services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_EMAIL_IN_USE);
            return false;
        }
        // check if the email is in use.
        $salt = '';
        for ($i = 0; $i < 8; $i++) {
            $possible = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
            $salt .= substr($possible, rand(0, strlen($possible) - 1), 1);
        }
        $user_info = array('display' => $nick, 'pass' => sha1($password . $salt), 'salt' => $salt, 'last_hostmask' => core::get_full_hostname($nick), 'last_timestamp' => core::$network_time, 'timestamp' => core::$network_time, 'identified' => 0, 'validated' => core::$config->nickserv->force_validation === true ? 0 : 1, 'real_user' => 1);
        // setup the user info array.
        $flags = core::$config->nickserv->default_flags;
        $flags = str_replace('u', '', $flags);
        $flags = str_replace('e', '', $flags);
        // ignore parameter flags
        database::insert('users', $user_info);
        database::insert('users_flags', array('nickname' => $nick, 'flags' => $flags . 'e', 'email' => $email));
        // insert it into the database.
        if (core::$config->nickserv->force_validation === true) {
            $validation_code = mt_rand();
            core::alog(core::$config->nickserv->nick . ': ' . $nick . ' requested by ' . core::get_full_hostname($nick));
            // logchan
            database::insert('validation_codes', array('nick' => $nick, 'code' => $validation_code));
            // insert the random code to the database
            $to = $nick . ' <' . $email . '>';
            $subject = 'Registration';
            $headers = 'From: ' . core::$config->server->network_name . ' <' . isset(core::$config->email_from) ? core::$config->email_from : core::$config->service_user . '>\\n';
            $message = '
Thank you for using ' . core::$config->server->network_name . '

Nickname: ' . $nick . '
Password: '******'
Confirmation Code: ' . $validation_code . '

To confirm your nickname type the following when connected to ' . core::$config->server->network_name . '
/msg ' . core::$config->nickserv->nick . ' confirm ' . $validation_code . '

You will then be able to identify with the password you chose by typing
/msg ' . core::$config->nickserv->nick . ' identify ' . $password . '
			';
            // generate the email information
            @mail($to, $subject, $message, $headers);
            // let's send the email
            services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_REQUESTED, array('email' => $email));
        } else {
            services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_NICK_REGISTERED);
            core::alog(core::$config->nickserv->nick . ': ' . $nick . ' registered by ' . core::get_full_hostname($nick));
            // logchan
            core::alog('register_command(): ' . $nick . ' registered by ' . core::get_full_hostname($nick), 'BASIC');
            // log what we need to log.
        }
    }
Esempio n. 22
0
 public static function flood_check(&$ircdata)
 {
     if (trim($ircdata[0]) == '') {
         return true;
     }
     // the data is empty, omgwtf..
     if (ircd::on_msg(&$ircdata) && $ircdata[2][0] == '#' && $ircdata[3][1] != self::$config->chanserv->fantasy_prefix) {
         return true;
     }
     // this is just here to instantly ignore any normal channel messages
     // otherwise we get lagged up on flood attempts
     if (ircd::on_notice(&$ircdata)) {
         return true;
     }
     // and ignore notices, since we shouldnt respond to any
     // notices what so ever, just saves wasting cpu cycles when we get a notice
     if (ircd::on_msg(&$ircdata) && $ircdata[2][0] != '#') {
         if (self::$config->settings->flood_msgs == 0 || self::$config->settings->flood_time == 0) {
             return false;
         }
         // check if it's disabled.
         $nick = self::get_nick(&$ircdata, 0);
         $time_limit = time() - self::$config->settings->flood_time;
         self::$nicks[$nick]['commands'][] = time();
         $from = self::get_nick(&$ircdata, 2);
         if (self::$nicks[$nick]['ircop']) {
             return false;
         }
         // ignore ircops
         $inc = 0;
         foreach (self::$nicks[$nick]['commands'] as $index => $timestamp) {
             if ($timestamp > $time_limit) {
                 $inc = 1;
             }
         }
         if ($inc == 1) {
             self::$nicks[$nick]['floodcmds']++;
         }
         // we've ++'d the floodcmds, if this goes higher than self::flood_trigger
         // they're flooding, floodcmds is cleared every 100 seconds.
         if (self::$nicks[$nick]['floodcmds'] > self::$config->settings->flood_msgs) {
             if (services::check_mask_ignore($nick) === true) {
                 return false;
             }
             if (self::$nicks[$nick]['offences'] == 0 || self::$nicks[$nick]['offences'] == 1) {
                 self::$nicks[$nick]['offences']++;
                 database::insert('ignored_users', array('who' => '*!*@' . self::$nicks[$nick]['host'], 'time' => core::$network_time));
                 timer::add(array('core', 'remove_ignore', array('*!*@' . self::$nicks[$nick]['host'])), 120, 1);
                 // add them to the ignore list.
                 // also, add a timer to unset it in 2 minutes.
                 $message = self::$nicks[$nick]['offences'] == 1 ? 'This is your first offence' : 'This is your last warning';
                 // compose a message.
                 services::communicate($from, $nick, operserv::$help->OS_COMMAND_LIMIT_1);
                 services::communicate($from, $nick, operserv::$help->OS_COMMAND_LIMIT_2, array('message' => $message));
                 self::alog(self::$config->operserv->nick . ': Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick) . ' being ignored for 2 minutes');
                 self::alog('flood_check(): Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick), 'BASIC');
                 return true;
             } elseif (self::$nicks[$nick]['offences'] >= 2) {
                 self::alog(self::$config->operserv->nick . ': Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick) . ' being glined for 10 minutes');
                 self::alog('flood_check(): Offence #' . self::$nicks[$nick]['offences'] . ' for ' . self::get_full_hostname($nick), 'BASIC');
                 ircd::gline(self::$config->operserv->nick, '*@' . self::$nicks[$nick]['oldhost'], 600, 'Flooding services, 10 minute ban.');
                 // third offence, wtf? add a 10 minute gline.
                 return true;
             }
         }
         // they're flooding
     }
 }
Esempio n. 23
0
            /*** insertion du serveur dans m4 ***/
            $dbm4->insert("m4_serveur (numero,adresse,port,hostname)");
            $dbm4->values("{$id},'{$adresse}','{$port}','{$nom}'");
            $dbm4->exec();
            $dbm4->close();
        }
        if ($insert_ab) {
            $dbab = new database();
            $dbab->debug($abdbdebug);
            $dbab->connect($abdbhost, $abdbuser, $abdbpass, $abdbname);
            /*** delete du serveur dans adminbot ***/
            $dbab->delete("gameserver");
            $dbab->where("ServerId = {$id}");
            $dbab->exec();
            /*** insertion du serveur dans adminbot ***/
            $dbab->insert("gameserver (ServerId,GameId,GameGroupId,ServerAddress,ServerPort,ServerIsUp,ServerType,ServerRcon,ServerHostName)");
            $dbab->values("'{$id}','','','{$adresse}','{$port}','','cs','{$rcon}','{$nom}'");
            $dbab->exec();
            $dbab->close();
        }
        /*** redirection ***/
        js_goto("?page=serveurs&op=modify&id={$id}");
    }
} elseif ($op == "delete") {
    /*** verification securite ***/
    if ($grade['a'] != 'a' && $grade['b'] != 'b' && $grade['r'] != 'r') {
        js_goto($PHP_SELF);
    }
    $db->delete("{$dbprefix}serveurs");
    $db->where("id = {$id}");
    $db->exec();
Esempio n. 24
0
 public function add()
 {
     // general add function
     // needs:
     //      1. columns name - FORM input names are identical to the table column names
     //          ** Use class property $this->cols
     //      2. table name - $this->table_name settled through set_table_name method
     //
     // TODO: Check obligatory fields, returns error or OK message
     // obligatory fields uses $this->obligatory_fields, which contains array ('table_col_name'=>'format')
     // formats: '##AAA###' : number, number, text, text,text, number, number, number
     // if no table_col_name has been found in array, it is considered not obligatory
     //
     $security_handler = new security();
     $security_handler->check_token();
     $i = 0;
     $cols = '';
     //$values = array();
     $field_error = array();
     foreach ($this->cols as $column) {
         //TODO: priority high. when inserting single record through form, execute fails
         // restructure array: instead of array = (0 => 'bla', 1 => 'ble', 2 => 'etc') make
         //  array = (0 => 'bla', 'ble', 'etc');
         //array_push ($values, trim($_POST[$column]));
         $values[0][] = trim($_POST[$column]);
         $cols .= $column . ',';
         $i++;
         //TODO: input format test - uses preset obligatory_fields property (array) for each column name
         if (isset($this->obligatory_fields)) {
             if ($column = $this->obligatory_fields[$column]) {
                 if (empty($_POST[$column])) {
                     $error = 'Obligatory field empty';
                 } else {
                     // TEST field format
                     // if required format is empty, just skip this step (accepts whatever user wants)
                     if (!empty($this->obligatory_fields[$column])) {
                         // format is not empty, need to test field format
                         // make for loop based on strlen($_POST[$column])
                         for ($i = 0, $j = strlen($_POST[$column]); $i < $j; $i++) {
                             // TODO: test each $_POST[$column] value if is present (if obligatory) and its format.
                             // if not, add the corresponding neat table name to an array, then display this array with the errors found
                             // obligatory / wrong format
                             // to check if a character is inside a string:
                             //      strstr($pattern, $_POST[$column][$i])) {
                             // if input does not agree with pattern, issue an error message
                         }
                     }
                 }
                 array_push($field_error, $error);
             }
         }
     }
     //var_dump($values);
     //echo "<br>";
     //print_r ($values);
     //die();
     $interrogation_mark = str_repeat('?, ', $i - 1);
     $interrogation_mark .= '?';
     $cols = substr($cols, 0, -1);
     $sql = "INSERT INTO " . $this->table_name . " (" . $cols . ") VALUES (" . $interrogation_mark . ")";
     $connection = new database();
     if ($connection->insert($sql, $values)) {
         $_SESSION['log'] .= new timestamp("Affected Rows: " . $connection->get_row_num());
     } else {
         $_SESSION['log'] .= new timestamp("Could not add values!");
     }
     //header("Location: http://localhost/css/index.php?controller={$_GET['controller']}&action=index");
 }
Esempio n. 25
0
            /*** insertion du serveur dans m4 ***/
            $dbm4->insert("m4_serveur (numero,adresse,port,hostname)");
            $dbm4->values("{$id},'{$adresse}','{$port}','{$nom}'");
            $dbm4->exec();
            $dbm4->close();
        }
        if ($insert_ab) {
            $dbab = new database();
            $dbab->debug($abdbdebug);
            $dbab->connect($abdbhost, $abdbuser, $abdbpass, $abdbname);
            /*** delete du serveur dans adminbot ***/
            $dbab->delete("adb_server_tbl");
            $dbab->where("server_id = {$id}");
            $dbab->exec();
            /*** insertion du serveur dans adminbot ***/
            $dbab->insert("adb_server_tbl (server_id,server_hostname,server_ip,server_port,server_rcon,server_game)");
            $dbab->values("{$id},'{$nom}','{$adresse}','{$port}','{$rcon}','CS'");
            $dbab->exec();
            $dbab->close();
        }
        /*** redirection ***/
        js_goto("?page=team_serveurs&op=modify&id={$id_s}&id_t={$id_t}");
    }
} elseif ($op == "delete") {
    if (!equipe_manager($id_t, $s_joueur)) {
        js_goto($PHP_SELF);
    }
    /*** verification securite ***/
    //if ($grade['a']!='a'&&$grade['b']!='b'&&$grade['r']!='r') {js_goto($PHP_SELF);}
    $db->delete("{$dbprefix}serveurs");
    $db->where("id = {$id_s}");
 /**
  * Save image as px in database
  * @access public
  * @param string $image
  * @return array
  */
 public function saveImage($src, $ext)
 {
     $db = new database();
     $data = new dataHandler();
     $size = getimagesize($src);
     $width = (int) $size[0];
     $height = (int) $size[1];
     if ($ext === 'png') {
         $image = imagecreatefrompng($src);
     }
     if ($ext === 'jpg' || $ext === 'jpeg') {
         $image = imagecreatefromjpeg($src);
     }
     if ($ext === 'gif') {
         $image = imagecreatefromgif($src);
     }
     if ($ext === 'bmp') {
         $image = imagecreatefromwbmp($src);
     }
     $values = '';
     for ($y = 0; $y < $height; ++$y) {
         for ($x = 0; $x < $width; ++$x) {
             $res = imagecolorat($image, $x, $y);
             $rgb1 = $res >> 16 & 0xff;
             $rgb2 = $res >> 8 & 0xff;
             $rgb3 = $res & 0xff;
             $values .= '(
                         AES_ENCRYPT("' . $rgb1 . '", "' . $db->aesKey . '"), 
                         AES_ENCRYPT("' . $rgb2 . '", "' . $db->aesKey . '"), 
                         AES_ENCRYPT("' . $rgb3 . '", "' . $db->aesKey . '"),
                         ' . $x . ',
                         ' . $y . ',
                         ' . $data->getRank($rgb1, $rgb2, $rgb3) . '
                     ),';
             if ($x % 100 == 0) {
                 $values .= '|';
             }
         }
         //end for $x
     }
     //end for $y
     $valueArray = explode('|', $values);
     $i_max = count($valueArray);
     for ($i = 0; $i < $i_max; ++$i) {
         $valueArray[$i] = substr($valueArray[$i], 0, strlen($valueArray[$i]) - 1);
         $sql = 'INSERT INTO 
                     pixel (pixelRGB1, pixelRGB2, pixelRGB3, pixelX, pixelY, pixelRank)
                 VALUES ' . $valueArray[$i];
         $db->insert($sql);
     }
     imagedestroy($image);
 }
Esempio n. 27
0
require "./../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
//Check user priviledge
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE username = '******' and status = 1 and user_type_id = '%s'", mysql_real_escape_string("useraccount"), mysql_real_escape_string($_SESSION['userSIMANHusername']), mysql_real_escape_string(3));
$resultUser = $db->select($strSQL, false, true);
//If privilegde available
if ($resultUser) {
    $strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s \n\t\t\t\tWHERE record_id = '%s'", mysql_real_escape_string("outcome"), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
    $resultSelectOutcome = $db->select($strSQL, false, true);
    $no = 1;
    if ($resultSelectOutcome) {
        $no = sizeof($resultSelectOutcome);
    }
    $strSQL = sprintf("INSERT INTO " . substr(strtolower($tbf), 0, -2) . "%s \n\t\t\t\tVALUE ('','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s'\n\t\t\t\t,'%s','%s','%s')", mysql_real_escape_string("outcome"), mysql_real_escape_string($_POST['gender']), mysql_real_escape_string($_POST['alive']), mysql_real_escape_string($_POST['stillbirth']), mysql_real_escape_string($_POST['ag5']), mysql_real_escape_string($_POST['ag10']), mysql_real_escape_string($_POST['rbm']), mysql_real_escape_string($_POST['birth_wieght']), mysql_real_escape_string($_POST['hc']), mysql_real_escape_string($_POST['fetal_length']), mysql_real_escape_string($_POST['bdf']), mysql_real_escape_string($_POST['bdf_identify']), mysql_real_escape_string($_POST['bdn']), mysql_real_escape_string($_POST['ebf']), mysql_real_escape_string($_POST['bf']), mysql_real_escape_string($_POST['ff']), mysql_real_escape_string($_POST['skin2skin']), mysql_real_escape_string($_POST['pmctv_lb']), mysql_real_escape_string($_POST['nb_adm']), mysql_real_escape_string($_POST['nb_date_adm']), mysql_real_escape_string($_POST['nb_time_adm']), mysql_real_escape_string($_POST['nb_neonatal']), mysql_real_escape_string($_POST['nb_refer']), mysql_real_escape_string($_POST['nb_refer_facility']), mysql_real_escape_string("nb." . $_SESSION['userSIMANHmother_record'] . "-" . $no), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
    $resultInsert = $db->insert($strSQL, false, true);
    if ($resultInsert) {
        $strSQL = sprintf("SELECT record_id FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s' ", mysql_real_escape_string("outcome"), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
        $resultCheck = $db->select($strSQL, false, true);
        if ($resultCheck) {
            $db->disconnect();
            ?>
			<script>
					alert('Delivery information complete!');
					window.location = '../enter/main.php?id=4';
			</script>
			<?php 
            exit;
        } else {
            $db->disconnect();
            ?>
Esempio n. 28
0
 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
 }
Esempio n. 29
0
 public static function login($agent_id, $rememberme = FALSE)
 {
     session::set(AGENT_SESSION_NAME, $agent_id);
     session::set(AGENT_LOGIN_SESSION, TRUE);
     if ($rememberme) {
         if (!cookie::exists(TOKEN_NAME)) {
             $token = hash::create("sha256", $agent_id, HASH_GENERAL_KEY);
             cookie::set(TOKEN_NAME, $token, COOKIE_EXPIRY);
             $db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
             $data = array();
             $data['agent_id'] = $agent_id;
             $data['token'] = $token;
             $db->insert("users_session", $data);
         }
     }
 }
Esempio n. 30
0
<?php

include "includes/database.class";
$db_object = new database();
$sht = "show tables";
$dtables = $db_object->get_rsltset($sht);
for ($i = 0; $i < count($dtables); $i++) {
    $tbl = $dtables[$i][0];
    $qry = "drop table {$tbl}";
    $db_object->insert($qry);
    //echo $qry;
}
echo "tables droped";