Jump to content

Nolongerused3921

Members
  • Posts

    141
  • Joined

  • Last visited

Everything posted by Nolongerused3921

  1. Didn't read through the setcookie page on php.net, turns out it only returns false on failure, and is not based on whether or not the user has accepted it.
  2. I'm trying to write a basic function to check whether or not the user has cookies enabled (So I can decide if I want mod_rewrite turned on or not, among other things)*, but I'm having some problems. public function CookiesAllowed() { //If cookie allowed exists, return 1... If not, try to set it for 2 weeks - if fails, return 0... If successful return 1 return (isset($_COOKIE['allowed'])) ? 1 : setcookie("allowed", "true", time()+60*60*24*30); } I'm using IE7.0 to test, I set it to ask me every time a cookie is set, and have the cookies array output using print_r... Even if I deny the cookie, and it doesn't show in the array (After several refreshes), this function still returns 1. Setcookie should return 0 if the cookie wasn't set properly, but it always returns 1 for some reason - any ideas why? Any way I can fix this? *I'd rather not have to edit all of my mod_rewrite rules to have SESSID on the end, so I just let PHP handle it and turn mod_rewrite off if the user isn't allowing cookies.
  3. 1) How do you edit attributes using PHP's Dom, with imported html. 2) How do you import/export html into PHP's Dom, without adding declarations or extra html tags.
  4. It looks like the error is caused by the locations not being in quotes, in the .php file. f ($location == Tampa Bay) print "<p>\nWe will contact you within 1 business day."; if ($location == Florida) print "<p>\nWe will contact you within 3 business days."; if ($location == US) print "<p>\nWe will contact you within within 5 business days."; if ($location == International) print "<p>\nWe will contact you within within within 10 business days."; Should be f ($location == "Tampa Bay") print "<p>\nWe will contact you within 1 business day."; if ($location == "Florida") print "<p>\nWe will contact you within 3 business days."; if ($location == "US") print "<p>\nWe will contact you within within 5 business days."; if ($location == "International") print "<p>\nWe will contact you within within within 10 business days.";
  5. Currently I'm trying to figure out how to take a small bit of html, say Edit, say, the value (Or innerHTML), an attribute or two, add an attribute, take one out, etc... Then export it back the same way it came in, but with the modifications. But I'm having two problems that are annoying me to no end. 1) I don't usually work with DOM, so I'm not quite sure how to edit attributes and the like. The HTML aspect isn't well documented, so any help here would be nice. 2) I'm getting extremely annoyed by the fact saveHTML() AND saveXML() both add all the extra stuff that I don't want. What's worse, it looks like even by importing the HTML with loadHtml, it adds the body tags which I don't need or want. How do I get around this? I want JUST the element(s) that go in, to come out. $domdoc = new DOMDocument(); $domdoc->validateOnParse = false; $domdoc->loadHtml($element); $textarea = $domdoc->getElementsByTagName("textarea"); $xml = simplexml_import_dom($domdoc); PrintNeatArrays($xml); This is pretty much all I have right now. Any help would be appreciated, thanks.
  6. Thanks for the quick reply, however I should have mentioned I had tried that, deciding not to use it due to issues with the speed of it. Sadly speed is broken down to: Functionless method (God I hope there's one)->Regex->sscanf->explode... The function will be called a lot, so I really wanna try to find something that's as faster than regex, but failing that - regex.
  7. I'm having a bit of a problem - I need to access an array entry (I.e., $array['key']['key2']) with a plain text string ($string = "[key][key2]"), but I'm not sure how to go about doing this... I've attempted to get the keys via regex, but that's not going so well and I'm going a bit insane, so I thought I'd get some help here. The regex, to give you an idea what I'm trying to do (I'd prefer not to use regex, if anyone can think of another way) : preg_match("/^([a-zA-Z0-9]+)(\[([a-zA-Z0-9]+)\])*/", $inputName, $sdf); Returns: I've tried several variations, but they always result in only one key being matched and returned.
  8. Sadly that won't work, as the font isn't unicode (And thus won't work seeing as Japanese isn't a Romance language). Basically the text you just typed doesn't make sense, it comes out to being: u - chi t - e t#2 - dji (I believe) e - u x - ...Well, you get the idea
  9. Thats what I'm asking, does PHP/GD have (Access to) a UTF-8 font?
  10. 90% of this is in the database, the other 10% is just getting the information from the database, and putting it into an array. I had experimented with some code taken from php.net (For GD + ttf fonts), however thats unimportant.
  11. Basically I've created a database with Japanese in it, under UTF-8 and have gotten it into PHP properly - I am able to print_r the table and it shows the Japanese properly, however I can not get GD to print it - even using a hiragana (Its Hiragana, not kata or kanji) ttf font and imagettftext... Has anyone worked with GD + foreign languages before? Is there a native PHP font that I can use, rather than a font I found online? If not, or even if so - whats the best way to get Japanese into an image, using GD? I plan on using Hiragana, Katakana, AND Kanji at some point (Just hiragana for now), so it'd be nice to have a native PHP UTF-8 Japanese font available, rather than hunting all over for new fonts and all that.
  12. Is there any way to get the directory/path of the file running the script, not the directory you're inside (Via dir())? I'm allowing the user to navigate through directories, and that part works great - but whenever I attempt to used getcwd(), it returns the directory the user is in - not the directory of the php file - is there any way to get the directory of the .php file the user is using?
  13. That works pretty well, but I need to get how many files are in each folder specifically, not a grand total. Like, theres 9 files in area1 5 files in subarea1, 2 in subsubarea1, etc.
  14. I'm having an incredibly hard time trying to solve this problem... I have an array similar to the following: [area1] => Array ( [subarea1] => Array ( [subsubarea1] => Array ( [0] => file1.txt [1] => file2.pdf ) [0] => blah1.txt [1] => blah.2.txt [2] => etc.mp3 ) [subarea2] => Array ( [subsubarea2.1] => Array ( [0] => blah.txt ) [subsubarea2.1] => Array ( [0] => file1.txt [1] => file2.pdf [2] => file3.mpg ) ) ) And I need to go through and count all the files (The [ #]s) in each of the sub arrays... But heres the problem - I need to track how many files are in each folder, and all folders underneath it. Basically, what it boils down to - is I need to find out how many files are in any given folder, including all of it's sub folders - so I can let the user know how many files are in a folder (Obviously). If anyone can think of a way to cycle through the array and get my answer - that'd be great... If you can think of another, better way to find out how many files are in a folder, and all of it's child folders, then that'd be better Thanks in advanced to anyone who saves me the extra few hours of pulling my hair out... I really hate working with filesystems.
  15. I just had the dumb idea of testing some more files, and... Well, they all work - even 2mB+ ones. Anyone have ANY idea why this file wouldn't open a connection correctly? I even tried renaming it so it didn't have spaces, and it STILL doesn't want to fopen() it from site2. (Site1 is eyesoute.com)
  16. Because its two different accounts and I'd rather not open one up to the other.
  17. Okay lets clear some stuff up... Download.php can do two things, it can either serve a user a file (This works fine, even with 2mB files) from the local directory, or it can download a file from the same script, on a different domain... Right now, ALL TESTING is done on a single server, but two different domains - lets call them site1, and site2. I'm currently trying to download a 333kB jpeg from site1 using the download.php script to both serve, and download the file (Serve from site1, download from site2). If I download the file directly, from my own computer, it works fine - even if its a large file. However, if I try to download the file from site2, it timesout. Now I highly doubt its because its not downloading fast enough, since it is downloading from the same server, the same IP, on the same network, etc.... Theres something wrong somewhere else, but I can't figure out where... To make matters worse, this worked before I moved to this new server.
  18. Tried that, same problem - however I just tried using the fopen and nothing else - and it takes more than 30 seconds... I believe the problem is here.
  19. Thats actually not the problem... It doesn't download to myself, only to the server- I have absolutely no interaction with the file - and besides, I download larger files through another script without any problems. And its definitely not a server download speed problem, since its downloading from a site hosted on the same server.
  20. Thats an option, however theres a serious reason why my server (Which is dual core) won't download a 300kB file and I'd like to find out what it is, then fix it properly instead of hacking it. I just increased the length in fread to 65536 and it didn't change anything.
×
×
  • 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.