View Single Post
  #25  
Old 6th August 2013, 04:34
ratza ratza is offline
Senior Member
 
Join Date: Jun 2009
P2P
Posts: 21
Default
I think this is the paypal.php page (it wasn't finished):

Code:
<?

require "include/bittorrent.php";

dbconn(false);
$donb=0;
// read the post from PayPal system and add 'cmd'
$req = 'cmd=_notify-validate';

while (list($key, $value) = each($_POST)) {
    $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 ('www.paypal.com', 80, $errno, $errstr, 30);

// assign posted variables to local variables
$item_name = (isset($_POST['item_name']) ? htmlspecialchars($_POST['item_name']) : '');
$item_number = (isset($_POST['item_number']) ? htmlspecialchars($_POST['item_number']) : '');
$payment_status = (isset($_POST['payment_status']) ? htmlspecialchars($_POST['payment_status']) : '');
$payment_amount = (isset($_POST['mc_gross']) ? htmlspecialchars($_POST['mc_gross']) : '');
$payment_currency = (isset($_POST['mc_currency']) ? htmlspecialchars($_POST['mc_currency']) : '');
$txn_id = (isset($_POST['txn_id']) ? htmlspecialchars($_POST['txn_id']) : '');
$receiver_email = (isset($_POST['receiver_email']) ? htmlspecialchars($_POST['receiver_email']) : '');
$payer_email = (isset($_POST['payer_email']) ? htmlspecialchars($_POST['payer_email']) : '');
$clid = (isset($_POST['custom']) ? htmlspecialchars($_POST['custom']) : '');


// block pending echecks. paypal posts payments again when echecks clear, blocks double credits.
if ($payment_type == "echeck" && $payment_status == "Pending") die;

if (!$fp)
{}
else
{
fputs ($fp, $header . $req);
while (!feof($fp))
{
$res = fgets ($fp, 1024);
if (strcmp ($res, "VERIFIED") == 0)
{
// process payment
if ($receiver_email == "ratzax13@yahoo.com")
{
settype($payment_amount, "float");
settype($payment_amount, "string");
///Lottery system add tickets

/*
If ($payment_amount >= 1)
{
$tickets = $payment_amount;
for ($i = 0; $i < $tickets; $i++)
{mysql_QUERY("INSERT INTO tickets(user) VALUES('$clid')");}
*/

$donated_time = get_date_time();


///Sort Upload and Donor time amounts
if ($payment_amount == 50)
{$months = 4.3*6;}
elseif ($payment_amount == 30)
{$months = 4.3*4;}
elseif ($payment_amount == 15)
{$months = 4.3*2;}
elseif ($payment_amount == 10)
{$months = 4.3*1;}

else {$months = 4.3*0.5;}




//set donor upload upgrade
if ($payment_amount == 50)
{$donb = 161061273600; }
elseif ($payment_amount == 30)
{$donb = 75161927680; }
elseif ($payment_amount == 15)
{$donb = 32212254720; }

else {
$donb = 2147483648*$payment_amount;}

if ($payment_amount == 50)
{$invites = 5; }
elseif ($payment_amount == 30)
{$invites = 3; }
elseif ($payment_amount == 15)
{$invites = 1; }

else {
$invites = 0;}


//get user information from DB
$query = "select * from users where id='".$clid."'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
//$tmp_max = $row['maxtorrents'];
$username = $row['username'];
$old=date($row['donoruntil']);
$class = $row['class'];
$dona = $row['uploaded'];

//Set class to VIP if lower then VIP
if ($payment_amount == 50 || $payment_amount == 30 || $payment_amount == 15 || $payment_amount == 10 || $payment_amount == 5) {
if ($class <= 2)
{$class = 2;}}

$r = @mysql_query("SELECT * FROM users WHERE id=$clid") or sqlerr();
$user = mysql_fetch_array($r) or bark("No user with ID $clid.");
//Reset download upload post and reset to zero H&R's
$query = "update users set donor='yes', class=$class, warned ='no', invites=$invites where id='".$clid."'";
$result = mysql_query("$query");

//Get Donor time if already some left from before
If ($old<>"0000-00-00 00:00:00")
{
$old1=strtotime($old)- gmtime();
$donateuntil = get_date_time((gmtime() + $months * 604800) +$old1);
}
else
{$donateuntil = get_date_time(gmtime() + $months * 604800);}
//add Upload bonus for amount given at 1Gb per Ł1
$bonus = $donb + $dona;
$donordif =strtotime($donateuntil)- gmtime();
//add to mod comment for staff to check if payment made via here
$modcomment = gmdate("Y-m-d") . " Donor Status Given. ($donb) Bonus Granted. ($donordif) Donator Time Added\n";
$modcom = sqlesc($modcomment);
//update users total and bonus totals
$query = "update users set uploaded='".$bonus."', modcomment = CONCAT($modcom,modcomment), donoruntil='$donateuntil', donated=$payment_amount, total_donated=total_donated+$payment_amount where id='".$clid."'";
$result = mysql_query($query);
//log donations
$donlog = "User: $username | Amount : $payment_amount";
$donlog = sqlesc($donlog);
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO donatelog (added, txt) VALUES($added, $donlog)") or sqlerr(__FILE__, __LINE__);

}}}}
//update donation totals for counter
$query = "select cash,user from funds";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
$money = $payment_amount;
$query = "INSERT INTO funds (cash,user,added) VALUES ($money, $clid, $added)";
$result = mysql_query($query);
write_log("Donation From ".$CURUSER['username']." ID: ".$userid." for ".$payment_amount." on ".$donated_time." and donor till ".$donateuntil." upgraded by system");
// Notify user
$msg = sqlesc("User ."]".$CURUSER['username']." donated amount of ".$payment_amount." on ".$donated_time." for VIP status, Go and check it out!");
$added = sqlesc(get_date_time());
mysql_query("INSERT INTO messages (sender, receiver, msg, added) VALUES(0, 1, $msg, $added)") or sqlerr(__FILE__, __LINE__);

header("Location: http://network.fnatic.ro/");

fclose ($fp);
stdfoot();
?>
I havent tested it cuz i don't have paypal so.... let me know if it works
Reply With Quote