php

Can I setup routes in Kohana to only match particular HTTP methods (GET/POST/etc)

I'm exploring a few PHP frameworks and the current front runner is Kohana. Having a Rails background I've become used to what the rails community calls "RESTful" routes. So a "GET /posts" displays all posts and is handled by the index method of the Posts Controller. A "POST /posts" creates a new post object and is handled by a different...

Strange issue -- PHP / ImageMagick / Ghostscript

Hi All, This question was close, but doesn't do the trick. I am trying to convert a pdf into a jpg (for thumbnailing). Here is the command I am running: convert -quality 100 -density 200x200 /path/file.pdf /path/file.jpg I have mamp pro 1.7.2,imagemagick, ghostscript all properly installed and working. This command works perfectly fr...

PHP 5.3 Late Static Binding - is there a shorter way?

Is there a better/shorter way to write the whoAmI method in the following code? It seems a bit unnecessary to create a new object just to get the static class' name. <?php abstract class baseClass { static function whoAmI() { echo get_class(new static); // Making a new class just to get its name??? } } ...

PHP exec() fails

I'm running wampserver and php5. exec() works when I run the script through the command-line, but when I try to run it through the server, it fails. I looked at all the error logs, there were none. I redirected stderr to stdout, there was still no output when I run it from the server. Any suggestions ? EDIT: I should have mentioned ...

Attaching a file from FTP to PHPMailer class

Hey guys i am trying to automate my system at work for sending artwork to clients, i am trying to make it so i can upload my final artwork pdf files (which i done) then later on when i select to send them an email it will attach it and send it off. I have tried doing it this way $mail->AddAttachment('http://#######.com.au/artwork/14653/...

php string versus boolean speed test

I'm looking at trying to optimise a particular function in a php app and foolishly assumed that a boolean lookup in a 'if' statement would be quicker than a string compare. But to check it I put together a short test (see below). To my surprise, the string lookup was quicker. Is there anything wrong with my test (I'm wired on too much c...

how to find out a specific process is still running in PHP

I'm writing a script that builds a queue of other scripts and is supposed to manage their launch. the manager script should know which child process has finished, so it can launch other scripts waiting in the queue. I added a "& echo $!" to get the Process Id of each child process. so I have my child processes Process Ids, and for now a...

expiry date using utc timestamp, mysql and php?

How do you add time or days to a current utc_timestamp? I am using; new CDbExpression('UTC_TIMESTAMP()') for both 'created' and 'updated' fields in my mysql table but would like to add an 'expiry' field which would allow 4 days from creation date. I presume this is possible but am unsure how. Thanks ...

MySQL conditonal query inside where clause

I'm not sure if I'm missing something really obvious, but I keep getting a syntax error on this query. Even if I AM missing something obvious, I'd like to know if there is a smarter way of getting what I'm after. Basically, the query asks for any rows tied to a user with a start_date between Monday and Friday. That works great. But then...

im trying to figure out how to write a gd class that will display a string in any font type i input.

here is the class i have so far <?php class txt2img { var $image; var $headertype; var $forecolor; var $fontsize; var $fontangle; var $font; var $string; //font size function fontsize($fontsize) { return $this->fontsize; } //forecolor function forecolor($forecolor) { return this->imagecolorallocate($this->img(),$this->forec...

codeigniter hook for app version checking

I am using CodeIgniter to build an application. The app is having many AJAX requests on setTimeoutInterval, which fires every few seconds. Now the situation is: If a user has a page kept open. The page sends ajax requests at intervals. At that point of time I have updated my application in the server. So I want to keep a version chec...

Warning: imageftbbox() [function.imageftbbox]: Problem loading glyph - what is this error

I got this error on my image generation script : Warning: imageftbbox() [function.imageftbbox]: Problem loading glyph: I think because of this I can't generate images from text properly - how do I fix this! ...

Update command not working properly in PHP

$query = "UPDATE members SET userrole ='$userrole' WHERE member_id = '$member_id'"; Sometimes it updates and sometimes it does not... i don't know whether the syntax is correct. userrole and member_id has array of values. The update query is performed for multiple items being checked. There is no error in mysql connection or error......

restrict the dimensions of image file to be uploaded

Hi all, How do i restrict the image's dimension that is being uploaded via a php script.? I am using cakephp v 1.2 thanks ...

What is Mysql Link ?

Hello I am debugging a php application. In the Local Debugging window, it shows the following information Name value Type LinkID 15 mysql link The value of LinkID change within the program What is mysql link type , being shown in the debugging window? Also, can anyone explain what the function performs ? Here is the...

Cross referencing sql tables php

Hi, I will try and explain this as best I can, any questions please ask: I have three tabels - tblOrderProducts tblOrders tblProducts tblOrders contains the order details but not the actual products that the customer has ordered, so I need to cross referrence the tables: VendorTxCode is a field in both tblOrders and tblOrderProduc...

Ideas for Implementing multiple views for the same data

My question is based in structure and architecture really and I'm after ideas on the best way to implement the following: I am using code igniter (although you could presume any MVC framework). I have a custom CMS which allows for the management of 5 different websites. Users log in and switch between these sites. They can add content t...

Appending from HTMl LInk in JQUery

Hi, I am having a Html LInk created using <?php echo $html->link( 'Save Form', array('action'=>'/homepage', $userid), array('class'=>'button','id'=>'saveForm'), 'really save the Form ?', false ); ?> And i want this link to append it to #save using JQuery How could i append this Link to ...

Zend_Filter_Input and empty values

I’m using Zend_Filter_Input to validate form data and want to customize the error messages, if a user does not enter a value. It is important that each field gets a different error message. With Zend Framework 1.8.0 I used the following array for the “validator” parameter of Zend_Filter_Input: $validators = array( 'salutation' => arra...

Delete command Issue in PHP

I have a similar problem with delete command too.. function deleteUsers($userID) { foreach($userID as $key => $val) { $query = "DELETE FROM members WHERE member_id = '$val'"; $result = mysql_query($query); } //$query = "DELETE FROM members WHERE member_id = $userID"; //$result = mysql_query($query); ...