I am a complete newbie in PHP. I would like to show the number of days missing for a specific date. In other words, I want to display something like:
"X days to go for the great event"
using PHP and the server time.
How is this accomplished?
...
I've just put together a very basic site using the Zend Framework and its MVC. (Actually, I'm not even using models at the moment, it's all just Controllers/Views for static info so far).
When I started toying with the Forms I realized that in the examples for Zend_Form they use something like this this set the form's action:
$form->...
I was tasked with cleaning up some errors on a site my company built quite a few years ago. I want to preface the code I post here with the caveat that I didn't write it, and I know it is not a very secure login system, but I have only been assigned to fix the bug at hand.
PROBLEM: When users go to login, after they submit the form the...
I know that the rand function in PHP generates random integers, but what is the best way to generate a random string such as:
Original string, 9 chars
$string = 'abcdefghi';
Example random string limiting to 6 chars
$string = 'ibfeca';
UPDATE: I have found tons of these types of functions, basically I'm trying to understand the lo...
I currently have two class hierarchies: one for handling errors and another for logging them. I am wondering 1) whether it is advantageous to delegate error handling to a class separate from the error handler and 2) whether what I have is a good design.
Here is what I have:
class ErrorHandler {
public __construct(ErrorLogger $ErrorLo...
If a method creates an object and I call the method from an other object, will the last object have access to the first object's properties and methods?
...
Hey all,
I have spent a lot of time trying to get dompdf (http://www.digitaljunkies.ca/dompdf/) to work but I keep running into problems. I am trying to generate a PDF from a PHP script which generates a fairly complex, filled out web form. The script accepts a $_GET parameter (record number) and fills out the form accordingly with da...
Looking for an example of storing session data in a database, using the Zend Framework.
...
I've used two PHP email scripts and routing it through my SMTP server, when I do this though it sends two of the same email.
When I use mail() this doesn't happen, but I'd much rather use SMTP.
Any ideas why this may be occuring?
...
I am to build a PHP application for a website that already has another PHP application running on the same domain/server.
My app will of course be using sessions, and I don't want my sessions to interfere with the existing app.
For example if I want to use $_SESSION['username'], maybe the other app also uses $_SESSION['username'], which ...
I set up this test page up on my server. Please tell me why the $_POST array does not contain anything even when I submit the form. I have tried this in three different browsers and nothing happens.
<?php print_r($_POST);?>
<form method="post">
<p><label>Email: </label>
<input type="text" id="login_email" />
</p>
<p><label>Password: ...
How can i reference a class property knowing only a string?
class Foo
{
public $bar;
public function TestFoobar()
{
$this->foobar('bar');
}
public function foobar($string)
{
echo $this->$$string; //doesn't work
}
}
what is the correct way to eval the string?
...
I have a PHP script on a server that generates the XML data on the fly, say with Content-Disposition:attachment or with simple echo, doesn't matter. I'll name this file www.something.com/myOwnScript.php
On another server, in another PHP script I want to be able to get this file (to avoid "saving file to disk") as a string (using the pat...
I would have liked to know if it was a good idea to return a select object from a method like '$selectObj = getSomethingByName($name)' to then pass it to another method like 'getResult($selectObj)' which will do the trick.
The idea is to be able to pass the select object to any usefull function like 'setLimit(10)' or addCriteria('blabla'...
Is there a good way to determine how many pages the twitter search api has returned or is there a way to determine how many values were returned and divide that by the number of twits per page?
...
For some reason the iis smtp server and php are not communicating properly. I have verified that the smtp is working by telneting to it and doing the mail commands and I'm able to receive an email. In addition, I followed this link http://support.microsoft.com/?id=297700 and was able to receive an email. But whenever I try to send ema...
We are using APC as an opcode cache. Is there a way to get APC to cache the non-existence of a file? We have set apc.stat = 0 and apc.include_once_override = 1. Is there something more to do to improve the performance of calling include_once on a file that may not be present on the filesystem? If it is present, obviously we want to i...
Hi,
Need some help about with Memcache.
I have created a class and want to store its objects in Memcache, finding trouble doing so please tell me where am I going wrong. Following is my code
// Class defined by me
class User
{
public $fname;
public $age;
/**
* @return unknown
*/
...
I am a capable programmer and I write software for a living. I am taking up a new project to build a website that has a bunch of forms that perform CRUD operations on a database and some multimedia. I am very familiar with PHP and Python and have written some websites in them. I have written some rake tasks and a few ruby scripts that ru...
Hi fellas,
Im working on porting some old ALP user accounts to a new ASP.Net solution, and I would like for the users to be able to use their old passwords.
However, in order for that to work, I need to be able to compare the old hashes to a newly calculated one, based on a newly typed password.
I searched around, and found this as th...