php

php : Capturing the command output

Hi All, I am using exec function to execute the specific executable files in php . exec ( $file , $output , $return_value ) ; When the given file executed successfully I am able to get the output in the second argument by checking the return values , So, It is working fine. But My requirement is when the command execution gettin...

Php zend framework forcedownload

Hi, I should set up a simple download manager and I don't understand whay this code doesn't work: protected function doDownload($filename){ //$this->_helper->layout()->disableLayout(); //$this->_helper->viewRenderer->setNoRender(true); $dir = Zend_Registry::get('dir'); $file = $dir->assets.$filename; ...

Zend Framework: Loading modules from another directory

Hey there guys, this is my first question on Stack Overflow. I figured this website has helped me alot so I give it a shot as well. I'm currently working on multiple Zend Framework applications that need to inherit modules from a common module directory. The file structure used is the conventional method (omitting actual names and refer...

Passing info via URL and parsing it with PHP

Hi guys, I need to pass information via a URL to a PHP function that parses the received data. So basically when they click on the specific link, it will go to the specific page, but also send through the arguments and values for the waiting PHP function to parse them and depending on what the values are do specific functions. eg: http...

Executing cmd commands in Windows from PHP Issue

Is it possible to execute cmd commands in Windows OS with PHP exec() function? I tried this: <?php try { echo exec( 'O:\test\pdftk.exe O:\test\outputs\OPP\out.pdf O:\test\outputs\OPP\out2.pdf cat output O:\test\123.pdf' ); } catch (Exception $e) { echo $e->getMessage(); } Basically, I'm trying to merge two pdf file...

Anyone able to read ning's json export files using PHP

I have a client's JSON files that he got from the NING exporter. I'm trying to load the data into PHP but seems like the json isnt properly formatted or something. SO PHP is not able to parse the JSON. I also used another PHP class to do it but that did not work either. Below is the content of one of the files ([{"id":"2492571:Note:7...

How to store affiliate ID correctly to browser.

I want to create a simple affiliate code. Currently I use PHP session to keep the affiliate ID. http://domain.com/aff.php?id=123 $_SESSION['referral'] = intval($_GET['id']); The problem now. Example user logged to affiliate area then logout, the $_SESSION['referral'] will unset & destroyed by session_unset() session_destroy() on lo...

Google Maps JS API v2 - Simple Multiple Marker Example

I'm fairly new to gmaps and Im using v2 because of the search function that I didnt find in v3. I've got an array of data that I want to loop through and put the markers on the map =) It seems really easy but I cant get it to work with v2 at all... Here is my what my array format and code looks like: function createMarkers(myLatLng,h...

problem on google weather report calcuation

Hi, This is GOOGLE Weather Report XML What is the calculation google doing , When i google with weather=London,UK keyword , Its showing somthing like this screen shot in my xml there is nothing like 26 , 11, 26 ,22 no my xml look like below WHAT IS THE CALCULATION INVOLVED IN THE Weather Report , How to get these into PHP v...

What is the fastest way to count all the records of a table using Doctrine ORM?

Hi, The title says it all... What is the fastest way to count all the records of a table using Doctrine ORM? I don't need the individual records of the table. I just need the total number of records in the table. Thanks! ...

replace words in text ignore urls

i use this line to search for a name in text with url's. $name = "xxx"; $text = "my name is xxx en my website is http://xxx.something.com"; $text = preg_replace("/\b(".preg_quote($name, "/").")\b/i", $url, $text); how can i change this regex to ignore urls in the text ...

PHP/OOP Help - logic and design issue

Hi, I'm going round in circles trying to work out how best to do this, i don't think it should be too difficult but i'm making it that way! In my site, each time a member provides some data, I store it against an Entry for that member. The idea is that members who submit data consecutively from month to month will be rewarded at some sta...

Dmoz/Monster algorithme to calculate count of each category and sub category?

I have to create a browse page like monter.com or dmoz directory. My problem is the counts for each category. What's the best practive to do a similar thing? I am using PHP/MySQL Thx! ...

Looping through an array and inserting into a table with parent child relationship

Hi there, I have an array which looks like Array ( [438044691:maincategoryone] => Array ( [0] => Array ( [id] => 438044692 [name] => main category one item one [category] => Array ( [2] => Array ( ...

is there a multiple payment providers (paypal, ogone, ...) php module for use in a web app?

We are building an ecommerce app where we want our users to pick out a (any provider we can make compatible with our app) payment provider. Up to today, we only support paypal and we have implemented this rather manually. We are looking for some sort of a module (free or commercial) to easily plugin in more payment providers to let cust...

Remote permanent synchronization

We have 2 servers, which one of them is customer's. Our customer is providing us an URLs of XML/JSON exports of his clients informations from his CMS and our task is to write some import scripts for importing data to webapp, which we're developing. I've always been doing that like this: INSERT INTO customers (name,address) VALUES ('Joh...

Make sure Apache user is allowed to use shell

Hello, how can I make sure that Apache/web server user is allowed to execute shell commands? I would like to execute a shell command in PHP script but it doesn't work for some reason (it works when written manually in shell by hand, of course, so the command is surely correct). I believe the problem is that the user PHP is running under...

How to overwrite existing PHP functions without APD?

I would like to overwrite a couple of functions that are already declared in PHP. The application I am working with is full of legacy code (including calls to eval()) so just replacing the identifier where the functions are called in the code might not be enough. Is it possible to change a function that has already been declared, withou...

jQuery Ajax - Alternate XML sources for each request

I have two XML sources to retrieve data from. I want to use them alternately per page load. So when someone visits the page the first source will be used, next time the visit the page the other source will be used. Here is the ajax request I am using to get one data source: $(document).ready(function() { $.ajax({ ...

imagejpeg() doesnt give the output properly in php

Hi there, I want to upload an image from disk, resize it, and then upload it to Amazon S3. However, I cant get the proper image output from imagejpeg(). heres my code: $sourceUrl = $_FILES['path']['tmp_name']; $thumbWidth = '100'; $thumbid = uniqid(); $img = imagecreatefromjpeg($sourceUrl); $width = imagesx( $img ); $height =...