[PHP] Enhancement of script

2002-09-07 Thread Ray Healy \(Data Net Services\)

Dear All

I have recently downloaded a calendar from CST (which is no longer
supported ) and I have made a few changes to the script.

The calendar will be used to see when something is booked and you can assign
messages to it as well which the general user cannot see. In this respects I
have created 2 pages - welcome .php for the general viewer and admin_welcome
for the updating of the calendar.

What I would like to do is to be able to enter multiple dates in at the same
time - either saying from a start date for so many days or from a start date
to an end date.

After spending hours looking at the code and in this forum I cannot seem to
get it right - basically I cannot do it.

I was wondering if someone could have a look and tell me where I am going
wrong.

I have attached the files to this email along with the mySQL table file in
case another column needs to be added.

You can see the script running at
www.matrix-hosting.co.uk/prestige/welcome.php for the general view and
www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side.

Any help would be appreciated


Ray

P.S. if any one also knows how to get it to display a 2 or 3 months at a
time or even a year this would also be a bonus as I have tried to do this as
well.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Enhancement of script

2002-09-07 Thread Philip J. Newman

Looks good if your keen to shear the code we could have a tinkle with it and
see if we can work it out.

Phil

- Original Message -
From: Ray Healy (Data Net Services) [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, September 07, 2002 10:11 PM
Subject: [PHP] Enhancement of script


 Dear All

 I have recently downloaded a calendar from CST (which is no longer
 supported ) and I have made a few changes to the script.

 The calendar will be used to see when something is booked and you can
assign
 messages to it as well which the general user cannot see. In this respects
I
 have created 2 pages - welcome .php for the general viewer and
admin_welcome
 for the updating of the calendar.

 What I would like to do is to be able to enter multiple dates in at the
same
 time - either saying from a start date for so many days or from a start
date
 to an end date.

 After spending hours looking at the code and in this forum I cannot seem
to
 get it right - basically I cannot do it.

 I was wondering if someone could have a look and tell me where I am going
 wrong.

 I have attached the files to this email along with the mySQL table file in
 case another column needs to be added.

 You can see the script running at
 www.matrix-hosting.co.uk/prestige/welcome.php for the general view and
 www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side.

 Any help would be appreciated


 Ray

 P.S. if any one also knows how to get it to display a 2 or 3 months at a
 time or even a year this would also be a bonus as I have tried to do this
as
 well.









 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Enhancement of script

2002-09-07 Thread Ray Healy \(Data Net Services\)

Dear All

The calendar will be used to see when something is booked and you can assign
messages to it as well which the general user cannot see. In this respects I
have created 2 pages - welcome .php for the general viewer and admin_welcome
for the updating of the calendar.

What I would like to do is to be able to enter multiple dates in at the same
time - either saying from a start date for so many days or from a start date
to an end date.

After spending hours looking at the code and in this forum I cannot seem to
get it right - basically I cannot do it.

I was wondering if someone could have a look and tell me where I am going
wrong. (scripts at bottom of page)

ng at
www.matrix-hosting.co.uk/prestige/welcome.php for the general view and
www.matrix-hosting.co.uk/prestige/admin_welcome.php for the admin side.

Any help would be appreciated

Ray

P.S. if any one also knows how to get it to display a 2 or 3 months at a
time or even a year this would also be a bonus as I have tried to do this as
well.

The Scipts:

mySQL Database File
CREATE TABLE tablename (
id int(11) DEFAULT '0' NOT NULL auto_increment,
username varchar(255),
stamp datetime,
subject varchar(255),
description blob,
PRIMARY KEY (id)
);


welcome.php (this is what the end user sees)
?
$mysql_hostname = 'localhost';
$mysql_username = '';
$mysql_password = '';
$mysql_database = '';
$mysql_tablename = '';
$currentday = date(j, time());
$currentmonth = date(m, time());
$currentyear = date(Y, time());
$lastday = 1;
$database = mysql_connect($mysql_hostname, $mysql_username,
$mysql_password);
if (!$month)
{
$month = date(m, time());
$year = date(Y, time());
}

mysql_select_db($mysql_database, $database);
echo centerfont face=Arial size=2b;
echo date('F', mktime(0,0,0,$month,1,$year));
echo  $yearpfont size=3/bp;

$firstday = date( 'w', mktime(0,0,0,$month,1,$year));
while (checkdate($month,$lastday,$year))
{
$lastday++;
}

$nextmonth = $month+1;
$nextyear = $year;
if ($nextmonth == 13)
{
$nextmonth = 1;
$nextyear = $year + 1;
}
$lastmonth = $month-1;
$lastyear = $year;
if ($lastmonth == 0)
{
$lastmonth = 12;
$lastyear = $year-1;
}
echo tabletr;
echo tdform method=post action=welcome.phpinput type=submit
value=''
input type=hidden name=month value=$lastmonth
input type=hidden name=year value=$lastyear/form/td;
echo tdform method=post action=welcome.phpinput type=submit
value=''
input type=hidden name=month value=$nextmonth
input type=hidden name=year value=$nextyear/form/td/tr/table;

echo table width=175 cellpadding=1 cellspacing=1 border=1;
echo trtd width=25font size=2bSun/b/font/tdtd width=25font
size=2bMon/b/font/td
td width=25font size=2bTue/b/font/tdtd width=25font
size=2bWed/b/font/td
td width=25font size=2bThu/b/font/tdtd width=25font
size=2bFri/b/font/td
td width=25font size=2bSat/b/font/td/b/font/tr;
for ($i=0; $i7; $i++)
{
if ($i  $firstday)
{
echo td/td;
}
else
{
$thisday = ($i+1)-$firstday;
if ($currentyear  $year)
{
echo td valign=top align=center bgcolor=dd;
}
else if ($currentmonth  $month  $currentyear == $year)
{
echo td valign=top align=center bgcolor=dd;
}
else if ($currentmonth == $month  $currentday  $thisday  $currentyear
== $year)
{
echo td valign=top align=center bgcolor=dd;
}
else
{
echo td valign=top align=center bgcolor=white;
}
echo font size=2b$thisday/b/fontbr
font size=3;
$query2 = mysql_query(SELECT subject FROM $mysql_tablename WHERE stamp =
\$year-$month-$thisday 00:00:00\ and stamp = \$year-$month-$thisday
23:59:59\ ORDER BY stamp);
for ($j = 0; $jmysql_num_rows($query2); $j++)
{
$results = mysql_fetch_array($query2);
if ($results[subject])
{
echo font color=redb$results[subject]/b/font;
}
}
if (mysql_num_rows($query2)  4)
{
for ($j=0; $j(4-mysql_num_rows($query2)); $j++)
echo ;
}
echo /td;
}
}
echo /tr\n;
$nextday = ($i+1)-$firstday;
for ($j = 0; $j5; $j++)
{
echo tr;
for ($k = 0; $k7; $k++)
{
if ($nextday  $lastday)
{
if ($currentyear  $year)
{
echo td valign=top align=center bgcolor=dd;
}
else if ($currentmonth  $month  $currentyear == $year)
{
echo td valign=top bgcolor=dd;
}
else if ($currentmonth == $month  $currentday  $nextday  $currentyear
== $year)
{
echo td valign=top align=center bgcolor=dd;
}
else
{
echo td valign=top align=center bgcolor=white;
}
echo font size=2b$nextday/b/fontbr
font size=3;
$query3 = mysql_query(SELECT subject FROM $mysql_tablename WHERE stamp =
\$year-$month-$nextday 00:00:00\ AND stamp = \$year-$month-$nextday
23:59:59\ ORDER BY stamp);
for ($i = 0; $imysql_num_rows($query3)+4; $i++)
{
$results2 = mysql_fetch_array($query3);
if ($results2[subject])
{
echo font color=redb$results2[subject]/b/font;
}
else if ($i  4)
{
echo ;
}
}
echo /td;
$nextday++;
}
}
echo /tr\n;
}
echo /tablefont size=3;
?


admin_welcome.php  (this is what the admin uses)
?
$mysql_hostname = 'localhost';
$mysql_username = '';
$mysql_password = '';
$mysql_database = '';
$mysql_tablename = '';
$currentday = date(j, time());
$currentmonth = date(m, time());
$currentyear = date(Y,