Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by CroNiX

  1. is it possible you don't have proper permissions to read the source file? You can test with is_readable($file);
  2. I'm sorry, I don't know what would cause an issue. It also worked fine in IE. Hopefully someone else can shine some light...
  3. This worked for me in chrome/firefox and opened the file save dialog box. I was able to open/view the pdf when opening the downloaded file. $file = 'C:\test.pdf'; $download_filename = 'test2.pdf'; header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="' . $download_filename . '"'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . filesize($file)); header('Accept-Ranges: bytes'); readfile($file);
  4. header("Content-Type: application/octet-stream"); //try this instead of application/pdf
  5. http://php.net/manual/en/function.header.php You are echoing stuff before you send your headers.
  6. Yeah just google "rainbow table" there are lots of sites dedicated to it, and some even have APIs lol
  7. Well I created a variable for that here and forced it to lower-case: $browser_name = strtolower($browser['browser']); so it's checking the $browser_name == lower-case browser names like 'firefox' instead of 'Firefox', which I think is would be more reliable.
  8. Haven't tried, but according to the docs this should work: //returns array of browser attributes $browser = get_browser(null, true); //get the name of the browser from the $browser array, but force to lowercase for comparison $browser_name = strtolower($browser['browser']); if($browser_name == 'firefox'){ echo "your browser is firefox"; }else if($browser_name == "chromium"){ echo "your browser is chromium"; }else if($browser_name = "chrome")){ echo "your browser is chrome"; }else if($browser_name = "explorer"){ echo "your browser is Internet Explorer"; }else{ echo "your browser was not detected"; } I'm not sure why you're using array_slice for this...
  9. The /e modifier has been deprecated in php >= 5.5 http://php.net/manual/en/migration55.deprecated.php
  10. You do realize this has been done many times before you attempted it? Have you tried googling for "php swear filter" or anything? There are lots of libraries out there that already are working, and probably a lot better than you can do trying from scratch because the problem is a bit more complex than I think you are considering. You don't want the filter to work on substrings for the reason that Jacques1 stated. "I assume you're talking about me" is a legitimate, clean piece of text. "ass" in assume should not be filtered. So you probably want it to work on individual words. That gets a bit complex for the regex because "you're an ass." (with a period after ass) is harder to match than "I think you're an ass dude." where ass is by itself. I'm sure there are regex modifiers that will do all of that, but trying to think of all main scenarios and then coding for it will be a bit of a challenge unless you are really good at regex. I'd suggest looking for something off-the-shelf and ready to go, all tried and tested.
  11. He is using wordpress, which restricts/filters $_GET, which is why this seeminhly easy problem is a bit more complex since it appears the global $_GET is being manipulated.
  12. I've always found those to be next to useless. You can always alter how you spell things and still get the intention of the word to come across. Are you going to be able to filter all possibilities, including misspellings and phonetics? No. I don't know what would be less offensive..to be called a dick, dik, diq, etc. All have the same intention.
  13. $doc = '##FILE##'; You're only setting a local variable, not manipulating the xml using simplexml. See an example of using simplexml to actually manipulate the xml: http://runnable.com/UnQMA-VaS1tAAABz/how-to-add-and-edit-elements-to-a-xml-using-simplexml-for-php
  14. Personally I'd just use a single image, and have it set to 100% within the container, and then just have the parent container be a certain % of the screen. It would automatically scale to the screen size, as well as switching between portrait/landscape on mobile. But yes, of course you can manipulate css with javascript. It would be a bit more complex due to the the many images.
  15. Show your current code if you've changed it and it's still not working.
  16. It's the same problem as the original. In your loop you have this line: $message = "<div id='events_holder'>"; Each time it cycles through the loop, it overwrites the previous value of $message, because you are setting it using only = You're basically doing this: $name = 'Fred'; $name = 'Bill'; $name = 'Janet'; echo $name; //outputs Janet put a $message = ''; just BEFORE the start of your loop, and change the line above in your loop to be a string concatenation instead of a = $message .= "<div id='events_holder'>";
  17. //your includes... //connect to db //select db foreach(glob('/path/to/files/*.xlsx') as $filename) { $objPHPExcel = PHPExcel_IOFactory::load($filename); foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { //rest of your code } } //close db connection
  18. One thing in your code...you shouldn't be connecting to mysql or selecting the database within your loop. You just need to connect once and select the db once, unless it changes. Connect and select the db just once before any loop and then close the connection after the loops. You are already closing the connection after the loop. The loop should just be inserting into the database.
  19. glob will help you get the file names from a dir in the form of an array of file names. You can even specify *.xlsx to get only that file type. Once you have the files in an array, just loop through them and use your existing code using the filename in the array instead of your hardcoded filename. //your includes... foreach(glob('/path/to/files/*.xlsx') as $filename) { $objPHPExcel = PHPExcel_IOFactory::load($filename); foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { //rest of your code } }
  20. whats the question about target? Perhaps you should be looking these up in the HTML specs so you know what's legal/valid and what they do? https://developer.mozilla.org/en-US/docs/Web/HTML/Element http://www.w3.org/TR/html5/
  21. You can have multiple submits...just give them different values <input type="submit" name="submit" value="delete" /> <input type="submit" name="submit" value="add" /> <?php if (isset($_POST['submit'])) { //form was submitted (name = submit) $action = $_POST['submit']; if ($action == 'delete') { //the submit with value of "delete" was pressed } else if ($action == 'add') { //the submit with value of 'add' was pressed } }
  22. if (strpos($row['colorsyoulike'], 'blue') !== FALSE) { //$row['colorsyoulike'] contained 'blue' somewhere in the string } strpos() will return boolean FALSE if the string isn't contained in the search string. However, it would probably be better to use stripos() which is case-insensitive, so it will match blue, BLUE, Blue, BlUe etc.
  23. You can also add and subtract time directly in the query itself and not use php at all. SELECT DATE_ADD(your_date_column, INTERVAL 2 HOUR) AS incremented_date
  24. It's not as straightforward or simple as normal, because an iFrame can be compared to a "different web page" and not a part of the main page you are viewing. It's almost like having 2 tabs open in the browser. There are extra steps needed to access the iframed content.
  25. You should google for "jquery selector iframe". Basically you'll have to give your iframe an ID (it may already have it), and use that to access the contents() of the iframe, and then you can grab whatever elements are in the body of the iframe.
×
×
  • 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.