public function getKYCWallet() { $kyc = $this->request->query['kyc']; $opts = array('http' => array('method' => "GET", 'user_agent' => "MozillaXYZ/1.0")); $context = stream_context_create($opts); $json = file_get_contents('https://kycglobal.net/kyc/info/' . $kyc, false, $context); $details = json_decode($json); if ($details->percent > 60) { $user = Session::read('default'); $data = array('kyc_id' => $kyc); $conditions = array("walletid" => $user['walletid']); Details::update($data, $conditions); return $this->render(array('json' => array('success' => 1, 'email' => $details->email, 'name' => $details->details->Name->first . " " . $details->details->Name->last, 'phone' => $details->details->Mobile, 'score' => $details->score, 'percent' => $details->percent))); } else { return $this->render(array('json' => array('success' => 0))); } }
public function settings() { $user = Session::read('default'); if ($user == "") { return $this->redirect('wallet::login'); } $wallet = Users::find("first", array("conditions" => array("walletid" => $user['walletid']))); $details = Details::find("first", array("conditions" => array("walletid" => $user['walletid']))); $greencoinAddress = $wallet['greencoinAddress'][0]; $address = Addresses::find("first", array("conditions" => array("a_id" => $greencoinAddress))); //$txid = "315965f1702a9bc0f5dede3f8bb81e8497e004789965452988d136b16391b8a5"; $balance = $address['balance'] / 100000000; $sent = $address['sent'] / 100000000; $receive = $address['receive'] / 100000000; if ($this->request->data) { if (stristr($_SERVER['HTTP_REFERER'], COMPANY_URL) === FALSE) { return $this->redirect('/wallet/login'); exit; } $data = array('alert.email.signin' => (bool) $this->request->data['alert_email_signin'], 'alert.email.receive' => (bool) $this->request->data['alert_email_receive'], 'alert.email.send' => (bool) $this->request->data['alert_email_send'], 'alert.phone.signin' => (bool) $this->request->data['alert_phone_signin'], 'alert.phone.receive' => (bool) $this->request->data['alert_phone_receive'], 'alert.phone.send' => (bool) $this->request->data['alert_phone_send'], 'password.send.email' => (bool) $this->request->data['password_send_email'], 'password.send.phone' => (bool) $this->request->data['password_send_phone']); $conditions = array("walletid" => $user['walletid']); $save = Details::update($data, $conditions); } $details = Details::find("first", array("conditions" => array("walletid" => $user['walletid']))); $ga = new GoogleAuthenticator(); $secret = $details['secret']; $qrCodeUrl = $ga->getQRCodeGoogleUrl(COMPANY_URL, $secret); return compact('greencoinAddress', 'wallet', 'balance', 'sent', 'receive', 'user', 'details', 'qrCodeUrl'); }
public function EmailPasswordSecurity($value = false) { $user = Session::read('default'); $user_id = $user['_id']; if ($user == "") { return $this->redirect('/login'); } $data = array('EmailPasswordSecurity' => $value); $conditions = array('user_id' => $user_id); $details = Details::update($data, $conditions); return $this->render(array('json' => array("Updated" => $value))); }
public function updateaddress() { if (!$this->request->query['recordid']) { return $this->render(array('json' => array("Error" => "recordid not specified"))); } if (!$this->request->query['walletid']) { return $this->render(array('json' => array("Error" => "walletid not specified"))); } if (!$this->request->query['pk0']) { return $this->render(array('json' => array("Error" => "pk0 not specified"))); } if (!$this->request->query['pk1']) { return $this->render(array('json' => array("Error" => "pk1 not specified"))); } if (!$this->request->query['pk2']) { return $this->render(array('json' => array("Error" => "pk2 not specified"))); } $coin = new Greencoin('http://' . GREENCOIN_WALLET_SERVER . ':' . GREENCOIN_WALLET_PORT, GREENCOIN_WALLET_USERNAME, GREENCOIN_WALLET_PASSWORD); $security = (int) 2; $publickeys = array($this->request->query['pk0'], $this->request->query['pk1'], $this->request->query['pk2']); $createMultiSig = $coin->createmultisig($security, $publickeys); $data = array('msx' => $createMultiSig); $conditions = array('walletid' => $this->request->query['walletid']); Details::update($data, $conditions); //////////// Send Email ////////////////////////////////////////// $view = new View(array('loader' => 'File', 'renderer' => 'File', 'paths' => array('template' => '{:library}/views/{:controller}/{:template}.{:type}.php'))); $body = $view->render('template', compact('email', 'verification', 'name'), array('controller' => 'users', 'template' => 'confirm', 'type' => 'mail', 'layout' => false)); $transport = Swift_MailTransport::newInstance(); $mailer = Swift_Mailer::newInstance($transport); $message = Swift_Message::newInstance(); $message->setSubject("Verification of email from " . COMPANY_URL); $message->setFrom(array(NOREPLY => 'Verification email ' . COMPANY_URL)); $message->setTo($Users->email); $message->addBcc(MAIL_1); $message->addBcc(MAIL_2); $message->addBcc(MAIL_3); $message->setBody($body, 'text/html'); $mailer->send($message); ////////////////////////////////////////////////////////////////// return $this->render(array('json' => array("success" => 1))); }
public function CheckTOTP() { $user = Session::read('default'); if ($user == "") { return $this->redirect('wallet::login'); } $wallet = Users::find("first", array("conditions" => array("walletid" => $user['walletid']))); $details = Details::find('first', array('conditions' => array('walletid' => $user['walletid']))); $CheckCode = $this->request->query['CheckCode']; $ga = new GoogleAuthenticator(); $checkResult = $ga->verifyCode($details['secret'], $CheckCode, 2); if ($checkResult) { $data = array('withdraw.security.totp' => true); $conditions = array("walletid" => $user['walletid']); $save = Details::update($data, $conditions); return $this->render(array('json' => array('success' => 1))); } else { $data = array('withdraw.security.totp' => false); $conditions = array("walletid" => $user['walletid']); $save = Details::update($data, $conditions); return $this->render(array('json' => array('success' => 0))); } }