php-general Digest 11 Sep 2005 14:03:45 -0000 Issue 3676
Topics (messages 222133 through 222143):
Date/Time Display for recurring monthly event
222133 by: Aragon.HELP
222140 by: Burhan Khalid
222141 by: Burhan Khalid
creating a login/registration/admin function/app
222134 by: info.globalissa.com
Re: PHP on FreeBSD - Compiler Bugs and Option selection
222135 by: Vizion
Re: Convert a timestamp to RFC822??
222136 by: Kevin Waterson
PHP page counter
222137 by: Michelle Konzack
date of file?
222138 by: sub.pudlz.com
222139 by: Michelle Konzack
date and time conversion
222142 by: babu
222143 by: Burhan Khalid
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Having a heck of time getting anything to work, can anyone make a suggestion
to the following.
I need a webpage that displays 5 recurring meeting dates, i.e. the second
Wednesday, Thursday, and Friday of each month in five different locations.
Is there an easy (meaning code only, without using a database connection)
way to get dates to display and automatically roll-over to the next months
date when the actual date changes?
Thanks in advance for the help.
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Having a heck of time getting anything to work, can anyone make a suggestion
to the following.
I need a webpage that displays 5 recurring meeting dates, i.e. the second
Wednesday, Thursday, and Friday of each month in five different locations.
<?php
echo "Current Month: \n\n";
echo date("r",strtotime("second Wednesday"))."\n";
echo date("r",strtotime("second Thursday"))."\n";
echo date("r",strtotime("second Friday"))."\n\n";
echo "Next Month: \n\n";
echo date("r",strtotime("second Wednesday",strtotime("1st
October")))."\n";
echo date("r",strtotime("second Thursday",strtotime("1st
October")))."\n";
echo date("r",strtotime("second Friday",strtotime("1st
October")))."\n\n";
echo "For all months of the year (for loop way) : \n\n";
for($x = 1; $x <=12; ++$x)
{
$current_month = date("F",mktime(0,0,0,$x,1,date("Y")));
echo 'For the month of '.$current_month.":\n\n";
echo date("r",strtotime("second Wednesday",strtotime("1st
".$current_month)))."\n";
echo date("r",strtotime("second Thursday",strtotime("1st
".$current_month)))."\n";
echo date("r",strtotime("second Friday",strtotime("1st
".$current_month)))."\n\n";
}
echo "For all months of the year (array_map way) : \n\n";
function findDates($month)
{
$current_month = date("F",mktime(0,0,0,$month,1,date("Y")));
$x[] = date("r",strtotime("second Wednesday",strtotime("1st
".$current_month)));
$x[] = date("r",strtotime("second Thursday",strtotime("1st
".$current_month)));
$x[] = date("r",strtotime("second Friday",strtotime("1st
".$current_month)));
return $x;
}
$dates = array_map('findDates',range(1,12));
echo 'For the month of December : '."\n";
print_r($dates[11]);
?>
Enjoy :)
--
Burhan
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
Burhan,
Thank you for replying, it is very much appreciated.
Perhaps I did not state what I needed as well as I should have. I'm
looking for the code which displays the date of the second Thursday of each
month on a web page. I have to insert this code at 5 different locations on
that webpage for different meetings. The scenario below describes how it
needs to work.
This month for example, September, the second Thursday is September
8, 2005. Up until midnight of September 8th the date on the webpage should
read September 8, 2005. When midnight arrives on September 8th, the date
displayed should change to October 13, 2005. If you can still help me I
would be grateful.
Oh, so you want to display the next available Thursday.
<?php
$current_month_thursday = strtotime("2nd
Thursday",mktime(0,0,0,date("m")-1,0,2005));
if (strtotime("now") > $current_month_thursday)
{
//First thursday has passed, show the first thursday
//of the next month
echo 'Next Meeting Date : ';
$next_month = mktime(0,0,0,date("m")+1,0,date("Y"));
echo date("r",strtotime("2nd Thursday",$next_month));
} else {
// This month's second thursday hasn't passed yet
echo date("r",$current_month_thursday);
}
?>
This prints :
[EMAIL PROTECTED] ~ $ php -q date2.php
Next Meeting Date : Thu, 13 Oct 2005 00:00:00 +0300
Hope this helps, and please, reply to the list and not directly to me so
others may contribute and learn.
Regards,
Burhan
[EMAIL PROTECTED]
-----Original Message-----
From: Burhan Khalid [mailto:[EMAIL PROTECTED]
Sent: Sunday, September 11, 2005 6:55 AM
To: [EMAIL PROTECTED]
Cc: [email protected]
Subject: Re: [PHP] Date/Time Display for recurring monthly event
[EMAIL PROTECTED] wrote:
Having a heck of time getting anything to work, can anyone make a
suggestion
to the following.
I need a webpage that displays 5 recurring meeting dates, i.e. the second
Wednesday, Thursday, and Friday of each month in five different locations.
<?php
echo "Current Month: \n\n";
echo date("r",strtotime("second Wednesday"))."\n";
echo date("r",strtotime("second Thursday"))."\n";
echo date("r",strtotime("second Friday"))."\n\n";
echo "Next Month: \n\n";
echo date("r",strtotime("second Wednesday",strtotime("1st
October")))."\n";
echo date("r",strtotime("second Thursday",strtotime("1st
October")))."\n";
echo date("r",strtotime("second Friday",strtotime("1st
October")))."\n\n";
echo "For all months of the year (for loop way) : \n\n";
for($x = 1; $x <=12; ++$x)
{
$current_month = date("F",mktime(0,0,0,$x,1,date("Y")));
echo 'For the month of '.$current_month.":\n\n";
echo date("r",strtotime("second Wednesday",strtotime("1st
".$current_month)))."\n";
echo date("r",strtotime("second Thursday",strtotime("1st
".$current_month)))."\n";
echo date("r",strtotime("second Friday",strtotime("1st
".$current_month)))."\n\n";
}
echo "For all months of the year (array_map way) : \n\n";
function findDates($month)
{
$current_month = date("F",mktime(0,0,0,$month,1,date("Y")));
$x[] = date("r",strtotime("second Wednesday",strtotime("1st
".$current_month)));
$x[] = date("r",strtotime("second Thursday",strtotime("1st
".$current_month)));
$x[] = date("r",strtotime("second Friday",strtotime("1st
".$current_month)));
return $x;
}
$dates = array_map('findDates',range(1,12));
echo 'For the month of December : '."\n";
print_r($dates[11]);
?>
Enjoy :)
--
Burhan
--- End Message ---
--- Begin Message ---
Hello Bruce,
I didn't want to sound like a walking advertisement on this list so I have
sticky emailed specific information direct to you about your question and our
answer.
However, I DID want the list to know about a freeware ( LGPL license ) mini
application that protects sensitive web pages with just one line of code (after
self installation on any web server). This freeware app is called
admin-login-only and it performs basic single user (administration) session
based authentication.
More info: http://www.globalissa.com/showcase.php?n=13&p=15
FREE Download: http://www.globalissa.com/download.php?n=13&p=15
We encourage commercial / or any use with the open ended LGPL license. The
software is absolutely free.
Dave.
===
Bruce wrote:
hi...
i'm in the process of looking for/creating a function to allow me to perform
user login/registration/etc, as well as handle a user admin function.
snip
--- End Message ---
--- Begin Message ---
On Saturday 10 September 2005 12:53, the author Vizion contributed to the
dialogue on-
Re: PHP on FreeBSD - Compiler Bugs and Option selection:
>On Saturday 10 September 2005 12:49, the author Vizion contributed to the
>dialogue on-
>
> PHP on FreeBSD - Compiler Bugs and Option selection:
>>Hi ale
>>
>>I just wanted to check you had received OK the two compiler errors that I
>>reported for /usr/ports/lang/php5-extensions.
>>
>>The first error was apparently caused by make expecting libmagic in an
>>incorrect path for FreeBSD 5.3. Once a copy was placed in the correct path
>>compilation resumed.
>
>I meant to say that full credit should be given to
>Kris Kennaway <[EMAIL PROTECTED]> who made the suggestion to
>copy /usr/src/contrib/file/magic.h to
>/usr/include/magic.h
>and see if it works. Which it did.
>
>>The second error seems also to be caused by an inability to find requisite
>>files for wddx.
>>ext/xml/expat_compat.h
>>ext/xml/php
>>
>>As a result of compiling php5 I began to wonder whether it would be
>> helpful to users if :
>>drwxr-xr-x 3 root wheel 512 May 2 07:06 php5-cli
>>drwxr-xr-x 3 root wheel 512 Sep 9 18:00 php5-extensions
>>drwxr-xr-x 3 root wheel 512 May 28 10:06 php_doc
>>were more integrated as choices within make for php5.
>>
>>I would personally find it helpful if all the build options for php could
>> be in an editable file for sysadmins to define a repeatable unattended
>> build from all available build options. A closer integration of the
>> subsidiary php5 ports into the php5 make would facilitate this process.
>>
>>I do not not how welcome these proposals might be or how easy it would be
>> to make the changes but would be interested to know what others think.
>>
>>Norberto Meijome <[EMAIL PROTECTED]> made a very interesting suggestion
>> that he uses on his servers to achieve the above goal. He
>>uses /usr/local/etc/pkgtools.conf for that purpose but my preference would
>> be to have a method that is particular to php and does not lead to an
>>overloading of /usr/local/etc/pkgtools.conf.
>>
>>I have copied Norbeto's example below:
>>****************** Quote*******************************
>>-if you want to avoid having to choose by hand what you really
>>-want( or have it preconfigured so all you have to do is press OK, then
>>-use something like /usr/local/etc/pkgtools.conf which will be read by
>>-portinstall (sysutils/port-maintenance-tools/)
>>-my relevant sections for my servers are:
>>-
>>----
>>- 'php4-*' =- [
>>- 'WITH_APACHE2=true',
>>- 'WITHOUT_DEBUG=true',
>>- 'WITH_BCMATH=true',
>>- 'WITH_BZ2=true',
>>- 'WITHOUT_CALENDAR=true',
>>- 'WITH_CRACK=true',
>>- 'WITH_CTYPE=true',
>>- 'WITHOUT_CURL=true',
>>- 'WITH_DBA=true',
>>- 'WITHOUT_DBASE=true',
>>- 'WITHOUT_DBX=true',
>>- 'WITHOUT_DIO=true',
>>- 'WITHOUT_DOMXML=true',
>>- 'WITHOUT_EXIF=true',
>>- 'WITHOUT_FILEINFO=true',
>>- 'WITHOUT_FILEPRO=true',
>>- 'WITHOUT_FRIBIDI=true',
>>- 'WITH_FTP=true',
>>- 'WITH_GD=true',
>>- 'WITHOUT_GETTEXT=true',
>>- 'WITHOUT_GMP=true',
>>- 'WITHOUT_ICONV=true',
>>- 'WITHOUT_IMAGICK=true',
>>- 'WITHOUT_IMAP=true',
>>- 'WITHOUT_INTERBASE=true',
>>- 'WITHOUT_LDAP=true',
>>- 'WITH_MBSTRING=true',
>>- 'WITHOUT_MCAL=true',
>>- 'WITH_MCRYPT=true',
>>- 'WITHOUT_MCVE=true',
>>- 'WITH_MHASH=true',
>>- 'WITHOUT_MING=true',
>>- 'WITHOUT_MNOGOSEARCH=true',
>>- 'WITHOUT_MSSQL=true',
>>- 'WITH_MYSQL=true',
>>- 'WITHOUT_NCURSES=true',
>>- 'WITHOUT_ODBC=true',
>>- 'WITHOUT_OPENSSL=true',
>>- 'WITHOUT_ORACLE=true',
>>- 'WITH_OVERLOAD=true',
>>- 'WITHOUT_PANDA=true',
>>- 'WITHOUT_PCNTL=true',
>>- 'WITH_PCRE=true',
>>- 'WITHOUT_PDF=true',
>>- 'WITHOUT_PGSQL=true',
>>- 'WITH_POSIX=true',
>>- 'WITHOUT_PSPELL=true',
>>- 'WITHOUT_READLINE=true',
>>- 'WITHOUT_RECODE=true',
>>- 'WITH_SESSION=true',
>>- 'WITH_SHMOP=true',
>>- 'WITHOUT_SNMP=true',
>>- 'WITHOUT_SOCKETS=true',
>>- 'WITHOUT_SYBASE_CT=true',
>>- 'WITH_SYSVMSG=true',
>>- 'WITH_SYSVSEM=true',
>>- 'WITH_SYSVSHM=true',
>>- 'WITH_TOKENIZER=true',
>>- 'WITHOUT_WDDX=true',
>>- 'WITH_XML=true',
>>- 'WITHOUT_XMLRPC=true',
>>- 'WITH_XSLT=true',
>>- 'WITHOUT_YAZ=true',
>>- 'WITHOUT_YP=true',
>>- 'WITH_ZIP=true',
>>- 'WITH_ZLIB=true',
>>- ],
>>- 'php4-dba-*' =- [
>>- 'WITH_CDB=true',
>>- 'WITH_DB4=true',
>>- 'WITH_GDBM=true',
>>- 'WITH_INIFILE=true',
>>- 'WITH_FLATFILE=true',
>>- ],
>>- 'php4-gd-*' =- [
>>- 'WITH_T1LIB=true',
>>- 'WITH_TRUETYPE=true',
>>- 'WITHOUT_JIS=true',
>>- 'WITH_LZW=true',
>>- ],
>>- 'php4-mbstring-*' =- [
>>- 'WITH_REGEX=true',
>>- ],
>>*************End Quote***************************
>>
>>I also wonder why the Makefile, by default, uses the --disable-all option
>> in the Makefile with no option to remove it.
I have now heard from uasers at the smf forum that some php programmes read
the settings which are from phpinfo(). If --disable-all option is set then
this is taken as a flag that php does not have sessions enabled even when it
may have been enabled at a later stage of the build. This problem has
accounted for some errors on php programs. Smf fails on php5 on freebsd 5.3 &
5.4. When --disable-all option is removed one freebsd user reported that the
bug phpbb then ran fine. I do not know whether the problem applies to all
configs - but it does seem to be there.
So I really fo think something needs to be done about this. My question is
would simply removing it from the make file cause build problems as things
now stand.
>>
>>I would be interested in what others have to say and would like to place on
>>record my appreciation for all your work in maintaining the ports.
>>
>>david
--
40 yrs navigating and computing in blue waters.
English Owner & Captain of British Registered 60' bluewater Ketch S/V Taurus.
Currently in San Diego, CA. Sailing bound for Europe via Panama Canal after
completing engineroom refit.
--- End Message ---
--- Begin Message ---
This one time, at band camp, Brian Dunning <[EMAIL PROTECTED]> wrote:
> I get my timestamp from the db in this format (I don't have control
> over this):
>
> 2004-05-14 13:24:48
>
> I need to convert it to RFC822 to make it a valid RSS pubDate field
> like this:
>
> Wed, 02 Oct 2002 13:00:00 GMT
>
> How can I do that? I'm tearing my hair out here (what's left)...
SELECT *, DATE_FORMAT(yourdatecolumn,'%d, %m,%Y %h:%i %p') AS your_date FROM
table
just change the %m options to suit the format you wish.
You will then have a field called your_date that you can access in your loop
like
while($row=mysql_fetch_array($result))
{
echo $row['your_date'];
}
enjoy,
kevin
--
"Democracy is two wolves and a lamb voting on what to have for lunch.
Liberty is a well-armed lamb contesting the vote."
--- End Message ---
--- Begin Message ---
G'Morning *,
Does anyone know, where I can get a PHP-Code for
a high performance page counter ?
I need one, which can handle very high traffic
(15.000 Hits/h) becase my own one sucks (locking). :-/
It can be text/plain or php-gd based.
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
In addition to reading the names of the files in a directory, I also need to
read the date the file was modified.
Right now I've got this:
if ($handle = opendir("$path"))
{
$b=0;
while (false !== ($file[$b] = readdir($handle)))
{
$b++;
}
closedir($handle);
}
What function do I need to use to do this? I'm working in php4.
Andrew Darrow
Kronos1 Productions
www.pudlz.com
--- End Message ---
--- Begin Message ---
Am 2005-09-11 03:08:22, schrieb [EMAIL PROTECTED]:
> In addition to reading the names of the files in a directory, I also
> need to read the date the file was modified.
filemtime()
Greetings
Michelle
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/3/88452356 67100 Strasbourg/France IRC #Debian (irc.icq.com)
signature.pgp
Description: Digital signature
--- End Message ---
--- Begin Message ---
Hi,
how to convert DD.MM.YYand HH:MM:SS into mysql date( 'YYYY-MM-DD' ) and time
format. I think the time is same as HH:MM:SS.
Are there any php built in functions , or need to convert them using regular
expressions.
thanks
babu
---------------------------------
How much free photo storage do you get? Store your holiday snaps for FREE with
Yahoo! Photos. Get Yahoo! Photos
--- End Message ---
--- Begin Message ---
babu wrote:
Hi,
how to convert DD.MM.YYand HH:MM:SS into mysql date( 'YYYY-MM-DD' ) and time format. I think the time is same as HH:MM:SS.
[EMAIL PROTECTED] ~ $ php -r 'echo
date("Y-m-d",strtotime(str_replace(".","/","12.12.05")))."\n";'
2005-12-12
Hope that helps :)
See http://php.net/date
http://php.net/strtotime
http://php.net/mktime
For more information
--
Burhan
--- End Message ---