Eco-$mart AWG Referrer
if($log == "out"){
echo("
Thank you. You are logged out.
");
exit();
}
if($RID == "" and $email == ""){
echo("
");
}//RID and email are both blank
elseif($RID != "" and $email == ""){
echo("
");
}//RID is not blank but email address is.
elseif($RID == "" and $email != ""){
echo("
");
}//RID is blank but email address is not.
else{//RID and email are both not blank
$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
mysql_select_db('ecosmar_contacts', $dbcnx);
$getref = mysql_query("SELECT email FROM refcon WHERE ID='$RID'");
if(!$getref){
echo("
" .
"" .
"| " .
"We are sorry. We are experiencing technical difficulties. Please try again later." .
" |
");
}else{//got referrer
$row = mysql_fetch_array($getref);
$RIDemail = $row['email'];
if (strcmp ($RIDemail, $email) == 0){//emails are the same
$sesame = "open";
}//emails are the same
else{//emails are different
echo("
");
}//emails are different
}//got referrer
}//RID and email are both not blank
////START OPENED SESAME HERE
if($sesame == "open"){
$dbcnx = @mysql_connect('mysql.plainhost.com', 'ecosmar_ecosmart', 'ecoman1');
///////////////////////////GET REFCON INFO ABOUT PAYMENTS
mysql_select_db('ecosmar_contacts', $dbcnx);
$getpay = mysql_query("SELECT name_1,name_2,Company,pay,rate FROM refcon WHERE ID='$RID'");
if(!$getpay){
$nopay = "on";
echo("
" .
"" .
"| " .
"We are sorry. We are experiencing technical difficulties. Please Contact Eco-\$mart about this error." .
" |
");
echo("
");
}else{//got pay
$nopay = "off";
$row = mysql_fetch_array($getpay);
$name_1 = $row['name_1'];
$name_2 = $row['name_2'];
$Company = $row['Company'];
$pay = $row['pay'];
$rate = $row['rate'];
///check if rate is flat if not it is not an exclusive AWG Referrer.
///Question rate and redirect w message
if($pay != "Flat Fee"){
$fee = "***";
$feenote = "*** Only exclusive AWG Referrer Records Displayed.";
}else{
$fee = sprintf("%01.2f", $rate);
}
$outs[] = "";
$outs[] = "NONE";
$outs[] = "None";
$outs[] = "No";
$outs[] = "N//A";
$outs[] = "n//a";
if(in_array($Company, $outs)){
$notice = $name_1." ".$name_2;
}else{
$notice = $Company;
}
}//got pay
$dnum = date(Ym)* 24;
echo("
" .
"" .
"| " .
"Welcome $name_1 $name_2" .
" |
");
//////////////////////////////Place download for DOC sell sheets here
echo("
");
//////////////////////////////Begin listing referrer info
echo("
" .
"" .
"" .
"Contacts for $notice ¦ Referrer ID: $RID");
$tmprid = $trichar.":".$RID;
mysql_select_db('ecosmar_contacts', $dbcnx);
$getcontacts = mysql_query("SELECT first_Name,Name,Company,Address,City,State,ZipCode FROM con_main WHERE tmp_RID='$tmprid'");
if(!$getcontacts){
echo(" Unable to retrieve Contacts. Please try again later.");
}else{//gotcontacts
$numrows = mysql_num_rows($getcontacts);
if($numrows < 1){
echo("" .
"| No Contacts Recorded for Referrer ID: $RID | ");
}else{//there are rows
echo("" .
"| Name | Company | Address | City | State | Zip Code | ");
while($rowc = mysql_fetch_array($getcontacts)){
echo("| $rowc[0] $rowc[1] | $rowc[2] | $rowc[3] | $rowc[4] | $rowc[5] | $rowc[6] | ");
}//while fetching contacts
}//gotcontacts
echo(" |
");
///////////////////INVOICE INFO
mysql_select_db('ecosmar_inv', $dbcnx);
echo("
" .
"" .
"" .
"Referrals for $notice ¦ Referrer ID: $RID");
$getinv = mysql_query("SELECT invnum,CID,ridpay,dtup,dtnum,status,prgrss FROM ecoinvoice WHERE RID='$RID'");
if(!$getinv){
echo(" Unable to retrieve Customer Info. Please try again later.");
}else{//gotinvoices
$invrows = mysql_num_rows($getinv);
if($invrows < 1){//there are no customers
echo("" .
"| No Referrals Recorded for Referrer ID: $RID | ");
}//there are no customers
else{//there are customers//////////
while($rowi = mysql_fetch_array($invrows)){
$invnum = $rowi['invnum'];
$CID = $rowi['CID'];
$ridpay = $rowi['ridpay'];
$dtup = $rowi['dtup'];
$chunk_dtup = chunk_split($dtup, 2, ':');
$chunk_arrd = explode(":", $chunk_dtup);
$duem = $chunk_arrd[2].'/'.$chunk_arrd[3].'/'.$chunk_arrd[0].$chunk_arrd[1];
$dtnum = $rowi['dtnum'];
$chunk_dtnum = chunk_split($dtnum, 2, ':');
$chunk_arrn = explode(":", $chunk_dtnum);
$datem = $chunk_arrn[2].'/'.$chunk_arrn[3].'/'.$chunk_arrn[0].$chunk_arrn[1];
$status = $rowi['status'];//EEE=process error,PPP=payment error,New,Active,Closed
$prgrss = $rowi['prgrss'];//Opened,Order In,Shipped,Delivered
if($status != "Closed"){
$actinvnums[] = $invnum;
$actCIDs[] = $CID;
$actridpays[] = $ridpay;
$actdtups[] = $duem;
$actdtnums[] = $datem;
$actstatuss[] = $status;
$actprgrsss[] = $prgrss;
}//status is not closed
else{//status is closed
$cloinvnums[] = $invnum;
$cloCIDs[] = $CID;
$cloridpays[] = $ridpay;
$clodtups[] = $duem;
$clodtnums[] = $datem;
$clostatuss[] = $status;
$cloprgrsss[] = $prgrss;
}//status is closed
}// while fetching all rows
//////////////////////deal with two arrays active and closed
$actcount = count($actinvnums);
if($actcount < 1){
echo("" .
"" .
"| No Active Orders Recorded for Referrer ID: $RID | ");
}else{//there are active accounts
echo("" .
"" .
"" .
"Active Referrals".
"" .
"| Invoice | Name | Date | Order Progress | Fee | ");
//////////////////////////////////////////begin gathering data
$i = 0;
while($i < $actcount){
echo("| $actinvnums[$i] | ");
mysql_select_db('ecosmar_contacts', $dbcnx);
$getcon = mysql_query("SELECT first_Name,Name FROM con_main WHERE ID='$actCIDs[$i]'");
if(!$getcon){
echo("Could not get invoice contact name. Error: ".mysql_error()." | ");
}else{
$row = mysql_fetch_array($getcon);
echo("$row[0] $row[1] | ");
}//gotcontact
echo("$actdtnums[$i] | $actprgrsss[$i] $actdtups[$i] | ");
if($actridpays[$i] > 0){
echo("$fee PD | ");
$paidfy[] = $fee;//its all about the fee
}else{
echo("$fee Due | ");
$doofy[] = $fee;
}
$i=$i+1;
}//while there are active rows to be read
$feesdue = array_sum($doofy);
echo("| Fees Due | $feesdue | ");
//^^^^ table inside this one vvvv
echo(" | ");
}//there are active accounts
}//there are customers//////////
}//gotinvoices
////////////////closed accounts
$clocount = count($cloinvnums);
if($clocount < 1){
echo("" .
"" .
"| No Closed Referrals Recorded for Referrer ID: $RID | ");
}else{//there are closed accounts
echo("" .
"" .
"" .
"Closed Referrals".
"" .
"| Invoice | Name | Date | Order Progress | Fee | ");
////begin gathering data
$i = 0;
while($i < $clocount){
echo("| $cloinvnums[$i] | ");
mysql_select_db('ecosmar_contacts', $dbcnx);
$getcon = mysql_query("SELECT first_Name,Name FROM con_main WHERE ID='$cloCIDs[$i]'");
if(!$getcon){
echo("Could not get invoice contact name. | ");
}else{
$row = mysql_fetch_array($getcon);
echo("$row[0] $row[1] | ");
}//gotcontact
echo("$clodtnums[$i] | $cloprgrsss[$i] $clodtups[$i] | ");
echo("$cloridpays[$i] PD | ");
$paidfy[] = $cloridpays[$i];
}
$i=$i+1;
}//while there are active rows to be read
$feespaid = array_sum($paidfy);
if($feespaid > 0){
echo("| Fees Paid | $feespaid");
}else{
echo(" | | | ");
}
//^^^^ table inside this one vvvv
echo(" | | ");
}//there are closed accounts
}//sesame is open
?>
|
Contact Eco-$mart
Email about Orders: orders@eco-smart.com
Please refer to the Invoice Number when corresponding about Orders.
Email about Eco-$mart Referrers: referrers@eco-smart.com
Please refer to your Referrer Number when corresponding about your Referral Status.
Phone: (888)329-2705
|
|