Advertisement
Guest User

Untitled

a guest
Nov 7th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.27 KB | None | 0 0
  1. public function loanAction() {
  2. if ( $this->session->has('sid') ){
  3.  
  4. $co = $this->session->get('sid') ;
  5. $user = Customers::findFirst("cid = '$co'") ;
  6.  
  7. var_dump($user->getLoanBy()->toArray()) ;
  8. if( $user->getLoanBy()->toArray() != null ){
  9.  
  10. $i = $user->getLoanBy()->toArray() ;
  11. $k = $user->getLoan()->toArray() ;
  12. $count = 0;
  13. foreach( $i as $j ){
  14. $loanid[] = $j['loanid'] ;
  15. $asset_info[] = $j['asset_information'] ;
  16. $asset_type[] = $j['asset_type'] ;
  17.  
  18. $count++ ;
  19. }
  20. $countt = 0;
  21. foreach( $k as $j ){
  22. $loanamount[] = $j['loanamount'] ;
  23. $insterestrate[] = $j['insterestrate'] ;
  24. $pay_per_month[] = $j['pay_per_month'] ;
  25. $countt++ ;
  26. }
  27.  
  28. $this->view->loanid = $loanid ;
  29. $this->view->asset_info =$asset_info ;
  30. $this->view->asset_type =$asset_type ;
  31. $this->view->loanamount = $loanamount ;
  32. $this->view->insterestrate =$insterestrate ;
  33. $this->view->pay_per_month =$pay_per_month ;
  34. }else{
  35. $this->response->redirect("index") ;
  36. }
  37. }else{
  38. var_dump("Not user") ;
  39. exit() ;
  40. }
  41.  
  42. }
  43.  
  44. public function CreditAction() {
  45. if ( $this->session->has('sid') ){
  46. $co = $this->session->get('sid') ;
  47. $user = Account::find("cid = '$co'") ;
  48.  
  49. foreach( $user as $ln ){
  50. $i = $ln->getCredit()->toArray() ;
  51. }
  52.  
  53. $countt = 0;
  54. foreach( $i as $j ){
  55. $Creditcardnumber[] = $j['Creditcardnumber'] ;
  56. $expire_date[] = $j['expire_date'] ;
  57. $limit[] = $j['limit'] ;
  58. $countt++ ;
  59. }
  60.  
  61. $this->view->Creditcardnumber = $Creditcardnumber ;
  62. $this->view->expire_date = $expire_date ;
  63. $this->view->limit = $limit ;
  64.  
  65. }else{
  66. var_dump("Not user") ;
  67. exit() ;
  68. }
  69.  
  70. }
  71. public function addloanAction(){
  72. if ( $this->session->has('sid') ){
  73. $co = $this->session->get('sid') ;
  74. $user = Customers::find("cid = '$co'") ;
  75.  
  76. if ( $this->request->isPost() ){
  77. $amount = $this->request->getPost("amount") ;
  78. $asset = $this->request->getPost("asset") ;
  79. $assetprice = $this->request->getPost("price") ;
  80. $this->response->redirect('user/added') ;
  81.  
  82. $rand =rand(10000,99999);
  83. $strrand = (string)$rand;
  84. $strasset = (string)$asset;
  85. $intp = (int)$assetprice;
  86. $json = '{'."\n".'"type" : "'.$strasset.'"'."\n".',"price" : "'.$intp.'"'."\n".'}';
  87.  
  88. $servername = "localhost";
  89. $username = "root";
  90. $password = "";
  91. $dbname = "mydb";
  92. $conn = new mysqli($servername, $username, $password, $dbname);
  93.  
  94. $sql = "INSERT INTO loan_information VALUES ($strrand,$amount,0.01,100)";
  95. $conn->query($sql);
  96.  
  97. $sql = "INSERT INTO loan_by (cid,loanid,asset_information) VALUES ($co,$strrand,'$json')";
  98. $conn->query($sql);
  99. }
  100.  
  101. }else {
  102. var_dump("Don't User") ;
  103. exit() ;
  104. }
  105. }
  106. public function addedAction(){
  107. if ( $this->request->isPost() ){
  108. $this->response->redirect('user') ;
  109. }
  110. }
  111. public function payloanAction(){
  112. if ( $this->session->has('sid') != null ){
  113. $id = $this->session->get('sid') ;
  114. $cus = Customers::findFirst("cid = '$id'") ;
  115. if ( $cus->getLoan() != false ){
  116. $loan = $cus->getLoan()->toArray() ;
  117. // var_dump($officer->getDept()) ;
  118. // exit() ;
  119. foreach( $loan as $a_loan ){
  120. $manyloan[] = $a_loan['loanid'] ;
  121. }
  122.  
  123. $this->view->manyloan = $manyloan ;
  124. }
  125. if ( $this->request->isPost() ){
  126. $amount = $this->request->getPost("amount") ;
  127. $date = $this->request->getPost("date") ;
  128. $loan = $this->request->getPost("loan") ;
  129. $this->response->redirect('user/added') ;
  130. // var_dump($id);
  131. // var_dump($loan);
  132. // var_dump($date);
  133. // var_dump($amount);
  134. // exit();
  135. $rand =rand(10000000,99999999);
  136. $set = (int)$amount;
  137. $servername = "localhost";
  138. $username = "root";
  139. $password = "";
  140. $dbname = "mydb";
  141. $conn = new mysqli($servername, $username, $password, $dbname);
  142.  
  143. $sql = "INSERT INTO paying VALUES ($rand,'$id','$loan','$date',$set)";
  144. $conn->query($sql);
  145.  
  146. }
  147. }
  148. }
  149.  
  150. public function historyAction() {
  151. if ( $this->session->has('sid') != null ){
  152. $id = $this->session->get('sid') ;
  153. $user = Customers::findFirst("cid = '$id'") ;
  154. if ( $user->getLoan() != false ){
  155. $loans = $user->getLoan()->toArray() ;
  156. // var_dump($officer->getDept()) ;
  157. // exit() ;
  158. foreach( $loans as $a_loan ){
  159. $manyloan[] = $a_loan['loanid'] ;
  160. }
  161.  
  162. $this->view->manyloan = $manyloan ;
  163.  
  164. $ci = $_GET['id'] ;
  165. if ( $ci ){
  166. $loan = LoanInformation::findFirst("loanid = '$ci'") ;
  167. $this->view->loanamount = $loan->loanamount ;
  168. $this->view->insterestrate =$loan->insterestrate ;
  169. $this->view->pay_per_month =$loan->pay_per_month ;
  170. $this->view->loanidd = $loan->loanid ;
  171.  
  172. if ( $loan->getPaying() != false ){
  173. $paying = $loan->getPaying()->toArray() ;
  174. // $sum = $cus->getPaying()->getLoan()-toArray() ;
  175.  
  176. foreach ( $paying as $a ){
  177. $date[] = $a['date'] ;
  178. $payid[] = $a['payingid'] ;
  179. $cusid[] = $a['cid'] ;
  180. $loanid[] = $a['loanid'] ;
  181. $bal[] = $a['amount'] ;
  182. }
  183.  
  184. $this->view->date = $date ;
  185. $this->view->bal = $bal ;
  186. $this->view->payid = $payid ;
  187. $this->view->cusid = $cusid ;
  188. $this->view->loanid = $loanid ;
  189. }
  190. }
  191. }else {
  192. $this->response->redirect("index") ;
  193. }
  194. }else{
  195. $this->response->redirect("index") ;
  196. }
  197.  
  198. }
  199.  
  200. public function RequestAction(){
  201. if ( $this->session->has('sid') ){
  202. $co = $this->session->get('sid') ;
  203. $user = Customers::findFirst("cid = '$co'") ;
  204.  
  205. if ( $this->request->isPost() ){
  206. $request = $this->request->getPost("request") ;
  207. $crm = CrmOfficer::findFirst()->oid;
  208. $this->response->redirect('user/added') ;
  209.  
  210. $rand =rand(10000000,99999999);
  211. $strrand = (string)$rand;
  212. $strasset = (string)$asset;
  213. $intp = (int)$assetprice;
  214.  
  215. $servername = "localhost";
  216. $username = "root";
  217. $password = "";
  218. $dbname = "mydb";
  219. $conn = new mysqli($servername, $username, $password, $dbname);
  220.  
  221. $sql = "INSERT INTO carry_request VALUES ('$co','$crm','$strrand','$request')";
  222. $conn->query($sql);
  223. }
  224.  
  225. }else {
  226. var_dump("Don't User") ;
  227. exit() ;
  228. }
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement