1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to make the registration in my website a paid one?

Discussion in 'PHP' started by Toon-c, Jan 27, 2010.

  1. #1
    Hi everyone ..

    I need to know how to make the registration process in one of my websites a paid one ..

    Any ideas or thoughts ?

    Is there any tools I can use to automate the process ..
    a payment via paypal to access the registration page maybe .

    Thanks.
     
    Toon-c, Jan 27, 2010 IP
  2. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #2
    You meant a subscription system? Have a look at paypal IPN.
     
    Kaizoku, Jan 27, 2010 IP
    Toon-c likes this.
  3. Toon-c

    Toon-c Well-Known Member

    Messages:
    1,775
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #3
    Thanks Rep+ ..
    It looks like it's the solution ... but how to implement the php code ? is it like securing the registration web page ?

     
    Toon-c, Jan 27, 2010 IP
  4. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #4
    How this works, it is up to how you want to implement it, but a basic overview follows.

    User signs up free account.
    User logs in, and decides to sign up premium subscription for "extra" features.

    You can then take advantage, such as getting their user_id for cross-referencing with user database etc. and implement it in paypal php script.

    
    // PHP 4.1
    
    // read the post from PayPal system and add 'cmd'
    $req = 'cmd=_notify-validate';
    
    foreach ($_POST as $key => $value) {
    $value = urlencode(stripslashes($value));
    $req .= "&$key=$value";
    }
    
    // post back to PayPal system to validate
    $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 ('ssl://www.paypal.com', 443, $errno, $errstr, 30);
    
    // assign posted variables to local variables
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $payment_status = $_POST['payment_status'];
    $payment_amount = $_POST['mc_gross'];
    $payment_currency = $_POST['mc_currency'];
    $txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    $payer_email = $_POST['payer_email'];
    $user_id = $_POST['custom'];
    
    if (!$fp) {
    // HTTP ERROR
    } else {
    fputs ($fp, $header . $req);
    while (!feof($fp)) {
    $res = fgets ($fp, 1024);
    if (strcmp ($res, "VERIFIED") == 0) {
     // use the $user_id variable to cross reference with user.
    }
    else if (strcmp ($res, "INVALID") == 0) {
    // log for manual investigation
    }
    }
    fclose ($fp);
    }
    ?>
    
    PHP:
     
    Kaizoku, Jan 27, 2010 IP
  5. Toon-c

    Toon-c Well-Known Member

    Messages:
    1,775
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #5
    The problem here is that I don't want premium account update ..
    I want the registration process to be paid from the beginning ..

    Is there a method to limit the access to the registration page to people who paid through paypal ?
     
    Toon-c, Jan 27, 2010 IP
  6. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #6
    Like I said, it's up to you how you implement it.

    There are a few ways you can do it if you want paid subscription.

    Have the user subscribe to your account using paypal.
    Then your script sends them a generated password. They then use it to continue signing up.

    OR

    You can use paypal PDT, which is like IPN but uses a token. Which you can set custom variables to paypal forms. So the user is signing up, which then sends username,password etc to paypal, then it sends it back to your server to process it.
     
    Kaizoku, Jan 27, 2010 IP
  7. Toon-c

    Toon-c Well-Known Member

    Messages:
    1,775
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #7
    Okey dokey .. got it ..

    Thank a lot for your help. appreciate it.
     
    Toon-c, Jan 27, 2010 IP
  8. radiotiger

    radiotiger Peon

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Why dont you buy a readymade php script or go for opensource like joomla and there are many extensions for this job. see my site has a good system - resalefactory dot com. sorry i am not allowed to post links.
     
    radiotiger, Jan 29, 2010 IP
  9. Toon-c

    Toon-c Well-Known Member

    Messages:
    1,775
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #9
    I figure it out thanks ..
     
    Toon-c, Jan 29, 2010 IP