Guest User

bank transaction

a guest
Oct 23rd, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1.  
  2. <html>
  3. <head>
  4.  
  5. <title>Insert title here</title>
  6. </head>
  7. <body>
  8. <form action="Bank_log.php" method="post">
  9. you Number:<input type="text" name="acc"><br>
  10. Pin :<input type="number" name="pin">
  11. <input type="submit" name="check" value="check">
  12. </form>
  13. </body>
  14. </html>
  15.  
  16. login php
  17.  
  18.  
  19.  
  20. <?php
  21. $username="root";
  22. $password="";
  23. $database="bankdb";
  24.  
  25. $first=$_POST["acc"];
  26. $pa=$_POST["pin"];
  27.  
  28.  
  29. session_start();
  30. $_SESSION['myValue']=$first;
  31. $con = mysql_connect("localhost",$username,$password);
  32. mysql_select_db("bankdb",$con);
  33.  
  34. $query = "select * from bank1";
  35. $result=mysql_query($query);
  36.  
  37. $f=1;
  38. while($row = mysql_fetch_array($result))
  39. {
  40. if($row['acc'] == $first && $row['pin'] == $pa)
  41. {
  42. $f=0;
  43. header("location:Bank_Wit.html");
  44.  
  45. }
  46. }
  47. if($f==1)
  48. {
  49. echo "login incorrect";
  50. }
  51.  
  52. mysql_close();
  53. ?>
  54.  
  55. operation html
  56.  
  57. <!DOCTYPE html>
  58. <html>
  59. <head>
  60. <meta charset="ISO-8859-1">
  61. <title>Insert title here</title>
  62. </head>
  63. <body>
  64. <form action="Bank_updat.php" method="post">
  65. <select name="sel">
  66. <option>Withdraw</option>
  67. <option>Deposit</option>
  68.  
  69.  
  70. </select>
  71. Enter ur amount:<input type="text" name="amt">
  72. <input type="submit" name="sub" value="update">
  73.  
  74. </form>
  75. </body>
  76. </html>
  77.  
  78. update php
  79.  
  80.  
  81.  
  82.  
  83.  
  84. <?php
  85. $username="root";
  86. $password="";
  87. $database="bankdb";
  88.  
  89. $wit=$_POST["sel"];
  90. $amt=$_POST["amt"];
  91. $con = mysql_connect("localhost",$username,$password);
  92. mysql_select_db("bankdb",$con);
  93.  
  94. session_start();
  95. $a= $_SESSION['myValue'];
  96.  
  97. $query = "select * from bank1";
  98. $result=mysql_query($query);
  99. $am=0;
  100. $f=1;
  101. while($row = mysql_fetch_array($result))
  102. {
  103. if($row['acc']==$a)
  104. {
  105. if ($wit=="Withdraw" )
  106. {
  107.  
  108. $am=$row['amt']-$amt;
  109. echo"record updated";
  110. }
  111. if ($wit=="Deposit")
  112. {
  113. $am=$row['amt']+$amt;
  114. echo "record add";
  115. }
  116. }
  117. }
  118. $query="update bank1 set amt='$am' where acc='$a' ";
  119. $result=mysql_query($query);
  120.  
  121. mysql_close();
  122. ?>
Add Comment
Please, Sign In to add comment