[UberCMS] PayPal IPN - Should Work

Results 1 to 3 of 3
  1. #1
    Ask me about Daoism FullmetalPride is offline
    MemberRank
    Nov 2010 Join Date
    2,172Posts

    note [UberCMS] PayPal IPN - Should Work

    This is an UN-Tested release. Why is it untested? Because Sandbox is refusing to be kind to me. And I'm broke. And

    All you gotta do is download the files, and place this code wherever you want people to be linked, where 'XXX' is your button ID (Gotta create a button in PayPal).


    Code:
    <form name="pp_frm" action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_s-xclick">
    <input type="hidden" name="hosted_button_id" value="XXX">
    <input type="hidden" name="on0" value="Username">
    <input type="hidden" name="os0" maxlength="200" value="%habboName%">
    <input type="hidden" name="custom" maxlength="200" value="%habboName%">
    <div style="height: 50px;">
    <img style="position: relative; left: 10px; top: 10px;" alt="credits" src="%www%/web-gallery/v2/images/newcredits/credit_in_white_bg.png"/>
    <span style="position: relative; left: -42px; top: -3px; font-size:1.5em; font-weight:bold; color: #000000;" class="habboclub-offerprice">5.00</span>
    <a href="#" class="new-button oversize" style="position: relative; left: -10px; top: 10px; margin-left: 0px" id="subscribe3" onClick="document.pp_frm.submit();"><b>Buy</b><i></i></a>
    </form>
    ipn-listen.php :
    PHP Code:
    <?php

        
    require_once "global.php";
        
        
    $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$errstr30);
        
        if(
    $fp) {
            
    fputs ($fp$header $req);
            while (!
    feof($fp)) {
                
    $res fgets ($fp1024);
                if (
    strcmp ($res"VERIFIED") == 0) {
                    
                    
    // *************************
                    
    $payment_status $_POST['payment_status'];
                    
    $transaction_id $_POST['txn_id'];
                    
    $payer_email     $_POST['payer_email'];
                    
    $amount_paid    $_POST['mc_gross'];
                    
                    
    // ************************
                    
    $getUser explode($_POST["custom"]);
                    
    $un $getUser[0];
                                    
                    
    // Payment statuses
                    //        - Completed
                    //        - Canceled_Reversal
                    
    if ($payment_status == 'Completed') {
                         {
                            
    $db->real_query("UPDATE users SET vip = '1' WHERE username = '" $un "");
                            
    define('doQuery'"UPDATE users SET rank = '2', credits = credits + '500', activity_points = activity_points + '20' WHERE id = '" $un "'");
                        }
                                    
                                
                        if(
    defined("doQuery")) {
                            
    $db->real_query(doQuery);
                        }
                        else {
                            exit;
                        }
                    }
                    else if (
    $payment_status == "Canceled_Reversal") {
                        
    $db->real_query("UPDATE users SET vip_points = 1 WHERE username = " $un "");
                    }
                }
            }
            
    fclose ($fp);
        }
        else {
            exit;
        }
    ?>
    I think that's all I need. If it's not, let me know..


    1/4 J2.ME (Making the base - RaGEZONE)
    1/2 Jonteh (Making the IPN for LightCMS)
    1/4 Me (Editing the IPN to be initially fully-working)

    =============================
    Conditions of this IPN:

    A. If you download it, and there are errors, and you fix them, it would be greatly respected of you if you released the fix.
    B. Don't whine about there being errors or this not working. As said before it should be fine if you're smart enough and capable of fixing it. I'm not sure if it will/won't fully work out-of-the-box.

    Thanks ;)


  2. #2
    Member Armo is offline
    MemberRank
    Sep 2012 Join Date
    66Posts

    Re: [UberCMS] PayPal IPN - Should Work

    ''Should work'', if you code something, try it first before you release it.

  3. #3
    Ask me about Daoism FullmetalPride is offline
    MemberRank
    Nov 2010 Join Date
    2,172Posts

    Re: [UberCMS] PayPal IPN - Should Work

    Quote Originally Posted by Armo View Post
    ''Should work'', if you code something, try it first before you release it.
    Yep.


    And on that note, /mod close please.

    Don't fret, developing an IPN right now. Implementing LightCMS's. I figured it out. Til then, please close ;D



Advertisement