php

How to generate semi transparent shapes in php using gdlib

Hi, this is the script i made // Create image $img = imagecreatetruecolor($w, $h); // Transparent image $white = imagecolorallocate($img,255,255,255); imagefilledrectangle($img,0,0,$w,$h,$white); imagecolortransparent($img, $white); //imagealphablending( $img, true ); //imagesavealpha( $img, true ); // Shape color $bgColor = ima...

Using PHP Gettext Extension vs PHP Arrays in Multilingual Websites?

So far the only 2 good things that I've seen about using gettext instead of arrays is that I don't have to create the "greeting" "sub-array" (or whatever its called). And I don't have to create a folder for the "default language". Are there other pros and cos of using gettext and php arrays for multilingual websites? USING GETTEXT: sp...

Can I use Apache servers for a local network?

I would like to write a computer game played by several users sitting in front of different computers. For that I would like to implement a P2P approach. Now I consider the following situation. I have, let say, 6 computers which build a local network. On every computer I install Apache web server. So, every computer runs a web site. In ...

Possible to turn off E_STRICT for library code but not my code?

Is it possible to change the error reporting level (turn off E_STRICT) for files that my PHP application includes with include or require_once? I'd like to be able to see strict notices that occur in my code, but I'm using PEAR MDB2, and I get pages of warnings from that code when I turn on E_STRICT. I know that it's possible to change...

Ajax, jquery form plugin won't work...

Hi all, I'm trying to use the malsup jquery form plugin and I can't get the simple example to work (http://jquery.malsup.com/form/#ajaxForm). I've pasted my code below. What is going wrong? All that happens is I get an alert box that says "Thank you for your comment!". Nothing else happens. Thanks, Mark This is the ajaxtest.html ...

PHP json handler compatible with older php versions

Is there a general-purpose PHP JSON library that detects the level of JSON support in your version of PHP and calls on an externally-provided JSON library if native support is not found? ... or, am I going to be spending time writing this myself. ...

running other file types as php

is there any problem with running html as php via htaccess? such as security or best practices ect. was doing this to make urls cleaner. ## run the following file types as php Addhandler application/x-httpd-php .html .htm .rss .xml well ideally id like to have my urls like localhost/blog/posts/view.php?id=64 to be localhost/projec...

Javascript/PHP and timezones

Hi, I'd like to be able to guess the user's timezone offset and whether or not daylight savings is being applied. Currently, the most definitive code that I've found for this is here: http://www.michaelapproved.com/articles/daylight-saving-time-dst-detect/ So this gives me the offset along with the DST indicator. Now, I want to use ...

PHP Always not null

I have this piece of code in my cms: <ul class="subsection_tabs" id="tab_group_one" style="clear:none;"> <?php if ($this->getChildHtml('description')==NULL) { echo '<div id="trollweb_1"></div>'; } else echo(' <li class="tab"><a href="javascript:void(0);" id="trollweb_1" onClick="trollweb_tabs(1)" class="active"><h4>' . $this->__...

Remote Zip Extraction > Can't seem to get this to the finish line...

The purpose of this code is to grab an update.zip file from a remote server, unzip it and save it to a local directory, updating, overwriting or creating the updated files. I've almost got a non cURL version of this working, but I'd rather use this version. The first problem I have is that the path to the tmp folder is incorrect. I need...

Codeigniter add Exceptions to Config class

Maybe, it's a bit silly, but does anybody thought about adding exceptions to Codeigniter Config Class(Library). Not sure, it is(will be) a good practice, but i suppose throwing an exception instead of just returning false is better. For example, if we have something connected with user payments. Usually(?), we'll take some configurable ...

Using only layout from a controller

Hello, how do I make available some data for a layout/layout.phtml script without having to create a view script from a controller? I've tried the following in indexAction function, but it does not work. When I do not create the view script I get an error. I could created empty one, but I don't like this solution much. Any better ideas...

PHP/MySQL: Preventing duplicate actions quickly in succession

For a browser game, I have a database table fights: fightID fromID toID simulated (1=true, 0=false) Whenever a user requests a page, I select all fights which still have to be simulated: SELECT fightID, fromID, toID FROM fights WHERE simulated = 0 These outstanding fights are then simulated in the PHP script and, finally, the figh...

Getting exif data from php

Hi again I'm trying to get a good exif parser for files. So far I'm using Exif reader v 1.2 But I'm have some trouble reading the lens information i.e what it was taken by. Does anyone have any good solutions. Thanks Richard ...

Are there any good php based html filters available?

I am currently in a project with php frontend. We're pretty concerned about security, because we'll have quite a lot of users and are an attractive target for hackers. Our users are able to submit html formatted content that is visible to other users later. This is a big problem because we're vulnerable for the whole set of XSS attacks. ...

Are there any PHP code visualization tools?

Looking for software that will analyze php code (i.e. all of wordpress or the thematic theme) and show me pretty pictures (perhaps a block diagram) of all the connections to help me more quickly get an understanding of where things are and what's connected to what. Ideally, this software would run on a Mac, but I'll take anything: Windo...

Zend-framework: YouTube video link validation

Hi, is any method to validate Youtube video link with Zend-framework ? If user inputs not valid link, for example http://www.youtube.com/watch?00zzv=nel how can I check it before inserting into site ? ...

web-application in PHP : PHP or Python for CLI scripts ?

My website already runs PHP for it's UI. I now need to code some scripts which will fetch data from certain URL's on a daily basis and populate the database. If PHP 5, with its enhanced object oriented features and rich libraries is on par with Python on the command line, then wouldn't it make better sense for me to use PHP for both web...

Is there some limit on a size of a file when causing a download with PHP?

Trying to force-download file with PHP using usual: header("Content-type: $type" ); header("Content-Disposition: attachment; filename=$name"); header('Content-Length: ' . filesize($path)); And it does successfully for files somewhere below 32 mb. For bigger ones it just returns zeroed file. Obviously there's some kind of limit, but w...

Sort array with recursive function call?

I need the following array in alphabetical order (at all levels), but asort doesn't seem to work because I have a recursive call in my function (or so I think); it only partially sorts my array, so I'll have chunks of it that are alphabetized, but they'll be out of order. Help! Ex. Directory Listing: apartments.html js/ application....