Is there a problem with this sign-in code?

Source: Internet
Author: User

  Check_login ();        $m _time= $this->getmillisecond ();                $con [' Si_time ']=array (' GT ', date (' y-m-d '));                $ranking =m (' sign ')->where ($con)->count ();                    if ($ranking) {$haha =intval ($ranking);                          Switch ($haha) {Case 1: $pm =5;//to 5 blocks $row = 2;                          $ch = "runner-up";                        Break                          Case 2: $pm =3;//to two $row = 2;                          $ch = "Third runner-up";                        Break                        Default: $pm = 0;                    }}else{$pm =10;//to 10 bonus coupon $row = 1;                $ch = "Champion";                    } if ($pm >0) {$this->insertgivecoupon ($this->memberid, $pm); $memo = "
You are today's sign-in {$ch}, successfully received {$PM} bonus coupon; } $dao =m (' sign ');//Instantiate the Sign object $current =date (' y-m-d h:i:s ', Time ()); $hasSign = $dao->where ("userid={$this->memberid}")->find (); $count = $hasSign [' Si_count ']; Find your Membership $member =m (' members '); $where [' id ']= $this->memberid; $memberName = $member->where ($where)->field (' name ')->find (); $this->membername= $memberName [' name ']; $this->uid= $this->memberid; If execution succeeds if ($hasSign) {$lastSignDay =strtotime ("{$hasSign [' Si_time ']}"); $lastSign =date (' y-m-d ', $lastSignDay); $today =date (' y-m-d ', Time ()); if ($lastSign = = $today) {//echo "is registered today, you have been signed in {$count} days, consecutive check-in 5 days a day + 5 Yuan voucher!"; $this->ajaxreturn ("," checked in today! ", 0); exit (); } $residueHour =24+24-date (' H ', $lastSignDay); Valid check-in time (the remaining hours of the registration Day + 1 days) $formatHour =strtotiMe (Date (' y-m-d H ', $lastSignDay). ': 0 0:00 ')//sign-on day 2014-12-07 18:00:00 $lastSignDate =strtotime ("+{$residueHour}hour", $formatHour);//On 2014-12-07 18:0 0:00 basis + Valid check-in time if (Times () > $lastSignDate) {//Current time > Last check-in time $count = 1; }else{$count = $count +1; } $sign = $dao->where ("userid={$this->memberid}")->save (Array (' si_time ' = $current, ' si_count ' + = $cou NT, ' m_second ' = $m _time)); Check-in table}else{$sign = $dao->add (' userId ' = $this->memberid, ' Si_count ' =>1, ' si_time ' = $cu Rrent, ' m_second ' = $m _time)); Registration Form $count = 1; if ($sign) {//First day sign-in +1 the second day sign in +2 the third day sign in +3 fourth day sign in +4 fifth day +5 consecutive 5 days a day +5 Switch ($count) {Case 1: $sc _score=1; Break Case 2: $SC _score=2; Break Case 3: $SC_score=3; Break Case 4: $SC _score=4; Break Default: $SC _score=5; } $dao->where ("userid={$this->memberid}")->setinc (' Coin ', $SC _score ); Registration Amount Cumulative $coin = $dao->where ("userid={$this->memberid}")->field (' coin ')->find (); if ($coin [' coin ']>=20) {$dao->where ("userid={$this->memberid}")->setdec (' coin ', 20);//If full 20 will be born into a 20 voucher $this->insertcoupon (' Member registration voucher ', $this->memberid); } $data =array (' userId ' = $this->memberid, ' Sc_score ' and $sc _score, ' Sc_detail ' = ' sign In + '. $sc _score, ' Sc_type ' =>1); M (' score ')->add ($data); Integration table if ($count >0) { $this->ajaxreturn ("," Sign in successfully!) You have signed in and successfully received {$SC _score} dollar Voucher! {$memo} ", 1); exit (); }else{$this->ajaxreturn ("," You are signed in! ", 1); exit (); }}else{$this->ajaxreturn ("," Sign in failed, please try again later!) ", 0); exit (); }}//Private method, generate voucher Private function Insertcoupon ($name, $amount, $mid) {$data [' Nam E ']=trim ($name); $data [' Amount ']= $amount; $data [' coupon '] = array (); $data [' Coupon ']=MD5 (uniqid (MD5 (Microtime (TRUE)), true)); $data [' Start_time ']=time (); $data [' Expire_time ']=strtotime ("+2 year"); $data [' Dateline ']=time (); $data [' Status ']=1; $data [' user_id ']= $mid; M (' coupon ')->add ($data); }//Private method, generate bonus voucher private Function Insertgivecoupon ($mid, $amount) {$map [' user_id ']= $mid; $map [' Status ']=1; $res =m (' Givecoupon ')->where ($map)->find (); if ($res) {M (' givecoupon ')->where ($map)->setinc (' Amount ', $amount); }else{$data [' Name ']= ' bonus coupon '; $data [' Amount ']= $amount; $data [' coupon '] = array (); $data [' Coupon ']=MD5 (uniqid (MD5 (Microtime (TRUE)), true)); $data [' Start_time ']=time (); $data [' Expire_time ']=strtotime ("next year"); $data [' Dateline ']=time (); $data [' Status ']=1; $data [' user_id ']= $mid; M (' Givecoupon ')->add ($data); } }

Reply content:


  Check_login ();        $m _time= $this->getmillisecond ();                $con [' Si_time ']=array (' GT ', date (' y-m-d '));                $ranking =m (' sign ')->where ($con)->count ();                    if ($ranking) {$haha =intval ($ranking);                          Switch ($haha) {Case 1: $pm =5;//to 5 blocks $row = 2;                          $ch = "runner-up";                        Break                          Case 2: $pm =3;//to two $row = 2;                          $ch = "Third runner-up";                        Break                        Default: $pm = 0;                    }}else{$pm =10;//to 10 bonus coupon $row = 1;                $ch = "Champion";                    } if ($pm >0) {$this->insertgivecoupon ($this->memberid, $pm); $memo = "
You are today's sign-in {$ch}, successfully received {$PM} bonus coupon; } $dao =m (' sign ');//Instantiate the Sign object $current =date (' y-m-d h:i:s ', Time ()); $hasSign = $dao->where ("userid={$this->memberid}")->find (); $count = $hasSign [' Si_count ']; Find your Membership $member =m (' members '); $where [' id ']= $this->memberid; $memberName = $member->where ($where)->field (' name ')->find (); $this->membername= $memberName [' name ']; $this->uid= $this->memberid; If execution succeeds if ($hasSign) {$lastSignDay =strtotime ("{$hasSign [' Si_time ']}"); $lastSign =date (' y-m-d ', $lastSignDay); $today =date (' y-m-d ', Time ()); if ($lastSign = = $today) {//echo "is registered today, you have been signed in {$count} days, consecutive check-in 5 days a day + 5 Yuan voucher!"; $this->ajaxreturn ("," checked in today! ", 0); exit (); } $residueHour =24+24-date (' H ', $lastSignDay); Valid check-in time (the remaining hours of the registration Day + 1 days) $formatHour =strtotiMe (Date (' y-m-d H ', $lastSignDay). ': 0 0:00 ')//sign-on day 2014-12-07 18:00:00 $lastSignDate =strtotime ("+{$residueHour}hour", $formatHour);//On 2014-12-07 18:0 0:00 basis + Valid check-in time if (Times () > $lastSignDate) {//Current time > Last check-in time $count = 1; }else{$count = $count +1; } $sign = $dao->where ("userid={$this->memberid}")->save (Array (' si_time ' = $current, ' si_count ' + = $cou NT, ' m_second ' = $m _time)); Check-in table}else{$sign = $dao->add (' userId ' = $this->memberid, ' Si_count ' =>1, ' si_time ' = $cu Rrent, ' m_second ' = $m _time)); Registration Form $count = 1; if ($sign) {//First day sign-in +1 the second day sign in +2 the third day sign in +3 fourth day sign in +4 fifth day +5 consecutive 5 days a day +5 Switch ($count) {Case 1: $sc _score=1; Break Case 2: $SC _score=2; Break Case 3: $SC_score=3; Break Case 4: $SC _score=4; Break Default: $SC _score=5; } $dao->where ("userid={$this->memberid}")->setinc (' Coin ', $SC _score ); Registration Amount Cumulative $coin = $dao->where ("userid={$this->memberid}")->field (' coin ')->find (); if ($coin [' coin ']>=20) {$dao->where ("userid={$this->memberid}")->setdec (' coin ', 20);//If full 20 will be born into a 20 voucher $this->insertcoupon (' Member registration voucher ', $this->memberid); } $data =array (' userId ' = $this->memberid, ' Sc_score ' and $sc _score, ' Sc_detail ' = ' sign In + '. $sc _score, ' Sc_type ' =>1); M (' score ')->add ($data); Integration table if ($count >0) { $this->ajaxreturn ("," Sign in successfully!) You have signed in and successfully received {$SC _score} dollar Voucher! {$memo} ", 1); exit (); }else{$this->ajaxreturn ("," You are signed in! ", 1); exit (); }}else{$this->ajaxreturn ("," Sign in failed, please try again later!) ", 0); exit (); }}//Private method, generate voucher Private function Insertcoupon ($name, $amount, $mid) {$data [' Nam E ']=trim ($name); $data [' Amount ']= $amount; $data [' coupon '] = array (); $data [' Coupon ']=MD5 (uniqid (MD5 (Microtime (TRUE)), true)); $data [' Start_time ']=time (); $data [' Expire_time ']=strtotime ("+2 year"); $data [' Dateline ']=time (); $data [' Status ']=1; $data [' user_id ']= $mid; M (' coupon ')->add ($data); }//Private method, generate bonus voucher private Function Insertgivecoupon ($mid, $amount) {$map [' user_id ']= $mid; $map [' Status ']=1; $res =m (' Givecoupon ')->where ($map)->find (); if ($res) {M (' givecoupon ')->where ($map)->setinc (' Amount ', $amount); }else{$data [' Name ']= ' bonus coupon '; $data [' Amount ']= $amount; $data [' coupon '] = array (); $data [' Coupon ']=MD5 (uniqid (MD5 (Microtime (TRUE)), true)); $data [' Start_time ']=time (); $data [' Expire_time ']=strtotime ("next year"); $data [' Dateline ']=time (); $data [' Status ']=1; $data [' user_id ']= $mid; M (' Givecoupon ')->add ($data); } }

Landlord code are not affixed to the whole!
And even if the whole, you 变量名称 estimate that everyone is too lazy to see!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.