PHP : binary image data, checking the image type
Hello, I have some images in bin, I want to check the header to check the format (jpg,png,etc) I dont want to use temp files! I have a solution using TEMP FILES. Thanks! ...
Hello, I have some images in bin, I want to check the header to check the format (jpg,png,etc) I dont want to use temp files! I have a solution using TEMP FILES. Thanks! ...
I've written a SWF distributor which GZIPs the SWF then sends it as an SWF content type, it works just if the SWF used to loop it no longer does. Anyone know any reason why the compressed SWF doesn't loop the video/animation? ...
I have a string of registry keys that looks like this: ThreatName REG_SZ c:\temp Protection Code REG_SZ a Check ThreatName REG_SZ c:\windows Protection I want to extract "c:\WHATEVER" from the string. It occurs multiple times between the words "ThreatName REG_SZ" and "Protection". How can I extract "c:\WHATEVER" multiple times using P...
hi im new to regular expressions and would like to decipher this. return preg_replace("/[<>]/", '_', $string); thanks!! ...
I'm using Netbeans for PHP code. When I use the generator for getter and setter methods in a class, the functions are named get_something() set_something() How can I generate the functions in the camel case: getSomething() setSomething() ...
I have an helper class with some static functions. all the functions in the class requires a 'heavy' initialization function to run once ( like it was a constructor.. ). is there a good practice ? the only thing i thought of is calling 'init' function , and breaking it's flow if it already run once (using static $initialized var). pro...
I'm developing sites using Wordpress and I want to use the lates version of jQuery. To make sure I use the lates version, I have found this piece of code from Binary Bonsai's example. What I see, is that he actually links to jQuery at Google API. So my question is, what is better. To link to jQuery on an external page? http://ajax.go...
When attempting to view a *.wav URL on our webserver, the data doesn't transfer properly. We are using apache2 with php5.10. Among the apache rewrite rules is: RewriteRule ^(.+)\.(wav)$ /wav.php?wav=$1.$2 [L,NC] And the relevant code from wav.php is: <?php $image = getPassed("wav"); header( 'Content-Type: audio/wav'); set_include_pa...
Because I noticed it was a pattern I was constantly re-implementing, I made a DataContainer class that overrides __set,__get,__isset,__unset, and implements ArrayAccess, Countable, IteratorAggregate, and Serializable For example, my View class, which renders PHP templates in an MVC fashion, inherits from DataContainer so that it has ove...
Inside the begining of a function I have this: if(false); { return 'TRUE'; } it is returning "TRUE"! Obviously my real use was checking a more useful expression and returning something else. I just changed it to this to elaborate my point. Why is this happening? Can you not put a return inside an if statement? I do this all the t...
Hello, I'm using a login system, and I'm trying to keep the user logged in for 10 days unless they specifically log out. I thought by using session_set_cookie_params('864000'); that it would make the user stay logged in for 10 days. But it's not doing that, at least in Chrome. The user only seems to be logged in for the standard 20-3...
I'm working on WordPress theme which has some custom functionality which includes the ability to add "events" that include a start and/or end date in string format. I'm wondering what the best method would be to parse these date strings in order to figure out which event should be shown in what order? Here's an example of the date stri...
I am working on a PHP Application, Every thing works perfectly, The only problem is. I have enabled SEO Friendly URL's, Which re-writes the actual URL's to virtual URL's( i know you guys know it ) Ex : hxxp://www.website.com/index.php?page=about-us To hxxp://www.website.com/page/about-us/ What i want to achieve is If the SEO URL's / M...
So suppose I have the url: http://url?x=1&y=2 Then I can just get all the get parameters via PHP using the $_GET variable so print_r($_GET) will echo all the get variables Now suppose I'm using zend framework and i'm trying to take advantage of the /var/value/var/value feature: so now my url is http://url/controller/action/x/1...
Hi, We are building a daily newsletter based on member preferences. The member can choose a city and some categories among a list of 10. Basically each email will be different. Each email is generated by our server. We are unable to find a provider with an API that can do that. Would you have any solution that ensure a 99% delivery. ...
I know that there was a few questions about this topic. I need an framework / script / solution to get plain text from PDF file by php. Does exist a solution how to get plain text from PDF file? (And yes, I searched for this hours. This is the last chance). ...
Hello, Can someone explain to me why this happens? I have a file called profile.php, where I want to echo out a user's photo by reading its file path from MySQL. The code is below: echo "<img src=\"{$row['PortraitPath']}\" />"; Some of the code that represents how a file path for the photo is saved is presented below (uploader.php)...
I've spent weeks working on double-submit protection on my forms. Straightup, the session method of storing tokens doesn't work. Sessions work fine for a refresh of the page or someone going back through their history... but the classic double submit by clicking the button numerous times cannot be prevented using sessions. I'm thi...
how do i save checkbox state through sessions? i'm using this jquery code to toggle the options: $('div.check input:checkbox').bind('change',function(){ $('#'+this.id+'txt').toggle($(this).is(':checked')); }); but when i reload, the checkboxes are back to their default state. i know i'd have to use sessions, but how do i make the ...
Question 1 I used to use that line for my PHP parser file for a game server, but it does not work anymore. I know there is the fopen("php://stdin") thing but that's now 3 lines of code instead of just one, why would PHP do this? Question 2 Also, when I use that method I keep getting this output which is causing my script to not read t...