I give up on it LOL, my brains about to explode after trying to do it. I actually managed to freeze the server for a minute and a half while I had it try to load both tables one after the other, somehow it got stuck in a loop or something... This is the reverted file back to the closest I could get it to come.
Sorry for the length of this message and file length. Just wanted to ensure understanding.
Code: Select all
<?php
// This script is written by Cliff Riley as a patch to get Paypal Mass Pay working
// as apparantly the company doesn't give a damn to fix this feature.
// SQL Data Structure
/*
members - number,id,pass,first,last,email,address,city,state,zip,country,method,acc,
earnings,pearnings,rearnings,tearnings,crl,points,ppoints,rpoints,tpoints,prl,trafex_credits,
trafex_pcredits,trafex_rcredits,trafex_tcredits,trafex_get_credits,trafex_cost_credits,
trafex_get_points,trafex_cost_points,trafex_maxurls,trafex_levels,trafex_get_earnings,
trafex_cost_earnings,trafex_last,trafex_next,trafex_credited,trafex_session,trafex_code,
trafex_max,exitex_credits,exitex_pcredits,exitex_rcredits,exitex_tcredits,exitex_get_credits,
exitex_cost_credits,exitex_get_points,exitex_cost_points,exitex_maxurls,lotto_max_plays,
lotto_plays,lotto_total,lotto_next,lotto_credited,lotto_last,exitex_levels,exitex_get_earnings,
exitex_cost_earnings,exitex_last,vacation,notes,ref,refs,owedrefs,joindate,interests,clicks,
lastclicked,nextclick,curad,curty,starttime,level,refpos,ip
sample: '16','DragonRider','MYPASS','Cliff','Riley','dragonrider858@MYEMAIL','MYADDRESS',
'','','','United States of America','','','1.103575','0.5297','0.245075','0.006','','0.0000',
'0.0000','0.0000','0','','0','8910','0','0','','','','','','','','','158','1079709452','No',
'1','code','3','5','5','0','0','','','','','','','0','26','1079797210','Yes','1079797211','',
'','','20040213134205','No','','jpgu','64','0','20040130202933','Computers,Internet,Games,Personal Home Pages,Teenagers,Television,',
'','1079895438','20040321135717','','','20040309172337','Gold','10','65.33.18.190'
autoredeem - id,type,client,arq,ara,arc,art,iw,ih,ig,subject,
url,sitename,image,ad,earnings,acc,date
sample: '5','PayPal','dragonrider','','','Dollars','','468',
'60','Main','','','','','','0.05','dragonrider@MYEMAIL','20040321161445'
*/
require("program.php");
adminlogin();
if ($submit == 'Download') {
header("Content-Type: download/this");
header("Content-Disposition: attachment; filename=paypal.txt");
echo $input;
exit();
}
?>
<html>
<head>
<body link="#0000FF" vlink="#000000">
<?php
$action = $_GET["action"];
if ($submit == 'Submit') {
foreach($ids as $id => $temp) {
if ($pay == 'requests') {
list ($amount, $arid) = split ('&', $temp);
$sql = "DELETE FROM autoredeem WHERE id='$arid'";
$result = mysql_query($sql);
} else {
$amount = $temp;
}
$sql = "UPDATE members SET earnings=earnings-$amount WHERE id='$id'";
$result = mysql_query($sql);
$sql = "INSERT INTO trans (username,type,amount,credittype,event,date) VALUES ('$id','Debit','$amount','Dollars','Payment','$now')";
$result = mysql_query($sql);
$sql = "UPDATE system SET paid=paid+$amount WHERE id='Admin'";
$result = mysql_query($sql);
}
echo "Done<br>";
} else {
if (!$minbal) $minbal = '0.01';
if (!$limit) $limit = '1000';
if (!$fee) $fee = '0';
?>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="50%">
Balances over<br>Limit<br>Fee<br>
</td>
<td width="50%" valign="top">
<form method="POST" action="<?php echo $PHP_SELF?>">
<input type="text" name="minbal" value="<?php echo $minbal ?>"><br>
<input type="text" name="limit" value="<?php echo $limit ?>"><br>
<input type="text" name="fee" value="<?php echo $fee ?>"><br>
</td>
</tr>
</table>
<center>
<input type="radio" name="pay" value="All">All
<input type="radio" name="pay" value="requests">Requests<br>
<input type="Submit" name="submit" value="View"></form>
</center>
<?php if ($_POST["minbal"]) { ?>
Download, then press submit and go to PayPal to use the file. <br>
<form method="post" action="<?php echo $PHP_SELF?>">
<input type="hidden" name="input" value="<?php
if ($fee != 0) {
$percent = $minbal * $fee / 100;
$minbal += $percent;
}
if (!$pay) { $pay = 'requests'; }
if ($pay == 'All') {
$sql = "SELECT * FROM members WHERE earnings>=$minbal limit $limit";
$col = 'id';
$col2 = 'email';
} else {
$sql = "SELECT * FROM autoredeem WHERE earnings>=$minbal limit $limit";
$col = 'client';
$col2 = 'acc';
}
$result = mysql_query($sql,$db);
while ($myrow = mysql_fetch_array($result, MYSQL_ASSOC)) {
if ($fee != 0) {
$percent = $myrow["earnings"] * $fee / 100;
$myrow["earnings"] -= $percent;
}
$id = $myrow[$col];
$ids[$id] = $myrow['earnings'];
echo $myrow[$col2]."\t".rounddown($myrow["earnings"], 2, '.', '')."\n";
}
?>">
<?php
if (is_array($ids)) {
foreach($ids as $k => $v) {
?>
<input type="hidden" name="ids[<?php echo $k ?>]" value="<?php echo $v ?>">
<?php
}
}
?>
<input type="hidden" name="pay" value="<?php echo $pay ?>">
<input type="Submit" name="submit" value="Download"><br>
<input type="Submit" name="submit" value="Submit">
</form>
<?php
}
}
?>
<?php
require('bottom.php');
?>