php5

How to fool Zend into thinking the request is dispatched from another directory instead of the default index.php

I am trying to integrate Wordpress with my Zend application using a plugin and it is working quite well except for one thing: the base url. My wordpress plugin calls my integration function inside my application's bootstrap from /myapplication/libray/wordpress. Therefore, the request base url is set to this value for the entire applicati...

gif, png, bmp to jpeg using PHP

How can I convert from 3 different image format gif , png and bmp to single jpeg format using PHP? Pls help. ...

Spreadsheet_Excel_Writer making Rows width longer

How can i make rows a bid longer? if i output the excel all prints fine, only if the title is a bit long, then the Title is not readable. How can i fix that? ...

How to get rid of ® and ™ in the string? (PHP)

Hello! I have a string like "Welcome to McDonalds®: I'm loving it™"... I want to get rid of ":", "'", ® and ™ symbols, so I do the following: $string = "Welcome to McDonalds®: I'm loving it™"; $string = preg_replace('/[^a-zA-Z0-9 -]/', '', $string); BUT on the output I receive: "Welcome to McDonaldsreg Im loving ittrade"... so preg...

How to access model to query database from a helper function?

Hi, I am trying to create authentication for my php website. I am using the codeigniter framework. I will have to validate the session in all the pages of my website. So to avoid the code repetition, i am planning to do it in a helper function. Now that my user credentials are in my database i would like to access the model to query th...

Best Graphing library for PHP

All, I was wondering if you have any suggestions for the best graphing library available for PHP. I plan to accomplish the following things: It should be scalable to support complex graphing plotting. It should support forecasting of data. It should be easy to implement and should be flexible to extend feature set. It should be option...

Answering HTTP_IF_MODIFIED_SINCE and HTTP_IF_NONE_MATCH in PHP

I have cacheable dynamic content made in PHP 5.1.0+. I already send the correct headers (including Last-Modified and ETag) to clients. I now want my script to be able to answer $_SERVER['HTTP_IF_MODIFIED_SINCE'] and $_SERVER['HTTP_IF_NONE_MATCH'] when present. When the conditions matches, I want to answer a HTTP 304 "Not Modified" to cl...

Is there a good base for me to work from for php user registration + subscription in MVC format?

Basically, I'm about to write a php script in the Zend Framework that's ONLY purpose is to handle user registration and offer AUTOMATIC MONTHLY subscriptions so that I can add other php driven scrips that they'll have access to based on their subscription status. Does something already do this? I'm looking for barebones, not something l...

PHP passing a class name becomes a string when passed to a function

Here's what I want to do: public function all($model) { $query = 'SELECT ' . implode(', ', $model::$fields) ....; } Called like this: $thing->all(Account); I get this error: Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /home/mark/public_html/*/account.php on line 15 When inspecting $model with var_dump it tu...

Create Upload progress bar in pure PHP

Hi all, I want to create Upload Progress bar Using simple and pure PHP Thanks in Advance NewBie ...

Decode the string encoded through php in javascript

Hi, I am working on a facebook page in which i have used ajax & response is returned in json format. I have encoded the string in php. Now i want to decode that string in javascript. foreach($feedbackdetails as $feedbackdetail) { $str.= '<div class="tweet"> <img style="cursor:pointer;" id="imgVoteUp" src="http://myserver/facebook/vote...

PHP Session Class and $_SESSION Array

Hello, i've implemented this custom PHP Session Class for storing sessions into a MySQL database: class Session { private $_session; public $maxTime; private $database; public function __construct(mysqli $database) { $this->database=$database; $this->maxTime['access'] = time(); $this->maxTime[...

PHP5 e-mail reminder when date field is one month before due date

I'm trying to set up an e-mail notification as a reminder to let me know when a vehicle inspection is due, preferably a month in advance. When a date is one month prior to the date in the due_date inspection table, it should send the reminder. Your help would be greatly appreciated. Below is the php code and MySQL schema I have so far: ...

PHP has encountered an Access Violation at ***

Win 2003, PHP 5.2.12 and IIS 6. I have PHP configured as ISSAPI and it is serving PHP pages. When I try a page that requires MySQL I am getting just: PHP has encountered an Access Violation at (and a RANDOM number) What does this mean? I have mysql extension uncommented in php.ini, iUSR_ has write permissions. I have specified the ph...

How to do something if sentence include one of the words in this array ?

Hello, I want to do something if my sentence include one of the words in this array, How to do that ? $sentence = "I dont give a badwordtwo"; $values = array("badwordone","badwordtwo","badwordthree","badwordfour"); Thanks... ...

PHP_iisfunc.dll is crashing wil i am trying access the detail for upload

hi all, Faulting application Apache.exe, version 2.0.63.200, faulting module php_iisfunc.dll, version 5.2.7.7, fault address 0x00001085. Any one having any idea about above error it thrown in Event view and crashes the apache server Regards, Hemant ...

Log4Php properties setting at runtime

I have a PHP application containing multiple modules and various settings within each module. I'd like to enable logging using log4php, but each individual module has different settings (ie. Log level, log file, etc). Some of these settings need to be changed on the fly by end users (log level), and I'd like to store these properties in ...

Need help with writing regular expression

Hi, I need help with writing regular expression for this pattern in PHP: [[{"type":"media","view_mode":"small","fid":"1","attributes":{"width":0,"height":0,"src":"http://localhost/x.png"}}]] This is part of the text and I am trying to replace this by something else. Would like to use preg_replace_all() but can't figure out what wou...

How to handle REQUEST in PHP

is there a class to handle $_REQUEST that makes the life of a php developer easier? I want to handle the client requests easier. I dont want to test with if(is_set($_REQUEST['blabla'])) {makesomthing();} I wish there could be a solution like this. class rpclike { public function getMember() { $memberid = $this->inputhandler['member...

Properly using classes in other classes in php?

Should have asked someone this a long time ago. What is the best way to use other classes within another class? For instance, lets say I have an application class: class Application { public function displayVar() { echo 'hello world'; } } and a database class class Database { // connects to db on construct p...