Exemple #1
0
<?php

// file: connectdb.php
// author: E. Setio Dewo, Maret 2003
$db_username = "******";
$db_hostname = "localhost";
$db_password = "******";
$db_name = "semarang-ukrida";
$con = _connect($db_hostname, $db_username, $db_password);
$db = _select_db($db_name, $con);
Exemple #2
0
define('GPC', get_magic_quotes_gpc());
//引入函数库
require ROOT_PATH . 'includes/global.func.php';
require ROOT_PATH . 'includes/mysql.func.php';
//执行耗时
define('START_TIME', _runtime());
//$GLOBALS['start_time'] = _runtime();
//echo  round((_runtime() - START_TIME),4);放在别的地方可以检测运行时间
//链接数据库
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PWD', '123456');
define('DB_NAME', 'testguest');
_connect();
//创建数据库连接
_select_db();
//选择一款数据库
_set_names();
//选择字符集
//网站系统设置初始化
if (!!($_rows = _fetch_array("SELECT\n\t    tg_webname,\n\t\ttg_article,\n\t\ttg_blog,\n\t\ttg_photo,\n\t\ttg_skin,\n\t\ttg_string,\n\t\ttg_post,\n\t\ttg_re,\n\t\ttg_code,\n\t\ttg_register\n\tFROM\n\t\ttg_system\n\tWHERE\n\t\ttg_id=1\n\tLIMIT\n\t\t1"))) {
    $_system = array();
    $_system['webname'] = $_rows['tg_webname'];
    $_system['article'] = $_rows['tg_article'];
    $_system['blog'] = $_rows['tg_blog'];
    $_system['photo'] = $_rows['tg_photo'];
    $_system['skin'] = $_rows['tg_skin'];
    $_system['post'] = $_rows['tg_post'];
    $_system['re'] = $_rows['tg_re'];
    $_system['code'] = $_rows['tg_code'];
    $_system['register'] = $_rows['tg_register'];
Exemple #3
0
<?php

// file: connectdb.php
// author: Eksansilus, Oktober 2012
//  $db_username = "******";
//  $db_hostname = "localhost";
//  $db_password = "******";
//  $db_name = "sisfoapp";
//  $con = _connect($db_hostname, $db_username, $db_password);
//  $db  = _select_db($db_name, $con);
$con = _connect('http://127.10.133.2:3306', 'admintVbGcz6', 'rrwK5lEZpKs-');
$db = _select_db('sisfoapp', $con);
/*                                                   
  $linksvr = mysql_connect($db_hostname, $db_username, $db_password)
    or die ("Tidak dapat berhubungan dengan database server");

  $linkdb = mysql_select_db($db_name, $linksvr)
    or die ("Tidak dapat membuka database <b>$db_name</b>.");
*/