Advertisement
tok124

SOAP Store

Apr 13th, 2015
316
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. session_start();
  3. @include('../config/db_conf.php');
  4. $soapUsername = 'MyUsername';
  5. $soapPassword = 'MyPassword';
  6. $soapHost = '127.0.0.1';
  7. $soapPort = '7878';
  8. $char = $_POST['char'];
  9. $item = $_POST['item'];
  10. $dp = $_POST['dp'];
  11.  
  12. $conn = new mysqli($host, $dbuser, $dbpass, $authdb);
  13.  
  14.     $client = new SoapClient(NULL, array(
  15.         'location' => "http://$soapHost:$soapPort/",
  16.         'uri'      => 'urn:TC',
  17.         'style'    => SOAP_RPC,
  18.         'login'    => $soapUsername,
  19.         'password' => $soapPassword,
  20.     ));
  21.  
  22. $select = "SELECT dp FROM account WHERE username = '" . $_SESSION['username'] . "' AND dp >= $dp";
  23. $result = $conn->query($select);
  24.  
  25. if ($result->num_rows > 0) {
  26.  
  27.     $sql = "UPDATE account SET dp=dp-$dp WHERE username = '" . $_SESSION['username'] . "'";
  28.    
  29.     if ($conn->query($sql) === TRUE) {
  30.         echo "Success";
  31.         echo $sql;
  32.         $command = "send items $char \"Donor Item\" \"Thank your for supporting our server !\" $item";
  33.         $result = $client->executeCommand(new SoapParam($command, 'command'));
  34.     } else {
  35.         echo "Error updating record: " . $conn->error . "<br>";
  36.     }
  37.    
  38. } else {
  39.     echo "Sorry, You don't have enough points";
  40. }
  41. ?>
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement