Exemple #1
0
 public function close()
 {
     if ($this->opened) {
         $this->opened = false;
         @mysql_close($this->conn);
     }
 }
 function disconnect()
 {
     if (!empty($this->db)) {
         mysql_close($this->db);
         $this->db = null;
     }
 }
Exemple #3
0
function getTangentText($type, $keyword)
{
    global $dbHost, $dbUser, $dbPassword, $dbName;
    $link = @mysql_connect($dbHost, $dbUser, $dbPassword);
    if (!$link) {
        die("Cannot connect : " . mysql_error());
    }
    if (!@mysql_select_db($dbName, $link)) {
        die("Cannot find database : " . mysql_error());
    }
    $result = mysql_query("SELECT sr_keywords, sr_text FROM soRandom WHERE sr_type = '" . $type . "' ORDER BY sr_ID ASC;", $link);
    $tempCounter = 0;
    while ($row = mysql_fetch_assoc($result)) {
        $pKey = "/" . $keyword . "/";
        $pos = preg_match($pKey, $row['sr_keywords']);
        //echo $pos . " is pos<br>";
        //echo $keyword;
        //echo " is keyword and this is the search return: " . $row['keywords'];
        if ($pos != 0) {
            $text[$tempCounter] = stripslashes($row["sr_text"]);
            $tempCounter++;
        }
    }
    mysql_close($link);
    //$text=htmlentities($text);
    return $text;
}
function getInsert($param, $name, $score)
{
    $dbParams = get_object_vars($param);
    $mysql_host = $dbParams['mysql_host'];
    $mysql_user = $dbParams['mysql_user'];
    $mysql_pass = $dbParams['mysql_pass'];
    $dbName = $dbParams['dbName'];
    $dbTable = $dbParams['dbTable'];
    //connect
    $link = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die('connection error: ' . mysql_error());
    //select db
    mysql_select_db($dbName) or die('DB error');
    //check user highest score
    $query_check_user = '******' . $dbTable . ' WHERE name = ' . $name . ';';
    $result_check_user = mysql_query($query_check_user) or die('Request down: ' . mysql_error());
    $checkUser = mysql_fetch_array($result_check_user);
    if ($checkUser['score'] < $score) {
        //inserting new scores
        $query_insert = 'INSERT INTO ' . $dbTable . '(name,score) VALUES (' . $name . ',' . $score . ') ON DUPLICATE KEY UPDATE score = VALUES(score);';
        $result = mysql_query($query_insert) or die('Request insert down: ' . mysql_error());
    }
    return $result;
    // clean
    if (isset($result)) {
        mysql_free_result($result);
    }
    // close
    mysql_close($link);
}
function HackingLog()
{
    echo "You're not allowed to use this program! This attempted violation has been logged and your IP address was captured.";
    Warehouse('footer');
    if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    if ($openSISNotifyAddress) {
        mail($openSISNotifyAddress, 'HACKING ATTEMPT', "INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('{$_SERVER['SERVER_NAME']}','{$ip}','" . date('Y-m-d') . "','{$openSISVersion}','{$_SERVER['PHP_SELF']}','{$_SERVER['DOCUMENT_ROOT']}','{$_SERVER['SCRIPT_NAME']}','{$_REQUEST['modname']}','" . User('USERNAME') . "')");
    }
    /*if($openSISNotifyAddress)
    		mail($openSISNotifyAddress,'HACKING ATTEMPT',"INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$_SERVER[REMOTE_ADDR]','".date('Y-m-d')."','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','$_REQUEST[modname]','".User('USERNAME')."')");*/
    if (false && function_exists('mysql_query')) {
        if ($_SERVER['HTTP_X_FORWARDED_FOR']) {
            $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
        } else {
            $ip = $_SERVER['REMOTE_ADDR'];
        }
        $link = @mysql_connect('os4ed.com', 'openSIS_log', 'openSIS_log');
        @mysql_select_db('openSIS_log');
        @mysql_query("INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('{$_SERVER['SERVER_NAME']}','{$ip}','" . date('Y-m-d') . "','{$openSISVersion}','{$_SERVER['PHP_SELF']}','{$_SERVER['DOCUMENT_ROOT']}','{$_SERVER['SCRIPT_NAME']}','{$_REQUEST['modname']}','" . User('USERNAME') . "')");
        @mysql_close($link);
        /*$link = @mysql_connect('os4ed.com','openSIS_log','openSIS_log');
        		@mysql_select_db('openSIS_log');
        		@mysql_query("INSERT INTO HACKING_LOG (HOST_NAME,IP_ADDRESS,LOGIN_DATE,VERSION,PHP_SELF,DOCUMENT_ROOT,SCRIPT_NAME,MODNAME,USERNAME) values('$_SERVER[SERVER_NAME]','$_SERVER[REMOTE_ADDR]','".date('Y-m-d')."','$openSISVersion','$_SERVER[PHP_SELF]','$_SERVER[DOCUMENT_ROOT]','$_SERVER[SCRIPT_NAME]','$_REQUEST[modname]','".User('USERNAME')."')");
        		@mysql_close($link);*/
    }
}
Exemple #6
0
 public function disconnect()
 {
     if ($this->_link) {
         @mysql_close($this->_link);
     }
     $this->_link = false;
 }
 function close()
 {
     if (is_resource($this->_conn)) {
         mysql_close($this->_conn);
     }
     parent::_clear();
 }
 protected function TearDown()
 {
     // Drop database if needed
     mysql_query('DROP DATABASE IF EXISTS ' . WF_SQL_BASE) or die(__FILE__ . ':' . __LINE__ . ':' . mysql_error());
     // Close connection
     mysql_close() or die(__FILE__ . ':' . __LINE__ . ':' . mysql_error());
 }
Exemple #9
0
 public function disconnect()
 {
     if (isset($this->link)) {
         mysql_close($this->link);
         unset($this->link);
     }
 }
 public function delete_article_by_alias($alias)
 {
     include "../db_connect.php";
     $query = "DELETE FROM `articles` WHERE `alias` = '" . $alias . "' ";
     $result = mysql_query($query);
     mysql_close($link);
 }
function QUERY_SYSLOGS($sql)
{
    $database = "syslogs";
    $bd = @mysql_connect(":/var/run/syslogdb.sock", "root", null);
    if (!$bd) {
        echo "Connect failed\n";
        return false;
    }
    $ok = @mysql_select_db($database, $bd);
    if (!$ok) {
        $errnum = @mysql_errno($bd);
        $des = @mysql_error($bd);
        echo "mysql_select_db [FAILED] N.{$errnum} DESC:{$des} mysql/QUERY_SQL\n";
        return false;
    }
    $results = mysql_query($sql, $bd);
    if (!$results) {
        $errnum = @mysql_errno($bd);
        $des = @mysql_error($bd);
        echo "mysql_select_db [FAILED] N.{$errnum} DESC:{$des} mysql/QUERY_SQL\n";
        return false;
        @mysql_close($bd);
    }
    @mysql_close($bd);
    return $results;
}
Exemple #12
0
function closedb()
{
    global $conn;
    if ($conn) {
        mysql_close($conn);
    }
}
Exemple #13
0
 /** 
  * Clos automatiquement la connexion MySQL.
  */
 public function __destruct()
 {
     if ($this->connectionId) {
         mysql_close($this->connectionId);
     }
     $this->connectionId = false;
 }
Exemple #14
0
 /** 关闭连接,没有返回值 */
 function closeCon()
 {
     if ($this->isCon) {
         mysql_close($this->link);
         $this->isCon = false;
     }
 }
Exemple #15
0
function add_message($locale, $groupid, $message)
{
    global $mysqlprefix;
    $link = connect();
    perform_query("insert into {$mysqlprefix}chatresponses (locale,groupid,vcvalue) values ('" . mysql_real_escape_string($locale, $link) . "'," . ($groupid ? intval($groupid) . ", " : "null, ") . "'" . mysql_real_escape_string($message, $link) . "')", $link);
    mysql_close($link);
}
Exemple #16
0
/**
 * 数据库处理函数
 * @param  $query mysql处理语句
 * @param  $kind 处理类型
 * @return  如果$kind等于count,则返回符合语句的条数
 * @return  如果$kind等于search,则返回符合语句的二维数组,第一维代表第几个符合,第二维为数据库信息,键为数据库表名
 * @return  如果$kind等于其他,如果操作成功则返回大于零的数,否则返回零
 */
function _mysql($query, $kind)
{
    /*
    	此处有配置
    */
    $conn = @mysql_connect($host, $user, $password) or die('数据库链接失败:' . mysql_errno());
    @mysql_select_db($name) or die('数据库错误:' . mysql_errno());
    @mysql_query('SET NAMES UTF8') or die('字符集错误:' . mysql_errno());
    $result = mysql_query($query, $conn);
    if ($kind == 'count') {
        $many = mysql_num_rows($result);
        mysql_close();
        return $many;
    } elseif ($kind == 'search') {
        $arRow = array();
        $i = 0;
        while (!!($row = mysql_fetch_array($result))) {
            $arRow[$i] = $row;
            $i++;
        }
        mysql_close();
        return $arRow;
    } else {
        mysql_close();
        return $result;
    }
}
 /**
  * close_connection();
  */
 public function close_connection()
 {
     if (is_resource($this->_connection) or is_object($this->_connection)) {
         mysql_close($this->_connection);
         unset($this->_connection);
     }
 }
Exemple #18
0
function connetti_query($query)
{
    global $Host, $User, $Password, $Database, $link;
    $ConfigManager = new ConfigManager();
    $Host = $ConfigManager->getHost();
    $User = $ConfigManager->getUser();
    $Database = $ConfigManager->getDatabase();
    $Password = $ConfigManager->getPassword();
    // Connessione al database
    if (!($link = mysql_connect($Host, $User, $Password))) {
        die("Errore nella connessione al database! -> " . mysql_error());
    }
    // Apertura del database
    if (!mysql_select_db($Database, $link)) {
        die("Errore nell'apertura del database mba!" . mysql_error());
    }
    // Esucuzione della query
    if (!($result = mysql_query($query, $link))) {
        print "Errore nell'esecuzione della query! <br />";
        die(mysql_error());
    }
    //chiusura del collegamento al database
    mysql_close($link);
    //restituzione all'ambiente chiamante del risultato della query
    return $result;
}
Exemple #19
0
function MainFunc($path, $db_host, $db_user, $db_pass, $db_name)
{
    if (!$path || $path == "") {
        echo "error";
        exit(0);
    }
    $db_host = "10.10.43.142";
    $Conn = mysql_connect($db_host, $db_user, $db_pass);
    mysql_query("SET NAMES 'GBK'");
    $network_flag = 0;
    if ($db_name == "LogFree") {
        $network_flag = 1;
    }
    if ($db_name == "LogFree_WAN") {
        $network_flag = 2;
    }
    mysql_select_db("LogFree", $Conn);
    $qs = "delete from tbl_last_action_time";
    mysql_query($qs);
    $qs = "insert into tbl_last_action_time set lat_dtDateTime = now()";
    mysql_query($qs);
    process_all_info("{$path}/gac");
    process_all_info("{$path}/gas");
    process_all_server_common("{$path}/gas", $network_flag);
    process_all_client_guid("{$path}/gas");
    process_all_client_common("{$path}/gac", $network_flag);
    $qs = "update tbl_client_log_common set happened_time = now() where happened_time > now()";
    mysql_query($qs);
    mysql_close();
}
function insert_hasher()
{
    include 'configdb.php';
    include 'opendb.php';
    $hash_name = $_POST['hash_name'];
    $insert = "INSERT INTO hashers set " . ($insert .= "hash_name = '" . $hash_name . "'");
    $insert .= ",first_name = '" . $_POST['first_name'] . "'";
    $insert .= ",last_name = '" . $_POST['last_name'] . "'";
    $insert .= ",password = '******'password'] . "'";
    $insert .= ",email_address = '" . $_POST['email_address'] . "'";
    $insert .= ",address = '" . $_POST['address'] . "'";
    $insert .= ",active = '" . $_POST['active'] . "'";
    $insert .= ",home_phone = '" . $_POST['home_phone'] . "'";
    $insert .= ",work_phone = '" . $_POST['work_phone'] . "'";
    $insert .= ",comments = '" . $_POST['comments'] . "'";
    $insert .= ",hide_address = '" . $_POST['hide_address'] . "'";
    $insert .= ",mother_hash = '" . $_POST['mother_hash'] . "'";
    $insert .= ",T_shirt_size = '" . $_POST['T_shirt_size'] . "'";
    $insert .= ",country = '" . $_POST['country'] . "'";
    $insert .= ",food_choice = '" . $_POST['food_choice'] . "' ";
    $result = mysql_query($insert);
    if ($result) {
        echo "<center><h2>Hasher {$hash_name} was added successfully</h2></center><p>";
    } else {
        echo "<center><h2>Sorry, there was an error adding hasher - {$hash_name}!<br>";
        echo "Please make sure the hasher doesn't already exist in the database.</h2></center>";
        echo "The insert statement was .... {$insert}<p>";
        $MYSQL_ERRNO = mysql_errno();
        $MYSQL_ERROR = mysql_error();
        echo "The error was {$MYSQL_ERRNO} ... {$MYSQL_ERROR}<br>";
    }
    mysql_close();
}
Exemple #21
0
function fromOpenID2CardID($openid)
{
    $mysql_host = SAE_MYSQL_HOST_M;
    $mysql_host_s = SAE_MYSQL_HOST_S;
    $mysql_port = SAE_MYSQL_PORT;
    $mysql_user = SAE_MYSQL_USER;
    $mysql_password = SAE_MYSQL_PASS;
    $mysql_database = SAE_MYSQL_DB;
    $mysql_table = "member";
    $mysql_state = "SELECT * FROM " . $mysql_table . " WHERE `openid` = '" . $openid . "'";
    $con = mysql_connect($mysql_host . ':' . $mysql_port, $mysql_user, $mysql_password, true);
    if (!$con) {
        die('Could not connect: ' . mysql_error());
    }
    mysql_query("SET NAMES 'UTF8'");
    mysql_select_db($mysql_database, $con);
    $result = mysql_query($mysql_state);
    $cardID = "";
    while ($row = mysql_fetch_array($result)) {
        $cardID = $row['cardid'];
        break;
    }
    mysql_close($con);
    return $cardID;
}
Exemple #22
0
function authenticate($user, $pass)
{
    $result = -1;
    // Get emails from Db that match
    include 'dbconn.php';
    $sql_email = "SELECT id, email, password, user_type FROM tbl_customers WHERE email = '{$user}'";
    $result_email = mysql_query($sql_email);
    $num_email = mysql_num_rows($result_email);
    $row_email = mysql_fetch_array($result_email);
    if ($num_email > 0) {
        $result++;
    }
    if ($pass == $row_email['password']) {
        // update items in shopping cart to include email of customer
        $sql_update = "UPDATE tbl_orders_temp SET email='{$user}' WHERE (session='{$PHPSESSID}')";
        if (!mysql_query($sql_update)) {
            // There was an error, but let's not stop the login for this error
            echo "Error: " . mysql_error();
        }
        $result = $result + $row_email['user_type'];
    }
    if (!empty($result_email)) {
        mysql_free_result($result_email);
    }
    mysql_close($dbcnx);
    // return value & end function
    return $result;
}
Exemple #23
0
 public function close_connection()
 {
     if (isset($this->connection)) {
         mysql_close($this->connection);
         unset($this->connection);
     }
 }
 function closeConnection($conn)
 {
     mysql_close($conn);
     if ($this->logger != null) {
         $this->logger->close();
     }
 }
 public function closeConnection()
 {
     if (!$this->persistentConnection) {
         mysql_close();
     }
     $this->connectionOpened = false;
 }
 function closeDBCon()
 {
     if ($this->v('db_con', false, $this->a)) {
         @mysql_close($this->a['db_con']);
     }
     unset($this->a['db_con']);
 }
 private function validate()
 {
     if (!defined('DB_HOSTNAME')) {
         $this->error['warning'] = 'Host required!';
     }
     if (!defined('DB_USERNAME')) {
         $this->error['warning'] = 'User required!';
     }
     if (!defined('DB_DATABASE')) {
         $this->error['warning'] = 'Database Name required!';
     }
     if (!($connection = @mysql_connect(DB_HOSTNAME, DB_USERNAME, DB_PASSWORD))) {
         $this->error['warning'] = 'Error: Could not connect to the database please make sure the database server, username and password is correct in the config.php file!';
     } else {
         if (!@mysql_select_db(DB_DATABASE, $connection)) {
             $this->error['warning'] = 'Error: Database "' . DB_DATABASE . '" does not exist!';
         }
         mysql_close($connection);
     }
     if (!$this->error) {
         return true;
     } else {
         return false;
     }
 }
Exemple #28
0
    public function validate()
    {/*{{{*/
        $msg = '';
        foreach ($this->dbreads as $dbread){
            $link = mysql_connect($dbread['host'], $this->account['user'], $this->account['pass']);
            $res = mysql_query('show slave status', $link);
            $row = mysql_fetch_assoc($res);
            if (empty($row)) {
                $msg .= $dbread['host'].' can\'t be connected;';
            } else if ($this->max < $row['Seconds_Behind_Master']) {
                error_log("\n".date('Y-m-d H:i:s').":\n".print_r($row, true), 3, '/tmp/db.log');
                $msg .= $dbread['host'].' delay '.$row['Seconds_Behind_Master'].';';
            } else if ('' != $row['Last_Error']) {
                $msg .= $dbread['host'].' has error!';
	    } else if ('Yes' != $row['Slave_IO_Running'] || 'Yes' != $row['Slave_SQL_Running']) {
                $msg .= $dbread['host'].' has repl error!';
	    } else if ('' != $row['Last_IO_Error']) {
                $msg .= $dbread['host'].' has io error!';
	    } else if ('' != $row['Last_SQL_Error']) {
                $msg .= $dbread['host'].' has sql error!';
            }
            mysql_close($link);

        }
        return $msg;
    }/*}}}*/
Exemple #29
0
function display($page, $topnav = true, $metatags = '', $AdminPage = false, $menu = true)
{
    global $link, $game_config, $debug, $user, $planetrow, $xgp_root, $phpEx;
    if (!$AdminPage) {
        $DisplayPage = StdUserHeader($metatags);
    } else {
        $DisplayPage = AdminUserHeader($metatags);
    }
    if ($topnav) {
        include_once $xgp_root . 'includes/functions/ShowTopNavigationBar.' . $phpEx;
        $DisplayPage .= ShowTopNavigationBar($user, $planetrow);
    }
    if ($menu && !$AdminPage) {
        include_once $xgp_root . 'includes/functions/ShowLeftMenu.' . $phpEx;
        $DisplayPage .= ShowLeftMenu($user['authlevel']);
    }
    $DisplayPage .= "\n<center>\n" . $page . "\n</center>\n";
    if (!defined('LOGIN') && $_GET['page'] != 'galaxy') {
        $DisplayPage .= parsetemplate(gettemplate('footer'), $parse);
    } else {
        $DisplayPage .= "</body>\n</html>";
    }
    if ($link) {
        mysql_close($link);
    }
    echo $DisplayPage;
    if ($user['authlevel'] == 3 && $game_config['debug'] == 1) {
        $debug->echo_log();
    }
    die;
}
Exemple #30
0
 function close()
 {
     if ($this->con != null) {
         mysql_close($this->con);
     }
     $this->con = null;
 }