php5

Downloading File from remote server using php script without fopen

Hi, Scenario : I have a c# .net web page. I want the user to be able to download a file placed on a remote server from a link on my page. However while downloading there should be minimum load on my server. Hence i tried creating a HttpWebRequest instance, passed the download.php path e.g. HttpWebRequest myHttpWebRequest = (HttpWebRe...

Warning: require_once(): It is not safe to rely on the system's timezone settingserror in PHP

I am trying to install a open source PHP application IIS; after installation I am getting the following error: Warning: require_once(): It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are...

Select multiple Image and upload atonce using PHP

Hi, I am using PHP5 and I want to create multiple file uploader of type Image, in such a way that user could select different images while holding Ctrl button and click mouse left button (While user doing so all images will push in an array) and when ever he click to Uplaod button then all images would be upload. ...

PHP xls, xlsx, ppt, pptx headers

Here is my code where I am trying to send a correct header depedning on a type of a document. I figured out the headers for pdf, doc and docx but I still need to know correct header for Excel and Powerpoint files. Any help appreciated. $document = urldecode($_GET['document']); $extension = end(explode('.', $document)); $m...

Allow users to download PDFs in PHP5, ZEND, MVC environment

All, I have a PHP5 application written with Zend Framework and MVC style. My application allows multiple users to login and see content based on their privileges. I have a dropdown on the home page. Upon selecting the dropdown, an ajax call occurs which populates the page with a table. Also, it generates a PDF file with the table data u...

1 transaction that uses 2 merchant accounts.

I need to setup a bill pay system to allow for 1 transaction that uses 2 merchant accounts. For example, 1 merchant account is attached to the client receiving the funds let’s say $30 dollars charge for the purchase, and attached we will charge let’s say a $3 bill pay fee attached to the bill pay service provider. So the funds need to ...

Download pdf file from a string using Jquery

All, I have a PHP5 application written with Zend Framework and MVC. On my home page, I want to incorporate the functionality to download a dynamically generated pdf file. The way this is done is: User clicks "download file" link. On Click, an AJAX call occurs to a PHP controller, which takes the form data, generates the pdf and return...

How to remove headers in an array

All, I have a PHP application that seems to generate the following headers in an array. I wish to remove these headers, so I can set new ones like the one for a pdf download. array(2) { [0]=> string(23) "X-Powered-By: PHP/5.3.1" [1]=> string(23) "Content-type: text/html" } How do I do this, as this doesn't seem to work: var_...

Convert HTML & CSS to a png image

Is there a way using php to take a div block with text and css and convert it to a solid png image? ...

jquery send the dropdown html

this is a nutts job here. Not sure if jquery can handle this. I have a php page called page1.php where I have drop down like this <select id="startRecord" > <option value="0"></option> </select> Now I caclulate some values here and then send the values to page2.php. Now on page2.php I do some more caclulations and rum a query. If...

How to convert 2010-07-28 00:00:00 to July 28, 2010, 00:00:00 using PHP

Hi, How to convert 2010-07-28 00:00:00 to July 28, 2010, 00:00:00 using PHP Thanks in advance ...

PHP Force Download file corrupt

Hi, I am using this PHP script to download a file: $status=stripos($_SERVER['HTTP_REFERER'],'servername'); if($status===false) { header('Location:http://xyz.com); } else { header('Content-disposition: attachment; filename=XXX.pdf'); header('Content-type: application/pdf'); readfile('http://www.xyz.com/Downloads/XXX.pdf)...

Windows Task Scheduler & PHP

I know Windows Task Scheduler is iffy at best, what I don't know is why. I tried to create a couple of tasks that would run a PHP script at various intervals, but nothing happens. No errors no nothing. If I right click on the task in the Task Scheduler and choose run - it works perfectly, but it will not run at the specified times by it...

How to access my singletons without using global state?

I know that Singleton pattern is bad because it uses global state. But in most applications, you need to have a single instance of a class, like a database connection. So I designed my Database object without using the singleton pattern but I instanciate it only once. My question is, how can I access my object in the low level classes ...

How do I add content to an existing XML file??

I do have an xml generator written in PHP. sample is given below but few lines only due to space issues. $output = '<?xml version="1.0" encoding="UTF-8"?>'."\n"; $output .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:ta...

array_shift not removing the first element of the array

I have the following code echo '<pre>'; print_r($this->region_id); echo '</pre>'; if(end($this->region_id) != 0){ if($this->region_id[0] == 0){ array_shift($this->region_id); } } echo '<pre>'; print_r($this->region_id); echo '</pre>'; Somehow it's not removing the first ...

Is there a performance difference between PDO fetch statements?

like in /* Exercise PDOStatement::fetch styles */ print("PDO::FETCH_ASSOC: "); print("Return next row as an array indexed by column name\n"); $result = $sth->fetch(PDO::FETCH_ASSOC); print_r($result); print("\n"); print("PDO::FETCH_BOTH: "); print("Return next row as an array indexed by both column name and number\n"); $result = $sth->...

building an extendible php application

I want to start a new project, there are currently 4 of us who plan to use the system as our website. So basically i'm wondering if there are any existing frameworks/libraries that will enable to us to build the app to be configurable. Kinda like how wordpress is, you can add your own theme and plugins to customize the functionality of t...

Type-less catch block in PHP

Has PHP any ability to catch all types of exceptions in one catch block? Is there any way to do this: try { throw new Exception; OR throw new MyException; } catch(???) { // Catch both exception types } ...

PHP 5 - Securing an admin area of a site

I'm currently writing a couple of MVC sites using Kohana as my framework. Each has a simple admin area where the admin can upload and edit content. I'm currently storing the admin's user model in a session and checking whether or not they're an administrator with the following method: private function checkAdmin() { if (!isset($_S...