《thinkphp 三级分销源代码实战贴》顶!第一季
程序员文章站
2022-06-02 18:41:48
...
求三级分销源代码实战贴,真实贴。
如何实现三级分销,有人说用递归。
————————————————————
1.控制器
2.model层
3.如何*定制,和扩展
————————————————————
如何实现三级分销,有人说用递归。
————————————————————
1.控制器
2.model层
3.如何*定制,和扩展
————————————————————
defined('YIMAOMONEY') or exit('Access denied');
ini_set('session.use_only_cookies', 1);
ini_set('date.timezone','Asia/Shanghai');
@set_magic_quotes_runtime(1);
define('YMURL', 'http://'.$_SERVER['HTTP_HOST'].'/');
define('YMADMINURL', YMURL.'yimaobacker/');
define('YMADMINDEX', YMADMINURL.'yimaomain.php');
define('YMINDEX', YMURL.'home.php');
define('YMJIAMI', 'yimao1011');
$YMTIME=time();
$YCF=array();
$YCF['anrea']=array('A组','B组');
$YCF['prizename']=array('利息','领导奖','辅导奖','片区奖','实发总额','小金库','收益钱包','佣金钱包');
$YCF['prizeval']=array('051','052','054','055','050','061','062','063');
$YCF['regbd']=0;
$YCF['regan']=0;
$YCF['regbdl']=0;
$YCF['reganl']=0;
?>
defined('YIMAOMONEY') or exit('Access denied');
function geteqval($arr){
if($arr[0]==$arr[1]){
return $arr[2];
}else{
return $arr[3];
}
}
function getpeistatus($arr){
if(!empty($arr[3])){
return '交易完成';
}elseif($arr[2]==0){
return '等待配对';
}elseif($arr[2]==1){
return '等待打款';
}elseif($arr[2]==2){
return '配对已过期';
}elseif($arr[2]==3){
return '已取消';
}
}
function getpeistatus1($arr){
if(!empty($arr[3])){
return '交易完成';
}elseif($arr[2]==0){
return '等待配对';
}elseif($arr[2]==1){
return '等待收款';
}elseif($arr[2]==2){
return '配对已过期';
}elseif($arr[2]==3){
return '已取消';
}
}
function random_filename()
{
$str = '';
for($i = 0; $i
{
$str .= mt_rand(0, 9);
}
return time().$str;
}
function getcunstatus($arr){
if($arr["pd011"]==1){
return "配对过期";
}elseif($arr["pd009"]==0&&empty($arr["pd008"])){
return "匹配成功尽快打款确认";
}elseif($arr["pd009"]==0&&!empty($arr["pd008"])){
return "收款人未确认";
}elseif($arr["pd009"]==1){
return "已结束";
}
// if($arr["pd009"]==0){
// return '配对成功';
// }elseif($arr["pd009"]==1){
// return '配对完成';
// }
}
function getcunstatus1($arr){
if($arr["pd011"]==1){
return "配对过期";
}elseif($arr["pd009"]==0&&empty($arr["pd008"])){
return "等待付款人付款";
}elseif($arr["pd009"]==0&&!empty($arr["pd008"])){
return "对方已付款尽快确认付款";
}elseif($arr["pd009"]==1){
return "已结束";
}
// if($arr["pd009"]==0){
// return '配对成功';
// }elseif($arr["pd009"]==1){
// return '配对完成';
// }
}
function historygo(){
echo "";
}
function locationurl($url){
echo '';
exit;
}
function geturls(){
return substr($_SERVER['HTTP_REFERER'],0,strlen($_SERVER['HTTP_REFERER'])-strlen(strrchr($_SERVER['HTTP_REFERER'],"/")));
}
function getcharnums($s){
$s=trim($s);
if(empty($s)) return 0;
preg_match_all('/./us', $s, $match);
return count($match[0]);
}
function getstrval($arr){
if(empty($arr[0])||empty($arr[1])) return $arr[3];
if(strstr($arr[0],$arr[1])){
return $arr[2];
}else{
return $arr[3];
}
}
function getPath($path,$xin){
if(empty($path)) $path="";
return str_replace(",,",",",str_replace(",,",",",",".$path.",").$xin.",");
}
function getmenu($arr,$search,$t=0){
$str='';
foreach ($arr as $kr => $vr) {
foreach ($vr as $k => $v) {
if($v[0]==$search){
if($t==1){
$str=$kr;
}else{
$str=$k;
}
break;
}
}
}
return $str;
}
function getfnum($num){
if($num==""||empty($num)){
return 0;
}
if(!is_numeric($num)){
return 0;
}
return (floor($num*100)/100);
}
function getatricletype($a){
$arr=array('公告','通知','新闻','滚动','其他');
if($a[0]==1){
return $arr[$a[1]];
}elseif($a[0]==2){
$s.='';
return $s;
}elseif($a[0]==3){
$s.='';
return $s;
}elseif($a[0]==4){
return $arr;
}
}
function a_bck($s){
echo '';
exit;
}
function msg_b($s){
echo '';
exit;
}
function msg_l($s,$u){
echo '';
exit;
}
function chkusername($s){
return preg_match("/^[a-zA-Z0-9][a-zA-Z0-9_]{3,14}$/u",$s);
}
function checkstr($strsql)
{ //检测字符串是否有注入风险
$strsql=trim($strsql);
$check=preg_match('/select|or|and|SELECT|INSERT|UPDATE|DELETE|insert|script|function|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile/i',$strsql);
if($check)
{
echo "";
exit;
}
return $strsql;
}
function getemailtype($a){
$arr=array('咨询','帮助','奖金','提现','充值','其他');
if($a[0]==1){
return $arr[$a[1]];
}elseif($a[0]==2){
$s='';
foreach ($arr as $k => $v) {
$s.=' ';
}
return $s;
}elseif($a[0]==3){
$s='';
foreach ($arr as $k => $v) {
$s.=' ';
}
return $s;
}elseif($a[0]==4){
return $arr;
}
}
function getinsertsql($arr,$t,$s=''){
$key=array();
$value=array();
foreach ($arr as $k => $v) {
$key[]=$k;
$type=gettype($v);
if((!empty($s)&&!($v==='')&&strpos("=".$s,$k))||($type=='integer'||$type=='double'||$type=='float')){
$value[]=$v;
}else{
$value[]="'".$v."'";
}
}
return "insert into $t(".implode(',',$key).") values(".implode(',',$value).")";
}
function getupdatesql($arr,$t,$c,$s=''){
$r=array();
foreach ($arr as $k => $v) {
$type=gettype($v);
if((!empty($s)&&!($v==='')&&strpos("=".$s,$k))||($type=='integer'||$type=='double'||$type=='float')){
$r[]="$k=$v";
}else{
$r[]="$k='$v'";
}
}
return "update $t set ".implode(',',$r)." where $c";
}
function chkpwd($arr,$t=0) {
if($t){
if(empty($arr[0])) return '请输入旧密码';
if(empty($arr[1])) return '请输入新密码';
if($arr[0]==$arr[1]) return '新密码和旧密码不能相同';
if(strlen($arr[1])
}else{
if(empty($arr[0])) return '请输入密码';
if(strlen($arr[0])
}
return true;
}
function getqueurl($ming,$num){
$url= $_SERVER["QUERY_STRING"];
$pattern="/".$ming."=[0-9]*/i";
if(preg_match($pattern,$url))
{
return preg_replace($pattern,$ming."=".$num,YMADMINDEX.'?'.$url);
}else{
if(empty($url))
return YMADMINDEX."?$ming=$num";
else
return YMADMINDEX.'?'.$url."&$ming=$num";
}
}
function geturl(){
return 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?".$_SERVER["QUERY_STRING"];
}
function getnums($v,$d=1){
if(empty($v)) return $d;
if(!is_numeric($v)) return $d;
$v=floor(abs($v));
if($v0){
$v=$d;
}elseif($v
$v=0;
}
return $v;
}
function formatrmb($v){
if(strstr($v,'.')){
$s=explode('.',$v);
if(empty($s[1])){
return $s[0];
}else{
if(strpos($s[1],'0')===false){
return $v;
}else{
$x1=substr($s[1],0,1);
$x2=substr($s[1],1,1);
if(empty($x1)&&!empty($x2)){
return $s[0].'.0'.$x2;
}elseif(!empty($x1)&&empty($x2)){
return $s[0].'.'.$x1;
}elseif(empty($x1)&&empty($x2)){
return $s[0];
}
}
}
}else{
return $v;
}
}
function getsex($s){
$arr=array('男','女','未知');
return $arr[$s];
}
function getaccounttype($s=-1){
$arr=array("现金钱包","收益钱包","佣金钱包",'激活币','小金库','冻结小金库','无');
if($s>=0)
return $arr[$s];
else
return $arr;
}
function gethuantype($s=-1){
$arr=array("现金钱包转激活币","小金库转现金币");
if($s>=0)
return $arr[$s];
else
return $arr;
}
function getzhuantype($s=-1){
$arr=array("激活币账户");
if($s>=0)
return $arr[$s];
else
return $arr;
}
function getsessiontime(){
$cha=time()-$_SESSION["savetime"];
$fen=floor($cha/60);
if($fen>30){
session_unset();
session_destroy();
locationurl("index.php");
}
$_SESSION["savetime"]=time();
}
function getshouyistatus($arr){
if($arr[0]==3){
return "已取消";
}elseif($arr[0]==2){
return "已过期";
}elseif($arr[1]==0){
return '收益中';
}elseif($arr[1]==1){
return '收益结束';
}elseif($arr[1]==2){
return '中断收益结束';
}
}
function getstatutype($v,$t){
$arr=array(array('待确认','已确认'),
array('待确认','已确认','已撤销'),
array('待激活','已激活','已激活'),
array('否','是'),
array('未阅','已阅'),
array('否','待审核','是'),
array('未正式','已正式','空单'),
array('等待','完成','已过期','已取消'),
array('收益中','收益结束','中断收益结束'));
switch ($t) {
case 1:
return $arr[0][$v];
break;
case 2:
return $arr[1][$v];
break;
case 3:
return $arr[2][$v];
break;
case 4:
return $arr[3][$v];
break;
case 5:
return $arr[4][$v];
break;
case 6:
return $arr[5][$v];
break;
case 7:
return $arr[6][$v];
break;
case 8:
return $arr[7][$v];
break;
case 9:
return $arr[8][$v];
break;
}
}
function formatdate($d,$t=0){
$arr=array('Y-m-d H:i:s','Y-m-d','m-d H:i:s');
if(empty($d)) return '';
if(date($arr[1],$d)=='1970-01-01') return '';
return date($arr[$t],$d);
}
function dump($var, $echo=true, $label=null, $strict=true) {
$label = ($label === null) ? '' : rtrim($label) . ' ';
if (!$strict) {
if (ini_get('html_errors')) {
$output = print_r($var, true);
$output = '' . $label . htmlspecialchars($output, ENT_QUOTES) . '
';
} else {
$output = $label . print_r($var, true);
}
} else {
ob_start();
var_dump($var);
$output = ob_get_clean();
if (!extension_loaded('xdebug')) {
$output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output);
$output = '' . $label . htmlspecialchars($output, ENT_QUOTES) . '
';
}
}
if ($echo) {
echo($output);
return null;
}else
return $output;
}
function menuval($s,$v,$l){
$menus1=array("prizelist","tiqulist","chonglist","zhuanlist","huanlist");
$menus2=array("register","tumap","anmap","mytj");
$menus3=array("openlist","bdshen");
$menus4=array("myinfo","modpwd","modmb","mybank","myuplevel");
$menus5=array("liuyan","sjx","fjx","yjx");
if($l==0){
$l1="active";
$l2="normal";
}else{
$l1="";
$l2="none";
}
switch ($v) {
case 1:
if(in_array($_GET["yim"], $menus1))
return $l1;
else
return $l2;
break;
case 2:
if(empty($_GET["yim"])){
return $l1;
}else{
if(in_array($_GET["yim"], $menus2))
return $l1;
else
return $l2;
}
break;
case 3:
if(in_array($_GET["yim"], $menus3))
return $l1;
else
return $l2;
break;
case 4:
if(in_array($_GET["yim"], $menus4))
return $l1;
else
return $l2;
break;
case 5:
if(in_array($_GET["yim"], $menus5))
return $l1;
else
return $l2;
break;
}
}
function getrealip()
{
static $realip = NULL;
if ($realip !== NULL)
{
return $realip;
}
if (isset($_SERVER))
{
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
/* 取X-Forwarded-For中第一个非unknown的有效IP字符串 */
foreach ($arr AS $ip)
{
$ip = trim($ip);
if ($ip != 'unknown')
{
$realip = $ip;
break;
}
}
}
elseif (isset($_SERVER['HTTP_CLIENT_IP']))
{
$realip = $_SERVER['HTTP_CLIENT_IP'];
}
else
{
if (isset($_SERVER['REMOTE_ADDR']))
{
$realip = $_SERVER['REMOTE_ADDR'];
}
else
{
$realip = '0.0.0.0';
}
}
}
else
{
if (getenv('HTTP_X_FORWARDED_FOR'))
{
$realip = getenv('HTTP_X_FORWARDED_FOR');
}
elseif (getenv('HTTP_CLIENT_IP'))
{
$realip = getenv('HTTP_CLIENT_IP');
}
else
{
$realip = getenv('REMOTE_ADDR');
}
}
preg_match("/[\d\.]{7,15}/", $realip, $onlineip);
$realip = !empty($onlineip[0]) ? $onlineip[0] : '0.0.0.0';
return $realip;
}
?>
3mhzxt_v3.9.zip ( 5.48 MB 下载:58 次 )
AD:真正免费,域名+虚机+企业邮箱=0元
上一篇: PHP实现的迷你漂流瓶_PHP