OK,
As I said, I will post this here in the forum so as to hopefully be able to help others with the same needs...
You want your members to be able to modify their "own" calendars but not others.
From your pm I now know that you have a login system working for the other "private" functions so that is one thing out of the way

I presume (hope) that you are using $_SESSION variables to validate the user on each page - is that correct?
I also suspect (again hope) that one of these session variables holds the "agentID".
If so, you can then update the calendar code (the main file) so that the ID_ITEM uses this value (currently in the code it uses a hardcode or $_REQUEST value.
So, you need to find this code:
- Code: Select all
if(isset($_REQUEST["id_item"])) define("ID_ITEM",$_REQUEST["id_item"]); #id sent via url, form session etc
else define("ID_ITEM", 6); # default used for demo
and replace it with somthing like this (depending on the name of you session variable):
- Code: Select all
if(isset($_REQUEST["id_item"]))
{
define("ID_ITEM", $_REQUEST["id_item"]); # id sent via url, form session etc
define("ALLOW_UPDATE", "0");
}
elseif(isset($_SESSION["agentID]))
{
define("ID_ITEM", $_SESSION["agentID]); # default used ;
define("ALLOW_UPDATE", "1");
}
else
{
die("NO ID SET");
}
This will do one of 3 things:
Firstly, if the calendar is being used to show the dates of "another" member - ie the $_REQUEST["id_item"] has been defined via an url, form etc then it will show the uneditable calendar for that member.
It also sets a new constant "ALLOW_UPDATE" to 0 which we will use later to tell the calendar that it can't be modified
Otherwise, if the user is logged in, it will use their "session id" to define which calendar to show.
In this case the "ALLOW_UPDATE" constant is set to "1" meaning that the calendar CAN be updated.
Finally the third case is to catch any errors if we don't have any id for the calendar OR if the user is not logged in (ie no session variables set)
OK, so now we have to modify the calendar to accept the new "ALLOW_UPDATE" constant...
Fortuantly the code is actually prepared for this though so it is just a question of finding this line:
- Code: Select all
draw_cal(ID_ITEM,$val["month"], $val["year"], $booked_days,1)
and replacing it with this:
- Code: Select all
draw_cal(ID_ITEM,$val["month"], $val["year"], $booked_days,ALLOW_UPDATE)
Here, the only difference is that we have replaced the hardcoded "1" value at the end to this new constant
Now, in theory, your calendar should accept work as required as regards the ability to modify calendars by users.
See if you can get this working before we move on to the next question - preventing previous months being shown.
I hope you can follow my instructions

Chris