Ejemplo n.º 1
0
 function Buy($f3)
 {
     $server = $this->loadServer();
     $account = new \Webmin($server);
     if (($saldo = $this->me->saldo) < $server->price) {
         $this->flash('Saldo Anda Kurang, Hub Admin utk Deposit');
         $f3->reroute($f3->get('URI'));
     }
     if (!$account->check($f3->get('POST.user'))) {
         $this->flash('User Sudah Terdaftar, Coba yang Lain');
         $f3->reroute($f3->get('URI'));
     }
     $account->copyFrom('POST');
     $account->real = $this->me->username;
     if ($f3->exists('POST.pass', $pass)) {
         if (!\Check::Confirm('POST.pass')) {
             $this->flash('Konfirmasi Password Tidak Cocok');
             $f3->reroute($f3->get('URI'));
         }
         $account->pass = $account->crypt($pass);
     }
     $active = date("Y/m/d", strtotime("+30 days"));
     $account->expire = \Webmin::exp_encode($active);
     if (!$account->save()) {
         $this->flash('Gagal, Coba Beberapa Saat Lagi');
         $f3->reroute($f3->get('URI'));
     }
     $this->me->saldo = $this->me->saldo - $server->price;
     $this->me->save();
     $this->flash('Pembelian Account Berhasil', 'success');
     $f3->set('SESSION.uid', $account->uid);
     $f3->set('SESSION.pass', $pass);
     $f3->reroute($f3->get('URI') . '/success');
 }
Ejemplo n.º 2
0
 function Set($f3)
 {
     $seller = $this->loadSeller();
     if ($seller->dry()) {
         $seller->load(array('username=?', $f3->get('POST.username')));
         if (!$seller->dry()) {
             $this->flash('User sudah terdaftar');
             $f3->reroute('/home/admin/seller/add');
         }
     }
     $seller->copyFrom('POST');
     if ($f3->exists('POST.password', $pass)) {
         if (!\Check::Confirm('POST.password')) {
             $this->flash('Konfirmasi Password Tidak Cocok');
             $f3->reroute($f3->get('URI'));
         }
         $seller->password = $pass;
     }
     $seller->save();
     $this->flash('Berhasil Disimpan', 'success');
     $f3->reroute('/home/admin/seller/' . $seller->id);
 }
Ejemplo n.º 3
0
 function Apply($f3)
 {
     $server = $this->loadServer();
     $account = $this->loadUser($server);
     if ($account->dry()) {
         if (!$account->check($f3->get('POST.user'))) {
             $this->flash('User Sudah Terdaftar');
             $f3->reroute($f3->get('URI'));
         }
         $account->real = $this->me->username;
     }
     $account->copyFrom('POST');
     if ($f3->exists('POST.pass', $pass)) {
         if (!\Check::Confirm('POST.pass')) {
             $this->flash('Konfirmasi Password Tidak Cocok');
             $f3->reroute($f3->get('URI'));
         }
         $account->pass = $account->crypt($pass);
     }
     if ($f3->exists('POST.exp', $exp)) {
         $account->expire = \Webmin::exp_encode($exp);
     }
     $account->save();
     $this->flash('Berhasil Disimpan', 'success');
     $f3->reroute('/home/admin/server/' . $server->id . '/account/' . $account->uid);
 }