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.

Paypal script im not sure here!

Discussion in 'PHP' started by byllan, May 11, 2012.

  1. #1
    Hello im not sure here and i do not got any money either to send and pay you know :D My friends dont know or dont got paypal either! So i wonder if someone could help me with this script??

    That i want when a user have donate with paypal that user will get access 2. Im not done yet theres more i want it add the username and how much money the user donated to table top_stod


    The scripts

    Donate.php > http://pastebin.com/8Qk7i8zX
    Ipn.php > http://pastebin.com/MgadT7Yb

    <?phpif (!isset($_SESSION['sess_user'])) {   header("Location: ?p=youneed");   exit;}
    ?><table width="400" border="0" align="center" cellpadding="3" cellspacing="1"><tr><td><strong><b><a href="?p=rules"><font color="red">Read the rules at section 4 before you donate.</a></font></strong></td></tr></table><html><body><br><br><b>Paypal</b><form action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="business" value="apelsin-donations@hotmail.com"><input type="hidden" name="lc" value="US"><input type="hidden" name="item_name" value="Support Apelsinen.com"><b>Username:</b> <input type="text"  name="custom" value="<?php echo $_SESSION['sess_name']; ?>">
    <select name="amount">  <option value="1.00">1 EUR</option>  <option value="5.00">5 EUR</option>  <option value="10.00">10 EUR</option></select><input type="hidden" name="button_subtype" value="products"><input type="hidden" name="currency_code" value="EUR"><input type="hidden" name="no_shipping" value="1"><input type="hidden" name="currency_code" value="EUR"><input type="hidden" name="notify_url" value="http://apelsinen.com/ipn/ipn.php"><input type="hidden" name="return" value="http://apelsinen.com"><input type="hidden" name="rm" value="0"><input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest"><input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form></html></body>
    <?phpif ($_REQUEST['debug']) {ini_set("display_errors", True);error_reporting(E_ALL);}$mysql_host = 'localhost'; //Leave at localhost  $mysql_user = 'root'; //DB User  $mysql_pass = ''; //DB Pass  $mysql_db = ''; //DB Name  $file = 'paypal.log'; //Paypal Log Name will be placed in the same location as your ipn.php file $payer_email = $_REQUEST['payer_email']; $ip = $_SERVER['REMOTE_ADDR'];if($ip != "" && $ip != "" && $ip != "" && $ip != "") {    print "Scammer...";$hak = fopen("scammer.log", "a");fwrite($hak, "$ip \r\n");fclose($hak);die(0);}$time = date("F j, Y, g:i a"); $paylist = array("1.00" => 1, "5.00" => 2 "10.00" => 2);
    // connect db  
    $db = mysql_connect($mysql_host, $mysql_user, $mysql_pass);
    $custom = stripslashes(ucwords(strtolower(trim($_REQUEST['custom']))));  $receiver_email = $_REQUEST['receiver_email'];  $payment_status = $_REQUEST['payment_status'];  $mc_gross = $_REQUEST['mc_gross']; mysql_select_db($mysql_db, $db);  if ($_REQUEST['debug']){print $payment_status . '\n';print (isset($paylist[$mc_gross])) ? 1 : 0 . '\n';print $receiver_email . '\n';print $custom . '\n';}if ($payment_status == "Completed" && $receiver_email == "apelsin-donations@hotmail.com" && isset($paylist[$mc_gross])) {  
    $query = "SELECT access FROM users WHERE name = '$custom'";  
    $result = mysql_query($query);  
    $prem = mysql_fetch_array($result);  $somecode = "'$time' '$custom' '$payer_email' '$mc_gross' '$ip'\r\n";
    // figure out how much to give$give = $paylist[$mc_gross];$points = $prem['access'] + $give;  // $points = mysql_query($prem)  $sql = "INSERT INTO top_stod SET username='$user' WHERE cash='$custom'";  // Log Paypal Transaction $hak = fopen($file, "a"); fwrite($hak, $somecode); fclose($hak); 
    $result2 = mysql_query($qry2);  }  else   {    echo("Error.");   }  ?>

    byllan, May 11, 2012 IP
  2. kulik

    kulik Member

    Likes Received:
    Best Answers:
    Trophy Points:
    I would recommend looking at this tutorial and use PayPal's sandbox environment to test it out until it works as needed. You'll have to edit _xclick for donations via PayPal's variables.
    kulik, May 11, 2012 IP
  3. byllan

    byllan Peon

    Likes Received:
    Best Answers:
    Trophy Points:
    Just help me i dont got time to learn now!
    byllan, May 12, 2012 IP