php5

Diferences between php5apache2_2_filter.dll and php5apache2_2.dll

Besides the name, what are the differences between loading one or another? I got issues with APC and X-Debug, I know that is a quick way to crash Apache but my application relies in APC and I MUST profile with WebGrind so it's no option for me to disable either. So I'm trying to think out of the box. What I can't do: Disable APC or X...

check for integer or float values

I have this $number = 0.5 if (is_float($number)) { echo 'float'; } else { echo 'not float'; } and it echos not float. what could be the reason thanks ...

PHP Code - no idea if it does something

Hi i have the following code snippet, in an appliation working with Zend Framework. I know what Zend Date does.. thats not the problem. But the coder simply calls "$date" , and i dont know if this does something? $date = new Zend_Date(time()); $date->addDay(1); $date; // save date, or do something ...

Restrict direct access to script based on joomla authentication

Hello i found Aron Rotteveel script: <?php $file = $_GET['file']; $fileDir = '/path/to/files/'; if (file_exists($fileDir . $file)) { // Note: You should probably do some more checks // on the filetype, size, etc. $contents = file_get_contents($fileDir . $file); // Note: You should probably implement some kind //...

how do i get system stats in PHP

i am launching a beta version of a web app and i want to log system information about resources. system monitors eat up way too much resources and do a lot more than what i need. What i want to do is get key stats and log them every time a user logs in. these are the stats i am interested in: number of users - i have done this alread...

Regex to remove div tags but not their content

Let's say this is my HTML: <ul> <li><div style="width: 10em;">Hello</div><div class="ble"></div></li> </ul> I want to get this: <ul> <li>Hello</li> </ul> As you can see, all div opening and closing tags were removed but not their content! This is what I have so far: $patterns = array(); $patterns[0] = '/<div.*>/'; $patter...

how to resolve Undefined index error?

hey guys i got following error Undefined index: hname in C:\Temp\5Aug2010\job.php on line 38 this error occur in insert command i use '".mysql_real_escape_string($_POST['hname'])."' where hname is a textbox field on form if i use '".mysql_real_escape_string((isset($_POST['hname'])))."' then error will gone but in database it sho...

Reading emails?

Hi everybody, I have thought some time about creating a PHP-based customer-service thingy that assigns different types of customer-related stuff to a ticket-id (#). For starters, I would like to be able read emails from an email account and assign a ticket-id to every new email that's received. I have no bloody idea of how I could ma...

best way to replace a string ?

string '/home/adam/Projects/red/storage/22ff0bc0662bd323891844f6ed342cce2603490ec0_tumb_2.jpg' (length=85) what i need is just http://localhost/storage/22ff0bc0662bd323891844f6ed342cce2603490ec0_tumb_2.jpg what is the best way doing it ? i mean useing strlen ? substr_replace ? substr ? im a bit confused what is the best way doing thi...

How to tell if optional parameter in PHP method/function was set or not?

Assume I have a method/function with the following signature: foo($bar = 0) Inside foo, how do I tell if $bar was set or not? isset will alway return a TRUE since $bar is assigned 0 in the event nothing is passed to foo. Checking for 0 is not an option. I need to know the difference between the parameter explicitly being set to 0 or ...

How to create a custom template system in PHP

Hello friend I want to use a custom template system in my php application, What I want is I want to keep away my php codes from design, I would like to use a tpl file for designs and a php file for php codes I dont want to use any ready maid scripts. Can any one point out some links link or useful info how to build a php templating...

Zend Framework 1.10.7 telephone validator

Please See Correct Answer for solution to the requested question. Hi, Recently I have been searching for telephone validation in zend framework which I think is a missing component of their Validator framework. Therefore I created custom telephone validator which I would like to share with you. Put code below in a file accessible by...

which jquery i can use?

hey guys i want to create one display form in which at the bottom images with some text are display in a sliding format. And when user take mouse pointer onto image that time at the top that image look bigger compare to bottom image.& with image some text also appear with "readmore" button. when you click "readmore" then it redirect to o...

Multiple RSS feeds with PHP (performance)

Hi! In my recently project i work with multiple rss feeds. I want to list only the latest post from all of them, and sort them by timestamps. My issue is that i have about 20 different feeds and the page take 6 seconds to load (only testing with 10 feeds). What can i do to make it perfrom better? I use simplexml: simplexml_load_file...

PHP HTTP Basic Auth using Form

How can I use HTTP basic Authentication and have the user submit their Username and Password in a HTML form and have it Authenticate using HTTP Basic Authentication. I heard that Internet Explorer no longer supports the use of http://user:[email protected] no more so I don't know the best way to approach this. Use of PHP and javascr...

email send request to user

i want to create a button and one text box. now i want user can send any site of link to his friend how can i give this all. can i get any structure of code or can i get code that where i can create this. ...

while sending link to side i am geting error

there is is this Object not found! The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error. If you think this is a server error, please contact the webmaster. Error 404 127.0.0.1 08/13/10 16:00:12 Apache/2.2.15 (Win32) PHP/5....

How do I read the value of PHP sess_ files?

Hi, At localhost (Debian Sid machine), PHP creates session files in /var/lib/php5. When I open sess_cd2ct9hud284gn01os13nk5mi7, for example, i can see something like that: Qms6wztHQ9u79B7jjiihLX0cKc_fXgwo0NeVE34jFhdE__1JDOliUDteHQVXgMAjcGZgJ1EkBft0IUsqBdWrck7s0Vjghsm3vk681u_GV8KRK-ExrAEbvbgXfl51Z83tyh5h2JtRy0qLZmhqwLtUFykm1XbdBBxx5xJpNp...

How to create a PHP singleton class to handle request vars?

Hi was thinking about creating a Single class called 'Request' to handle and clean POST and GET variables but being new to the singleton pattern I'm not sure how to implement it. Ideally I'd like to have 2 functions post($name,$clean) and get($name,$clean) - $clean being a boolean to determine whether to trim/ escape the value ...

Zend Framework 1.10: Cookies aren't stored

Hi, I'm trying to with Cookies and Zend Framework 1.10. This is my code: $zendCookie = new Zend_Http_Cookie('foo', 'bar', 'localhost', time() + 60 * 60 * 24 * 30); $client = new Zend_Http_Client(); $client->setCookie($zendCookie); But the cookies aren't stored. I checked it with Firecookie Firefox's extension. What's wrong? Thank yo...