コード例 #1
0
ファイル: shared.inc.php プロジェクト: kktsvetkov/1double.com
function init()
{
    global $HTTP_POST_VARS, $HTTP_GET_VARS, $PARAM;
    global $debugFP, $dbh, $dbuser, $dbhost, $dbport, $dbpass, $dbname, $debugLogFile;
    //assume that the variables order is "GP"
    $PARAM = array_merge($_GET, $_POST);
    if (defined('DEBUG') && DEBUG == 1) {
        // If DEBUG is true, try to open log file:
        if (!($debugFP = @fopen($debugLogFile, "a"))) {
            // fopen failed, set program status:
            setLogAndStatus('', '', $debugLogFile, 'init()', 'DEBUG_LOG_OPEN');
            return 0;
        }
    }
    if (!($dbh = db_connect("{$dbhost}:{$dbport}", $dbuser, $dbpass))) {
        // database connection failed, set program status:
        setLogAndStatus('', db_errno($dbh), db_error($dbh), 'init()', 'DB_CONNECT');
        return 0;
    }
    if (!db_select_db($dbname, $dbh)) {
        // database selection failed, set program status:
        setLogAndStatus('', db_errno($dbh), db_error($dbh), 'init()', 'DB_SELECT');
        return 0;
    }
    //mysql_query('set names utf8');
    session_name('diploma');
    session_start('');
    return 1;
}
コード例 #2
0
/**
 * This function saves the data into the database
 * @param string $data the content of the sld-document to be stored inside the database
 */
function saveSld($data)
{
    $con = db_connect($DBSERVER, $OWNER, $PW);
    db_select_db($DB, $con);
    $sql = "UPDATE sld_user_layer SET sld_xml=\$1 WHERE fkey_gui_id=\$2 AND fkey_layer_id=\$3 AND fkey_mb_user_id=\$4";
    $v = array($data, $_SESSION["sld_gui_id"], $_SESSION["sld_layer_id"], $_SESSION["mb_user_id"]);
    $t = array('s', 's', 'i', 'i');
    $res = db_prep_query($sql, $v, $t);
}
コード例 #3
0
ファイル: core_database_API.php プロジェクト: ColBT/php_tut
function db_pconnect($p_hostname = "localhost", $p_username = "******", $p_password = "", $p_database = "mantis", $p_port = 3306)
{
    $t_result = mysql_pconnect($p_hostname . ":" . $p_port, $p_username, $p_password);
    if (!$t_result) {
        echo "ERROR: FAILED CONNECTION TO DATABASE: ";
        echo db_error();
        exit;
    }
    $t_result = db_select_db($p_database);
    if (!$t_result) {
        echo "ERROR: FAILED DATABASE SELECTION: ";
        echo db_error();
        exit;
    }
}
コード例 #4
0
function authenticate($name, $pw)
{
    $con = db_connect(DBSERVER, OWNER, PW);
    db_select_db(DB, $con);
    $sql = "SELECT * FROM mb_user WHERE mb_user_name = \$1 AND mb_user_password = \$2";
    $v = array($name, md5($pw));
    // is md5 used really?
    $t = array('s', 's');
    $res = db_prep_query($sql, $v, $t);
    if ($row = db_fetch_array($res)) {
        $e = new mb_exception('row mb_user_name: ' . $row['mb_user_name']);
        return $row;
    } else {
        return false;
    }
}
コード例 #5
0
function db_test_create_db_permission($database) {
    global $db_error;
    $db_created = false;
    $db_error = false;
    if (!$database) {
        $db_error = 'No Database selected.';
        return false;
    }
    if ($db_error) {
        return false;
    } else {
        if (!@db_select_db($database)) {
            $db_error = mysql_error();
            return false;
        }else {
            return true;
        }
    return true;
    }
}
コード例 #6
0
ファイル: shared.inc.php プロジェクト: kktsvetkov/1double.com
function init()
{
    global $HTTP_POST_VARS, $HTTP_GET_VARS, $PARAM;
    global $debugFP, $dbh, $dbuser, $dbhost, $dbport, $dbpass, $dbname, $debugLogFile;
    ////---- [Mrasnika's] Edition Aug-01-2008
    global $Cache;
    $Cache = new Cache('CACHE2_');
    //assume that the variables order is "GP"
    $PARAM = array_merge($_GET, $_POST);
    if (defined('DEBUG') && DEBUG == 1) {
        // If DEBUG is true, try to open log file:
        if (!($debugFP = @fopen($debugLogFile, "a"))) {
            // fopen failed, set program status:
            setLogAndStatus('', '', $debugLogFile, 'init()', 'DEBUG_LOG_OPEN');
            ////---- [Mrasnika's] Edition Aug-01-2008
            //return 0;
            $Cache->force();
        }
    }
    if (!($dbh = @db_connect("{$dbhost}:{$dbport}", $dbuser, $dbpass))) {
        // database connection failed, set program status:
        setLogAndStatus('', db_errno($dbh), db_error($dbh), 'init()', 'DB_CONNECT');
        ////---- [Mrasnika's] Edition Aug-01-2008
        //return 0;
        $Cache->force();
    }
    if (!@db_select_db($dbname, $dbh)) {
        // database selection failed, set program status:
        setLogAndStatus('', db_errno($dbh), db_error($dbh), 'init()', 'DB_SELECT');
        ////---- [Mrasnika's] Edition Aug-01-2008
        //return 0;
        $Cache->force();
    }
    //mysql_query('set names utf8');
    ////----[Mrasnika's] Edition 20.06.2003
    if (!defined('INDEX')) {
        session_name('v');
        session_start('');
    }
    return 1;
}
コード例 #7
0
 /**
  * @param  integer  the ID of the KML.
  * @return string   the KML document with the given ID.
  */
 public function getKmlDocumentFromDB($kmlId)
 {
     $con = db_connect(DBSERVER, OWNER, PW);
     db_select_db(DB, $con);
     //get KML from database (check if user is allowed to access)
     # for now, do not restrict access
     #		$sql = "SELECT kml_doc FROM gui_kml WHERE kml_id = $1 AND fkey_mb_user_id = $2 AND fkey_gui_id = $3 LIMIT 1";
     #		$v = array($kmlId, Mapbender::session()->get("mb_user_id"), Mapbender::session()->get("mb_user_gui"));
     #		$t = array("i", "i", "s");
     $sql = "SELECT kml_doc FROM gui_kml WHERE kml_id = \$1 LIMIT 1";
     $v = array($kmlId);
     $t = array("i");
     $result = db_prep_query($sql, $v, $t);
     $row = db_fetch_array($result);
     if ($row) {
         return $row["kml_doc"];
     } else {
         $e = new mb_exception("class_kml.php: getKMLDocumentFromDB: no KML found for ID " . $kmlId);
     }
     return "";
 }
コード例 #8
0
<?php

require dirname(__FILE__) . "/../../conf/mapbender.conf";
require dirname(__FILE__) . "/../../http/classes/class_administration.php";
require dirname(__FILE__) . "/../../http/classes/class_connector.php";
require_once dirname(__FILE__) . "/../../http/classes/class_mb_exception.php";
require dirname(__FILE__) . "/../../owsproxy/http/classes/class_QueryHandler.php";
//database connection
$db = db_connect($DBSERVER, $OWNER, $PW);
db_select_db(DB, $db);
$imageformats = array("image/png", "image/gif", "image/jpeg", "image/jpg");
//control if digest auth is set, if not set, generate the challenge with getNonce()
if (empty($_SERVER['PHP_AUTH_DIGEST'])) {
    header('HTTP/1.1 401 Unauthorized');
    header('WWW-Authenticate: Digest realm="' . REALM . '",qop="auth",nonce="' . getNonce() . '",opaque="' . md5(REALM) . '"');
    die('Text to send if user hits Cancel button');
}
//read out the header in an array
$requestHeaderArray = http_digest_parse($_SERVER['PHP_AUTH_DIGEST']);
//error if header could not be read
if (!$requestHeaderArray) {
    echo 'Following Header information cannot be validated - check your clientsoftware!<br>';
    echo $_SERVER['PHP_AUTH_DIGEST'] . '<br>';
    die;
}
//get mb_username and email out of http_auth username string
$userIdentification = explode(';', $requestHeaderArray['username']);
$mbUsername = $userIdentification[0];
$mbEmail = $userIdentification[1];
$userInformation = getUserInfo($mbUsername, $mbEmail);
if ($userInformation[0] == '-1') {
コード例 #9
0
 function sql($statment, &$o)
 {
     static $connected = false, $db_link;
     // $connect would be set to true on successful connection
     if (!$connected) {
         /****** Connect to MySQL ******/
         if (!($db_link = @db_connect(config('dbServer'), config('dbUsername'), config('dbPassword')))) {
             echo "<div class=\"alert alert-danger\">Couldn't connect to MySQL at '" . config('dbServer') . "'. You might need to re-configure this application. You can do so by manually editing the config.php file, or by deleting it to run the setup wizard.</div>";
             exit;
         }
         /****** Select DB ********/
         if (!db_select_db(config('dbDatabase'), $db_link)) {
             echo "<div class=\"alert alert-danger\">Couldn't connect to the database '" . config('dbDatabase') . "'.</div>";
             exit;
         }
         $connected = true;
     }
     if (!($result = @db_query($statment))) {
         echo "An error occured while attempting to execute:<br><pre>" . htmlspecialchars($statment) . "</pre><br>MySQL said:<br><pre>" . db_error(db_link()) . "</pre>";
         exit;
     }
     return $result;
 }
コード例 #10
0
        if ($password != $confirmPassword) {
            $errors[] = $Translation['password no match'];
        }
        if (!$email) {
            $errors[] = $Translation['email invalid'];
        }
    }
    /* test database connection */
    if (!($connection = @db_connect($db_server, $db_username, $db_password))) {
        $errors[] = $Translation['Database connection error'];
    }
    if ($connection !== false && !@db_select_db($db_name, $connection)) {
        // attempt to create the database
        if (!@db_query("CREATE DATABASE IF NOT EXISTS `{$db_name}`")) {
            $errors[] = @db_error($connection);
        } elseif (!@db_select_db($db_name, $connection)) {
            $errors[] = @db_error($connection);
        }
    }
    /* in case of validation errors, output them and exit */
    if (count($errors)) {
        if ($test) {
            echo 'ERROR!';
            exit;
        }
        ?>
				<div class="row">
					<div class="col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
						<h2 class="text-danger"><?php 
        echo $Translation['The following errors occured'];
        ?>
コード例 #11
0
ファイル: incCommon.php プロジェクト: WebxOne/fwldba
function sql($statment, &$o)
{
    /*
    	Supported options that can be passed in $o options array (as array keys):
    	'silentErrors': If true, errors will be returned in $o['error'] rather than displaying them on screen and exiting.
    */
    global $Translation;
    static $connected = false, $db_link;
    $dbServer = config('dbServer');
    $dbUsername = config('dbUsername');
    $dbPassword = config('dbPassword');
    $dbDatabase = config('dbDatabase');
    ob_start();
    if (!$connected) {
        /****** Connect to MySQL ******/
        if (!extension_loaded('mysql') && !extension_loaded('mysqli')) {
            echo error_message('PHP is not configured to connect to MySQL on this machine. Please see <a href="http://www.php.net/manual/en/ref.mysql.php">this page</a> for help on how to configure MySQL.');
            $e = ob_get_contents();
            ob_end_clean();
            if ($o['silentErrors']) {
                $o['error'] = $e;
                return FALSE;
            } else {
                echo $e;
                exit;
            }
        }
        if (!($db_link = @db_connect($dbServer, $dbUsername, $dbPassword))) {
            echo error_message(db_error($db_link, true));
            $e = ob_get_contents();
            ob_end_clean();
            if ($o['silentErrors']) {
                $o['error'] = $e;
                return FALSE;
            } else {
                echo $e;
                exit;
            }
        }
        /****** Select DB ********/
        if (!db_select_db($dbDatabase, $db_link)) {
            echo error_message(db_error($db_link));
            $e = ob_get_contents();
            ob_end_clean();
            if ($o['silentErrors']) {
                $o['error'] = $e;
                return FALSE;
            } else {
                echo $e;
                exit;
            }
        }
        $connected = true;
    }
    if (!($result = @db_query($statment, $db_link))) {
        if (!stristr($statment, "show columns")) {
            // retrieve error codes
            $errorNum = db_errno($db_link);
            $errorMsg = db_error($db_link);
            echo error_message(htmlspecialchars($errorMsg) . "\n\n<!--\n" . $Translation['query:'] . "\n {$statment}\n-->\n\n");
            $e = ob_get_contents();
            ob_end_clean();
            if ($o['silentErrors']) {
                $o['error'] = $errorMsg;
                return false;
            } else {
                echo $e;
                exit;
            }
        }
    }
    ob_end_clean();
    return $result;
}
コード例 #12
0
	global $session;
	$sql = "DELETE from debuglog WHERE date <'".date("Y-m-d H:i:s",strtotime("-".(getsetting("expirecontent",180)/10)." days"))."'";
	db_query($sql);
	$sql = "INSERT INTO debuglog VALUES(0,now(),{$session['user']['acctid']},$target,'".addslashes($message)."')";
	db_query($sql);
}

if (file_exists("dbconnect.php")){
	require_once "dbconnect.php";
}else{
	echo "You must edit the file named \"dbconnect.php.dist,\" and provide the requested information, then save it as \"dbconnect.php\"".
	exit();
}

$link = db_pconnect($DB_HOST, $DB_USER, $DB_PASS) or die (db_error($link));
db_select_db ($DB_NAME) or die (db_error($link));
define("LINK",$link);

require_once "translator.php";


session_register("session");
function register_global(&$var){
	@reset($var);
	while (list($key,$val)=@each($var)){
		global $$key;
		$$key = $val;
	}
	@reset($var);
}
$session =& $_SESSION['session'];
コード例 #13
0
function cw_cpanel_install_tables($params)
{
    global $var_dirs, $mysql_connection_id;
    $current_connection = $mysql_connection_id;
    $ret = @db_connect($params['mysql_host'], $params['mysql_user'], $params['mysql_password']);
    if ($ret) {
        $ret &= db_select_db($params['mysql_db']);
    }
    if (!$ret) {
        $mysql_connection_id = $current_connection;
        cw_cpanel_install_show_status('db_connect', $file, false);
        return false;
    }
    $new_connection = $mysql_connection_id;
    $file_path = $var_dirs['repository'] . '/sql';
    $files = array('ars_tables.sql', 'ars_data.sql');
    foreach ($files as $file) {
        $fp = @fopen($file_path . '/' . $file, "rb");
        if ($fp === false) {
            $mysql_connection_id = $current_connection;
            cw_cpanel_install_show_status('read_db_file', $file, false);
            return false;
        }
        $command = "";
        $counter = 0;
        while (!feof($fp)) {
            $c = chop(fgets($fp, 100000));
            $c = ereg_replace("^[ \t]*(#|-- |---*).*", "", $c);
            $command .= $c;
            if (ereg(";\$", $command)) {
                $command = ereg_replace(";\$", "", $command);
                if (ereg("CREATE TABLE ", $command)) {
                    $table_name = ereg_replace(" .*\$", "", eregi_replace("^.*CREATE TABLE ", "", $command));
                    db_query($command);
                    $myerr = mysql_error();
                    if (!empty($myerr)) {
                        $mysql_connection_id = $current_connection;
                        cw_cpanel_install_show_status('create_table', $table_name, false);
                        return false;
                    }
                    $mysql_connection_id = $current_connection;
                    cw_cpanel_install_show_status('create_table', $table_name, true);
                    $mysql_connection_id = $new_connection;
                } else {
                    db_query($command);
                    $myerr = mysql_error();
                    if (!empty($myerr)) {
                        $mysql_connection_id = $current_connection;
                        cw_cpanel_install_show_status('sql_row', $table_name, false);
                        return false;
                    } else {
                        $counter++;
                        if (!($counter % 50)) {
                            echo ".";
                        }
                        flush();
                    }
                }
                $command = "";
                flush();
            }
        }
        fclose($fp);
    }
    $mysql_connection_id = $current_connection;
    return true;
}
コード例 #14
0
function cw_patch_execute_sql_query($sql_query, $databases)
{
    global $mysql_connection_id;
    $pieces = array();
    cw_patch_split_sql_file($pieces, $sql_query, PMA_MYSQL_INT_VERSION);
    $pieces_count = count($pieces);
    if ($sql_file != 'none' && $pieces_count > 10) {
        $sql_query_cpy = $sql_query = '';
    } else {
        $sql_query_cpy = implode(";\n", $pieces) . ';';
    }
    // Runs multiple queries
    if (is_array($databases)) {
        $current_connection = $mysql_connection_id;
        foreach ($databases as $params) {
            $ret = @db_connect($params['host'], $params['user'], $params['password']);
            if ($ret) {
                $ret &= db_select_db($params['db']);
            }
            for ($i = 0; $i < $pieces_count; $i++) {
                $a_sql_query = $pieces[$i];
                $result = db_query($a_sql_query);
                if ($result == FALSE) {
                    $my_die = $params['db'] . '@' . $params['host'] . ' ' . $a_sql_query;
                    break;
                }
            }
            if ($result == FALSE) {
                break;
            }
        }
        $mysql_connection_id = $current_connection;
    }
    unset($pieces);
    return $my_die;
}
コード例 #15
0
 function namespaces($fid)
 {
     $namespace_name = array();
     $namespace_location = array();
     global $DBSERVER, $DB, $OWNER, $PW;
     $con = db_connect($DBSERVER, $OWNER, $PW);
     db_select_db($DB, $con);
     $sql = "SELECT * FROM wfs_featuretype_namespace WHERE fkey_featuretype_id = \$1";
     $v = array($fid);
     $t = array("s");
     $res = db_prep_query($sql, $v, $t);
     $cnt = 0;
     while ($row = db_fetch_array($res)) {
         $this->namespace_name[$cnt] = $row["namespace"];
         $this->namespace_location[$cnt] = $row["namespace_location"];
         $cnt++;
     }
 }
コード例 #16
0
ファイル: p_routes.php プロジェクト: NobisPete/choose
<?
	include('../../../includes/db.php');

	db_select_db('cal_games');

	include('header.txt');

	function insertRoutes($id, $data){
		$count = 0;
		$room = db_single(db_fetch("SELECT * FROM choose_rooms WHERE id=$id"));
		if ($room[end_here]){
			print $data."<td bgcolor=\"#ffcccc\"><a href=\"room.php?room=$id\">$id</a></td></tr>";
			$count++;
		}else{
			$data .= "<td bgcolor=\"#eeeeee\"><a href=\"room.php?room=$id\">$id</a></td>";
			if ($room[room_1]){
				$count += insertRoutes($room[room_1],$data);
			}else{
				print $data."<td bgcolor=\"#cccccc\">0a</td></tr>";
				$count++;
			}
			if ($room[room_2]){
				$count += insertRoutes($room[room_2],$data);
			}else{
				print $data."<td bgcolor=\"#cccccc\">0b</td></tr>";
				$count++;
			}
		}
		return $count;
	}
コード例 #17
0
<?php

/*
 * $Id: jFileBrowser, 2010.
 * @author Juaniquillo
 * @copyright Copyright � 2010, Victor Sanchez (Juaniquillo).
 * @email juaniquillo@gmail.com
 * @website http://juaniquillo.com
*/
$sql_host = 'localhost';
/////informacion MySQL
$sql_db = "Base_de_datos";
$sql_user = "******";
$sql_password = "******";
//Funciones
include 'funciones.inc.php';
//PHPPaging
include 'PHPPaging.lib.php';
//Conexion
$conexion_gal = db_connect($sql_host, $sql_user, $sql_password) or die('No se puede conectar a la base de datos');
db_select_db($sql_db, $conexion_gal);
コード例 #18
0
ファイル: admin.php プロジェクト: gblok/rsc
$far_3 = glob('core/functions/admin/*.php');
$far = array_merge($far_1, $far_2, $far_3);
$cfar = count($far);
if (file_exists('core/cache/afcache.php')) {
    include 'core/cache/afcache.php';
} else {
    for ($n = 0; $n < $cfar; $n++) {
        include $far[$n];
    }
}
define('PATH_DELIMITER', isWindows() ? ';' : ':');
$_POST = xStripSlashesGPC($_POST);
$_GET = xStripSlashesGPC($_GET);
$_COOKIE = xStripSlashesGPC($_COOKIE);
db_connect(DB_HOST, DB_USER, DB_PASS) or die(ERROR_DB_INIT);
db_select_db(DB_NAME) or die(db_error());
settingDefineConstants();
if ((int) CONF_SMARTY_FORCE_COMPILE) {
    if (file_exists("core/cache/afcache.php")) {
        unlink("core/cache/afcache.php");
    }
} else {
    ob_start();
    for ($n = 0; $n < $cfar; $n++) {
        readfile($far[$n]);
    }
    $_res = ob_get_contents();
    ob_end_clean();
    $fh = fopen("core/cache/afcache.php", 'w');
    fwrite($fh, $_res);
    fclose($fh);
<?php

require_once dirname(__FILE__) . "/../../core/globalSettings.php";
require_once dirname(__FILE__) . "/../classes/class_administration.php";
require_once dirname(__FILE__) . "/../classes/class_wfs.php";
include_once dirname(__FILE__) . "/../extensions/JSON.php";
//db connection
$con = db_connect(DBSERVER, OWNER, PW);
db_select_db(DB, $con);
$json = new Services_JSON();
$obj = $json->decode(stripslashes($_REQUEST['obj']));
//workflow:
switch ($obj->action) {
    case 'getServices':
        $obj->services = getServices($obj);
        sendOutput($obj);
        break;
    case 'getWfsConfData':
        $obj->wfsConf = getWfsConfData($obj->wfs);
        sendOutput($obj);
        break;
    case 'getAssignedGuis':
        $obj->assignedGuis = getAssignedGuis($obj);
        sendOutput($obj);
        break;
    case 'deleteSelectedConfs':
        deleteWfsConf($obj);
        sendOutput($obj);
        break;
    default:
        sendOutput("no action specified...");
        // require_once("lib/smsnotify.php");
        // }
        // And tell the user it died.  No translation here, we need the DB for
        // translation.
        if (!defined("DB_NODB")) {
            define("DB_NODB", true);
        }
        page_header("Database Connection Error");
        output("Unable to connect to the database server.  Sorry it didn't work out.");
        page_footer();
    }
    define("DB_CONNECTED", false);
} else {
    define("DB_CONNECTED", true);
}
if (!DB_CONNECTED || !db_select_db($DB_NAME)) {
    if (!defined("IS_INSTALLER") && DB_CONNECTED) {
        // Ignore this bit.  It's only really for Eric's server
        if (file_exists("lib/smsnotify.php")) {
            $smsmessage = "Cant Attach to DB: " . db_error();
            require_once "lib/smsnotify.php";
        }
        // And tell the user it died.  No translation here, we need the DB for
        // translation.
        if (!defined("DB_NODB")) {
            define("DB_NODB", true);
        }
        page_header("Database Connection Error");
        output("I was able to connect to the database server, but couldn't connect to the specified database.  Sorry it didn't work out.");
        page_footer();
    }
コード例 #21
0
 /** end createObjfromDB **/
 public function getallwfs($userid)
 {
     $this->wfs_id = array();
     $this->wfs_name = array();
     $this->wfs_title = array();
     $this->wfs_abstract = array();
     global $DBSERVER, $DB, $OWNER, $PW;
     $con = db_connect($DBSERVER, $OWNER, $PW);
     db_select_db($DB, $con);
     if ($userid) {
         $sql = "SELECT * FROM wfs WHERE wfs_owner = \$1";
         $v = array($userid);
         $t = array('i');
         $res = db_prep_query($sql, $v, $t);
     } else {
         $sql = "SELECT * FROM wfs";
         $res = db_query($sql);
     }
     $cnt = 0;
     while ($row = db_fetch_array($res)) {
         $this->wfs_version[$cnt] = $row["wfs_version"];
         $this->wfs_id[$cnt] = $row["wfs_id"];
         $this->wfs_name[$cnt] = $row["wfs_name"];
         $this->wfs_title[$cnt] = $row["wfs_title"];
         $this->wfs_abstract[$cnt] = $row["wfs_abstract"];
         $this->wfs_getcapabilities[$cnt] = $row["wfs_getcapabilities"];
         $this->wfs_describefeaturetype[$cnt] = $row["wfs_describefeaturetype"];
         $this->wfs_getfeature[$cnt] = $row["wfs_getfeature"];
         $cnt++;
     }
 }
コード例 #22
0
    output("`\$Blast!  I wasn't able to connect to the database server with the information you provided!");
    output("`2This means that either the database server address, database username, or database password you provided were wrong, or else the database server isn't running.");
    output("The specific error the database returned was:");
    rawoutput("<blockquote>" . $error . "</blockquote>");
    output("If you believe you provided the correct information, make sure that the database server is running (check documentation for how to determine this).");
    output("Otherwise, you should return to the previous step, \"Database Info\" and double-check that the information provided there is accurate.");
    $session['stagecompleted'] = 3;
} else {
    output("`^Yahoo, I was able to connect to the database server!");
    output("`2This means that the database server address, database username, and database password you provided were probably accurate, and that your database server is running and accepting connections.`n");
    output("`nI'm now going to attempt to connect to the LoGD database you provided.`n");
    if (httpget("op") == "trycreate") {
        require_once 'lib/installer/installer_functions.php';
        create_db($session['dbinfo']['DB_NAME']);
    }
    if (!db_select_db($session['dbinfo']['DB_NAME'])) {
        output("`\$Rats!  I was not able to connect to the database.");
        $error = db_error();
        if ($error == "Unknown database '{$session['dbinfo']['DB_NAME']}'") {
            output("`2It looks like the database for LoGD hasn't been created yet.");
            output("I can attempt to create it for you if you like, but in order for that to work, the account you provided has to have permissions to create a new database.");
            output("If you're not sure what this means, it's safe to try to create this database, but you should double check that you've typed the name correctly by returning to the previous stage before you try it.`n");
            output("`nTo try to create the database, <a href='installer.php?stage=4&op=trycreate'>click here</a>.`n", true);
        } else {
            output("`2This is probably because the username and password you provided doesn't have permission to connect to the database.`n");
        }
        output("`nThe exact error returned from the database server was:");
        rawoutput("<blockquote>{$error}</blockquote>");
        $session['stagecompleted'] = 3;
    } else {
        output("`n`^Excellent, I was able to connect to the database!`n");
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once dirname(__FILE__) . "/../../core/globalSettings.php";
$gui_id = Mapbender::session()->get("mb_user_gui");
$target = $_REQUEST["e_target"];
$e_id_css = $_REQUEST["e_id_css"];
$isLoaded = $_REQUEST["isLoaded"];
$con = db_connect($DBSERVER, $OWNER, $PW);
db_select_db($DB, $con);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset='<?php 
echo CHARSET;
?>
'">
<title>mod_wfsGazetteerEditor</title>
<STYLE TYPE="text/css">
<!--
div.mainDiv {
	width: 330px;	 
}
コード例 #24
0
ファイル: med_settings.php プロジェクト: hewu/blogwp
    }
    ?>
</div><?php 
} else {
    #	no errors, lets proceed pending on the button the user clicked
    #
    switch ($_POST['btn']) {
        #----------------
        case CREATE_BTN:
            #----------------
            #
            #	create the (empty) myEASYdb own tables
            #
            $MED_OWN_TABLES = explode('|', MED_OWN_TABLES);
            $errors = array();
            $result = db_select_db(array($_POST['med_own_database']));
            if ($result == 1) {
                ?>
<div class="updated"><?php 
                foreach ($MED_OWN_TABLES as $table) {
                    if (file_exists(MED_PATH . 'inc/sql/' . $table . '-create.sql')) {
                        if (!table_exists($table, $_POST['med_own_database'])) {
                            echo '<p>' . __('Adding table: ', MED_LOCALE) . '<strong>' . $table . '</strong></p>';
                            $sql = file_get_contents(MED_PATH . 'inc/sql/' . $table . '-create.sql');
                            $sth = db_query($sql, __LINE__, __FILE__);
                            echo '<code>' . $sql . '</code><br />';
                            #	0.0.6
                        }
                    } else {
                        $errors[] = $table;
                    }
コード例 #25
0
             echo "<br />\n";
         }
         echo cw_get_langvar_by_name("lbl_restoring_table_n", array("table" => $table_name), false, true) . "<br />\n";
         flush();
         db_query("drop table if exists {$table_name}");
         $cmdcnt = 0;
     }
 }
 $cmdcnt++;
 if ($sql_reconnect_count > 0 && $cmdcnt % $sql_reconnect_count == 0) {
     #
     # While restoring database re-establish connection
     # with mysql server before every Nth table row
     #
     db_connect($app_config_file['sql']['host'], $app_config_file['sql']['user'], $app_config_file['sql']['password']) || die('Connection is lost. Could not reconnect to server');
     db_select_db($app_config_file['sql']['db']) || die("Could not connect to SQL db");
 }
 db_query($command);
 if ($cmdcnt % 50 == 0) {
     cw_flush(".");
 }
 if ($cmdcnt % 3000 == 0) {
     cw_flush("<br />\n");
 }
 $myerr = mysql_error();
 if (!empty($myerr)) {
     echo $myerr;
     break;
 }
 $command = "";
 flush();
コード例 #26
0
 */
if (cw_is_ajax_request()) {
    cw_load('ajax');
    define('IS_AJAX', true);
}
if (function_exists('date_default_timezone_set')) {
    if (!empty($app_config_file['time_zone']['default_zone'])) {
        date_default_timezone_set($app_config_file['time_zone']['default_zone']);
    }
}
cw_include('init/prepare.php');
include_once $app_main_dir . '/config.php';
// Redefine error_reporting option (see config.php)
error_reporting($app_error_reporting);
// Connect to database
if (!(@db_connect($app_config_file['sql']['host'], $app_config_file['sql']['user'], $app_config_file['sql']['password']) && db_select_db($app_config_file['sql']['db']))) {
    if (is_readable($app_dir . '/install/index.php')) {
        die('Problem with settings. Proceed with <a href="' . str_replace('\\', '/', 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])) . '/install/index.php" >installation</a>');
    } else {
        die('Problem with settings. Installation script also is not found. Please contact administrator.');
    }
}
if (is_readable($app_dir . '/install/index.php')) {
    die('Installation script is accessible - store is vulnerable - please rename install folder or protect it by setting appropriate permissions or just delete');
}
db_query('SET NAMES "utf8"');
if (!in_array($area, array('cron'))) {
    include_once $app_main_dir . '/init/sessions.php';
}
include_once $app_main_dir . '/include/blowfish.php';
$blowfish = new ctBlowfish();