You are here: Re: How can you pull a random item and leave that item on site for a specified time period? « PHP Programming Language « IT news, forums, messages
Re: How can you pull a random item and leave that item on site for a specified time period?

Posted by Paul Herber on 10/01/07 19:00

On Mon, 1 Oct 2007 18:47:54 +0100, Krustov <me@privacy.net> wrote:

><comp.lang.php>
><itcassy>
><Mon, 01 Oct 2007 17:19:48 -0000>
><1191259188.218679.86660@g4g2000hsf.googlegroups.com>
>
>> I would like to pull a random or alphabetical result on the home page
>> of a site and leave that same result on there for one week. The
>> closest example I have found online is Random Quote Version 3.1 which
>> pulls from a text file rather than the database. I cannot mod it to
>> pull from my db and also it relies on cookies, so I would assume it
>> would pull a different random item for each computer and then keep
>> that item on the page for whatever time you specify (?). I am working
>> with dealers and would like to automatically feature a different
>> dealer every week without having to go into the db and choose which
>> one to feature.
>>
>
><?php
>
>$temp=time()+604800;
>
># the above is TIME NOW plus one week
>
># save $temp to database or flat file
>
>?>
>
><?php
>
># grab $temp from database or flat file
>
>$rambo=time();
>
>if ($rambo>$temp) {print "One week has passed - select another dealer";}
>
>?>

Whatever you do, do not follow Krusty's variable naming style.


--
Regards, Paul Herber, Sandrila Ltd. http://www.sandrila.co.uk/

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация