Jump to content

cyber0ne

Members
  • Posts

    56
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://www.cyber0ne.com
  • ICQ
    0

Profile Information

  • Location
    Columbia, SC

cyber0ne's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Excellent, it's working now. And nice tip on glob, thanks!
  2. This is probably a simple one, but so far my searches have turned up no answer...I use "$fileHandle = opendir($directoryPath);" in a function to open a directory on my server (after which time, I will iterate through the files and put certain ones into an array). Normally, this works fine, but testing has found that it errors out when the $directoryPath contains a single quote (or potentially any of a short list of special characters, but so far this is the only one that's been found in testing).The error is:opendir([DIRECTORY_NAME]) [<a href='function.opendir'>function.opendir</a>]: failed to open dir: No such file or directory(of course, replace [DIRECTORY_NAME] with the actual directory name)One thing of note is that, in the error, it looks like it inserts the slash before the single quote automatically (and, of course, when I tried wrapping it in addslashes() it just doubled up on the slashes).Any ideas what I need to do here? I know the directory exists, that part's been triple-checked. It's found earlier in the script by using the same function to list all directories in the current directory. I can iterate up and down the entire tree, and the only directories that give me trouble are, without exception, the ones with a single-quote in the name.
  3. Ah, you're right about that. But wouldn't that hidden field still be available in $_POST? In any event, I don't really need that hidden field. And if I need any other $_POST values on that form, I can hop on over to the PHP forum.Thanks
  4. This may be a very simple problem that I'm just not seeing, but maybe another set of eyes looking at it will be able to pick out what I'm doing wrong. I have some PHP code that outputs the following editavatar.php (stripped down for brevity): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html> <head> <title>cyber0ne.com</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <form action="/users/editavatar.php" method="POST" enctype="multipart/form-data"> <input type="file" class="POST" name="userAvatar" /><br /> <input type="hidden" name="updateAvatar" value="1" /><input type="submit" name="postAvatar" value="Submit" /> </form> </body></html> For some reason, whenever I post back with the Submit on the form, the post values (in the $_POST array in PHP) for userAvatar and updateAvatar are empty. Is there something wrong with the HTML on this that would be causing the post to be empty, or in some way incorrect?
  5. I was thinking of that this morning, ya. The output from the Japanese/English page is definitely using UTF-8, but I can't seem to find a way to scrape it properly in PHP, that's my problem.I have the entire output of the page coming to me as a string. First I try grepping out the Japanese part and then run that part through utf8_encode(), but it comes out as nonsense (not properly encoded). Then I tried running the entire page through utf8_encode() and then grepping out the Japanese part, but it still wasn't properly encoded. Tried the same stuff with utf8_decode() (that might have been a silly change, or maybe the first one was silly, but like I said I'm just now learning about character encoding), same problem.I guess what I need help with is not the character encoding itself, but just how to handle it properly in my PHP code.
  6. I need to build a simple little page that scrapes some Japanese text off of another page and feeds the text through BabelFish and scrapes the response. Sounds simple enough, but I seem to be having trouble with the character encoding (a subject I'm just now beginning to learn).The page I'm grabbing is mostly English, it just has some Japanese buried in there. Can anyone point me to some sample code that shows how to grab a properly encoded response from such a page, so that I can feed it through a regexp to parse out the non-English part?
  7. Indeed it does... I guess the problem lies elsewhere. I know that function is returning a 5-element array. Maybe I have a typo somewhere or something simple like that.In any event, you've given me something to go on. Thanks
  8. Can PHP store an array as a value in a session variable? The following code seems to suggest that it can't since it gives me an error, but I wonder if there's maybe something else I just need to do or if someone has figured out a way to at least achieve the same functionality: $_SESSION["UserGroups"] = {function that returns an array};$temp = $_SESSION["UserGroups"];echo $temp[count($temp) - 1];exit; Is this something that can't be done by design, or is there a way to have an array follow a session? I did notice that count($temp) is 2 in the above code (though the original array returned by the function had 5 elements), but I don't know why...
  9. Awesome, you've been very helpful!Thanks!
  10. That looks really useful, thanks!I have a question about the bitmask for those constants and how it's applied in the code. In the example, I see: // we will do our own error handlingerror_reporting(0); Is this where that bitmask is being applied? Does the 0 mean that any and all of the aforementioned constants will be automatically caught by this error handler?For example, suppose somewhere in my code I forget to check for the existance of a file before using it in a require() statement. By default, the script halts execution and an error is written to the vhost's error log. With this code in place, would that behavior be pre-empted by the custom error handler?
  11. Supposing I have a vhost in apache that's hosting an entirely php-driven website, is there a way to have any and all fatal errors (or any class of error that causes the php script to stop executing) present the user with a standard catch-all error page customized for that vhost?Basically, I'd just like to have a default "I'm sorry, but an error occurred" page with some contact info, the company logo, etc. and have all errors for the site send the user to that page.Any ideas?
  12. I have a form where the user inputs DateTime values. They are "encouraged" to use the format:MM/DD/YYYY HH:mmWhat I need to do in my code, however, is validate the input from the form. I need to make sure that what they enter is a complete and valid date/time. Then, I need to re-format it to this:YYYYMMDDHHmmSS (where SS will just be 00)I'm still pretty new to PHP, but is there anything built-in that can help me with this? Maybe create some kind of datetime object with the passed string, use that object to check its own validity (assuming it didn't error out on creating it with an invalid string), and get output from that object in a custom format?Any help would be much appreciated, thank you.
  13. Well, most of what I've seen via Google just display everything as a long list of items, with categorization between classes and methods done by making their headings larger. But it's all black text and difficult to find anything specific.I was just hoping that someone would have written something that divs things up nicely and makes a document that can easily be browsed by someone unfamiliar with the code that's being documented.Though, the more I looked into this today, the more I think I'll end up having to use a tool to generate multiple XHTML pages from the given XML document, rather than just apply a style to the XML document. Any way I look at it, the latter would still be one large page (very large for some of the things I'm documenting).
  14. I'm really getting into the use of XML documentation in Visual Studio .NET for my code comments. But, I'm very new to practical XML usage, especially in terms of applying visual styles to it. Does anyone have any neat XSL files for making the generated documentation human-readable?
  15. Has anyone seen any nifty tricks for making table-like structures in pure CSS?For example, suppose I have a form with a bunch of fields. A simple way of presenting it would be to have a borderless 2-column table where the left is the field labels and the right is the inputs. That way everything is neatly justified and each input is properly vertically aligned with its label regardless of user font settings, etc.But I tend to agree with the school of though that "if something isn't really a table, don't put it in an HTML table." With all the tips and tricks you guys have written/found, is there anything that covers this subject?
×
×
  • Create New...