Jump to content

bob_the _builder

Members
  • Posts

    206
  • Joined

  • Last visited

Everything posted by bob_the _builder

  1. Is there away to format links that are loading pages via jquery/ajax so search engines can index the pages? Thanks
  2. Thanks for all you help Barand! Just one more thing.. MAX(DATETIME(t.timeslot)) as latest Should that not show the date and time printing when $latest?
  3. Ops I should have looked harder.. It does appear to be bringing back the correct clientid's.. but listing the timeslot field as DESC.. The reason for SELECT * is so within the query loop, taking firstname, email, timeslot etc and dispatch an email to those clients.. The date field needs to be the latest (last) appointment date/time so we can say your last visit was on ####. Can the query be altered to bring the latest timeslot as the result? Thanks
  4. It looks like it is briging back their first appointment ever.. Should it not bring back any results at all, seems like a random result.. If I do 32 days ago I get: Fri 01 Jun 2012 @ 4:00 pm -> Josh Thu 26 Jul 2012 @ 11:00 am -> Chris Again, a match that doesnt fall within 32 days old.. Lost on this one.
  5. I just run the query based on 15 days ago.. Tue 10 Jan 2012 @ 1:00 pm -> Geoff Fri 20 Jan 2012 @ 12:00 pm -> Keith Fri 24 Feb 2012 @ 11:30 am -> Greg Mon 14 May 2012 @ 2:00 pm -> Darion Wed 23 May 2012 @ 5:30 pm -> Eroll Mon 03 Sep 2012 @ 2:00 pm -> Michelle Wed 12 Sep 2012 @ 11:30 am -> Lisa Some of these dates are going back months.. The idea is to pull out records that are exactly 15 days older than today, so they only get notifiyed once.. $sql = mysql_query("SELECT c.*, t.* FROM timeslots as t JOIN clients as c ON c.clientid = t.clientid GROUP BY c.clientid HAVING MAX(DATE(timeslot)) = CURDATE() - INTERVAL 15 DAY");
  6. I run a test using my code and got one result of latest appointment being 30 days ago.. When I run you code I got no result.. I should have got back the same one result, as that is the latest appointment = 30 days ago. I guess because the field is date/time.. and your code is taking the time stamp into consideration so looking for appointment exactly 30 days to the minute?
  7. Not exactly.. thats what my posted script does.. I need to pluck out anyone who had an appointment 30 days ago, but disregard anyone who had made an appointment within that 30 days or ay time in the future.. Its so an email can be dispatched to any client that hasnt been in for 30 days and havnt booked another appointment since then.. But let me check that.. I may have read your post wrong..
  8. This is based on appointment time slots.. The following code grabs any clients who had an appointment 30 days ago.. $sql = mysql_query("SELECT t.*, c.* FROM timeslots as t JOIN clients as c ON c.clientid = t.clientid WHERE timeslot >= CURRENT_DATE - INTERVAL 31 DAY AND timeslot < CURRENT_DATE - INTERVAL 30 DAY"); But I also need to exclude anyone that has another appointment booked between 29 days ago and into the future.. if that makes sence? An example of results from the above script: These people had an appointment 30 days ago, so would be emailed.. Fri 31 Aug 2012 @ 8:30 am -> Alan Fri 31 Aug 2012 @ 12:30 pm -> Martin Fri 31 Aug 2012 @ 3:00 pm -> Craig Fri 31 Aug 2012 @ 9:00 am -> Sue Fri 31 Aug 2012 @ 2:00 pm -> Kellie Fri 31 Aug 2012 @ 9:30 am -> Karen But these 2 names allready have up coming appointments.. Thu 13 Sep 2012 @ 1:00 pm -> Kellie Fri 14 Sep 2012 @ 3:30 pm -> Martin So need to be excluded from the results above.. Basically looking for people that havnt been back in the last 30 days and havnt booked any further appointments.. Thanks
  9. It appears to work just using prefix path ../home/###/files/
  10. Via script is the plan.. Already have my cart code sorted, but files are being uploaded to a public folder via the admin area..
  11. Uploading the files to the directory.. I have them going to a folder in the public directory.. should I shift them after upload or can they be uploaded directly to that location
  12. Ahh yes I tried / and ./ but not ../ which works..
  13. Here is what I am trying to make work.. But get responce 'Requested file does not exist' When you say ouside web root you mean in Root Directory? I know the $hiddenPath exist as I have connected via ftp and uploaded a few files.. // Path to downloadable files $hiddenPath = "home/####/files/"; // Variables if (!empty($_GET['file'])){ $file = str_replace('%20', ' ', $_GET['file']); $category = (!empty($_GET['category'])) ? $_GET['category'] . '/' : ''; } $file_real = $hiddenPath . $category . $file; $ip = $_SERVER['REMOTE_ADDR']; // Check to see if the download script was called if (basename($_SERVER['PHP_SELF']) == 'getfile.php'){ if ($_SERVER['QUERY_STRING'] != NULL){ // Hack attempt check if ((substr($file, 0, 1) == '.') || (strpos($file, '..') > 0) || (substr($file, 0, 1) == '/') || (strpos($file, '/') > 0)) { // Display hack attempt error echo("Hack attempt detected!"); die(); } // If requested file exists if (file_exists($file_real)){ // Get extension of requested file $extension = strtolower(substr(strrchr($file, "."), 1)); // Determine correct MIME type switch($extension){ case "png": $type = "video/x-ms-asf"; break; case "avi": $type = "video/x-msvideo"; break; case "jpg": $type = "application/octet-stream"; break; case "jpeg": $type = "video/quicktime"; break; case "mp3": $type = "audio/mpeg"; break; case "mpg": $type = "video/mpeg"; break; case "gif": $type = "video/mpeg"; break; case "rar": $type = "encoding/x-compress"; break; case "txt": $type = "text/plain"; break; case "wav": $type = "audio/wav"; break; case "pdf": $type = "text/plain"; break; case "doc": $type = "audio/wav"; break; case "jpeg": $type = "text/plain"; break; case "bmp": $type = "audio/wav"; break; case "wma": $type = "audio/x-ms-wma"; break; case "wmv": $type = "video/x-ms-wmv"; break; case "zip": $type = "application/x-zip-compressed"; break; default: $type = "application/force-download"; break; } // Fix IE bug $header_file = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? preg_replace('/\./', '%2e', $file, substr_count($file, '.') - 1) : $file; // Prepare headers header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public", false); header("Content-Description: File Transfer"); header("Content-Type: " . $type); header("Accept-Ranges: bytes"); header("Content-Disposition: attachment; filename=\"" . $header_file . "\";"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . filesize($file_real)); // Send file for download if ($stream = fopen($file_real, 'rb')){ while(!feof($stream) && connection_status() == 0){ //reset time limit for big files set_time_limit(0); print(fread($stream,1024*); flush(); } fclose($stream); } }else{ // Requested file does not exist (File not found) echo("Requested file does not exist"); die(); } } }
  14. Yea I have googled it, hence my asking if that is the best option.. Was just after some opinions of other as to the best way.. whether I could just have a folder in the public directory with maybe an index page to hide the contents and download.php script from there.. I have been playing with a script, but it keeps sayng file doesnt exist even tho I know it does.. Wondering if the folder I am trying to use cant be accessed without a password.. The folder I am trying to access is in the Root Directory apposed to WWW Directory
  15. Thats not where the problem is.. I am wanting to know the best way to secure the files so they cant just be accessed by anyone.. so posibally by storing the files outside the public folder and accessing them using headers, file path hidden etc
  16. They will need to buy the file before download, then I guess they would need the ability to re download if they lost the file for what ever reason, that will be governed member member accounts..
  17. Hey, Whats the best method when wanting to sell digital files online.. Storing the files outside of public_html folder and using header() to access the files? Can files be ulpoaded to a folder outside the public_html using just a general file upload form? Thanks
  18. I am trying to capture the array of post variables on includes/cart-trans-process.php so process the request.. I used to use the following, but it only appearsd to work for single form variables apposed to an array of variables.. Im guesing that the use of id in the from locks it down to one variable not an array of variable.. ie <input id="utotal" name="utotal" type="text" size="8"> vers. <input id="utotal" name="utotal[]" type="text" size="8"> $("#cart-trans-process").live('click',function(){ var data = {utotal: $('#utotal').val(), total: $('#total').val(), method: $('#method').val(), firstname: $('#firstname').val(), lastname: $('#lastname').val(), email: $('#email').val(), transid: $('#transid').val(), }; $("#shop").html('<center><br /><br /><img src="./loading.gif"></center>'); $.post("includes/cart-trans-process.php", data, function(response){ $("#shop").html(response); },'text'); });
  19. Hey, im new to all the jquery stuff.. I cant get the function below to work proprely using serialize.. I guess I am way off track? $('#myForm').submit(function() { var data = $('#myForm').serialize(); $("#shop").html('<center> <img src="./loading.gif"></center>'); $.post("includes/cart-trans-process.php", data, function(response){ $("#shop").html(response); },'text'); }); echo '<form name="myForm" id="myForm">'; $sql = mysql_query("SELECT FROM trans ORDER BY firstname ASC"); while($row = mysql_fetch_array($sql)) { foreach($row as $key=>$value){ $$key = ValidateOutput($value); } echo '<tr> <p><a href="includes/cart-trans-delete.php?transid='.$transid.'" id="cart-trans-delete">x</a> | '.$firstname.' '.$lastname.' - <b>$'.$total.'</b></p> <p><input id="utotal" name="utotal[]" type="text" size="8"></p> <p><input type="hidden" id="method" name="method[]" value="'.$method.'"></p> <p><input type="hidden" id="firstname" name="firstname[]" value="'.$firstname.'"></p> <p><input type="hidden" id="lastname" name="lastname[]" value="'.$lastname.'"></p> <p><input type="hidden" id="email" name="email[]" value="'.$email.'"></p> <p><input type="hidden" id="total" name="total[]" value="'.$total.'"></p> <p><input type="hidden" id="transid" name="transid[]" value="'.$transid.'"></p> <input type="submit" id="myForm" value="Submit">'; } echo '</form>'; With the code above the entire page reloads.. Appears it doesnt link to the jquery function.. Thanks
  20. Thanks.. array_map did the job..
  21. Yea the next step where the array data is used is below.. But I cant be sure where to use trim on $array data foreach($array as $eacharray) { /* Check if product code in each line is in the array of $productcodesarray pulled from the database */ if(in_array($eacharray[0],$productcodesarray)) { /* The product code was found, update the record */ $code = trim($eacharray[0]); $description = trim($eacharray[1]);
  22. In the following code, where would you use trim to clean whitespaces from fields within the csv? $handle = fopen("products.csv", "r"); while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $array[] = $data; } Thanks
  23. Thanks for the wise words ChristianF.. The page was being called via a jquery function into a div.. I forgot to put session_start(); at the top of the page Sorry team, thanks for the help
  24. Sorry that was while playing with variations to make it work.. originally there were no quotes and still didnt work.. Is it to do with the number in the session variable [bMNHYR] => 1?
×
×
  • 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.