Jump to content

Garrett

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Everything posted by Garrett

  1. I have a simple script that imports all images in a folder to my site and generates thumbnails. It works, but on folders with a rather large amount of images (500+) it can reach the max execution time and give a fatal error. I could always break up my import folders into smaller chunks or increase the max execution time, but I am wondering if there is a different approach I could take. Is there a way to reset the execution time of a script by inserting some kind of a pause/delay?
  2. Thanks for the help. It appears to be working perfectly if there is only one set of code tags. But if there are 2+ sets of code tags it merges the first [ code=] tag with the last [ /code] tag. In addition to this it doesn't remove the line breaks from the first [ code=] tag to the next tag. Say I have this: [code] [ code=test]test test test[ /code] [code= test2]test2 test2 test2 test2[ /code] It will appear like this : test test test[ code] [ code=test2] test2 test2 test2 It seems it is removing the / on the first end code tag. Any help would be great.
  3. On my website users can input data into a textarea and it will store it in the mysql database. But, I am unsure on how to prevent against mysql injections without using mysql_real_escape_string since I need to be able to display " " and / if the user enters it. Basically similar to how a forum post displays text data is what I need to do.
  4. This what I am doing and trying to achieve: I have a text area on my website that allows users to input data into a mysql database. When a user tries to view a specific page it display the entered data to them using nl2br() to form the line breaks. Now I am allowing use of bbcode and I have [ code] and [ /code] tags. This allows text to be entered unformatted which it surrounds with a div and pre tags. The problem is the nl2br() and pre combined are causing double new lines. So I need to be able to remove line breaks from only inside of [ code] [/code] I have this regex: /\[code\=(.*?)\](.*?)\[\/code\]/is But I am unsure on how to edit it to remove line breaks. Any help would be great.
  5. I have the following: $bb_replace = array ('/(\[[bb]\])(.+)(\[\/[bb]\])/s','/(\[url=)(.+)(\])(.+)(\[\/url\])/s','/(\[code=)(.+)(\])(.+)(\[\/code\])/s'); Now it works...but it appears to use the last occurrence of a tag. For example: [ code=test] something ... ... [ /code] [ code=test2] something ... ... [ /code] [ code=test] will use the very last occurrence of [ /code], thus combining everything into the same block. Hopefully my description of the bug is easy to understand what is going on. Anything that can help would be great.
  6. I have a set of tags [nohtml] [/nohtml] On my website a user submits a form containing data in a text area. This can include html, but I want to give the user a simple option to disable html on a portion of it. This is where the nohtml tags come in. For example say a user submits this: <a href="test.php">test</a> <br /> [nohtml] <a href="test2.php">test2</a> [/nohtml] The regex should grab all data within (not including) the [nohtml] and [/nohtml] tags. It should format the grabbed data with htmlentities(). After all is done it should look like this: (test would be a hyperlink) test <a href="test2.php">test2</a> I am unsure on how to do this all. Any help would be greatly appreciated.
  7. Before format: <a href="a.html">a</a> [nohtml] <a href="b.html">b</a> [/nohtml] After format: (a being a link) a <a href="b.html">b</a>
  8. I have a mysql database that allows users to enter content with html, but I also want to have a tag that will disable the html between it for example: <a href="a.html">a</a> [nohtml] <a href="b.html">b</a> [/nohtml] Thus it should look like after formatting: a <a href="b.html">b</a> How would I go about doing this?
  9. I am adding caching to my website and when writing to the file using fwrite I am getting: Warning: fwrite(): supplied argument is not a valid stream resource My folder/file permissions for the target folder and the file running the php script is 755. This is my code: $cache_file = "cache/header.html"; if (file_exists($cachefile)) { include($cachefile); exit; } ob_start(); ... ... $fp = fopen($cachefile, 'w'); fwrite($fp, ob_get_contents()); fclose($fp); ob_end_flush(); Any help would be great.
  10. I'm exporting data from a game that allows players to use (almost) any characters in their names.
  11. I get this error when inserting a string that has a letter with an accent over it into my mysql db. Illegal mix of collations (swe7_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' I tried changing it to utf8_general_ci. It removes the error but it converts my entered string by removing everything except the first letter (including the letter with the accent over it). How do I fix this?
×
×
  • 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.