Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
Programming Q&A
Syntax error..
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Proximity" data-source="post: 358393" data-attributes="member: 43026"><p>[code]</p><p><?php</p><p>function filter($var)</p><p> {</p><p> return stripslashes(htmlspecialchars($var));</p><p> }</p><p> </p><p>require_once('paypal.class.php');</p><p>$p = new paypal_class; </p><p>$p->paypal_url = 'https://www.paypal.com/cgi-bin/webscr';</p><p> </p><p>$this_script = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];</p><p></p><p>if (empty($_GET['action'])) $_GET['action'] = 'process'; </p><p></p><p>switch ($_GET['action']) {</p><p> </p><p> case 'process':</p><p> </p><p> if(!isset($_POST['username']) || !isset($_POST['amount']))</p><p> {</p><p> echo 'username and amount needed for purchase';</p><p> die; </p><p> }</p><p> </p><p>$name = filter($_POST['username']);</p><p></p><p>switch($_POST['amount'])</p><p>{</p><p> case '1':</p><p> </p><p> $cost = '7.00'; //Cost of VIP</p><p> $wut = 'Ultra VIP-%user_name%''; //Name of Package</p><p> break;</p><p> case '2':</p><p> </p><p> $cost = '25.00'; //Cost of VIP</p><p> $wut = 'Platinum VIP-%user_name%'; //Name of Package</p><p> break;</p><p> case '3':</p><p> </p><p> $cost = '30.00'; //Cost of VIP</p><p> $wut = 'Emerald VIP-%user_name%'; //Name of Package</p><p> break;</p><p> case '4':</p><p> </p><p> $cost = '40.00'; //Cost of VIP</p><p> $wut = 'Diamond VIP-%user_name%'; //Name of Package</p><p> </p><p> </p><p> break;</p><p> case '5':</p><p> </p><p> $cost = '70.00'; //Cost of VIP</p><p> $wut = 'Trial Mod-%user_name%'; //Name of Package</p><p> </p><p> break;</p><p> </p><p> default:</p><p> </p><p> $cost = '7.00'; //Cost of VIP again</p><p> </p><p> </p><p> break;</p><p>}</p><p> </p><p> $p->add_field('business', '@yahoo.com'); //Your paypal email</p><p> $p->add_field('return', 'http://'.$_SERVER['HTTP_HOST']);</p><p> $p->add_field('custom', $name);</p><p> $p->add_field('cancel_return', 'http://'.$_SERVER['HTTP_HOST']);</p><p> $p->add_field('notify_url', $this_script.'?action=ipn');</p><p> $p->add_field('item_number', filter($_POST['amount']));</p><p> $p->add_field('item_name', $wut);</p><p> $p->add_field('amount', $cost)</p><p></p><p> $p->submit_paypal_post();</p><p> break;</p><p> </p><p> //EDIT YOUR DATABSE SETTINGS BELOW (Same as your Phoenix Database Info)</p><p> case 'ipn':</p><p> </p><p> if ($p->validate_ipn()) {</p><p> </p><p> $host = "localhost";</p><p> $username = "root"; //IIS and XAMPP is root</p><p> $password = "";</p><p> $dbname = "";</p><p> $connect = mysql_connect($host, $username, $password) or die(mysql_error());</p><p>mysql_select_db($dbname, $connect) or die("Could not connect to database, error: ".mysql_error());</p><p></p><p>switch($p->ipn_data['item_number'])</p><p>{</p><p> case '2':</p><p> </p><p> $coins = '150000'; //Amount of coins they recieve</p><p> </p><p> $pixels = '150000'; //Amount of ducket they recieve</p><p> </p><p> $diamonds = '5'; //Amount of Diamonds they recieve</p><p> </p><p> $rank = '2'; </p><p> </p><p> break;</p><p> </p><p> case '3':</p><p> </p><p> $coins = '150000'; //Amount of coins they recieve</p><p> </p><p> $pixels = '150000'; //Amount of pixels they recieve</p><p> </p><p> $diamonds = '15'; //Amount of Diamonds they recieve</p><p> </p><p> $rank = '3';</p><p> </p><p> break;</p><p> </p><p> case '4':</p><p> </p><p> $coins = '150000'; //Amount of coins they recieve</p><p> </p><p> $pixels = '150000'; //Amount of pixels they recieve</p><p> </p><p> $diamonds = '25'; //Amount of Diamonds they recieve</p><p> </p><p> $rank = '4'; </p><p> </p><p> break;</p><p> </p><p> case '5':</p><p> </p><p> $coins = '150000'; //Amount of coins they recieve</p><p> </p><p> $pixels = '150000'; //Amount of pixels they recieve</p><p> </p><p> $diamonds = '40'; //Amount of Diamonds they recieve</p><p> </p><p> $rank = '5';</p><p> </p><p> break;</p><p> </p><p> case '6':</p><p> </p><p> $coins = '150000'; //Amount of coins they recieve</p><p> </p><p> $pixels = '150000'; //Amount of pixels they recieve</p><p> </p><p> $diamonds = '100'; //Amount of Diamonds they recieve</p><p> </p><p> $rank = '6'; </p><p> </p><p> break;</p><p> </p><p>}</p><p></p><p>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");</p><p> }</p><p> break;</p><p> } </p><p></p><p>?></p><p>[/code]</p></blockquote><p></p>
[QUOTE="Proximity, post: 358393, member: 43026"] [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; } ?> [/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
Programming Q&A
Syntax error..
Top