时间:2021-07-01 10:21:17 帮助过:2人阅读
$db_host = 'localhost';
$db_user = '*****';
$db_password = '*******';
$db_database = '******';
$conn = new mysqli($db_host, $db_user, $db_password, $db_database);
mysqli_query($conn, "set names 'utf8'");
if(mysqli_connect_errno()){die('数据库连接失败: ' . mysqli_connect_error());}
$site_data = $conn->query("SELECT * FROM `dh_member_control` WHERE `id`=1");
$site = mysqli_fetch_array($site_data);
?>
function marrbase(){
if(isset($_COOKIE["uname"]) && isset($_COOKIE["uid"])){
global $mbase;
global $conn;
$mql = "select * from dh_member where `id`=" . $_COOKIE["uid"] . " and `mck`=1";
$mbase_data = mysqli_query($conn, $mql);
$mbase = mysqli_fetch_array($mbase_data);}
else{exit();}
}
function login_log($muid){
if (empty($muid)){exit();}
else {
global $conn;
$lql = "INSERT INTO `dh_mllog` (`uid`,`ltime`,`lip`,`lptxt`) VALUES (". $muid .",'". date("Y-m-d H:i:s") ."','". getIPaddress() ."','". getIPS138(getIPaddress()) ."')" ;
if (!mysqli_query($conn, $lql)){die(mysqli_error());exit();}}
}
function memberislogin($back = NULL){
if(!isset($_COOKIE["uname"]) || !isset($_COOKIE["uid"])){echo ""; exit();}
else {
global $conn;
$login_check = mysqli_query ("SELECT * FROM `dh_member` WHERE `id`=". $_COOKIE["uid"] ." AND `mck`=1");
if(!mysqli_num_rows($login_check)){echo ""; exit();}}
}
.....等等自定义函数