Jump to content

A JM

Members
  • Posts

    249
  • Joined

  • Last visited

Everything posted by A JM

  1. I have the following SQL executing on MySQL 5.6 and need a single statement solution or another solution on how to get a single recordset??? This is a working SQL statement with the following results. week cumulative_A cumulative_M cumulative_E cumulative_W 1 0 5 24 7 2 0 5 35 14 10 0 14 54 22 11 0 17 54 55 12 0 17 62 65 13 0 17 68 77 14 0 17 77 86 Essentially the SQL below executes in 2 statements, 1 for establishing variables and the other to populate them, my webpage isn't able to deal with that. Any ideas on how to address?? Thanks, SET @csumA:= @csumM:= @csumE:= @csumW:=0; select week, (@csumA := @csumA + A) as cumulative_A, (@csumM := @csumM + M) as cumulative_M, (@csumE := @csumE + E) as cumulative_E, (@csumW := @csumW + W) as cumulative_W from( SELECT WEEK(s.date) week, SUM(CASE WHEN s.user_id = 50 THEN s.points ELSE 0 END) AS A, SUM(CASE WHEN s.user_id = 51 THEN s.points ELSE 0 END) AS M, SUM(CASE WHEN s.user_id = 52 THEN s.points ELSE 0 END) AS E, SUM(CASE WHEN s.user_id = 53 THEN s.points ELSE 0 END) AS W FROM users u, scores s, league l WHERE u.user_id = s.user_id AND l.league_id = s.league_id and l.league_name = 'Sunday League' AND year(s.date) = YEAR(sysdate()) GROUP BY s.date ORDER BY s.date ASC) PTS;
  2. Yes, that is where I ended up since it was becoming difficult to rectify. I've modded the UploadHandler.php in the Jquery_File_Upload plugin its strange that it doesn't deal with those situations already. Many thanks for the input. AJM.
  3. Is there a better way to address file downloads? Maybe a jquery addin or something similar and sort of remove the php coding for the download by passing it the variables of the file, location, etc.? Just trying to remedy the problem with an alternate solution. Thanks for the insight. AJM,
  4. It seems to be tied to the down load somehow since the file name looks correct in the URL that is passed. In this cas I tried a simple .jpg that wen clicked is assumed to be a .wav file?? <?php $ID=stripslashes($_GET['recordid']); $file = $_GET['file']; // the absolute path to your directory storing your files. $path = '../claims/' . $ID . '/'; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"$file\""); header("Content-Description: File Transfer"); header('Accept-Ranges: bytes'); header('Content-Length: ' . filesize($file)); readfile($path.$file); ?>
  5. I didn't think to use them together..rawurlencode() or htmspecialcharacters()... duh! I'm still experiencing issues with it though (see attached) The 2nd file, seems to pass correctly to the download but then appears the "_". AJM, EDIT I've tried to break it up like this: $dir = dir($path); while($value = $dir->read()) { if($value != '.' && $value != '..') { $file = htmlspecialchars(rawurlencode($value), ENT_QUOTES); echo "<form method='post' action='"?><?php echo"' ><a href='/pages/download.php?file=$file&recordid=$claim_doc_folder'> $value </a></form>"; } }
  6. So digging further... ugh. I can accomodate for files with a single quote by using the following: $file = htmlspecialchars($value, ENT_QUOTES); However when the user clicks on the link to download the file the file name now has an "_" underscore in the name, from the GET() function? 2003 Baja 20_' Outlaw.pdf <?php $ID=stripslashes($_GET['recordid']); $file = $_GET['file']; // the absolute path to your directory storing your files. $path = '../claims/' . $ID . '/'; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=\"$file\""); header("Content-Description: File Transfer"); header('Accept-Ranges: bytes'); header('Content-Length: ' . filesize($file)); readfile($path.$file); ?>
  7. After further researching - the problem appears to be related to a filename that contains a single quote... I'm not sure how to create the URL to deal with that?
  8. requinex, Having a similar issue after I encapsulated the HTML attributes with quotes... seems like it should be working, thoughts? I'm still seeing the file name get truncated at spaces.. <?php //initialize the session if (!isset($_SESSION)) { session_start(); } $doc_folder= $_SESSION['port_recordID']; //variable comes from detail page only used to carry claimnumber $path = "../claims/" . $doc_folder . "/"; $dir = dir($path); while($file = $dir->read()) { if($file != '.' && $file != '..') { echo "<a href='/pages/download.php?file=$file&recordid=$doc_folder'> $file </a>"; } } ?>
  9. I found the answer to my issues in that have multiple php tags that need to be combined and they had a blank line in between them, ugh!!!! http://www.tech-recipes.com/rx/1489/solve-php-error-cannot-modify-header-information-headers-already-sent/ Many thanks for the suggestions and assistance. AJM,
  10. The offending code does not have any echo or print functions within it but there is some echo'ing going on in some of the JavaScript.. I've removed the offending echo() from the javascript section and tried the page again but still get the same error, I'm confused on how to track this down. The form is posting correctly as the data is written as designed I just can't get it past the header() redirect. Is there an alternative on how to track down where the offending code is?
  11. Is that output to the user or submitted to the DB? Just not 100% on what "output" is referring to.. Thanks,
  12. I'm having a problem solving the following problem that I am having with the Submittal of a form. After the Submit button I am inserting records into a database and then wanting to redirect to a confirmation page but I'm getting the following error and am not sure how to resolve the problem. Any suggestions of ideas I can follow? Thanks. AJM, Warning: Cannot modify header information - headers already sent by (output started at /home/content/91/4761691/html/pages/claim.php:82) in /home/content/91/4761691/html/pages/claim.php on line 226
  13. Many thanks for the help, that resolved the problem. Can you elaborate on the security issue and how the htmlspecialchars() functions aleviates the problem? AJM,
  14. Thanks for the insight and the corrections requinix... I'm still a bit green with PHP, trying to learn as I go. Just greenness on the tags, just wasn't paying attention to it... AJM,
  15. I think I need to lean more towards urlencode()? As long as the filename doesn't contain a "space" then the routine works as designed.. I' m trying to figure out what's happening first so that I can make a better assesment of how to fix it, thanks for the suggestion. AJM,
  16. I've got a problem hopefully someone can assist with when unlinking files it has to do with file names that have spaces in them. If the file name contains no spaces the name is displayed correctly and the URL is complete. However if the file name contains spaces, the filename is displayed correctly but the URL is truncated at the space and the delete routine doesn't work, I must be missing something obvious here???? Any ideas on how to fix? <?php //initialize the session if (!isset($_SESSION)) { session_start(); } $claim_folder= $_SESSION['port_recordID']; //variable comes from detail page only used to carry claimnumber $path = "../docs/" . $doc_folder . "/"; if(isset($_GET['delete']) && $_GET['delete']=='true') { $fname = $_GET['deletefile']; $fID = $_GET['recordid']; $path = '../claims/' . $fID . '/'; print_r($path.$fname); //exit(); unlink($path.$fname); //header('location: file_list.php'); die(); } ?> <?php $dir = dir($path); while($file = $dir->read()) { if($file != '.' && $file != '..') { echo "<form method='post' action="?><?php echo $_SERVER['PHP_SELF'].'?delete=true&recordid='.$doc_folder.'&deletefile='.$file;?> <?php echo" ><a href= /pages/download.php?file=$file> $file </a> <input type='submit' value='delete'></form>"; } } ?> AJM,
  17. Please ignore this post. As soon as I posted it I figured out the issue, go figure... it was a form related problem and not a script related issue. Sorry for the noise. A JM,
  18. I have a PHP form that is currently using the jquery datepicker (1.7.2, yes I know old..) but for the life of me I can't figure out why I can't get the autocomplete (https://jqueryui.com/autocomplete/) to work. It's not firing the autocomplete function unless I do a page refresh however my datepicker is working fine... Should/Can I just add the autocomplete to the datepicker function, will that work or does it need to be a seperate function? Initially I had 2 seperate function() <Script>> and realized that probably wasn't going to work since the function name was the same... <script type="text/javascript"> $(function() { var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ]; $("#vis_los_date").datepicker({changeMonth: true,changeYear: true, onClose: function(set_date) { document.getElementById('los_date').value = document.getElementById('vis_los_date').value; } }); $( "#tags" ).autocomplete({ source: availableTags }); }); </script> Looking for some suggestions or thoughts... thanks. A JM,
  19. Ah!!! Oversight on my behalf for the .value instead of .innerHTML... That got it, thanks! AJM,
  20. The form works with the <input> and is fully functional the problem is incorporating the information from the ajax call..
  21. Thanks for the reply mac_gyver. I was able to get past that portion of the code and it made sense after working through it. I'm basically now hung up on the <div> tag and the <input> tag since this is a form for user input should I change the <input> to a <text> instead, do you see any issues with that? AJM,
  22. I found the issue with the source, basically the elements werent being set to the variables correctly.. document.getElementById("txtHint2").innerHTML=update[0]; document.getElementById("txtBlah2").innerHTML=update[1]; But like all custom work I ran into another problem.. since the elements require <div> tags to populate the result and the fields that I am attempting to fill with the users selection are <input> I'm not having much luck at making this work since it appears that you can't have a <div> and an <input> together, anyone have any ideas? AJM,
  23. I'm close but can't get my <div> tags to update??? <script> function showUser(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { var response = xmlhttp.responseText; var update = new Array(); update = response.split('|$|'); if(update.length !=0) { alert(update[0]); alert(update[1]); document.getElementById("txtHint2").innerHTML==update[0]; document.getElementById("txtBlah2").innerHTML==update[1]; } } } xmlhttp.open("GET","../Connections/request.php?q="+str,true); xmlhttp.send(); } </script> </head> <body> <form> <select name="txtHint" onchange="showUser(this.value)"> <option value="">Select a person:</option> <option value="1">Fredas</option> <option value="2">Colony</option> <option value="3">Indiana</option> </select> </form> <div id="txtHint2"><b>Person info will be listed here.</b></div> <div id="txtBlah2"><b>Person info will be listed here.</b></div> </body> </html>
×
×
  • 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.