首頁 > php教程 > php手册 > 《thinkphp 三级分销源代码实战贴》顶!第一季

《thinkphp 三级分销源代码实战贴》顶!第一季

WBOY
發布: 2016-06-07 11:34:50
原創
1259 人瀏覽過

求三级分销源代码实战贴,真实贴。
如何实现三级分销,有人说用递归。
————————————————————

1.控制器
2.model层
3.如何自由定制,和扩展

————————————————————<?php <br /> defined('YIMAOMONEY') or exit('Access denied');<br> ini_set('session.use_only_cookies', 1);<br> ini_set('date.timezone','Asia/Shanghai');<br> @set_magic_quotes_runtime(1);<br> <br> <br> define('YMURL', 'http://'.$_SERVER['HTTP_HOST'].'/');<br> define('YMADMINURL', YMURL.'yimaobacker/');<br> define('YMADMINDEX', YMADMINURL.'yimaomain.php');<br> define('YMINDEX', YMURL.'home.php');<br> define('YMJIAMI', 'yimao1011');<br> <br> $YMTIME=time();<br> $YCF=array();<br> <br> <br> $YCF['anrea']=array('A组','B组');<br> $YCF['prizename']=array('利息','领导奖','辅导奖','片区奖','实发总额','小金库','收益钱包','佣金钱包');<br> $YCF['prizeval']=array('051','052','054','055','050','061','062','063');<br> $YCF['regbd']=0;<br> $YCF['regan']=0;<br> $YCF['regbdl']=0;<br> $YCF['reganl']=0;<br> ?><?php <br /> defined('YIMAOMONEY') or exit('Access denied');<br> function geteqval($arr){<br>     if($arr[0]==$arr[1]){<br>         return $arr[2];<br>     }else{<br>         return $arr[3];<br>     }<br> }<br> <br> function getpeistatus($arr){<br>     if(!empty($arr[3])){<br>             return '<span>交易完成</span>';<br>     }elseif($arr[2]==0){<br>         return '<span>等待配对</span>';<br>     }elseif($arr[2]==1){<br>         return '<span>等待打款</span>';<br>     }elseif($arr[2]==2){<br>         return '<span>配对已过期</span>';<br>     }elseif($arr[2]==3){<br>         return '<span>已取消</span>';<br>     }<br> <br> }<br> <br> <br> function getpeistatus1($arr){<br>     if(!empty($arr[3])){<br>             return '<span>交易完成</span>';<br>     }elseif($arr[2]==0){<br>         return '<span>等待配对</span>';<br>     }elseif($arr[2]==1){<br>         return '<span>等待收款</span>';<br>     }elseif($arr[2]==2){<br>         return '<span>配对已过期</span>';<br>     }elseif($arr[2]==3){<br>         return '<span>已取消</span>';<br>     }<br> <br> }<br> <br> <br> function random_filename()<br> {<br>         $str = '';<br>         for($i = 0; $i          {<br>             $str .= mt_rand(0, 9);<br>         }<br> <br>         return time().$str;<br> }<br> <br> <br> function getcunstatus($arr){<br>     if($arr["pd011"]==1){<br>         return "配对过期";<br>     }elseif($arr["pd009"]==0&&empty($arr["pd008"])){<br>         return "匹配成功尽快打款确认";<br>     }elseif($arr["pd009"]==0&&!empty($arr["pd008"])){<br>         return "收款人未确认";<br>     }elseif($arr["pd009"]==1){<br>         return "已结束";<br>     }<br> <br> <br>     // if($arr["pd009"]==0){<br>     //     return '<span>配对成功</span>';<br>     // }elseif($arr["pd009"]==1){<br>     //     return '<span>配对完成</span>';<br>     // }<br> }<br> <br> function getcunstatus1($arr){<br>     if($arr["pd011"]==1){<br>         return "配对过期";<br>     }elseif($arr["pd009"]==0&&empty($arr["pd008"])){<br>         return "等待付款人付款";<br>     }elseif($arr["pd009"]==0&&!empty($arr["pd008"])){<br>         return "对方已付款尽快确认付款";<br>     }elseif($arr["pd009"]==1){<br>         return "已结束";<br>     }<br>     // if($arr["pd009"]==0){<br>     //     return '<span>配对成功</span>';<br>     // }elseif($arr["pd009"]==1){<br>     //     return '<span>配对完成</span>';<br>     // }<br> <br> }<br> <br> <br> function historygo(){<br>     echo "<script>history.go(-1)</script>";<br> }<br> <br> function locationurl($url){<br>     echo '<script>window.location.href="&#039;.$url.&#039;"</script>';<br>     exit;<br> }<br> <br> function geturls(){<br>     return substr($_SERVER['HTTP_REFERER'],0,strlen($_SERVER['HTTP_REFERER'])-strlen(strrchr($_SERVER['HTTP_REFERER'],"/")));<br> }<br> <br> <br> function getcharnums($s){<br>     $s=trim($s);<br>     if(empty($s)) return 0;<br> <br>     preg_match_all('/./us', $s, $match);<br> <br>     return count($match[0]);<br> }<br> <br> function getstrval($arr){<br>     if(empty($arr[0])||empty($arr[1])) return $arr[3];<br>     if(strstr($arr[0],$arr[1])){<br>         return $arr[2];<br>     }else{<br>         return $arr[3];<br>     }<br> }<br> <br> <br> function getPath($path,$xin){<br>     if(empty($path)) $path="";<br>     return str_replace(",,",",",str_replace(",,",",",",".$path.",").$xin.",");<br> }<br> <br> function getmenu($arr,$search,$t=0){<br>     $str='';<br>     foreach ($arr as $kr => $vr) {<br>         foreach ($vr as $k => $v) {<br>             if($v[0]==$search){<br>                 if($t==1){<br>                     $str=$kr;<br>                 }else{<br>                     $str=$k;<br>                 }        <br>                 break;<br>             }<br>         }<br>     }<br>     return $str;<br> }<br> <br> function getfnum($num){<br>     if($num==""||empty($num)){<br>         return 0;<br>     }<br>     if(!is_numeric($num)){<br>         return 0;<br>     }<br>     return (floor($num*100)/100);<br> }<br> <br> <br> function getatricletype($a){<br>     $arr=array('公告','通知','新闻','滚动','其他');<br>     if($a[0]==1){<br>         return $arr[$a[1]];<br>     }elseif($a[0]==2){<br>         $s.='<select>';<br>         foreach ($arr as $k => $v) {<br>             $s.='<option>'.$v.'</option>';<br>         }<br>         $s.='</select>';<br>         return $s;<br>     }elseif($a[0]==3){<br>         $s.='<select>';<br>         foreach ($arr as $k => $v) {<br>             $s.='<option>'.$v.'</option>';<br>         }<br>         $s.='</select>';<br>         return $s;<br>     }elseif($a[0]==4){<br>         return $arr;<br>     }<br> <br> }<br> <br> function a_bck($s){<br>     echo '<script>artbck("&#039;.$s.&#039;");</script>';<br>     exit;<br> }<br> <br> function msg_b($s){<br>     echo '<script>alert("&#039;.$s.&#039;");history.go(-1)</script>';<br>     exit;<br> }<br> <br> function msg_l($s,$u){<br>     echo '<script>alert("&#039;.$s.&#039;");window.location.href="&#039;.$u.&#039;"</script>';<br>     exit;<br> }<br> <br> function chkusername($s){<br>     return preg_match("/^[a-zA-Z0-9][a-zA-Z0-9_]{3,14}$/u",$s);<br> }<br> <br> function checkstr($strsql)<br> {     //检测字符串是否有注入风险<br>        <br>     $strsql=trim($strsql);<br>     $check=preg_match('/select|or|and|SELECT|INSERT|UPDATE|DELETE|insert|script|function|update|delete|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile/i',$strsql);<br>   <br>     if($check)<br>     {   <br>         echo "<script>alert(&#039;您输入的信息存在非法字符!\\n\\n".$strsql."&#039;);history.go(-1)</script>";<br>         exit;<br>     }        <br>     return  $strsql;                      <br>                <br> }<br> <br> function getemailtype($a){<br>     $arr=array('咨询','帮助','奖金','提现','充值','其他');<br>     if($a[0]==1){<br>         return $arr[$a[1]];<br>     }elseif($a[0]==2){<br>         $s='';<br>         foreach ($arr as $k => $v) {<br>             $s.='<label><input> '.$v.'</label> ';<br>         }<br>         return $s;<br>     }elseif($a[0]==3){<br>         $s='';<br>         foreach ($arr as $k => $v) {<br>             $s.='<label><input> '.$v.'</label> ';<br>         }<br>         return $s;<br>     }elseif($a[0]==4){<br>         return $arr;<br>     }<br> }<br> <br> function getinsertsql($arr,$t,$s=''){<br>     $key=array();<br>     $value=array();<br>     foreach ($arr as $k => $v) {<br>         $key[]=$k;<br>         $type=gettype($v);<br>         if((!empty($s)&&!($v==='')&&strpos("=".$s,$k))||($type=='integer'||$type=='double'||$type=='float')){<br>             $value[]=$v;<br>         }else{<br>             $value[]="'".$v."'";<br>         }<br>         <br>     }<br>     return "insert into $t(".implode(',',$key).") values(".implode(',',$value).")";<br> }<br> <br> function getupdatesql($arr,$t,$c,$s=''){<br>     $r=array();<br>     foreach ($arr as $k => $v) {<br>         $type=gettype($v);<br>         if((!empty($s)&&!($v==='')&&strpos("=".$s,$k))||($type=='integer'||$type=='double'||$type=='float')){<br>             $r[]="$k=$v";<br>         }else{<br>             $r[]="$k='$v'";<br>         }<br> <br>     }<br>     return "update $t set ".implode(',',$r)." where $c";<br> }<br> <br> function chkpwd($arr,$t=0) {<br> <br>     if($t){<br>         if(empty($arr[0])) return '请输入旧密码';<br>         if(empty($arr[1])) return '请输入新密码';<br>         if($arr[0]==$arr[1]) return '新密码和旧密码不能相同';<br>         if(strlen($arr[1])      }else{<br>         if(empty($arr[0])) return '请输入密码';<br>         if(strlen($arr[0])      }<br> <br>     return true;<br> }<br> <br> <br> function getqueurl($ming,$num){<br>     $url= $_SERVER["QUERY_STRING"];<br>     $pattern="/".$ming."=[0-9]*/i";<br>     if(preg_match($pattern,$url))<br>     {<br>         return preg_replace($pattern,$ming."=".$num,YMADMINDEX.'?'.$url);<br>     }else{<br>         if(empty($url))<br>             return YMADMINDEX."?$ming=$num";<br>         else<br>             return YMADMINDEX.'?'.$url."&$ming=$num";<br>     }    <br> }<br> <br> function geturl(){<br>     return 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']."?".$_SERVER["QUERY_STRING"];<br> }<br> <br> function getnums($v,$d=1){<br>     if(empty($v)) return $d;<br>     if(!is_numeric($v)) return $d;<br>     $v=floor(abs($v));<br>     if($v0){<br>         $v=$d;<br>     }elseif($v         $v=0;<br>     }<br> <br>     return $v;<br> }<br> <br> function formatrmb($v){<br>     if(strstr($v,'.')){<br> <br>         $s=explode('.',$v);<br>         if(empty($s[1])){<br>             return $s[0];<br>         }else{<br> <br>             if(strpos($s[1],'0')===false){<br>                 return $v;<br>             }else{<br>                 $x1=substr($s[1],0,1);<br>                 $x2=substr($s[1],1,1);<br>                 if(empty($x1)&&!empty($x2)){<br>                     return $s[0].'.0'.$x2;<br>                 }elseif(!empty($x1)&&empty($x2)){<br>                     return $s[0].'.'.$x1;<br>                 }elseif(empty($x1)&&empty($x2)){<br>                     return $s[0];<br>                 }<br>             }<br>         }<br>     }else{<br>         return $v;<br>     }<br> }<br> <br> <br> function getsex($s){<br>     $arr=array('男','女','未知');<br>     return $arr[$s];<br> }<br> <br> function getaccounttype($s=-1){<br>     $arr=array("现金钱包","收益钱包","佣金钱包",'激活币','小金库','冻结小金库','无');<br>     if($s>=0)<br>         return $arr[$s];<br>     else<br>         return $arr;<br> }<br> <br> <br> function gethuantype($s=-1){<br>     $arr=array("现金钱包转激活币","小金库转现金币");<br>     if($s>=0)<br>         return $arr[$s];<br>     else<br>         return $arr;<br> }<br> <br> <br> function getzhuantype($s=-1){<br>     $arr=array("激活币账户");<br>     if($s>=0)<br>         return $arr[$s];<br>     else<br>         return $arr;<br> }<br> <br> <br> function getsessiontime(){<br>     $cha=time()-$_SESSION["savetime"];<br>     $fen=floor($cha/60);<br> <br>     if($fen>30){<br>         session_unset();<br>         session_destroy();<br>         locationurl("index.php");<br>     }<br>     $_SESSION["savetime"]=time();<br> }<br> <br> function getshouyistatus($arr){<br> <br>     if($arr[0]==3){<br>         return "已取消";<br>     }elseif($arr[0]==2){<br>         return "已过期";    <br>     }elseif($arr[1]==0){<br>         return '<span>收益中</span>';<br> <br>     }elseif($arr[1]==1){<br>         return '<span>收益结束</span>';<br>     }elseif($arr[1]==2){<br>         return '<span>中断收益结束</span>';<br>     }<br> }<br> <br> <br> function getstatutype($v,$t){<br>     $arr=array(array('<span>待确认</span>','<span>已确认</span>'),<br>                array('<span>待确认</span>','<span>已确认</span>','<span>已撤销</span>'),<br>                array('<span>待激活</span>','<span>已激活</span>','<span>已激活</span>'),<br>                array('<span>否</span>','<span>是</span>'),<br>                array('<span>未阅</span>','<span>已阅</span>'),<br>                array('<span>否</span>','<span>待审核</span>','<span>是</span>'),<br>                array('<span>未正式</span>','<span>已正式</span>','<span>空单</span>'),<br>                array('<span>等待</span>','<span>完成</span>','<span>已过期</span>','<span>已取消</span>'),<br>                array('<span>收益中</span>','<span>收益结束</span>','<span>中断收益结束</span>'));<br>     switch ($t) {<br>         case 1:<br>             return $arr[0][$v];<br>         break;<br>         case 2:<br>             return $arr[1][$v];<br>         break;        <br>         case 3:<br>             return $arr[2][$v];<br>         break;    <br>         case 4:<br>             return $arr[3][$v];<br>         break;    <br>         case 5:<br>             return $arr[4][$v];<br>         break;    <br>         case 6:<br>             return $arr[5][$v];<br>         break;    <br>         case 7:<br>             return $arr[6][$v];<br>         break;    <br>         case 8:<br>             return $arr[7][$v];<br>         break;    <br>         case 9:<br>             return $arr[8][$v];<br>         break;                                                                <br>     }<br> }<br> <br> function formatdate($d,$t=0){<br>     $arr=array('Y-m-d H:i:s','Y-m-d','m-d H:i:s');<br>     if(empty($d)) return '';<br>     if(date($arr[1],$d)=='1970-01-01') return '';<br>     return date($arr[$t],$d);<br> }<br> <br> function dump($var, $echo=true, $label=null, $strict=true) {<br>     $label = ($label === null) ? '' : rtrim($label) . ' ';<br>     if (!$strict) {<br>         if (ini_get('html_errors')) {<br>             $output = print_r($var, true);<br>             $output = '<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre><div class="contentsignin">登入後複製</div></div><div class="contentsignin">登入後複製</div></div>';<br>         } else {<br>             $output = $label . print_r($var, true);<br>         }<br>     } else {<br>         ob_start();<br>         var_dump($var);<br>         $output = ob_get_clean();<br>         if (!extension_loaded('xdebug')) {<br>             $output = preg_replace('/\]\=\>\n(\s+)/m', '] => ', $output);<br>             $output = '<div class="code" style="position:relative; padding:0px; margin:0px;"><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:php;toolbar:false">' . $label . htmlspecialchars($output, ENT_QUOTES) . '</pre><div class="contentsignin">登入後複製</div></div><div class="contentsignin">登入後複製</div></div>';<br>         }<br>     }<br>     if ($echo) {<br>         echo($output);<br>         return null;<br>     }else<br>         return $output;<br> }<br> <br> <br> function menuval($s,$v,$l){<br> $menus1=array("prizelist","tiqulist","chonglist","zhuanlist","huanlist");<br> $menus2=array("register","tumap","anmap","mytj");<br> $menus3=array("openlist","bdshen");<br> $menus4=array("myinfo","modpwd","modmb","mybank","myuplevel");<br> $menus5=array("liuyan","sjx","fjx","yjx");<br> if($l==0){<br>     $l1="active";<br>     $l2="normal";<br> }else{<br>     $l1="";<br>     $l2="none";<br> }<br> <br> switch ($v) {<br>     case 1:<br> <br>         if(in_array($_GET["yim"], $menus1)) <br>             return $l1;<br>         else<br>             return $l2;<br>     <br>     break;<br>     case 2:<br>          if(empty($_GET["yim"])){<br>              return $l1;<br> <br>         }else{<br>    <br>         if(in_array($_GET["yim"], $menus2)) <br>             return $l1;<br>         else<br>             return $l2;<br>         }<br>     break;   <br>     case 3:<br>         if(in_array($_GET["yim"], $menus3)) <br>             return $l1;<br>         else<br>             return $l2;<br>     break;   <br>     case 4:<br>         if(in_array($_GET["yim"], $menus4)) <br>             return $l1;<br>         else<br>             return $l2;<br>     break;            <br>     case 5:<br>         if(in_array($_GET["yim"], $menus5)) <br>             return $l1;<br>         else<br>             return $l2;<br>     break;   <br> <br> }<br> <br> }<br> <br> <br> function getrealip()<br> {<br>     static $realip = NULL;<br> <br>     if ($realip !== NULL)<br>     {<br>         return $realip;<br>     }<br> <br>     if (isset($_SERVER))<br>     {<br>         if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))<br>         {<br>             $arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);<br> <br>             /* 取X-Forwarded-For中第一个非unknown的有效IP字符串 */<br>             foreach ($arr AS $ip)<br>             {<br>                 $ip = trim($ip);<br> <br>                 if ($ip != 'unknown')<br>                 {<br>                     $realip = $ip;<br> <br>                     break;<br>                 }<br>             }<br>         }<br>         elseif (isset($_SERVER['HTTP_CLIENT_IP']))<br>         {<br>             $realip = $_SERVER['HTTP_CLIENT_IP'];<br>         }<br>         else<br>         {<br>             if (isset($_SERVER['REMOTE_ADDR']))<br>             {<br>                 $realip = $_SERVER['REMOTE_ADDR'];<br>             }<br>             else<br>             {<br>                 $realip = '0.0.0.0';<br>             }<br>         }<br>     }<br>     else<br>     {<br>         if (getenv('HTTP_X_FORWARDED_FOR'))<br>         {<br>             $realip = getenv('HTTP_X_FORWARDED_FOR');<br>         }<br>         elseif (getenv('HTTP_CLIENT_IP'))<br>         {<br>             $realip = getenv('HTTP_CLIENT_IP');<br>         }<br>         else<br>         {<br>             $realip = getenv('REMOTE_ADDR');<br>         }<br>     }<br> <br>     preg_match("/[\d\.]{7,15}/", $realip, $onlineip);<br>     $realip = !empty($onlineip[0]) ? $onlineip[0] : '0.0.0.0';<br> <br>     return $realip;<br> }    <br> <br> ?>

附件 3mhzxt_v3.9.zip ( 5.48 MB 下载:58 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板