php

cakephp data validation before posting remote form

This one is really racking my brain: I need to post non-sensitive data to a third party payment gateway. I want to use the built in cakephp form validation which is working fine. What i am doing is submitting the form to a local action which calidates the data and outputs any errors if there are any. Where i am stuck is trying to re-sub...

Calculate days since a timestamp?

This one works for dates in format: 0000-00-00 But I need a function for unix timestamp format function dateDiff($start, $end) { $start_ts = strtotime($start); $end_ts = strtotime($end); $diff = $end_ts - $start_ts; return round($diff / 86400); } Could anyone help a brother out?? ...

Has anyone tackled Signed Requests for Amazon Product Advertising API in PHP?

I am about to get stuck into fixing the Product Advertising API Signed Requests issue for PHP for a site I wrote a while ago. Is there a library out there already, or do I need to roll up my sleeves? https://affiliate-program.amazon.co.uk/gp/advertising/api/detail/faq.html ...

Check whether image exists on remote URL

I am generating dynamic URLs of images for book ISBNs. I need a reliable way with PHP to check whether the images actually exist at the remote url. I tried various approaches with different PHP libraries, curl, etc., but none of them works well, some of them are downright slow. Given the fact that I need to generate (and check!) about 60...

How to reference *just* the image part of an image node in Drupal 6

Hiya, I'm building a recipe management system for a cooking website in Drupal, and I have to say the whole node / view / template thing is working very nicely! I've got one problem though and that is that I can't get a view to display JUST an image - it always comes bundled with it's title and a link through to the gallery. Can anyone...

run php from java

Is there a way to run php server**(remote)** scripts from a java program (with secured/encrypted connection). ...

jQuery-like interface for PHP?

I was curious as to whether or not there exists a jQuery-style interface/library for PHP for handling HTML/XML files -- specifically using jQuery style selectors. I'd like to do things like this (all hypothetical): foreach (j("div > p > a") as anchor) { // ... } print j("#some_id")->html(); print j("a")->eq(0)->attr("name"); ...

PHP Doctrine SoftDelete - Include deleted records?

If I have one of my PHP Doctrine objects act as a SoftDelete, is it possible to include deleted items in the results of certain queries? What I'm looking for is something like this... $q = Doctrine_Query::create() ->select('*') ->from('Test t') ->where('id < ?', 25) *->includeDeleted()*; Something like this would be u...

PHP regular expressions to clean duplicated HTML tags

I am trying to get a regular expression to work, but not having a whole lot of luck. the source file I am reading(poorly formatted, but nothing I can do there) has the following in its source between elements <BR> <BR> <BR> how do I match this with a php regular expression? ...

cron job problem with soapclient included in php

I have a php script, and need to run it everyday. This script has a soapclient, and it works fine if I run it as a script using browser directly. However, some fatal errors if I set it as a cron job. The script is very simple as "crontest.php" <?php $mage_url = 'http://******.com/api/?wsdl'; $mage_user = '*****'; $mage_api_key = ...

How to update a relational table ?

I've 3 tables. Users (id, mail, username, etc..) Practices (id, name) UsersPractices (userId, practiceId) The last one is the relational table which is n-n. I'd like to update this one, depending on the user's will. It means, that he could want to add, or remove some his practices. What algorithm could i use to do this ? Should i...

How to preform whitelist-based CSS filtering in PHP

I am working on a site and I would like to make a user able to enter custom CSS into that will be publicly displayed. However, seeing as a good deal of XSS attacks can be preformed through CSS, I would like to be able to find a way to "clean" the CSS output, similar to how HTML Purifier works, by parsing the CSS, running the parsed CSS ...

jQuery or PHP Script to Grab Page Information

Hello, I'm looking for some direction on a script that I'd like to build. Essentially, I am looking to build something that functions similar to that of Facebook, where users can provide a URL, and in turn, the script grabs the 'page information' from that URL. Furthermore, if a user were to provide a YouTube URL, it would be able to ...

PHP GD gives error

Update: TTF file seems to be there after testing. Update: changed to a relative path for the font file. Still doesn't work. I get the following error when I try to make an image using GD through PHP. [Tue Sep 01 19:44:15 2009] [error] [client IP ADDRESS] PHP Warning: imagettftext() [function.imagettftext]: Could not find/o...

Drupal, SQL Server and IIS7

Is there a SQL Server Provider for Drupal? I know that there is a SQL Server Client for PHP in beta and I wonder whether it would be hard to change the database provider to point to SQL Server instead of MySQL. ...

uncheck a checkbox when checking another

<?php session_start(); if (count($_POST) > 0) { $_SESSION['link'] = $_POST['link']; } ?> <form method="post"> Gmail: <input type="checkbox" name="link" value="gmail" id="gmail" <?php if ($_SESSION['link'] == 'gmail') echo "checked"; ?>> Hotmail: <input type="checkbox" name="link" value="hotmail" id="hotmail" <?php if ($...

Is there a PHP/MySQL database admin that doesn't use sessions?

I am doing development work on a site with a strange server set up where sessions basically don't work. It's kind of a long story, but the main crux is it's a cluster of servers that are syncronized from an FTP server every few minutes. And for example, anything written to the filesystem in PHP gets deleted within 5 minutes. So this mea...

PHP/MySQL - SELECT from various tables, with a list of indexes

Hi folks... im with a hugh question... Here is the scenario. Im developing a timeclock system, i have these tables: -punch (id_punch,date) -in1 (id_in1,time,id_punch,...) -in2 (id_in2,time,id_punch,...) . -in6 (id_in6,time,id_punch,...) -out1 (id_out1,time,id_punch,...) -out2 (id_out2,time,id_punch,...) . -out6 (id_out6,time,id_punch...

Communication between two subdomains. Zend Framework.

Hey all, I'm adding a bulletin board to my Zend-driven site, and am using an open source one called Phorum. While it would be theoretically possible to integrate Phorum into my Zend site, it's already self contained, and not designed to run through a controller. My solution was to make a sub-domain for Phorum, which worked quite well...

htmlentities in PHP but preserving html tags

Hi there, I want to convert all texts in a string into html entities but preserving the HTML tags, for example this: <p><font style="color:#FF0000">Camión español</font></p> should be translated into this: <p><font style="color:#FF0000">Cami&oacute;n espa&ntilde;ol</font></p> any ideas? ...