<?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*...
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...
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
...
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...
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.
...
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.
...
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
...
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
...
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...
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
...
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 ...
someonce can help me setup php to use json in php4?
thank!
...
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?
...
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...
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...
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...
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...
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 ...
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 (+=) ?
...