Syntax error..

Proximity

IDK?
Feb 13, 2014
673
56
Hello I am trying to setup a paypal script but I am getting a syntax error:

[26-Nov-2015 00:27:16 Europe/Belgrade] PHP Parse error: syntax error, unexpected '$p' (T_VARIABLE) in C:\inetpub\wwwroot\ipn\paypal.php on line 75



THis is line 75
$p->submit_paypal_post();
 

Proximity

IDK?
Feb 13, 2014
673
56
Code:
<?php
function filter($var)
    {
        return stripslashes(htmlspecialchars($var));
    }
   
require_once('paypal.class.php');
$p = new paypal_class; 
$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';
           
$this_script = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

if (empty($_GET['action'])) $_GET['action'] = 'process';  

switch ($_GET['action']) {
   
   case 'process':
   
   if(!isset($_POST['username']) || !isset($_POST['amount']))
   {
    echo 'username and amount needed for purchase';
    die;  
   }
   
$name = filter($_POST['username']);

switch($_POST['amount'])
{
    case '1':
   
    $cost = '7.00'; //Cost of VIP
    $wut = 'Ultra VIP-%user_name%''; //Name of Package
    break;
    case '2':
   
    $cost = '25.00'; //Cost of VIP
    $wut = 'Platinum VIP-%user_name%'; //Name of Package
    break;
    case '3':
   
    $cost = '30.00'; //Cost of VIP
    $wut = 'Emerald VIP-%user_name%'; //Name of Package
    break;
    case '4':
   
    $cost = '40.00'; //Cost of VIP
    $wut = 'Diamond VIP-%user_name%'; //Name of Package
   
   
    break;
        case '5':
   
    $cost = '70.00'; //Cost of VIP
    $wut = 'Trial Mod-%user_name%'; //Name of Package
   
    break;
   
    default:
   
    $cost = '7.00'; //Cost of VIP again
   
   
    break;
}
     
      $p->add_field('business', '@yahoo.com'); //Your paypal email
      $p->add_field('return', 'http://'.$_SERVER['HTTP_HOST']);
     $p->add_field('custom', $name);
      $p->add_field('cancel_return', 'http://'.$_SERVER['HTTP_HOST']);
      $p->add_field('notify_url', $this_script.'?action=ipn');
     $p->add_field('item_number', filter($_POST['amount']));
      $p->add_field('item_name', $wut);
      $p->add_field('amount', $cost)

      $p->submit_paypal_post();
      break;
     
      //EDIT YOUR DATABSE SETTINGS BELOW (Same as your Phoenix Database Info)
   case 'ipn':
     
      if ($p->validate_ipn()) {
         
    $host = "localhost";
    $username = "root"; //IIS and XAMPP is root
    $password = "";
    $dbname = "";
        $connect = mysql_connect($host, $username, $password) or die(mysql_error());
mysql_select_db($dbname, $connect) or die("Could not connect to database, error: ".mysql_error());

switch($p->ipn_data['item_number'])
{
    case '2':
   
    $coins = '150000'; //Amount of coins they recieve
   
    $pixels = '150000'; //Amount of ducket they recieve
   
    $diamonds = '5'; //Amount of Diamonds they recieve
   
    $rank = '2'; 
   
    break;
   
        case '3':
   
    $coins = '150000'; //Amount of coins they recieve
   
    $pixels = '150000'; //Amount of pixels they recieve
   
    $diamonds = '15'; //Amount of Diamonds they recieve
   
    $rank = '3';
   
    break;
   
        case '4':
   
    $coins = '150000'; //Amount of coins they recieve
   
    $pixels = '150000'; //Amount of pixels they recieve
   
    $diamonds = '25'; //Amount of Diamonds they recieve
   
    $rank = '4'; 
   
    break;
   
        case '5':
   
    $coins = '150000'; //Amount of coins they recieve
   
    $pixels = '150000'; //Amount of pixels they recieve
   
    $diamonds = '40'; //Amount of Diamonds they recieve
   
    $rank = '5';
   
    break;
   
                case '6':
   
    $coins = '150000'; //Amount of coins they recieve
   
    $pixels = '150000'; //Amount of pixels they recieve
   
    $diamonds = '100'; //Amount of Diamonds they recieve
   
    $rank = '6'; 
   
    break;
       
}

mysql_query("UPDATE users SET vip = '1', rank = '{$rank}', credits = credits + {$coins}, activity_points = activity_points + {$pixels}, seasonal_currency = seasonal_currency + {$diamonds} WHERE username = '".$p->ipn_data['custom']."' LIMIT 1");
      }
      break;
 }    

?>
 

BIOS

ಠ‿ಠ
Apr 25, 2012
906
247
Didn't see that thanks Alex(@Quackster )
 
How can I have two fields in this
$p->add_field('item_number', filter($_POST['amount']));

Amount=item name

I want it item name-username

Edit the function add_field?
PHP:
function add_field($num, $val){

// do stuff with the $num and $val

}

$p->add_field(1, 'value');
 

Users who are viewing this thread

Top