Advertisement
tok124

Store

Apr 13th, 2015
234
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.         $testquery = "INSERT INTO test.azer_items_log (account, item, status)
  41.         VALUES ('" . $_SESSION['username'] . "', '$item','Success')";
  42.         if(mysqli_query($conn, $testquery)){
  43.         }else{
  44.         }
  45.         $command = "send items $char \"Donor Item\" \"Thank your for supporting our server !\" $item";
  46.         $result = $client->executeCommand(new SoapParam($command, 'command'));
  47.     } else {
  48.         $testquery = "INSERT INTO test.azer_items_log (account, item, status)
  49.         VALUES ('" . $_SESSION['username'] . "', '$item','Unsuccessful')";
  50.         if(mysqli_query($conn, $testquery)){
  51.         }else{
  52.         }
  53.     }
  54.     header('location: ../?p=home');
  55. } else {
  56.     echo "Sorry, You don't have enough points";
  57.     header('refresh:2; ../?p=home');
  58. }
  59. ?>
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement