Advertisement
Guest User

Untitled

a guest
Nov 7th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. public function addloanAction(){
  2. if ( $this->session->has('sid') ){
  3. $co = $this->session->get('sid') ;
  4. $user = Customers::find("cid = '$co'") ;
  5.  
  6. if ( $this->request->isPost() ){
  7. $amount = $this->request->getPost("amount") ;
  8. $asset = $this->request->getPost("asset") ;
  9. $assetprice = $this->request->getPost("price") ;
  10. $this->response->redirect('user/added') ;
  11.  
  12. $rand =rand(10000,99999);
  13. $strrand = (string)$rand;
  14. $strasset = (string)$asset;
  15. $intp = (int)$assetprice;
  16. $json = '{'."\n".'"type" : "'.$strasset.'"'."\n".',"price" : "'.$intp.'"'."\n".'}';
  17.  
  18. $servername = "localhost";
  19. $username = "root";
  20. $password = "";
  21. $dbname = "mydb";
  22. $conn = new mysqli($servername, $username, $password, $dbname);
  23.  
  24. $sql = "INSERT INTO loan_information VALUES ($strrand,$amount,0.01,100)";
  25. $conn->query($sql);
  26.  
  27. $sql = "INSERT INTO loan_by (cid,loanid,asset_information) VALUES ($co,$strrand,'$json')";
  28. $conn->query($sql);
  29. }
  30.  
  31. }else {
  32. var_dump("Don't User") ;
  33. exit() ;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement