php

PHP Java Bridge # calling FOP from PHP

Hello guys, I often check StackOverflow and help me so much usually :) so i guessed why don't ask for help on this one ? I'm using PHP on a web-based application and i need to use Apache FOP to generate a PDF from a pre-formatted FO file. ATM I'm using the command line exec('fop...') for this purpose, but i have several troubles when ch...

GD lib detecting CMYK

Hi there I have some code to resize an image w/ GD and Perl sub adjust_size { my ($localfile, $ext) = @_; # need to use truecolor option to support 24 bit colors $image = GD::Image->trueColor(1); $image = new GD::Image->new($localfile); my ($w, $h) = $image->getBounds(); ... everything works properly with RGB ...

Java regex: Get the matched sequence

In Perl/PHP regex is's possible to match a sequence and get an array with matched sequences: preg_match('/20[0-1][0-9]/', $inputstring, $array_return); // PHP I can't figure out how to do this in Java. match.group() returns the whole string. Is this impossible? ...

How do I update a table from an array?

$query = "SELECT users FROM tabl ORDER BY RAND()"; $result = mysql_query ($query) or die ("Query '$query' failed with error message: \"" . mysql_error () . '"'); while ($row = mysql_fetch_array($result)) { $users[] = $row[0]; } $current = end($users); $partners = array(); foreach ($users as $user) { $partners[$user] = $...

RESTful Zend Framework API

I'm developing a Zend Framework based application and I found myself writing a skeleton for the API module. I read a bit on the web and I started writing the skeleton based on Zend_Rest_Controller. Turned out ok, key login required to use the API. The questions started when a colleague of mine started implementing the skeleton in a prop...

PHP front end and Django backend?

I need to replace the front end portion of our site with PHP that uses some Ajax calls, but the backend uses Django for db calls. I'm hesitant about using PHP and Django together, so I was wondering if anyone has experience doing so? Anything I should be aware of when integrating the two, for instance, urls that are mapped in the appli...

If IE then include file [A] else include file [B]

Hello, I have page for which I want to load different content for different browsers. Example : IF Internet explorer {include file="/content1.tpl"} ELSE if any other browser {include file="/content2.tpl"} {/if} Content1.tpl & Content 2.tpl are two different files having their respected Html & CSS. How can I achieve this usi...

Check location of a from a class called by that script PHP :s

If I have a class (e.g Database) can I check the location of the script that tried to instantiate this class. An example: I have an example dir structure like so: lib Database.class.php app action.class.php and in action.class.php: $db = new Database; and in Database.class.php function __construct(){ $name = //some code to f...

The value of a local variable of a function has to be retained over multiple calls to the function. How should that variable be declared in PHP

The value of a local variable of a function has to be retained over multiple calls to the function. How should that variable be declared in PHP? ...

Is it possible to pass a variable stored in an array by reference in PHP?

If I want myFunction to take $myVariable and assign to it an instance of SomeClass, I know I can do this: class SomeClass { } function myFunction(&$myVariable) { $myVariable = new SomeClass(); } myFunction($myVariable); var_dump($myVariable); However, I would like to be able to have myFunction operate like this: class SomeClas...

php problem with encoding in a cli script reading id3 tags

i am trying to get a php cli script to go through a folder, get the id3 tags, which are in utf8 in cyrillic and but it in the database. when i execute the script i get the raw utf in the DB fields like "&#192;&#235;&#225;&#229;&#237;&#224;" here is the script <? set_time_limit(0); include('classes/adodb5/adodb.inc.php'); include ('cla...

a way to parse S3 data array

If, for example, I had array like this: array(34) { ["ahostel.lt/img/background.png"]=> array(4) { ["name"]=> string(29) "ahostel.lt/img/background.png" ["time"]=> int(1277819688) ["size"]=> int(36811) ["hash"]=> string(32) "2600e98e10aba543fb2637b701dec4f3" } ["ahostel.lt/img/body-navigation-bg.p...

if $a and $b are bothe arrays the what would be the result of $a+$b?

Possible Duplicate: + operator for array in PHP? if $a and $b are bothe arrays the what would be the result of $a+$b? ...

Php OpenID fault in google accounts

hi I'm use"PHP OpenID" for login with Google accounts into my site(forum and wiki) but when i send my profile address and i signed in bellow error are shown: OpenID authentication failed: Nonce already used or out of range 1.where is the problem and how can i fix it? 2.how can get picture and another information's from a Google profi...

php output xml produces parse error "&rsquo;"

Hi, Is there any function that I can use to parse any string to ensure it won't cause xml parsing problems? I have a php script outputting a xml file with content obtained from forms. The thing is, apart from the usual string checks from a php form, some of the user text causes xml parsing errors. I'm facing this "&rsquo;" in particula...

How would you make this simple scheduler?

I'm working on an admin section right now to schedule employees for their shifts. It is simple in that on any day, employees work either the day or the night shift. How would you go about doing this so that it is easy to display? I was thinking I have a table with the employee names going down the first column. Then, the next 7 colum...

How to generate a key for a session cookie and when do we need it?

Excerpt from http://php.about.com/od/advancedphp/ss/php_sessions.htm: So how will it know it's me? Most sessions set a cookie on your computer to uses as a key... it will look something like this: 350401be75bbb0fafd3d912a1a1d5e54. My question is, in PHP, how to generate a key (e.g., 350401be75bbb0fafd3d912a1a1d5e54) for a session c...

SQL insert field, with value of other auto increment field + value

Hi. It might sound complicated, but it's not. I have a table called "orders", with fields: id INT(11) auto_increment, realid INT(14) Now, I want at every insert into this table, do something like: INSERT INTO orders VALUES (null, id+1000); However I'll be doing it on shop which is currently online, and I want to change everything ...

Using PHP and MySQL to develop website

I want to develop a professional website using PHP and MySQL. Can i do it in Windows 7 (64-bit) or i need to install linux based OS. How to go for it. ...

Create pathway with PHP

What is the best way to create pathway with PHP (like Dailymotion)? home > videos >search results for enrico macias mendiant de la amour > macias enrico - le mendiant de l'amour ...