Automatic VIP Script

Status
Not open for further replies.
Gamma Spamma
Decennium
Joined
Dec 16, 2011
Messages
2,009
Reaction score
640
Hello there... Since I don't have a hotel anymore, I am going to be releasing my automatic VIP script... Yes, this is a 'real' automatic VIP, not a exploit filled, after payment redirection, this is the real deal!

This script only works once the user has PAYED for the VIP, and you can edit the MySQL updates to what you want.. I have it set to:

PHP:
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");

Well, what's the download?


How do I use this ****?
Are you an idiot? Just put the folder 'swag_pp' into the main directory of your hotel's CMS, and where ever you want to put the purchase button, add this code:
PHP:
<form action="swag_pp/paypal.php" method="post" name="paypal">
<label for="name"><b>Username:</b></label><br />
<input id="name" name="name" onclick="changeName()" type="text" value="<?php echo $_SESSION['username']; ?>" /><br />
<button name="submit" type="submit" name="buy" class="button" style="float:middle; onclick="return submitForm()">Buy VIP!</button></form>

Once you've done that, you're ready to go, and you don't have to worry about that fukin manual VIP again :p

This hasn't been tested yet, but I'll test it once I get my cash tomorrow so I can check it, but yeah, this is a release, and here are some images:
Liam - Automatic VIP Script - RaGEZONE Forums

Liam - Automatic VIP Script - RaGEZONE Forums

Liam - Automatic VIP Script - RaGEZONE Forums


Once you click on 'Buy' it gets your PayPal details and sends it to my email... Nah, I'm joking, it makes a secure connection, and then allows the person to login through PayPal and pay, once they have payed, it'll update the script, and it'll run the MySQL querys, and you're all done!

There are no errors, I've tested it, except for the actual payment, but yeah, it's cool and If you need help PM me, REP/Like this if you find it helpful, I will be updating it so it's more, you know, good looking when it comes to the buy now button, and if there are errors, post here and I'll update and fix it ASAP.

Thanks to PayPal for some of the script!

UPDATE:
I almost forgot, once you've uploaded it, go into:
/swag_pp/paypal.php, find:
And replace with your email!

Also, find:
PHP:
if ($p->validate_ipn()) {
And change your DB details! :lol:
 
If you want to grow your e-peen, then fucking create your own ****, don't take others code and take out the fucking credits:


and your index.php says "**** off cunts - created by swag: <a href="http://forum.ragezone.com/members/1333386434.html">http://forum.ragezone.com/members/1333386434.html</a>" Very mature, eh ?
 
^Considering it is an IPN script, and about 99% of people here can't make one themselves, you can't consider people ripping this type of script as being a 'noob', or the like.

Most people, once they have an IPN script cannot get it to work, so this is progress.
The following is a good script to use as well, I like it more, tbh. =P

I would suggest people use this script, made by JM2.me (here on RZ).
 
Last edited:
^Considering it is an IPN script, and about 99% of people here can't make one themselves, you can't consider people ripping this type of script as being a 'noob', or the like.

Most people, once they have an IPN script cannot get it to work, so this is progress.
The following is a good script to use as well, I like it more, tbh. =P

I would suggest people use this script, made by JM2.me (here on RZ).
 
I cant configure the PayPal bit. I get the following error:

The link you have used to enter the PayPal system contains an incorrectly formatted item amount.

Ive changed the email and the amount box. Can someone please help. Im fed up of MANUALLY adding peoples VIP lol.
 
Hello,
What is the Notification URL for Paypal - Instant Payment Notification (IPN)?
or do i need it?
 
Last edited:
Can you create one for PayGol to please?
Would be nice.
Because i cant find a good working IPN for that one,
And i dont get my own one working ;s

Greetz,
 
If you want to grow your e-peen, then fucking create your own ****, don't take others code and take out the fucking credits:


and your index.php says "**** off cunts - created by swag: <a href="http://forum.ragezone.com/members/1333386434.html">http://forum.ragezone.com/members/1333386434.html</a>" Very mature, eh ?

Unless you've got something constructive to say, then don't post at all. Because I don't see anyone in the Habbo section providing a working PayPal IPN to help out some retro owners and save them time of having to code it and search it up themselves.

And Yeah, I know, I didn't code all this? I found it on Google, and decided to edit it so that it would automatically give VIP and help out people.

@ Aaron, thanks for the comment!

@ Everyone, if you need help PM me ONLY or make a Help thread, don't ask for help here, unless it's a error everyone gets.
 
Hello,
What is the Notification URL for Paypal - Instant Payment Notification (IPN)?
or do i need it?

That hiddein input-field is crucial to this script. =P The URL to your IPN script, so in this case it's the path to the 'paypal.class.php' file.

I've put together a small script that should work perfectly fine for you.

[index.php]
PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
  <h2>Donate via Paypal!</h2>
<?PHP
$sess = $_SESSION['user_name']; //replace with your session username variable
//I understand PHP intertwined with HTML is bad practice, but for the sake of simplicity, and understanding, I'm putting it here.
if(isset($_POST['next'])){
$amount = $_POST['amount'];
$your_email = "xxx"; //your paypal address
$return_url = "http://";//url to success page
$cancel = "http://";//url to cancel page
$item = "Habbo Cash - $amount";
$ipn = "http://";//URL TO IPN PAGE
echo "
<h2>You are about to purchase ${$amount} worth of coins! Click 'Purchase Coins' to continue!</h2>
<form method='post' name='paypalConfirm' action='http://www.paypal.com/cgi-bin/webscr'>
<input type='hidden' name='rm' value='2'/>
<input type='hidden' name='cmd' value='_xclick'/>
<input type='hidden' name='business' value='{$business_email}'/>
<input type='hidden' name='return' value='{$return_url}'/>
<input type='hidden' name='cancel_return' value='{$cancel}'/>
<input type='hidden' name='notify_url' value='{$ipn}'/>
<input type='hidden' name='item_name' value='{$item}'/>
<input type='hidden' name='amount' value='{$amount}'/>
<input type='hidden' name='custom' value='{$sess}'/>
<p><input type='submit' value='Purchase Coins'></p>
</form>"; 

}else {

?>
<form method=post>
      <input type="radio" value="5.00" name="amount" />5.00 <br />
      <input type="radio" value="10.00" name="amount" />10.00 <br />
      
      <input type="submit" name="next" value="CONTINUE" />
</form>
<?PHP 
}
?>
  </body>
</html>
[ipn-script.php]
PHP:
    <?php
    function write2LogFile( $message, $file = "mylog.txt" ) { $file = fopen($file, "a"); fputs($file, "[".date('d-m-Y')."] ".$message."\n"); fclose($file); }
    $req = 'cmd=_notify-validate';
    foreach ($_POST as $key => $value)
    {
            $value = urlencode(stripslashes($value));
            $req .= "&$key=$value";
    }
    $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
    $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
    $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
    $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
    if (!$fp) {
            write2LogFile( "ERROR Can not connect to paypal!" );
    }
    else
    {
            fputs ($fp, $header . $req);
            while (!feof($fp))
            {
                    $res = fgets ($fp, 1024);
                    if (strcmp ($res, "VERIFIED") == 0)
                    {
                            $payment_currency = $_POST['mc_currency'];
                            $payment_gross = $_POST['payment_gross'];
                            $payment_status = $_POST['payment_status'];
                            $transaction_id = $_POST['txn_id'];
                            $payer_email    = $_POST['payer_email'] );
                            $custom_field   = $_POST['custom'];//let this be their username, via the form
     
                            if ( $payment_status == 'Completed' )
                            {                      
                                 //Checking Currency is USD
                                 if($payment_currency == 'USD'){//Success
                                  //Confirming Amount
                                  if($payment_gross == 5.00){//payment IS 5 dollars
                                    mysql_query("UPDATE `user` SET `cash` = '".mysql_real_escape_string($payment_gross)."' WHERE `ID`='".mysql_real_escape_string($custom_field)."'"); 
                                    //success. This will need to be updated to whatever fields or tables are in YOUR database. This is merely an example
                                  }elseif($payment_gross == 10.00){}//Should there be more than one payment option. The statement would either continue, or end! =P
                                 
                                 }
                            }
                            else if ( $payment_status == 'Canceled_Reversal' )
                            {
                                    // Player was stupid enough to make a dispute/claim or used a stolen credit card info
                                    // Basically we ban his account here.
                            }
                    }
            }
            fclose ($fp);
    }
    ?>
I would use something along the lines of that. One thing you need to make sure, that is imperative is that the paypal.class.php, or ipn-script.php file is completely inaccessible. Put it in it's own directory, and .htaccess deny all direct requests (via browser).

Simply make a .htaccess file and put deny from all inside, and there you go. =P

I cant configure the PayPal bit. I get the following error:

The link you have used to enter the PayPal system contains an incorrectly formatted item amount.

Ive changed the email and the amount box. Can someone please help. Im fed up of MANUALLY adding peoples VIP lol.

Try the above code. With his code I believe you have to use 7.00? I'm not sure. =P
 
^Considering it is an IPN script, and about 99% of people here can't make one themselves, you can't consider people ripping this type of script as being a 'noob', or the like.

Most people, once they have an IPN script cannot get it to work, so this is progress.
The following is a good script to use as well, I like it more, tbh. =P

I would suggest people use this script, made by JM2.me (here on RZ).
 
Even though I paid JM2.me for that script you just released I approve of it xD

PHP:
<?php
require "global.php";

function write2LogFile( $message, $file = "mylog.txt" ) { $file = fopen($file, "a"); fputs($file, "[".date('d-m-Y')."] ".$message."\n"); fclose($file); }
$req = 'cmd=_notify-validate';
$header = "";
foreach ($_POST as $key => $value)
{
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
}
$header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
$header .= "Content-Type: application/x-www-form-urlencoded\r\n";
$header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
$fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30);
if (!$fp) {
    write2LogFile( "ERROR Can not connect to paypal!" );
}
else
{
    fputs ($fp, $header . $req);
    while (!feof($fp))
    {
        $res = fgets ($fp, 1024);
        if (strcmp ($res, "VERIFIED") == 0)
        {
            $payment_status = $_POST['payment_status'];
            $transaction_id = $_POST['txn_id'];
            $payer_email     = $_POST['payer_email'];
            $custom_field     = intval($_POST['custom']);
            $amount_paid    = $_POST['payment_gross'];
            
            $query1 = mysql_query("SELECT * FROM users WHERE id = '".$custom_field."'");
            while($srow = mysql_fetch_assoc($query1))
            {
                $username_hotel = $srow['username'];
            }
            if ( $payment_status == 'Completed' ) // This checks if payment was made, duh xD
            {            
                if ( $amount_paid  == "20.00" )
                {
                    if(mysql_result(mysql_query("SELECT temp FROM users WHERE username = '" . $username_hotel . "'"), 0) == 1)
                    {
                        mysql_query("UPDATE users SET temp = '0' WHERE username = '" . $username_hotel . "'");
                    }
                    $newkey = md5(rand(1,9999) . rand(1,9999));
                    if(mysql_num_rows(dbquery("SELECT * FROM `vip_codes` WHERE `key` = '" . $newkey . "'")))
                    {
                        $newkey = md5(rand(1,500) . rand(1,600) . rand(1,500));
                    }
                    mysql_query("INSERT INTO `vip_payments` (`username`, `type`) VALUES ('".$username_hotel."', 'P')");
                    mysql_query("INSERT INTO `vip_codes` (`purchased_by`, `redeemed`, `redeemed_by`, `product`, `key`) VALUES ('" . $username_hotel . "', '0', 'nill', 'Platinum VIP', '" . $newkey . "')");
                }
                elseif ( $amount_paid  == "10.00" )
                {
                    if(mysql_result(mysql_query("SELECT temp FROM users WHERE username = '" . $username_hotel . "'"), 0) == 1)
                    {
                        mysql_query("UPDATE users SET temp = '0' WHERE username = '" . $username_hotel . "'");
                    }
                    
                    $newkey = md5(rand(1,9999) . rand(1,9999));
                    if(mysql_num_rows(dbquery("SELECT * FROM `vip_codes` WHERE `key` = '" . $newkey . "'")))
                    {
                        $newkey = md5(rand(1,500) . rand(1,600) . rand(1,500));
                    }
                    mysql_query("INSERT INTO `vip_payments` (`username`, `type`) VALUES ('".$username_hotel."', 'S')");
                    mysql_query("INSERT INTO `vip_codes` (`purchased_by`, `redeemed`, `redeemed_by`, `product`, `key`) VALUES ('" . $username_hotel . "', '0', 'nill', 'Super VIP', '" . $newkey . "')");
                
                }
                elseif ( $amount_paid == "3.00" )
                {
                    $newkey = md5(rand(1,9999) . rand(1,9999));
                    if(mysql_num_rows(dbquery("SELECT * FROM `vip_codes` WHERE `key` = '" . $newkey . "'")))
                    {
                        $newkey = md5(rand(1,500) . rand(1,600) . rand(1,500));
                    }
                    mysql_query("INSERT INTO `vip_payments` (`username`, `type`) VALUES ('".$username_hotel."', 'Throne')");
                    mysql_query("INSERT INTO `vip_codes` (`purchased_by`, `redeemed`, `redeemed_by`, `product`, `key`) VALUES ('" . USER_NAME . "', '0', 'nill', 'Super VIP', '" . $newkey . "')");    
                }
                else
                {
                    die("lolwat");
                }
            }
            else if ( $payment_status == 'Canceled_Reversal' )
            {
                // Player was stupid enough to make a dispute/claim or used a stolen credit card info
                // Basically we ban his account here.

            }
        }
    }
    fclose ($fp);
}
?>

That's my copy.

Exploited!!
 
Not sure, but just thinking outside the box here, if there is no automatic-expiry date, you could make something simple.

Add a row, or whatever, and add "DatePurchased", enter the date that it was purchased (via the IPN script, if payment was successful).

Then just do a simple script to see if the user's latest VIP purchase is still within that month's time frame. =P

Or run a cron/windows scheduled task to automatically update everyone's account to the 'normal status' if their VIP has expired, that way you don't have to run any scripts. Idk, whatever works.
 
Just want to say this, before any of you guys put anything like this onto your live website, make sure to test it fully with the PayPal Sandbox!! Doing this could save you problems in the future if someone manages to avoid paying somehow. Testing is good :D The PayPal Sandbox gives you access to unlimited funds in a PayPal account (not a real one) which can be used to test and develop IPN scripts :)
 
Just want to say this, before any of you guys put anything like this onto your live website, make sure to test it fully with the PayPal Sandbox!! Doing this could save you problems in the future if someone manages to avoid paying somehow. Testing is good :D The PayPal Sandbox gives you access to unlimited funds in a PayPal account (not a real one) which can be used to test and develop IPN scripts :)

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.
 
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.

I've made a few useful releases, and I suggest you re-read my post! I was posting advice for people using this, to make sure they do not cause damage to their hotels, as real money is involved, it is always wise to do some extra testing.
 
Last edited by a moderator:
Status
Not open for further replies.
Back