Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include "connnnn.php";
- session_start();
- function login_xcard()
- {
- global $conn;
- $username = $_REQUEST['username'];
- $password = $_REQUEST['password'];
- // $query ="SELECT crm_customer.customerXcard,crm_customer.customerNo,crm_customer.customerId,
- // crm_customer.customerPoint,crm_customer.CustomerHP,crm_customer.CustomerHP2,crm_customer.CostomerEmail,
- // all_new_customer_xcard.customerXcard,all_new_customer_xcard.customerPoint
- // FROM crm_customer
- // INNER JOIN all_new_customer_xcard on crm_customer.customerXcard=all_new_customer_xcard.customerXcard
- // WHERE crm_customer.customerXcard='".$username."' and crm_customer.CustomerHP='".$password."' ";
- //
- $query ="SELECT crm_customer.customerXcard,crm_customer.customerNo,crm_customer.customerId,
- crm_customer.customerPoint,crm_customer.CustomerHP,crm_customer.CustomerHP2,crm_customer.CostomerEmail
- FROM crm_customer
- WHERE crm_customer.customerXcard='".$username."' and crm_customer.CustomerHP='".$password."' ";
- $user = sqlsrv_query($conn,$query);
- $count = 0;
- while($row = sqlsrv_fetch_array($user,SQLSRV_FETCH_ASSOC))
- {
- $count++;
- }
- if ($count > 0)
- {
- return "OK";
- }else
- {
- // echo "<script>alert('Username / Password Salah'); location.href='index';</script>";
- echo "<script>alert('Username / Password Salah');</script>";
- }
- }
- function lupa_password_xcard()
- {
- }
- function check_point_xcard($customerXcard)
- {
- global $conn;
- if(empty($customerXcard))
- {
- return "Error <br> Sorry Xcard Number Invalid";
- }else
- {
- // $query ="SELECT crm_customer.customerXcard,crm_customer.customerNo,crm_customer.customerId,
- // crm_customer.customerPoint,crm_customer.CustomerHP,crm_customer.CustomerHP2,crm_customer.CostomerEmail,
- // all_new_customer_xcard.customerXcard,all_new_customer_xcard.customerPoint
- // FROM crm_customer
- // INNER JOIN all_new_customer_xcard on crm_customer.customerXcard=all_new_customer_xcard.customerXcard
- // WHERE crm_customer.customerXcard='".$customerXcard."' ";
- $query ="SELECT *
- FROM crm_customer
- WHERE crm_customer.customerXcard='".$customerXcard."' ";
- // WHERE crm_customer.customerXcard= ? ";
- $getXcard = sqlsrv_query( $conn, $query);
- if ( $getXcard === false)
- {
- // die( FormatErrors( sqlsrv_errors() ) );
- return "Error";
- }
- while( $row = sqlsrv_fetch_array( $getXcard, SQLSRV_FETCH_ASSOC))
- {
- // PopulateProductsTable( $row );
- $pointXcard = $row['CustomerPoint'];
- $xcard = $row['CustomerXCard'];
- $name = $row['CustomerName'];
- $email = $row['CostomerEmail'];
- $hp = $row['CustomerHP'];
- }
- return $pointXcard."|@|".$xcard."|@|".$name."|@|".$email."|@|".$hp;
- }
- }
- function daftar_xcard($CustomerIdentityNo,$CustomerName,$CostomerEmail,$CustomerPlaceOfBirth,$CustomerDateOfBirth,$CustomerGender,$CustomerAddrCity,$CustomerAddrDetail,$CustomerCompany,$CustomerCompanyAddr,$CustomerCompanyCodePost,$CustomerCompanyTlp,$CustomerCompanyFax,$CustomerCompanyPosition)
- {
- $query ="INSERT into crm_customer (CustomerIdentityNo,
- CustomerName,
- CostomerEmail,
- CustomerPlaceOfBirth,
- CustomerDateOfBirth,
- CustomerGender,
- CustomerAddrCity,
- CustomerAddrDetail,
- CustomerCompany,
- CustomerCompanyAddr,
- CustomerCompanyCodePost,
- CustomerCompanyTlp,
- CustomerCompanyFax,
- CustomerCompanyPosition)
- VALUES ('".$CustomerIdentityNo."',
- '".$CustomerName."',
- '".$CostomerEmail."',
- '".$CustomerPlaceOfBirth."',
- '".$CustomerDateOfBirth."',
- '".$CustomerGender."',
- '".$CustomerAddrCity."',
- '".$CustomerAddrDetail."',
- '".$CustomerCompany."',
- '".$CustomerCompanyAddr."',
- '".$CustomerCompanyCodePost."',
- '".$CustomerCompanyTlp."',
- '".$CustomerCompanyFax."',
- '".$CustomerCompanyPosition."') ";
- if(sqlsrv_query($query))
- {
- return "OK";
- }else
- {
- return "error";
- }
- }
- // echo login_xcard($_REQUEST['username'],$_REQUEST['password']);
- echo check_point_xcard($_REQUEST['xcard']);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement