Automatic VIP Script

Status
Not open for further replies.
O . M . G. you are such a genius. Try releasing something useful yourself rather than being skeptical of everyone elses releases. His release works perfectly fine.

No one is disrespecting this release.
You should use sandbox when testing any API modules, or in this case the IPN module, just to ensure it's working properly.

You wouldn't want to put a script live on your website only assuming that it works, would you? Sandbox allows you to fully test all aspects of this script, thus ensuring it works before putting it live on your website. You will find this useful for future scripts, or API modules, as most companies have a sandbox testing mode.
 
@ Sean111 - You can make a cronjob and a database table, the cronjob runs every... say month, and once it's the month, it'll clear the users VIP status causing when they login to loose there VIP?

@ Everyone, thanks for using this! I am testing it now :) So I'll let you know if it officially works with real paid money.

Unfortunantly, I don't think this is working as indented. I will fix this ASAP!
 
If any support is needed, or anything let me know.
Pop a PM or something.

The above code should work 100% with real-time payments. It's recommended that you test w/ sandbox first. Doing so will allow you to see if REAL payments will work.

Good luck =P
 
Post your edit, so we can have a look.
 
I had one of my staff test this.. It sends money but for some reason it don't give them VIP I fixed the last bug just redid the paypal button and it worked but now it don't give them the vip?
 
PHP:
<?php
function filter($var)
	{
		return stripslashes(htmlspecialchars($var));
	}
	
require_once('paypal.class.php');  // include the class file
$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['name']))
   {
	 echo 'You need to enter in a username before you can purcahse VIP!';
	 die;  
   }
   
		$swag = filter($_POST['name']);
      
      $p->add_field('business', '[email protected]');
      $p->add_field('return', 'http://'.$_SERVER['HTTP_HOST']); //The success URL
	  $p->add_field('custom', $swag);
      $p->add_field('cancel_return', 'http://'.$_SERVER['HTTP_HOST']); // The "canceled" URL
      $p->add_field('notify_url', $this_script.'?action=ipn'); //The IPN URL, the URL pointing to THIS page.
	  $p->add_field('item_number', 'Hotel VIP');
      $p->add_field('item_name', 'Hotel VIP');
      $p->add_field('amount', '£5.50');

      $p->submit_paypal_post();
      break;
      
      
   case 'ipn':
      
      if ($p->validate_ipn()) {
          
	$host = "localhost";
	$username = "root";
	$password = "Password";
	$dbname = "phoenix";
		 $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());

mysql_query("UPDATE users SET vip = 1 WHERE username = '".$p->ipn_data['custom']."' LIMIT 1");
mysql_query("UPDATE users SET rank = 2 WHERE username = '".$p->ipn_data['custom']."' LIMIT 1");
      }
      break;
 }     

?>
 
PHP:
$p->add_field('amount', '£5.50');
Enter only the amount, remove the E, or dollar sound, lol:
PHP:
$p->add_field('amount', '5.50');

If you want to only allow that specific currency use the appropriate Paypal variable
PHP:
mc_currency
 
No, you'll have to look at their IPN/API scripts and do one separately. This thread is merely for Paypal.
 
It's for whatever.
In order for it to work, you need to use your CMS's cookie/session variable in replace with what's in the above code.
 
Status
Not open for further replies.
Back