php4

$_COOKIE[] will not accept string with periods?

<?php $Test = "dsdsdad.dsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITH A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*3); } $Test = "dsdsdaddsad"; if (isset($_COOKIE["$Test"])) { echo "I GOT A COOKIE WITHOUT A PERIOD"; } else { setcookie("$Test", "yes", time()+60*60*24*...

file_get_contents create file is not exists

Is there any alternative to file_get_contents that would create the file if it did not exist. I am basically looking for a one line command. I am using it to count download stats for a program. I use this PHP code in the pre-download page: Download #: <?php $hits = file_get_contents("downloads.txt"); echo $hits; ?> and then in the dow...

PHP Image Upload Problem

Getting Undefined index: filename error in the below image upload php code. Is there any problem in the below code? <div id="content"> <form class="wufoo" action=<?php echo (BASE_PATH. 'admin/addbusinessdetail'); ?> method="post"> <input type="hidden" name="maxSize" value="9999999999" /> <input type="hidden"...

How to round a decimal number to nearest 5 or nearest 10 in php

How to round a decimal number to nearest 5 or nearest 10 in php ...

PHP - Question about uploading & uploaded image file

Hello all, I have read the following tutorial "Uploading Files To the Server Using PHP" and have several questions related to the topics. Q1> The tutorial mentions that "Note that PHP must have write access to $uploadDir or else the upload will fail" For me, I only allow the user to upload the file after the user has login t...

Get <p> and <br /> tags positions in HTML

Hi, I have to get <p> and <br /> tags positions in whole html code. If I use strpos function, I get only first tag position. Does it possible to make this function greedy or something ? Or maybe there is any other solution(function) ? Your help would be appreciated. ...

Insert string into other string

Hi, is there any function to insert string1 into another string2 if known particular insert place of string2. For example I have HTML code about 2000 chars long. And at 1000 char I want to insert other string which is 200 chars length. Your help would be appreciated. ...

compare date trimming

I have a field (nonTimeStampDate) that has date like this 2010-03-15 and I want to check it against another field (timeStampDate) which is 2010-03-15 15:07:45 to see if the date matchs. But as you can see since the format is different it doesnt match even though the date is same. Any help will be appreciated. thanks ...

ftping only todays files only..

Hi, I am new to php. have a task to ftp only todays files from the server containing files for over a week. how do i select or filter the files based on date and ftp to my local folder. Help is much appreciated !! Soloman ...

php output with sleep()

I'm trying to run a loop every second for 25 seconds basically. for($i = 0; $i <= 25; $i += 1){ echo $i; sleep(1) } The thing is it doesn't output until it's fully done, so after the loop continues 25 times. Is there a way to do this so it will output before each sleep? and not wait until the full loop is complete? Thanks...

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 ...

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 ...

php4 with json data

someonce can help me setup php to use json in php4? thank! ...

Parse and Stringify JSON in PHP 4

Possible Duplicate: php4 with json data Is there a library or class that provides parsing (JSON to PHP primitives/arrays) and stringifying (PHP primitives/arrays to JSON) for PHP 4? ...

Porting PHP5 to legacy PHP4, DOMDocument quibbles

I'm trying to make some of my php5 code work on a legacy server, which unfortunately cannot be upgraded (client's machine). if (!isset($docRoot)) { $docRoot = $_SERVER['DOCUMENT_ROOT']; } // generic storage class for the words/phrases $t = new stdClass(); $t->lang = $curPage->lang; // load xml translations, could split this int...

PHP Fatal error: Call to undefined method mosMenu::mosDBTable()

I have a Mambo CMS web site hosted with 000webhost. The site is powered by Mambo 4.6.2. and PHP Version 5.2.13 is installed on the 000webhost web server. The web site runs fine. I've upgraded the OS of my development machine to Ubuntu 10.04 since I last worked on the site, and the site no longer works. This machine has PHP Version 5.3.2...

Safe Encrypt/Decrypt Functions

Given an input string (will actually be an integer value) and an encryption key, I need to encrypt the input string in such a way that the resulting string is: URL safe (my permitted URI characters is currently: a-z 0-9~%.:_-) Filename safe (meaning, it only uses valid directory/filename characters) FTP account username safe Email acco...

Using a class in PHP4 and i don't know how to set a method

in PHP 5 it would be class Example { private $foo = "old data"; public function __construct(){} public function setVar($data){ $this->foo = $data; } public function output(){ return $this->foo; } } $var = new Example(); $var->setVar("new data"); echo $var->output(); I never learned OO in PHP 4 and am having tr...

PHP parse error in rss parse function

Hey, I have a client who needs a website urgently, but I have no access to information such as the control panel. PHP Version is 4.4 Which is a pain as I'm used to 5. The first problem is I keep getting: Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ')' in D:\hshome\*******\********\includes\functions.php on line ...

what is the different between this in php ?

Hi friends what is the difference between $totalprice += $product['price'] * $product['count']; and $totalprice = $product['price'] * $product['count']; both give the same result. so what's the use of (+=) ? ...