/**
  * Creates a new Ip model.
  * 创建一个新的IP绑定,并且将绑定数据存入数据库
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Ip();
     if ($post = Yii::$app->request->post()) {
         $model->load(Yii::$app->request->post());
         $telnet = new telnet();
         $loginMsg = $telnet->signin();
         $telnet->bind($model->ip, $model->mac);
         $telnet->close();
         $model->save();
         if ($model->type == 3) {
             return $this->redirect(['charge', 'ip' => $model->ip]);
         } else {
             return $this->redirect(['index']);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
/*
 * PayPal System - IPN Coins
 * @author Dasoldier
 */
require "../class/paypal.php";
require "../config.php";
require "../connect.php";
include "l2j_telnet.php";
$p = new paypal_class();
$p->paypal_url = $payPalURL;
if ($p->validate_ipn()) {
    if ($p->ipn_data['payment_status'] == 'Completed') {
        // Telnet host, port, pass, timeout.
        $telnet = new telnet("" . $telnet_host . "", "" . $telnet_port . "", "" . $telnet_pass . "", 2);
        // Gets the donated amount.
        $amount = $p->ipn_data['mc_gross'];
        // Gets the donated amount minus paypals fee.
        $amountminfee = $p->ipn_data['mc_gross'] - $p->ipn_data['mc_fee'];
        // Get character name + donation option from paypal ipn data.
        $custom = $p->ipn_data['custom'];
        // Here we need to separate the data into separate values.
        $splitdata = explode('|', $custom);
        $charname = $splitdata[0];
        $donation_option = $splitdata[1];
        $donation_option_enc = $splitdata[2];
        $donation_option1 = 'Coins';
        $donation_option2 = 'Karma';
        $donation_option3 = 'Pkpoints';
        $donation_option4 = 'Enchitems';