Jump to content

DarkWater

Members
  • Posts

    6,173
  • Joined

  • Last visited

    Never

Everything posted by DarkWater

  1. Try something like: $myRaidDate = strtotime("{$_POST['Year']}/{$_POST['Month']}/{$_POST['Day']}"); Then, in your query: mysql_query("INSERT INTO raids (RaidNum, RaidDate, RaidLength) VALUES ('$newRaidNum', FROM_UNIXTIME('$varRaidDate'), '{$_POST["Length"]}')"); You don't need all that crazy quoting and concatenation and stuff. Variables interpolate into double quoted strings.
  2. GD takes a ton and a half of memory.
  3. Actually, parse errors can't be trapped by any set_error_handler()'s because the functions aren't processed before syntax checking and stuff is done, it seems. Test script: <?php function myErrorHandler($errno, $errstr, $errfile, $errline) { print $errstr."aa"; } set_error_handler("myErrorHandler"); `touch foo_file`; //SYNTAX ERROR NEXT LINE :: 'foo_file' was not present in my working directory, so it doesn't seem to process until after it's all said and done. You should be checking for parse errors before running any live scripts (where error handling is important) anyway. P.S: Zend has the CODE to run any user defined error handler, even for E_PARSE, but it doesn't matter because you can't set an error handler UNTIL the script parses.
  4. I just went and looked through the PHP source, and it turns out that they get clever and actually do call any user defined error handlers for even parse errors. Your issue is that you're defining the function AFTER using it in the set_error_handler() call, as far as I can tell. P.S: If anyone is interested: void zenderror(char *error) { zend_error(E_PARSE, "%s", error); } Note: zenderror is the equivalent of yyerror #define yyerror zenderror Relevant parts of zend_error(): //...snip... /* Obtain relevant filename and lineno */ switch (type) { case E_CORE_ERROR: case E_CORE_WARNING: error_filename = NULL; error_lineno = 0; break; case E_PARSE: case E_COMPILE_ERROR: case E_COMPILE_WARNING: case E_ERROR: case E_NOTICE: case E_STRICT: case E_WARNING: case E_USER_ERROR: case E_USER_WARNING: case E_USER_NOTICE: case E_RECOVERABLE_ERROR: if (zend_is_compiling(TSRMLS_C)) { error_filename = zend_get_compiled_filename(TSRMLS_C); error_lineno = zend_get_compiled_lineno(TSRMLS_C); } else if (zend_is_executing(TSRMLS_C)) { error_filename = zend_get_executed_filename(TSRMLS_C); error_lineno = zend_get_executed_lineno(TSRMLS_C); } else { error_filename = NULL; error_lineno = 0; } break; default: error_filename = NULL; error_lineno = 0; break; } if (!error_filename) { error_filename = "Unknown"; } va_start(args, format); /* if we don't have a user defined error handler */ if (!EG(user_error_handler) || !(EG(user_error_handler_error_reporting) & type)) { zend_error_cb(type, error_filename, error_lineno, format, args); //...snip... Nice.
  5. I'm fairly sure that parse errors are not handled by set_error_handler(). They're handled directly in the yacc grammar that PHP uses to parse your file.
  6. The file itself isn't in memory...just the like, 50 bytes of data about it. Clearing the array is highly unnecessary. I'd try to optimize where it counts and make the memory intensive parts use less memory.
  7. What happens if you try to use the error handler with your html class thing that you're trying to load? Also, why are you using PHP4...?
  8. I think that everyone who agrees should put a link to http://catb.org/~esr/faqs/smart-questions.html in their signature. I'm going out right now, but I will when I get back, lol. I absolutely hate threads that ask for help 'liek dis'.
  9. Err, that's the point. It's not supposed to interpret it.
  10. Okay. Can you show me an example of the file that you want to parse? I can probably work out a parsing routine pretty easily with file_get_contents() and preg_match(). Give me some example data.
  11. Can I see your code for putting it back into the textbox? I'm 99% sure that you have it as a value="" attribute on a tag and you're not encoding the quote, so it's breaking the HTML.
  12. Wait. Is ad_keywords column a CSV with a bunch of keywords in it? If it is, that's horrible database design and should most definitely be rewritten into another table with a one-to-many relationship with the ads table.
  13. @flyhoney: I don't know if executing the script is that good. It'll take kind of long and potentially have side effects. @Mchl: That idea works too. Parsing it could be annoying though. xD
  14. Why not? just wondering... <?php echo mysql_real_escape_string(addslashes("Some random stuff ' ")); ?> OUTPUT: Some random stuff \\\' It completely wrecks your backslashes by using both of them.
  15. So the config data is stored in a 'site' class in each CMS? I'd suggest making a small rewrite to the class and have it load all the data from a configuration (.ini) file. The change will be transparent to the user (they won't notice a difference), and it would be much easier to read in.
  16. Don't use mysql_real_escape_string() AND addslashes(). Use the former.
  17. Call me crazy, but I think I'm entirely missing your goal here. What EXACTLY are you doing with your "site checker"? How is the site class being included multiple times?
  18. I'd suggest checking out MySQL's FULLTEXT index.
  19. I have a feeling that expireDate != NOW() because that wouldn't make any sense. "This expires...NOW."
  20. In case anyone else is interested: << < January 2009 > >> Wk Mo Tu We Th Fr Sa Su (1) 29 30 31 1 2 3 4 (2) 5 6 7 8 9 10 11 (3) 12 13 14 15 16 17 18 (4) 19 20 21 22 23 24 25 (5) 26 27 28 29 30 31 1 They had that on the Wiki article, which was actually rather informative. I never bothered learning about week numbering like that. Cool. EDIT: It won't line up for me, but you get the idea.
  21. Actually, the ISO specification says that the first week began on December 29th this year. EDIT: GingerRobot got it too. xD
  22. There are about 52.18 weeks in a year. I think that January 2nd this year falls after the 53rd week. It could have something to do with your computer's time on the Mac though. I don't know. Is it mission-critical?
  23. He just posted a tiny one line snippet. I'm fairly sure he already did that stuff before this line.
  24. I'm fairly sure that this would be completely JS.
  25. You can't name a field or table 'key'.
×
×
  • 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.