<?php
header('Content-Type: text/html; charset=utf-8');
session_start();
date_default_timezone_set('Asia/shanghai');
error_reporting(0);
C(require('db.php'));
$dbcon = new mysqli(C('db_host'),C('db_user'),C('db_pass'),C('db_base'));
!$dbcon && die('数据库连接错误');
$dbcon->query('set names utf8;');
function C($name=null, $value=null) {
static $_config = array();
if (empty($name)) return $_config;
if (is_string($name)) {
if (!strpos($name, '.')) {
$name = strtolower($name);
if (is_null($value))
return isset($_config[$name]) ? $_config[$name] : null;
$_config[$name] = $value;
return;
}
$name = explode('.', $name);
$name[0] = strtolower($name[0]);
if (is_null($value))
return isset($_config[$name[0]][$name[1]]) ? $_config[$name[0]][$name[1]] : null;
$_config[$name[0]][$name[1]] = $value;
return;
}
if (is_array($name)){
return $_config = array_merge($_config, array_change_key_case($name));
}
return null;
}
function V($view=''){
require $view.'.php';
}
function S($name='',$value='') {
if ($value==='') {
if ($name==='') {
return $_SESSION;
} elseif(is_null($name)) {
session_destroy();
} else {
return isset($_SESSION[$name]) ? $_SESSION[$name] :false;
}
} elseif(is_null($value)) {
unset($_SESSION[$name]);
} else {
$_SESSION[$name]=$value;
}
}
function U($uri='') {
if (substr($uri,0,4)=='http') {
return $uri;
} else {
if ($uri=='-2') {
$h = $_SERVER['HTTP_HOST'];
$h = strtolower($h);
if (strpos($h,'/')!==false) {
$p = @parse_url($h);
$h = $p['host'];
}
$l = array('com','edu','gov','int','mil','net','org','biz','info','pro','name','museum','coop','aero','xxx','idv','mobi','cc','me');
$s = '';
foreach($l as $v){
$s.=($s ? '|' : '').$v;
}
$m = "[^\.]+\.(?:(".$s.")|\w{2}|((".$s.")\.\w{2}))$";
if (preg_match("/".$m."/ies",$h,$t)) {
$d = $t['0'];
} else{
$d = $h;
}
return $d;
}elseif ($uri=='-1') {
$url1 = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443' ? 'https://' : 'http://';
$url2 = $_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
$url3 = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '';
$url4 = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : $url2.(isset($_SERVER['QUERY_STRING']) ? '?'.$_SERVER['QUERY_STRING'] : $url3);
return $url1.(isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '').$url4;
}
return 2==1 ? base_url($uri) : site_url($uri);
}
}
function R($url, $d='', $method='GET', $headers=array()) {
if (substr($url,0,4)!='http') $url = U($url);
$ci = curl_init();
curl_setopt($ci, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ci, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ci, CURLOPT_TIMEOUT, 30);
if ($method=='POST') {
curl_setopt($ci, CURLOPT_POST, TRUE);
curl_setopt($ci, CURLOPT_POSTFIELDS, $d);
}
curl_setopt($ci, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ci, CURLOPT_URL, $url);
$response = curl_exec($ci);
curl_close($ci);
return $response;
}
function J($msg,$type=0) {
if (is_array($msg)) {
$j = $msg;
$msg = $j['msg'];
}else{
$j['msg'] = $msg;
}
switch($type) {
case '0': $j['state'] = 'error';break;
case '1': $j['state'] = 'success';break;
default: $j['state'] = $type;break;
}
//header('Content-type: application/json');
die(json_encode($j));
}
function I($name,$default='',$filter='str_htmlencode') {
if (strpos($name,'.')) {
list($method,$name) = explode('.',$name,2);
} else {
$method = 'param';
}
switch(strtolower($method)) {
case 'get' : $input =& $_GET;break;
case 'post' : $input =& $_POST;break;
case 'put' : parse_str(file_get_contents('php://input'), $input);break;
case 'param' :
switch($_SERVER['REQUEST_METHOD']) {
case 'POST':$input = $_POST;break;
case 'PUT' :parse_str(file_get_contents('php://input'), $input);break;
default :$input = $_GET;
}
break;
case 'request' : $input =& $_REQUEST;break;
case 'session' : $input =& $_SESSION;break;
case 'cookie' : $input =& $_COOKIE;break;
case 'server' : $input =& $_SERVER;break;
case 'globals' : $input =& $GLOBALS;break;
default:return NULL;
}
if (empty($name)) {
$data = $input;
$filters = $filter;
if ($filters) {
$filters = explode(',',$filters);
foreach($filters as $filter){
$data = $filter($data);
}
}
} elseif (isset($input[$name])) {
$data = $input[$name];
$filters = $filter;
if ($filters) {
$filters = explode(',',$filters);
foreach($filters as $filter){
if (function_exists($filter)) {
$data = $filter($data);
}
}
if (!$data) return isset($default)?$default:NULL;
}
} else {
$data = isset($default) ? $default:NULL;
}
return $data;
}
function base_url($uri = '') {
if (isset($_SERVER['HTTP_HOST'])) {
$base_url = isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off' ? 'https' : 'http';
$base_url .= '://'. $_SERVER['HTTP_HOST'];
$base_url .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
} else {
$base_url = 'http://localhost/';
}
if (is_array($uri)) $uri = implode('/', $uri);
$uri = trim($uri, '/');
return $base_url.ltrim($uri, '/');
}
function site_url($uri = '') {
return base_url().'index.php/'.$uri;
}
function sys_ip() {
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$pos = array_search('unknown',$arr);
if (false!==$pos) unset($arr[$pos]);
$ip=trim($arr[0]);
} elseif(isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip=$_SERVER['HTTP_CLIENT_IP'];
} elseif(isset($_SERVER['REMOTE_ADDR'])) {
$ip=$_SERVER['REMOTE_ADDR'];
}
// IP地址合法验证
$ip = (false !== ip2long($ip)) ? $ip : '0.0.0.0';
return $ip;
}
function set_token($str='token') {
$data = md5(time().uniqid());
setcookie($str,$data,time()+3600*24);
return $data;
}
function get_token($str='token') {
$post = I($str,'token');
$token = $_COOKIE[$str];
if ($token && $post == $token) {
setcookie($str,'',time()+3600*24);
return true;
}
return false;
}
function redirect($url) {
header("Location: $url");
exit;
}
function db_sql($sql,$type=2) {
global $dbcon;
$r = array();
$result = $dbcon->query($sql);
switch ($type) {
case 1:$r = mysqli_fetch_assoc($result); break;
case 2:while ($row=@mysqli_fetch_assoc($result)) {$r[] = $row;} break;
case 3:$r = mysqli_num_rows($result);break;
default:$r = $result;break;
}
return $r;
}
function escape($str){
if (is_string($str)){
$str = "'".$str."'";
}elseif (is_bool($str)){
$str = ($str === FALSE) ? 0 : 1;
}elseif (is_null($str)){
$str = 'NULL';
}
return $str;
}
function _has_operator($str){
$str = trim($str);
if(!preg_match("/(\s|<|>|!|=|is null|is not null)/i", $str))return FALSE;
return TRUE;
}
function _where($key, $value = NULL, $type = ' AND ', $escape = NULL){
if (!is_array($key))$key = array($key => $value);
foreach ($key as $k => $v){
if (!is_null($v)){
if ($escape===TRUE)$v = ' '.escape($v);
if (!_has_operator($k))$k
没有合适的资源?快使用搜索试试~ 我知道了~
幸运九宫格抽奖系统带后台PHP网页源码,可做计算机毕业设计
共686个文件
gif:333个
png:153个
js:82个
需积分: 0 7 下载量 57 浏览量
2023-03-23
15:48:34
上传
评论 1
收藏 9.35MB ZIP 举报
温馨提示
幸运九宫格抽奖系统带后台PHP网页源码,可做计算机毕业设计
资源推荐
资源详情
资源评论
收起资源包目录
幸运九宫格抽奖系统带后台PHP网页源码,可做计算机毕业设计 (686个子文件)
animate.min.css 51KB
metinfo.css 41KB
default.css 21KB
swiper.min.css 17KB
online.css 12KB
iframe.css 11KB
metinfo_box.css 11KB
common.css 10KB
common_mobile-1.0.0.css 8KB
asyncbox.css 8KB
newstyle.css 6KB
index-1.0.0.css 5KB
datepicker.css 4KB
datepicker.css 4KB
qq.css 3KB
simple.css 2KB
uploadify.css 2KB
prettify.css 973B
mobile.css 786B
public.css 567B
WdatePicker.css 158B
20201110150259.gif 255KB
4.gif 255KB
20201110150357.gif 41KB
7.gif 41KB
zydh.gif 38KB
static.gif 35KB
asyncbox_tipsbar_bg.gif 18KB
title-bg-orange.gif 17KB
35.gif 13KB
42.gif 13KB
40.gif 10KB
nopic.gif 9KB
18.gif 8KB
19.gif 8KB
11.gif 8KB
logoimg.gif 7KB
32.gif 7KB
49.gif 6KB
29.gif 6KB
97.gif 5KB
65.gif 5KB
msn_3.gif 5KB
31.gif 5KB
46.gif 5KB
57.gif 5KB
45.gif 5KB
8.gif 5KB
msn_13.gif 5KB
43.gif 4KB
33.gif 4KB
msn_6.gif 4KB
68.gif 4KB
msn_12.gif 4KB
26.gif 4KB
14.gif 4KB
7.gif 4KB
msn_4.gif 4KB
51.gif 4KB
10.gif 4KB
msn_5.gif 4KB
47.gif 4KB
72.gif 4KB
6.gif 3KB
asynctips_bg.gif 3KB
94.gif 3KB
84.gif 3KB
41.gif 3KB
17.gif 3KB
9.gif 3KB
msn_8.gif 3KB
28.gif 3KB
skype_6.gif 3KB
50.gif 3KB
skype_4.gif 3KB
msn_10.gif 3KB
95.gif 3KB
22.gif 3KB
msn_7.gif 3KB
qq_3.gif 3KB
27.gif 3KB
skype_8.gif 3KB
skype_5.gif 3KB
msn_11.gif 3KB
skype_24.gif 3KB
msn_9.gif 3KB
skype_7.gif 3KB
67.gif 3KB
90.gif 3KB
skype_2.gif 3KB
skype_9.gif 3KB
60.gif 3KB
loading.gif 3KB
58.gif 3KB
skype_10.gif 3KB
skype_3.gif 2KB
74.gif 2KB
25.gif 2KB
101.gif 2KB
54.gif 2KB
共 686 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
4748520
- 粉丝: 6
- 资源: 73
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功