Jump to content

jimmyp3016

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jimmyp3016's Achievements

Member

Member (2/5)

0

Reputation

  1. Can someone help me real quick? Please!
  2. I guess its not passing through the url. What is an easy way to get the users address to input it in the $to_address field after it posts in the database? The users email is email1 Any help would be great thanks!
  3. Hey Guys, My script runs perfect and inserts my form data into the database but it does not email the user. Can you look at the top part of my script and tell me why? Is it because its not grabbing the persons address? I think there is a problem with $to_address = $_GET['email']; email is the value of that field on this same page. 1. 2. 3. <?php 4. include 'clientmessage.php'; 5. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 6. { 7. $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue; 8. 9. switch ($theType) { 10. case "text": 11. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 12. break; 13. case "long": 14. case "int": 15. $theValue = ($theValue != "") ? intval($theValue) : "NULL"; 16. break; 17. case "double": 18. $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; 19. break; 20. case "date": 21. $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 22. break; 23. case "defined": 24. $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; 25. break; 26. } 27. return $theValue; 28. } 29. 30. $editFormAction = $_SERVER['PHP_SELF']; 31. if (isset($_SERVER['QUERY_STRING'])) { 32. $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); 33. } 34. 35. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { 36. $insertSQL = sprintf("INSERT INTO Customers (PlayLevel, Source, SourceDes, WithFriend, School, Sponsor, Asst, HCoach, CoachName, CoachDOB, CoachSSN, ShirtSize, CoachAddr, CoachPh, CoachEmail, Bcheck, Agreement, ModelRel, Name, ChildName, ChildShirt, addr1, addr2, City, `State`, Zip, Phone1, Phone2, email1, email2, Age, Birthday, Location) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", 37. GetSQLValueString($_POST['PlayLevel'], "text"), 38. GetSQLValueString($_POST['Source'], "text"), 39. GetSQLValueString($_POST['SourceDes'], "text"), 40. GetSQLValueString($_POST['WithFriend'], "text"), 41. GetSQLValueString($_POST['School'], "text"), 42. GetSQLValueString(isset($_POST['Sponsor']) ? "true" : "", "defined","'Y'","'N'"), 43. GetSQLValueString(isset($_POST['Asst']) ? "true" : "", "defined","'Y'","'N'"), 44. GetSQLValueString(isset($_POST['HCoach']) ? "true" : "", "defined","'Y'","'N'"), 45. GetSQLValueString($_POST['CoachName'], "text"), 46. GetSQLValueString($_POST['CoachDOB'], "date"), 47. GetSQLValueString($_POST['CoachSSN'], "text"), 48. GetSQLValueString($_POST['ShirtSize'], "text"), 49. GetSQLValueString($_POST['CoachAddr'], "text"), 50. GetSQLValueString($_POST['CoachPh'], "text"), 51. GetSQLValueString($_POST['CoachEmail'], "text"), 52. GetSQLValueString(isset($_POST['Bcheck']) ? "true" : "", "defined","'Y'","'N'"), 53. GetSQLValueString(isset($_POST['Agreement']) ? "true" : "", "defined","'Y'","'N'"), 54. GetSQLValueString(isset($_POST['ModelRel']) ? "true" : "", "defined","'Y'","'N'"), 55. GetSQLValueString($_POST['Name'], "text"), 56. GetSQLValueString($_POST['ChildName'], "text"), 57. GetSQLValueString($_POST['ChildShirt'], "text"), 58. GetSQLValueString($_POST['addr1'], "text"), 59. GetSQLValueString($_POST['addr2'], "text"), 60. GetSQLValueString($_POST['City'], "text"), 61. GetSQLValueString($_POST['State'], "text"), 62. GetSQLValueString($_POST['Zip'], "text"), 63. GetSQLValueString($_POST['Phone1'], "text"), 64. GetSQLValueString($_POST['Phone2'], "text"), 65. GetSQLValueString($_POST['email1'], "text"), 66. GetSQLValueString($_POST['email2'], "text"), 67. GetSQLValueString($_POST['Age'], "text"), 68. GetSQLValueString($_POST['Birthday'], "text"), 69. GetSQLValueString($_POST['Location'], "text")); 70. 71. mysql_select_db($database_custs, $custs); 72. $Result1 = mysql_query($insertSQL, $custs) or die(mysql_error()); 73. 74. $to_address = $_GET['email']; 75. mail ("$to_address", "$subject", "$mail_body", "From: info@mywebsite.com"); 76. 77. $insertGoTo = "/SignupComplete.htm"; 78. if (isset($_SERVER['QUERY_STRING'])) { 79. $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; 80. $insertGoTo .= $_SERVER['QUERY_STRING']; 81. } 82. header(sprintf("Location: %s", $insertGoTo)); 83. } 84. ?>
  4. The script is only showing the last affiliate who made a sale and thats it, even though there are 2 different affiliates who made a sale. It should be showing the 2 rows but it doesnt. Does it have anything to do with this line? Is this line set to only echo one row? echo "<tr><td>".$userLink."</td><td>".$row->referrals."</td><td>\$".($row->referrals*AFFILIATE_COMMISSION_2)."</td><td>".$details."</td></tr>\n";
  5. I changed it to Order by and got this "Query failed to execute correctly: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause" Here is my whole script... <?php require_once( "../database.cls.php" ); require_once( "../functions.inc.php" ); adminPage(); if ( $_REQUEST['masspay'] ) { $startDate = $_REQUEST['year']."-".$_REQUEST['month']."-01 00:00:00"; $endDate = $_REQUEST['year']."-".$_REQUEST['month']."-".date( "t", mktime( 0, 0, 0, $_REQUEST['month'], 1, 2000 ) )." 23:59:59"; $db = new MySQL( DB_HOST, DB_USER, DB_PASS, DB_NAME ); $sql = "SELECT *, COUNT(id) AS referrals FROM user WHERE id IN ("; $sql .= " SELECT DISTINCT u.referral FROM user u, servtrans t WHERE u.id=t.userID AND t.createdOn BETWEEN '$startDate' AND '$endDate'"; $sql .= ") ORDER BY id DESC"; $q = $db->query( $sql ); if ( $q->numRows() > 0 ) { $row = $q->getNext( "object" ); if ( $row->payPal ) $mp .= $row->payPal."\t".($row->referrals*AFFILIATE_COMMISSION_2)."\t".PRODUCT_CURRENCY."\t\tReferral commissions payment."; } header( "Content-Disposition: attachment; filename=".$_REQUEST['month']."-".$_REQUEST['year']."-commissions.xls" ); header( "Content-Type: application/vnd.ms-excel" ); echo $mp; exit(); } echo file_get_contents( "head.txt" ); echo doAdminNavBar(); ?> <h3>Web 2.0 Affiliate commissions</h3> <p>Show how much your users have earned in affiliate commission for the Web 2.0 Service.</p> <form method="get" action="service.php"> <p>Show monthly statement: <select name="month"> <?php for ($i = 1; $i < 13; $i++) echo "<option value=\"$i\">$i</option>\n"; ?></select> <select name="year"> <?php for ($i = 2006; $i < 2051; $i++) echo "<option value=\"$i\">$i</option>\n"; ?></select> <input type="submit" value="Go" /></p></form> <?php if ( $_REQUEST['month'] && $_REQUEST['year'] ) { $startDate = $_REQUEST['year']."-".$_REQUEST['month']."-01 00:00:00"; $endDate = $_REQUEST['year']."-".$_REQUEST['month']."-".date( "t", mktime( 0, 0, 0, $_REQUEST['month'], 1, 2000 ) )." 23:59:59"; ?> <p>Showing statement for <?php echo $startDate." - ".$endDate; ?>. <a href="service.php?masspay=1&month=<?php echo $_REQUEST['month']; ?>&year=<?php echo $_REQUEST['year']; ?>">Download PayPal 'mass-pay' file</a>.</p> <table cellpadding="5px" style="background:#eee;width:100%;"> <tr style="font-weight:bold;"><td>Name</td><td>Referrals</td><td>Total earned</td><td>Payment details</td></tr> <?php $db = new MySQL( DB_HOST, DB_USER, DB_PASS, DB_NAME ); $sql = "SELECT *, COUNT(id) AS referrals FROM user WHERE id IN ("; $sql .= " SELECT DISTINCT u.referral FROM user u, servtrans t WHERE u.id=t.userID AND t.createdOn BETWEEN '$startDate' AND '$endDate'"; $sql .= ") ORDER BY id DESC"; $q = $db->query( $sql ); if ( $q->numRows() > 0 ) { $row = $q->getNext( "object" ); if ( $row->payPal ) $details = "PayPal: ".$row->payPal; else { $details = "Cheque: ".$row->cheques."<br />"; if ( $row->address1 ) $details .= $row->address1."<br />"; if ( $row->address2 ) $details .= $row->address2."<br />"; if ( $row->city ) $details .= $row->city."<br />"; if ( $row->state ) $details .= $row->state."<br />"; if ( $row->zip ) $details .= $row->zip."<br />"; if ( $row->country ) $details .= $row->country."<br />"; } $userLink = "<a href=\"users.php?email=".$row->email."\">".$row->firstName." ".$row->lastName."</a>"; echo "<tr><td>".$userLink."</td><td>".$row->referrals."</td><td>\$".($row->referrals*AFFILIATE_COMMISSION_2)."</td><td>".$details."</td></tr>\n"; } ?> </table> <?php } echo file_get_contents( "foot.txt" ); ?>
  6. Hey Glyde, I just tried that and i got a nasty... Query failed to execute correctly: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SORT BY id DESC' at line 1 It didnt like it. Any suggestions?
  7. Hey Guys, I have this statement that shows who made affiliate commisions during the month I choose. $sql = "SELECT *, COUNT(id) AS referrals FROM user WHERE id IN ("; $sql .= " SELECT DISTINCT u.referral FROM user u, servtrans t WHERE u.id=t.userID AND t.createdOn BETWEEN '$startDate' AND '$endDate'"; $sql .= ") GROUP BY id"; I run it and it runs correctly except for the fact that if an affiliate makes a couple sales from the same person, its not showing. Its only showing one sale. Is this because this statment is only pulling out unique id's? If so, how can i fix it? Thank you in advance. -Jimmy
  8. Thank you all for the help! This worked! function doCommision() { global $user; if ($user->jv == 'y') { define( "AFFILIATE_COMMISSION", 20 ); } else { define( "AFFILIATE_COMMISSION", 10 ); } } Problem Solved!
  9. its not defined anyplace else. How would I setup the variable instead?
  10. Hey Glyde, Thanks for your quick response. I put your method in but its still showing 10 for jv = y I wonder why its doing that, when i echo the jv variable on the page it tells me y So in theory it should show 20 am i right?
  11. Hey Guys, Trying to figure this one out. I have this function below. function doCommision() { if ($user->jv == 'y') { define( "AFFILIATE_COMMISSION", 20 ); } else { define( "AFFILIATE_COMMISSION", 10 ); } } So basically if the user is a jv partner, the affiliate commisions are higher. I have a user that is a jv partner but it says he earns 10 when he should earn 20. I even echo'd the page for the jv variable and it says y. Users who jv is N show 10 which is the correct amount. Can you tell me what im doing wrong?
  12. Ok, disreguard my last post by doing a print_r($_COOKIE); It DOES display my stored cookie and the ref value. My only question is how can I get that value to populate my hidden form value of <?php if ($_REQUEST['ref']) echo "<input type=\"hidden\" name=\"referer\" value=\"".$_REQUEST['ref']."\" />"; ?> Do i request the cookie instead?
  13. Thanks for the quick response. I dont think its pulling the cookie once its set because I have a hidden value in my form <?php if ($_REQUEST['ref']) echo "<input type=\"hidden\" name=\"referer\" value=\"".$_REQUEST['ref']."\" />"; ?> If I hit mysite.com?ref=4 That hidden value shows 4 and should store a cookie But if i then go to mysite.com it should pull the cookie and show the hidden value of 4 but it doesnt. Any thoughts?
  14. Hey Guys, I need some help with cookies. What im trying to do is store an refferer id so if someone comes back to my webpage, the person who reffered them will get the credit. Here is what I have but it does not store the cookie. Any help ASAP would be much appreciated. $ref = $_REQUEST['referer']; if ( !$ref ) $ref = -1; if(isset($_COOKIE['mysite'])) { echo ""; } else { $Month = 2592000 + time(); setcookie(mysite, $ref, $Month); }
  15. Here is the error I get. Prob cause this is not defined Warning: unlink(imgfile): No such file or directory in /home/content/server/html/members/upload.php on line 46
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.