示例#1
0
 function onWithdraw($info)
 {
     $this->withdraw_msg = "";
     ////////////////////////////////////
     //	checkPass
     ////////////////////////////////////
     $u = new user("");
     if ($u->checkPass($info['password']) == FALSE) {
         $this->withdraw_msg = "<font color='red'>Wrong paypal email or Password</font>";
     } else {
         ////////////////////////////////////
         //	check paypalemail
         ////////////////////////////////////
         $pmail = osBackUserPaypalEmail();
         if (strlen($pmail . "") < 4) {
             //1st time, add pmail
             if ($u->bookPaypalEmail($info['paypalemail'], $info['password']) == TRUE) {
                 $pmail = $info['paypalemal'];
             }
         }
         if ($info['paypalemail'] != $pmail) {
             $this->withdraw_msg = "<font color='red'>Wrong paypal email or Password</font>";
         } else {
             ////////////////////////////////////
             //	check amount
             ////////////////////////////////////
             $this->reCalc();
             if ($this->balance < $info['amount']) {
                 $this->withdraw_msg = "<font color='red'>Not enough credit in balance</font>";
             } else {
                 ////////////////////////////////////
                 // redeuce transaction
                 ////////////////////////////////////
                 $t = new transaction("");
                 $t->bookWithdraw(-$info['amount'], "Withdraw via paypal");
                 ////////////////////////////////////
                 // send email to us
                 ////////////////////////////////////
                 $this->sendPaymentEmail($info['amount']);
                 ////////////////////////////////////
                 //	Show Result
                 ////////////////////////////////////
                 $this->withdraw_msg = "<font color='green'>It will be in your paypal account in 48 hours</font>";
             }
             //Amount check
         }
         //paypalemail
     }
     //Password check
     $this->_bookframe("frmBalance");
 }