php

PHP: Possible reasons for $_SESSION['var'] to be mysteriously undefined with flash upload

I am having trouble with a session id not being defined. The session variable is being called on a page that a form posts to via an ajax/jquery query. The session variable is called on every other page without a problem. The variable is set when a user logs in, and is checked by an auth.php file. The auth.php file finds the session v...

How to get user mails in my free gmail inbox through contact us form on my website.

How to get user mails in my free gmail inbox through contact us form on my website. I do not use email with my website name . i use free gmail. I tried many script but the all need email account on domain. ...

How to buffering an Ajax Request?

Hi guys, I have a simple ajax function, something like this: var x; var myRequest = new Array(); function CreateXmlHttpReq(handler) { var xmlhttp = null; try { xmlhttp = new XMLHttpRequest(); }catch(e){ try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }catch(e){ xml...

Zend Framework: How to get default param?

How do I get the 'default' param if not specified? Consider the following: http://localhost/controller/action/id/123 In my controller, I can get the value of 'id' using $request = $this->getRequest(); $id = $request->getParam('id'); If the URL is http://localhost/controller/action/456 how do I get the value of 456? What is the ...

Best practice in CakePHP for saving data, using models in component

I'm writing a Cake component and it seems to make sense that I use it for saving data rather than doing so in a controller. In the manual it says using models in a component is discouraged, but the other way of doing it would mean I'd be repeating code in the controller. The component basically analyses a load of data from various sourc...

Starting with versioning mysql schemata without overkill. Good solutions?

I've arrived at the point where I realise that I must start versioning my database schemata and changes. I consequently read the existing posts on SO about that topic but I'm not sure how to proceed. I'm basically a one man company and not long ago I didn't even use version control for my code. I'm on a windows environment, using Aptana...

Convert jpg image to gif, png & bmp format using PHP

Hi all, How can I convert a single jpg image into 3 different image format gif , png and bmp using PHP? Pls help ...

I can't get jQuery.post to work. Please help.

Hi, I'm trying to use jQuery.post() function to retrieve som data. But i get no ouput. I have a HTML that dispalys a table. Clicking this table should trigger a jQuery.post event. My scriptfile looks like this: jQuery(document).ready(function() { jQuery('#storeListTable tr').click(function() { var storeID = this.cells[0].inn...

Unit testing Zend controllers - how do I test what has been set in the view

In Zend, models are added to the view: //In a controller public function indexAction() { //Do some work and get a model $this->view->model = $model; } We can easily check that "model" exists in the view (I'm using simpletest for this): //In a unit test public function testModelIsSetInView() { //Call the controllers inde...

Load multiple event feeds with one GData calendar query.

So, my problem is as such... I'm building a simple calendar module for my company's intranet portal. We use Google (Apps for your Domain) Calendar and I'd like to give the employees the ability to see all the feeds they've subscribed to in one calendar--just like on the real Google Calendar! The reason I'm not just using the the gadge...

Regarding Google Safe Browsing API

Does anyone know how to use the Google safe browsing API. I downloaded the entire the malware and phish update from the google safe browsing using the API key and tried comparing the hash of the suspicious site (md5_file method in php) but it did not work. I also tried comparing the hash of the suspicious site's url (md5 method in php)....

PHPMailer and SMTP: Mail never shows up when sent from remote server, works fine on local machine.

I have a script that uses PHPMailer to send out an email. The email is sent with a direct SMTP connection to a remote mail server. The problem is that while everything seems to be okay when I run the script on my local machine, when the script is run on our live site using the same remote SMTP server the email never gets through. What...

PHP-GD imagejpeg unable to open

When trying to save a thumbnail made with GD imagejpeg($tnImage, "../../img/thumbs/".$maxWidth."x".$maxHeight."_".$filename); I am getting the following error: Warning: imagejpeg() [function.imagejpeg]: Unable to open '../../img/thumbs/80x80_55865-drops.jpg' for writing: No such file or directory in /home/user/workspace/stewart/serve...

Large File Upload Errors with PHP

I have an image upload for a slideshow, and the users are continuously uploading files that are 2MB plus. Files under this size work fine, but files over the size cause what looks like a browser timeout. Here are my php ini settings: Max memory allocation: 12M Max file upload size: 10M Max HTTP Post size: 10M Max execution time: 60 M...

"public static" or "static public"?

A minor point about function declaration keywords in PHP: If you've got a class method that's static, should the static keyword come before or after the visibility keyword (public, protected, private)? Assuming all your methods, static or otherwise, have a visibility keyword, then you'd want the visibility keyword to remain in the same ...

Website screenshots using PHP

Hi, Is there any way of taking a screenshot of a website in PHP, then saving it to a file? Thanks ...

.htaccess Optional characters?

Though .htaccess, I want to redirect /page/var1/var2 to ./page.php?var1=var1&var2=var2. This is very easy BUT I want to make it so /page/var1 also redirects to ./page.php?var1=var1 (without having the var2). The only way I'm doing this is: RewriteRule page/(.*)$ ./page.php?var1=$1 RewriteRule page/(.*)/(.*)$ ./page.php?var1=$1&var2=$2 ...

PHP: How do I access this object property?

I'm using a PHP class someone wrote to interface with the BaseCamp API. The particular call I'm doing is to retrieve the items in a todo list, which works fine. My problem is, I'm not sure how to access just the todo-items property of the object that is returned. Here's the var_dump of the returned object: object(stdClass)[6] public...

PHP: Delete first four lines from the top in content stored in a variable

I have a variable that needs the first four lines stripped out before being displayed: Error Report Submission From: First Last, [email protected], 12345 Date: 2009-04-16 04:33:31 pm Eastern The content to be output starts here and can go on for any number of lines. I need to remove the 'header' from this data before I display it as ...

Is there anything like Chronic available in PHP?

I am looking for a very robust datetime parser, similar to Ruby's Chronic, but for PHP. strtotime() isn't cutting it for a lot of the edge cases I'm seeing in my project. Anyone know of any good libraries? Ideally: - PHP 5 OOP - well documented - fast and stable Thanks! ...