Advertisement
tok124

Store

Apr 13th, 2015
214
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 = 'tok124';
  5. $soapPassword = '126126';
  6. $soapHost = '127.0.0.1';
  7. $soapPort = '7878';
  8. $char = $_POST['char'];
  9. $item = $_POST['item'];
  10.  
  11. $conn = new mysqli($host, $dbuser, $dbpass, $authdb);
  12.  
  13. $test = "SELECT points FROM test.azer_items WHERE item_entry = $item";
  14. $testresult = $conn->query($test);
  15.  
  16. if ($testresult->num_rows > 0) {
  17.     // output data of each row
  18.     while($row = $testresult->fetch_assoc()) {
  19.         $dp = $row['points'];
  20.     }
  21. } else {
  22. }
  23.  
  24.     $client = new SoapClient(NULL, array(
  25.         'location' => "http://$soapHost:$soapPort/",
  26.         'uri'      => 'urn:TC',
  27.         'style'    => SOAP_RPC,
  28.         'login'    => $soapUsername,
  29.         'password' => $soapPassword,
  30.     ));
  31.  
  32. $select = "SELECT dp FROM account WHERE username = '" . $_SESSION['username'] . "' AND dp >= $dp";
  33. $result = $conn->query($select);
  34.  
  35. if ($result->num_rows > 0) {
  36.  
  37.     $sql = "UPDATE account SET dp=dp-$dp WHERE username = '" . $_SESSION['username'] . "'";
  38.    
  39.     if ($conn->query($sql) === TRUE) {
  40.         $command = "send items $char \"Donor Item\" \"Thank your for supporting our server !\" $item";
  41.         $result = $client->executeCommand(new SoapParam($command, 'command'));
  42.     } else {
  43.     }
  44.    
  45. } else {
  46.     echo "Sorry, You don't have enough points";
  47. }
  48. ?>
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement