⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eg.inc.php

📁 网络硬盘_支持1GB文件上传和续传_无错版
💻 PHP
字号:
<?
/**
* in this class,we ignore the Trial checking
*/
class EG_Validater{
    //common payment
    var $Amount=0;
    var $details_text='';
    var $PLANID='';
    var $UID='';
    var $PaymentType='';
    var $PayeeAccount='';
    var $TestMode=0;
    /**
    * load gateway setting
    */
    function EG_Validater($db)
    {
    $db->setQuery("select * from gateway where Provider='EG'");
    $db->query();
    $gateway=$db->loadRow();
    $this->PayeeAccount=$gateway['PayeeAccount'];
    $this->MD5AccountPassword=$gateway['MD5AccountPassword'];
    $this->TestMode=$gateway[TestMode];
    }
    /**
    * load host plan infomation from groups
    */
    function LoadClient()
    {
    global $input,$user,$db;
    if(isset($input[uid])) $user->uid=$input[uid];
    $plan_id=$input[plan_id];
    $info=split('-',$plan_id);
    if(!$info[0])
    {
        $ipn->SetError('Data error:No Group ID found!');
        return false;
    }
    $group_id=$info[0];
    $plan_id=$info[1];

    $db->setQuery("select * from groups where id='$group_id'");
    $db->query();
    if($db->getNumRows()==0)
    {
        $ipn->SetError('Data error:Group ID '.$group_id.' can not be found!');
        return false;
    }
        
    $row=$db->loadRow();

    $periods=split(',',$row[subscr_period]);
    $fees=split(',',$row[subscr_fee]);

    $this->PaymentType='instant';
    $this->details_text=$row[name];
    $this->details_descr=$row[name];
    $this->Amount=$fees[$plan_id];
    $this->PLANID=$group_id.'-'.$plan_id;
    $this->UID=$user->uid;
    }
    /**
    * load vaild data to verify the IPN Data
    */
    function LoadServer($ipn)
    {
    global $db;
    $uid=$ipn->GetVar('UID');
    /**
    * 1:load this user
    */
    $db->setQuery("select * from users where id='$uid'");
    $db->query();
    $row=$db->loadRow();

    $plan_id=$ipn->GetVar('PLANID');
    $info=split('-',$plan_id);
    if(!$info[0])
    {
        $ipn->SetError('Data error!');
    }
    $group_id=$info[0];
    $plan_id=$info[1];

    /**
    * 2:load host plan infomation
    */
    $db->setQuery("select * from groups where id='$group_id'");
    $db->query();
    $row=$db->loadRow();

    $periods=split(',',$row[subscr_period]);
    $fees=split(',',$row[subscr_fee]);
    
    $this->PaymentType=$row[payment_type];
    $this->details_text=$row[name];
    $this->SubsUnit=$row[subscr_unit];
    $this->SubsPeriod=$periods[$plan_id];
    $this->SubsAmount=$this->Amount=$fees[$plan_id];
    }
    /**
    * btach function to retrieve vaild data
    */
    function GetPayeeAcount()
    {
    return $this->PayeeAccount;
    }
    function GetAmount()
    {
    return $this->Amount;
    }
    /**
    * Process the payment
    */
    function ProcessPayment($ipn)
    {
    global $db;
    $uid=$ipn->GetVar('UID');
    $dateinfo=array('D'=>24*60*60,'M'=>30*24*60*60,'Y'=>12*30*24*60*60);
    $fee_text="\$$this->Amount/$this->SubsPeriod $this->SubsUnit";

    /**
    * load the user
    */
    $db->setQuery("select * from users where id='$uid'");
    $db->query();
    if($db->getNumRows()==0)
    {
        $ipn->SetError('Data error:USER ID '.$uid.' can not be found!');
        return false;
    }
        
    $row=$db->loadRow();
    $plan_id=$ipn->GetVar('PLANID');
    $info=split('-',$plan_id);
    $group_id=$info[0];
    $txn_id=$ipn->GetTXNID();
    $expire_date=time()>$row[expire_date]?time()+$dateinfo[$this->SubsUnit]*$this->SubsPeriod:$row[expire_date]+$dateinfo[$this->SubsUnit]*$this->SubsPeriod;

    /**
    * update the expire date for users
    */
    $db->setQuery("update users set gid='$group_id', expire_date='$expire_date' where id='$uid'");
    $db->query();

    $descr= mysql_escape_string('Payment for '.$this->details_text.':'.$fee_text);
    $db->setQuery("update $ipn->IPNTable set uid='$uid',item_name='$this->text',descr='$descr' where txn_id='$txn_id'");
    $db->query();
    
    }
}
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -