Members only calendar

Members only calendar

Postby mnizi » Mon Sep 08, 2008 7:13 am

Hi,
I am currently setting up a motel directory website and have been tying to integrate your excellent calendar script. I have currently set up a members area for each member which allows them to edit their booking calendar once they have logged in via username & pass. This sytem uses sessions to validate each member. I have also modified the calendar to update the db with a ListingID and memberID each time it is modified. This all works great except that once they have logged in, it is possible to edit another members calendar by simply typing a different ListingID into the url bar. I have tried to overcome this by adding this piece of code to my update calendar page which as per your original script would be index.php:

$qp = "select * from ".T_BOOKINGS." where ListingID = '$_GET[ListingID]' and MemberID = '$memberID' ";
$rp = mysql_query($qp) or die(mysql_error());

if(mysql_num_rows($rp) <= 0){

echo "<h4>YOU CANNOT EDIT OTHER USERS LISTINGS</h4>";
die();
}

this piece of code will display the error message if the ListingID from the url doesn't match the ListingID in the db & the memberID from the session login doesn't match the memberID in the db.

This also works great except that if a member has not yet entered any calendar dates, the error message will appear and even worse the calendar does not display allowing you to enter any dates.

I presume this happens because if there are no dates selected then there is nothing stored in the db meaning the above code will show the error message before the calendar can display.

Hopefully you can follow what i am trying to do, Have you any suggestions how i can get around this problem?
mnizi
 
Posts: 1
Joined: Mon Sep 08, 2008 6:56 am

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron