Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
I thought it was an XML document? Which is it, HTML or XML? You can't just mix it like you're doing.
-
header('Content-type: application/xml');
-
Well, you're not the one reading it, are you? If you want to read it then serve it as application/xml like you're supposed to do for XML data. A page will default to text/html in a web browser, but yours isn't HTML, so of course it'll not look right.
-
Right, I don't know what browser you use, but in Firefox you can Ctrl+Click (or middle click) on link to open in a new tab, or you can Shift+Click to open in a new Window. You can also right click on the link and choose those yourself. You have the power to control where you want it opened, if we do target=_blank then we remove that power from you, which is incredibly annoying. As I said, target=_blank is a usability problem. It makes it impossible to open in the same window/tab even if you want to.
-
Use DOM.
-
Mac character encoding error? I think? Makes no sense..
Daniel0 replied to br3nn4n's topic in PHP Coding Help
How does this relate to PHP? -
Try this: http://stackoverflow.com/questions/610603/help-me-translate-long-value-expressed-in-hex-back-in-to-a-date-time
-
No, I absolutely hate when websites do it. What if I wanted to open it in the same window/tab? That's impossible when someone thought they should decide how I want to browse. Target=_blank is an accessibility issue, and W3C recommends against it in the strict DTDs, if I remember correctly. You'd have to ask Google anyway.
-
I'll say Zend Studio as well. It's great.
-
Or generally any scripting language.
-
You cannot really protect PHP code anyway. The PHP interpreter needs it in plain text, so theoretically you should be able to just grab it from memory while it's running. You'll have to rely on laws regarding protection of IP and take people to court if they violate your rights instead.
-
Put it in parentheses.
-
Bar the horrendous grammar, I don't see anything wrong with the contents of this topic.
-
Store the MD5 hash (or another similar hash from another algorithm) and match against that. You can use md5_file to get the hash.
-
You should be able to do php_flag engine off if PHP is running as an Apache module.
-
Switch to an Apache based server or find out whether IIS has a mod_rewrite equivalent.
-
Should be R=301 though. I don't think you can just write permanent.
-
You cannot have a single quote within a single quote delimited string without escaping it.
-
[SOLVED] if($ratio1>$ratio2, how do you know?
Daniel0 replied to student101's topic in PHP Coding Help
Because you have to figure out what the growth rate is... I just picked 20% randomly, which would then have a growth rate of 0.8. The $widthMax / $width is that growth rate, and so you multiply it with the $height so the width and height will grow uniformly. Then you do the same again only with width and height switched. -
It must be a difference in output between PHP 4 and PHP 5 (you should upgrade, by the way). Either way it should be /usr/local/lib/php.ini. If it doesn't exist then it's because it's using the default values, and you'll have to create a config file yourself.
-
That's a path, not a file. Take a look at "Loaded Configuration File" and/or "additional .ini files parsed".
-
[SOLVED] if($ratio1>$ratio2, how do you know?
Daniel0 replied to student101's topic in PHP Coding Help
Well, if you make e.g. the width 20% smaller then you would need to make the height 20% smaller as well in order to retain the original proportions. -
What's supposed to be the full path to your php.ini config file according to phpinfo()?
-
[SOLVED] if($ratio1>$ratio2, how do you know?
Daniel0 replied to student101's topic in PHP Coding Help
You'll need to know within what size you need to be. $heightMax = 200; $widthMax = 200; $width = $widthOrig = imagex($src_img); $height = $heightOrig = imagey($src_img); if ($height > $heightMax) { $width = round(($heightMax / $height) * $width); $height = $heightMax; } if ($width > $widthMax) { $height = round(($widthMax / $width) * $height); $width = $widthMax; } echo "New size: {$width}x{$height}" . PHP_EOL; echo "Old size: {$widthOrig}x{$heightOrig}" . PHP_EOL; echo 'Ratio (before): ' . round($widthOrig/$heightOrig, 3) . PHP_EOL; echo 'Ratio (after): ' . round($width/$height, 3) . PHP_EOL;