PHP整站程序如何修改conn.php 连接数据库
使用说明如下:执行http://域名-恢复数据库.修改/conn.php/inc/conn.php里的数据库连接后台地址为http://域名/admin账号密码都是adm...
使用说明如下:
执行http://域名-恢复数据库.
修改/conn.php /inc/conn.php里的数据库连接
后台地址为http://域名/admin账号密码都是admin
conn.php打开如下
<?
mysql_connect("localhost","lfggw","lfggw");
mysql_select_db("niuchao513");
mysql_query("set names 'gbk'");
date_default_timezone_set('PRC');
function Q($str){
return mysql_query($str);
}
function R($str){
return mysql_fetch_array(mysql_query($str));
}
function F($result){
return mysql_fetch_array($result);
}
function mstr($str, $start, $len) {
$tmpstr = "";
$strlen = $start + $len;
for($i = 0; $i < $strlen; $i++) {
if(ord(substr($str, $i, 1)) > 0xa0) {
$tmpstr .= substr($str, $i, 2);
$i++;
} else
$tmpstr .= substr($str, $i, 1);
}
return $tmpstr;
}
function showi($str,$url){
if($url=="-1"){
echo "<script>alert('$str');history.go(-1);</script>";
}
else{
echo "<script>alert('$str');location.href='$url';</script>";
}
exit;
}
function goi($url){
if($url=="-1"){
echo "<script>history.go(-1);</script>";
}
else{
echo "<script>location.href='$url';</script>";
}
exit;
}
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
{
$cip = $_SERVER["HTTP_CLIENT_IP"];
}
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
else if(!empty($_SERVER["REMOTE_ADDR"]))
{
$cip = $_SERVER["REMOTE_ADDR"];
}
else
{
$cip = '';
}
preg_match("/[\d\.]{7,15}/", $cip, $cips);
$cip = isset($cips[0]) ? $cips[0] : 'unknown';
unset($cips);
return $cip;
}
function GetTitle($id){
$r=R("select t from fafa where id='$id'");
return $r['t'];
}
$userid=getcookieid();
function getcookieid(){
$uid=@$_COOKIE['fafa_userid'];
if($uid==""){
$uid=0;
}
return $uid;
} 展开
执行http://域名-恢复数据库.
修改/conn.php /inc/conn.php里的数据库连接
后台地址为http://域名/admin账号密码都是admin
conn.php打开如下
<?
mysql_connect("localhost","lfggw","lfggw");
mysql_select_db("niuchao513");
mysql_query("set names 'gbk'");
date_default_timezone_set('PRC');
function Q($str){
return mysql_query($str);
}
function R($str){
return mysql_fetch_array(mysql_query($str));
}
function F($result){
return mysql_fetch_array($result);
}
function mstr($str, $start, $len) {
$tmpstr = "";
$strlen = $start + $len;
for($i = 0; $i < $strlen; $i++) {
if(ord(substr($str, $i, 1)) > 0xa0) {
$tmpstr .= substr($str, $i, 2);
$i++;
} else
$tmpstr .= substr($str, $i, 1);
}
return $tmpstr;
}
function showi($str,$url){
if($url=="-1"){
echo "<script>alert('$str');history.go(-1);</script>";
}
else{
echo "<script>alert('$str');location.href='$url';</script>";
}
exit;
}
function goi($url){
if($url=="-1"){
echo "<script>history.go(-1);</script>";
}
else{
echo "<script>location.href='$url';</script>";
}
exit;
}
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
{
$cip = $_SERVER["HTTP_CLIENT_IP"];
}
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
{
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
else if(!empty($_SERVER["REMOTE_ADDR"]))
{
$cip = $_SERVER["REMOTE_ADDR"];
}
else
{
$cip = '';
}
preg_match("/[\d\.]{7,15}/", $cip, $cips);
$cip = isset($cips[0]) ? $cips[0] : 'unknown';
unset($cips);
return $cip;
}
function GetTitle($id){
$r=R("select t from fafa where id='$id'");
return $r['t'];
}
$userid=getcookieid();
function getcookieid(){
$uid=@$_COOKIE['fafa_userid'];
if($uid==""){
$uid=0;
}
return $uid;
} 展开
展开全部
建议你使用mysqli,面向对象的,比起mysql来说方便多了,数据连接mysqli(‘h’,‘u’,‘p','d'),然后返回给一个对象就行了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
打开直接修改哟
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询