<?php
/***************************************************************************
* copyright : (C) 2006 The openology Group
* email : hide@address.com
*
* $Id
*
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
header('content-type:text/html;charset=UTF-8');
//ç½ç«æ ¹ç®å½çç»å¯¹è·¯å¾åç«ç¹ç½å
$base_dir="~basedir~";
$base_url = "~baseurl~";
//æ°æ®åºè¿æ¥ä¿¡æ¯
$dbname = "~dbname~";
$dbhost = "~dbhost~";
$dbusername = "~dbuser~";
$dbuserpwd = "~dbpwd~";
//å®è£
ç®å½
$bdir = "~phpdir~";
//æ°æ®å¤ä»½ç®å½
$bak_dir = $bdir."/php/bak";
//ç½é¡µé¦é¡µé¾æ¥ååç§°
$index_url="~indexurl~";
$index_name="é¦é¡µ";
//-----è¿æ¥MySqlæ°æ®åº----------------
function connectMySql()
{
global $dbname,$dbhost,$dbusername,$dbuserpwd;
$openconn = mysql_pconnect($dbhost,$dbusername,$dbuserpwd) or die("æ æ³è¿æ¥MySQLæ°æ®åº!");
mysql_select_db($dbname,$openconn);
mysql_query("SET NAMES 'utf8'");
return $openconn;
}
//-----䏿å符æªå--------
function cn_substr($str,$len)
{
return cn_midstr($str,0,$len);
}
function cn_midstr($str,$start,$len){
$i=0;
$dd=0;
while($i<$start)
{
$ch=substr($str,$i,1);
if(ord($ch)>127) $dd++;
else $dd=$dd+2;
$i++;
}
if($dd%2!=0) $start++;
$i=$start;
$endnum = $start+$len;
while($i<$endnum)
{
$ch=substr($str,$i,1);
if(ord($ch)>127) $i++;
$i++;
}
$restr=substr($str,$start,$i-$start);
return $restr;
}
//-------è¿æç¤ºä¿¡æ¯----------
function ShowMsg($msg,$gotoPage)
{
$msg = str_replace("'","`",trim($msg));
$gotoPage = str_replace("'","`",trim($gotoPage));
echo "<script language='javascript'>\n";
echo "alert('$msg');";
if($gotoPage=="back")
{
echo "history.go(-1);\r\n";
}
else if(ereg("^-",$gotoPage))
{
echo "history.go($gotoPage);\r\n";
}
else if($gotoPage!="")
{
echo "location.href='$gotoPage';\r\n";
}
echo "</script>";
}
//æGETåéå解为å¤é¨åé
if (!empty($_GET))
{
foreach($_GET AS $key => $value)
{
$$key = $value;
}
}
//æPOSTåéå解为å¤é¨åé
if (!empty($_POST))
{
foreach($_POST AS $key => $value)
{
$$key = $value;
}
}
//æcookieåéå解为å¤é¨åé
if (!empty($_COOKIE))
{
foreach($_COOKIE AS $key => $value)
{
$$key = $value;
}
}
//è°ç¨è¯è¨å
if (!session_is_registered('session_lang'))
{
session_register('session_lang');
$_SESSION['session_lang'] = 'zh-cn';
}
if (isset($_GET['lang']))
{
$_SESSION["session_lang"] = $_GET['lang'];
}
$file_lang = dirname(__FILE__).'/language/'.$_SESSION["session_lang"].'.php';
include "$file_lang";
?>