Advertisement
Guest User

fx

a guest
May 13th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. <?php
  2.  
  3. include "connnnn.php";
  4.  
  5. session_start();
  6.  
  7. function login_xcard()
  8. {
  9. global $conn;
  10.  
  11. $username = $_REQUEST['username'];
  12. $password = $_REQUEST['password'];
  13. // $query ="SELECT crm_customer.customerXcard,crm_customer.customerNo,crm_customer.customerId,
  14. // crm_customer.customerPoint,crm_customer.CustomerHP,crm_customer.CustomerHP2,crm_customer.CostomerEmail,
  15. // all_new_customer_xcard.customerXcard,all_new_customer_xcard.customerPoint
  16. // FROM crm_customer
  17. // INNER JOIN all_new_customer_xcard on crm_customer.customerXcard=all_new_customer_xcard.customerXcard
  18. // WHERE crm_customer.customerXcard='".$username."' and crm_customer.CustomerHP='".$password."' ";
  19.  
  20. //
  21. $query ="SELECT crm_customer.customerXcard,crm_customer.customerNo,crm_customer.customerId,
  22. crm_customer.customerPoint,crm_customer.CustomerHP,crm_customer.CustomerHP2,crm_customer.CostomerEmail
  23. FROM crm_customer
  24. WHERE crm_customer.customerXcard='".$username."' and crm_customer.CustomerHP='".$password."' ";
  25.  
  26. $user = sqlsrv_query($conn,$query);
  27. $count = 0;
  28. while($row = sqlsrv_fetch_array($user,SQLSRV_FETCH_ASSOC))
  29. {
  30. $count++;
  31. }
  32.  
  33. if ($count > 0)
  34. {
  35. return "OK";
  36. }else
  37. {
  38. // echo "<script>alert('Username / Password Salah'); location.href='index';</script>";
  39. echo "<script>alert('Username / Password Salah');</script>";
  40. }
  41.  
  42.  
  43. }
  44.  
  45. function lupa_password_xcard()
  46. {
  47.  
  48. }
  49.  
  50. function check_point_xcard($customerXcard)
  51. {
  52. global $conn;
  53.  
  54. if(empty($customerXcard))
  55. {
  56. return "Error <br> Sorry Xcard Number Invalid";
  57. }else
  58. {
  59. // $query ="SELECT crm_customer.customerXcard,crm_customer.customerNo,crm_customer.customerId,
  60. // crm_customer.customerPoint,crm_customer.CustomerHP,crm_customer.CustomerHP2,crm_customer.CostomerEmail,
  61. // all_new_customer_xcard.customerXcard,all_new_customer_xcard.customerPoint
  62. // FROM crm_customer
  63. // INNER JOIN all_new_customer_xcard on crm_customer.customerXcard=all_new_customer_xcard.customerXcard
  64. // WHERE crm_customer.customerXcard='".$customerXcard."' ";
  65.  
  66. $query ="SELECT *
  67. FROM crm_customer
  68. WHERE crm_customer.customerXcard='".$customerXcard."' ";
  69. // WHERE crm_customer.customerXcard= ? ";
  70.  
  71. $getXcard = sqlsrv_query( $conn, $query);
  72. if ( $getXcard === false)
  73. {
  74. // die( FormatErrors( sqlsrv_errors() ) );
  75. return "Error";
  76. }
  77.  
  78. while( $row = sqlsrv_fetch_array( $getXcard, SQLSRV_FETCH_ASSOC))
  79. {
  80. // PopulateProductsTable( $row );
  81. $pointXcard = $row['CustomerPoint'];
  82. $xcard = $row['CustomerXCard'];
  83. $name = $row['CustomerName'];
  84. $email = $row['CostomerEmail'];
  85. $hp = $row['CustomerHP'];
  86. }
  87.  
  88. return $pointXcard."|@|".$xcard."|@|".$name."|@|".$email."|@|".$hp;
  89. }
  90.  
  91. }
  92.  
  93. function daftar_xcard($CustomerIdentityNo,$CustomerName,$CostomerEmail,$CustomerPlaceOfBirth,$CustomerDateOfBirth,$CustomerGender,$CustomerAddrCity,$CustomerAddrDetail,$CustomerCompany,$CustomerCompanyAddr,$CustomerCompanyCodePost,$CustomerCompanyTlp,$CustomerCompanyFax,$CustomerCompanyPosition)
  94. {
  95.  
  96. $query ="INSERT into crm_customer (CustomerIdentityNo,
  97. CustomerName,
  98. CostomerEmail,
  99. CustomerPlaceOfBirth,
  100. CustomerDateOfBirth,
  101. CustomerGender,
  102. CustomerAddrCity,
  103. CustomerAddrDetail,
  104. CustomerCompany,
  105. CustomerCompanyAddr,
  106. CustomerCompanyCodePost,
  107. CustomerCompanyTlp,
  108. CustomerCompanyFax,
  109. CustomerCompanyPosition)
  110. VALUES ('".$CustomerIdentityNo."',
  111. '".$CustomerName."',
  112. '".$CostomerEmail."',
  113. '".$CustomerPlaceOfBirth."',
  114. '".$CustomerDateOfBirth."',
  115. '".$CustomerGender."',
  116. '".$CustomerAddrCity."',
  117. '".$CustomerAddrDetail."',
  118. '".$CustomerCompany."',
  119. '".$CustomerCompanyAddr."',
  120. '".$CustomerCompanyCodePost."',
  121. '".$CustomerCompanyTlp."',
  122. '".$CustomerCompanyFax."',
  123. '".$CustomerCompanyPosition."') ";
  124. if(sqlsrv_query($query))
  125. {
  126. return "OK";
  127. }else
  128. {
  129. return "error";
  130. }
  131.  
  132.  
  133. }
  134.  
  135.  
  136. // echo login_xcard($_REQUEST['username'],$_REQUEST['password']);
  137. echo check_point_xcard($_REQUEST['xcard']);
  138.  
  139.  
  140. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement