Jump to content

jimmyp3016

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Everything posted by jimmyp3016

  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
  16. Hey Guys, Can someone help me get this script up and running. I know I need to echo in a few lines where it says "use what you need" but its still giving me errors. Any help would be great. <?php require_once( "../database.cls.php" ); require_once( "../functions.inc.php" ); userPage(); $user = $_SESSION['user']; echo doHeader( "../" ); echo doNavBar(); ?> <?php if ($_SERVER['REQUEST_METHOD' ] == "POST") { /* SUBMITTED INFORMATION - use what you need * temporary filename (pointer): $imgfile * original filename : $imgfile_name * size of uploaded file : $imgfile_size * mime-type of uploaded file : $imgfile_type */ /*== upload directory where the file will be stored relative to where script is run ==*/ $uploaddir = "./images/uploads/"; /*== get file extension (fn at bottom of script) ==*/ /*== checks to see if image file, if not do not allow upload ==*/ $pext = getFileExtension($imgfile_name ); $pext = strtolower($pext ); if (($pext != "jpg") && ( $pext != "jpeg")) { print "<h1>ERROR</h1>Image Extension Unknown.<br>" ; print "<p>Please upload only a JPEG image with the extension .jpg or .jpeg ONLY<br><br>" ; print "The file you uploaded had the following extension: $pext</p>\n "; /*== delete uploaded file ==*/ unlink ($imgfile); exit(); } //-- RE-SIZING UPLOADED IMAGE /*== only resize if the image is larger than 250 x 200 ==*/ $imgsize = GetImageSize( $imgfile); /*== check size 0=width, 1=height ==*/ if (($imgsize[0] > 250) || ( $imgsize[1] > 200)) { /*== temp image file -- use "tempnam()" to generate the temp file name. This is done so if multiple people access the script at once they won't ruin each other's temp file ==*/ $tmpimg = tempnam("/tmp", "MKUP"); /*== RESIZE PROCESS 1. decompress jpeg image to pnm file (a raw image type) 2. scale pnm image 3. compress pnm file to jpeg image ==*/ /*== Step 1: djpeg decompresses jpeg to pnm ==*/ system ("djpeg $imgfile >$tmpimg"); /*== Steps 2&3: scale image using pnmscale and then pipe into cjpeg to output jpeg file ==*/ system("pnmscale -xy 250 200 $tmpimg | cjpeg -smoo 10 -qual 50 >$imgfile" ); /*== remove temp image ==*/ unlink ($tmpimg); } /*== setup final file location and name ==*/ /*== change spaces to underscores in filename ==*/ $final_filename = str_replace( " ", "_", $imgfile_name); $newfile = $uploaddir . "/$final_filename" ; /*== do extra security check to prevent malicious abuse==*/ if (is_uploaded_file ($imgfile)) { /*== move file to proper directory ==*/ if (!copy($imgfile,"$newfile" )) { /*== if an error occurs the file could not be written, read or possibly does not exist ==*/ print "Error Uploading File."; exit(); } } /*== delete the temporary uploaded file ==*/ unlink($imgfile ); print("<img src=\"$final_filename \">"); $db = new MySQL( DB_HOST, DB_USER, DB_PASS, DB_NAME ); $db->query( "UPDATE user SET picture='$final_filename' WHERE id = ".$user->id ); $q = $db->query( "SELECT * FROM user WHERE id = ".$user->id ); $user = $q->getNext( "object" ); $_SESSION['user'] = $user; } ?> </head> <body bgcolor="#FFFFFF"> <h2>Upload and Resize an Image</h2> <form action="<?php echo $_SERVER['PHP_SELF' ]; ?>" method="POST" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="50000"> <p>Upload Image: <input type="file" name="imgfile"><br> <font size="1">Click browse to upload a local file</font><br> <br> <input type="submit" value="Upload Image"> </form> <?php echo doFooter( "../" ); ?> <?php /*== FUNCTIONS ==*/ function getFileExtension($str) { $i = strrpos($str,"." ); if (!$i) { return "" ; } $l = strlen($str ) - $i; $ext = substr ($str,$i+1,$l ); return $ext; } ?>
  17. ahh the 2 && signs! Hey im still learning Thank you for the help. Everybody has to start someplace right?
  18. Hey guys, Im pretty new to php and mysql and was wondering how to write an if statement that checks 2 conditions. Here is what im trying to do. ------------------------------------------------ If password = blank AND membership = 2 echo "whatever i want" Else echo "nothing" ------------------------------------------------ Could someone help me out with this real quick? Thanks!
  19. Hey Guys, I am running an older verison of sql on my webhost and it does not support nested querys which was enabled in 4.1 i think. How can I break up this statement so my code will run on my server? [code] $sql = "SELECT *, COUNT(id) AS referrals FROM user WHERE id IN ("; $sql .= "  SELECT DISTINCT u.referral FROM user u, transaction t WHERE u.id=t.userID"; $sql .= ") GROUP BY id";[/code] Any help would be great thanks
  20. In the initial account creation, does putting PASSWORD('$p') make it encrypted like MD5('$p') would? $p being my password variable
  21. So I got the script working and it sends me the random password but it does not store it in the database as MD5. It stores it as the random password so when i try to login it doesnt work. What could be wrong? Here is my script... [code] include "config-site.php"; require_once( "functions.inc.php" ); echo doHeader(); $email = $_GET['email']; if ($email != "") {   // Open database...   $db = mysql_connect("$localhost", "$databaseuser", "$databasepasswd");   mysql_select_db("$databasename",$db);   // Get password and email from database...   $sql="SELECT password,email FROM user WHERE email='$email'";   $result = mysql_query("$sql",$db);   if (mysql_num_rows($result) != 0) {     // Store in variables...     $password = mysql_result($result, 0, "password");     $email = mysql_result($result, 0, "email");   }     $str = ''; for ($i=1; $i<=10; $i++){ $set = array(rand (65,90),rand(97,122)); $str .= chr($set[rand(0,1)]); }     $newencpass = md5($str);     $sql = "SELECT * FROM user WHERE email='$email'";   $sql = "UPDATE user SET password = '$str' WHERE email='$email'";   $result = mysql_query($sql,$db) || die("Can't query DB: ". mysql_error());   // Close database...   mysql_close($db);   if ($email != "") {     // Send message with password... $message="Your New Password is:\n\n"; $message.="Login : $email\n\n"; $message.="Password : $str \n\n"; $recipient="$email";     $subject="MySite.com - Login-Pass Request";     mail("$recipient","$subject","$message","From: passrequest@mysite.com \nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit");   } [/code]
  22. [quote author=Hypnos link=topic=123086.msg508325#msg508325 date=1169172528] You can not (effectively) undo an MD5 encryption (assuming you're using MD5). That's why you use it. md5() encrypts. It doesn't unecrypt. This forces you to take the more secure route of generating a random password and emailing it to them. [/quote] Is there a pre maid script out there that you know of that can do this so i can just update my table name ect?
  23. Hey Guys, I have a forgot password script i wrote that a user enters their email address and then it mails them their username and password. Everything works correctly except... ...It mails them the encrypted password in the database. How do I decrypt it and mail them their actual password instead of random numbers and letters? Any help will be greatly appriciated!
  24. [quote author=thorpe link=topic=121872.msg501977#msg501977 date=1168488981] How? Where do you define $mailbody? [color=red]In the include 'corpmessage.php'; line[/color] Also, are you aware that variables do NOT need to be surrounded by quotes? [color=red]Im still pretty new to php so I dont know exact syntax[/color] If your not getting the mysql_error() as defined within the die() then your query is fine. If userName is not being updated then $user is empty. However this would normally trigger an error unless your userName field allows nulls. [color=red]Should I set the userName field to Null?[/color] [/quote]
×
×
  • 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.