online booking system

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wish i could code
Forum Newbie
Posts: 3
Joined: Wed Feb 20, 2008 9:26 am

online booking system

Post by wish i could code »

hi im trying to build a online booking system, something very simple.

what im building is a system for a user to book a tennis court for a hour,
they go in chose a date and a hour, and book it, then they pay online.
then they get a confirmation email(maybe but not needed)

how im think of building is the user clicks on a a calender.
that brings then to a table with the hours on the left saying if the the court id free or not,

if its not already booked there should be buttons to book. then they pay etc.

on the admin they should be able to look at a particular day and see if its booked, if they get phone bookings they can set a particular hour as booked so it cant be booked online.

i know im giving a vague description, but it dosent need to be complex.


any ideas would greatly help or if you know or have seen something like point me in the right direction
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: online booking system

Post by califdon »

Sounds like you're on the right track. You will need a lot of different forms, including the admin pages that you've already recognized the need for, and you should look carefully at how you "sanitize" all data received from the user, to avoid sql injection and other malicious inputs. How are you planning to implement your online payment? If this is a concept project, like for a class assignment, I'd say you've made a decent start. You'll probably need to get more detailed about how you will store your data (database schema), and your payment implementation, as I mentioned.
User avatar
micknc
Forum Contributor
Posts: 115
Joined: Thu Jan 24, 2008 11:13 pm

Re: online booking system

Post by micknc »

I don't know if it will help you but there is a php booking calendar on SourceForge that I have been working with a little. It would take some editing on our side to get it to do exactly what you were talking about but it may be a good jump off point for you.

It is a work in progress so you will need to download the patches. It took a few little changes but it is working on my machine.


http://sourceforge.net/projects/bookingcalendar/
wish i could code
Forum Newbie
Posts: 3
Joined: Wed Feb 20, 2008 9:26 am

Re: online booking system

Post by wish i could code »

micknc wrote:I don't know if it will help you but there is a php booking calendar on SourceForge that I have been working with a little. It would take some editing on our side to get it to do exactly what you were talking about but it may be a good jump off point for you.

It is a work in progress so you will need to download the patches. It took a few little changes but it is working on my machine.


http://sourceforge.net/projects/bookingcalendar/


sound i found that a few days ago i cant seem to get it working i was getting the following error



Warning: main(includes/functions/database.php) [function.main]: failed to open stream: No such file or directory in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 125

Warning: main() [function.include]: Failed opening 'includes/functions/database.php' for inclusion (include_path='/booking_calendar/:/booking_calendar/includes/:/booking_calendar/includes/functions/:/booking_calendar/includes/widgets/:.;./includes;./pear') in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 125

Fatal error: Call to undefined function: wrap_db_connect() in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 127






have any ideas
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: online booking system

Post by califdon »

wish i could code wrote: sound i found that a few days ago i cant seem to get it working i was getting the following error

Warning: main(includes/functions/database.php) [function.main]: failed to open stream: No such file or directory in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 125

Warning: main() [function.include]: Failed opening 'includes/functions/database.php' for inclusion (include_path='/booking_calendar/:/booking_calendar/includes/:/booking_calendar/includes/functions/:/booking_calendar/includes/widgets/:.;./includes;./pear') in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 125

Fatal error: Call to undefined function: wrap_db_connect() in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 127

have any ideas
All 3 of those warnings or errors are telling you that your script is calling for a file that it can't find. Usually this is because there was a directory and/or a file that was present when the script was originally written, but you haven't provided the same directory and/or file on the computer where the script is now running. You will have to find out if you even have the files that are needed. If you do, either put them in the same directory structure or change the lines in your script to specify where you put them. If you don't even have the files, you won't be able to use that script.
wish i could code
Forum Newbie
Posts: 3
Joined: Wed Feb 20, 2008 9:26 am

Re: online booking system

Post by wish i could code »

wish i could code wrote:
micknc wrote:I don't know if it will help you but there is a php booking calendar on SourceForge that I have been working with a little. It would take some editing on our side to get it to do exactly what you were talking about but it may be a good jump off point for you.

It is a work in progress so you will need to download the patches. It took a few little changes but it is working on my machine.


http://sourceforge.net/projects/bookingcalendar/


sound i found that a few days ago i cant seem to get it working i was getting the following error



Warning: main(includes/functions/database.php) [function.main]: failed to open stream: No such file or directory in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 125

Warning: main() [function.include]: Failed opening 'includes/functions/database.php' for inclusion (include_path='/booking_calendar/:/booking_calendar/includes/:/booking_calendar/includes/functions/:/booking_calendar/includes/widgets/:.;./includes;./pear') in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 125

Fatal error: Call to undefined function: wrap_db_connect() in C:\Inetpub\vhosts\**********\httpdocs\booking_calendar\includes\application_top.php on line 127






have any ideas




i have the files this is the code any idea where its going wrong

<?
// Define Script Setup

// Define our webserver variables
// FS = Filesystem (physical)
// WS = Webserver (virtual)

// Current Script Name
define('SCRIPT_NAME',substr($_SERVER['PHP_SELF'],strrpos($_SERVER['PHP_SELF'],"/")+1));
// Current Script WS Path
define('SCRIPT_PATH', $_SERVER['PHP_SELF']);

// You can setup testing server variables for a testing machine, such as Win32.
if (preg_match("/^[CDEFGHIJKL]{1}:/i", $_SERVER['DOCUMENT_ROOT'])) {
define('TESTING_SERVER', 1); // Set to '1' to use settings for testing server
define('HTTP_SERVER', 'http://127.0.0.1'); // testing server
define('DIR_FS_DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT'] . '/booking_calendar/');
} else {
define('TESTING_SERVER', 0); // Web Server
define('HTTP_SERVER', '');
define('DIR_FS_DOCUMENT_ROOT', $_SERVER['DOCUMENT_ROOT'] . '/booking_calendar/');
}
define('DOMAIN_NAME', 'stsenansgaa.com');
define('HTTPS', false);

// WS = Webserver (virtual)
define('DIR_WS_SCRIPTS', '/booking_calendar/');
define('DIR_WS_IMAGES', '/booking_calendar/images/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_WIDGETS', DIR_WS_INCLUDES . 'widgets/');
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
define('DIR_WS_DATA', DIR_WS_INCLUDES . 'data/');
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

// FS = Filesystem (physical)
define('DIR_FS_INCLUDES', DIR_FS_DOCUMENT_ROOT . 'includes/');
define('DIR_FS_LOGS', DIR_FS_INCLUDES . 'logs/');
define('DIR_FS_DATA', DIR_FS_INCLUDES . 'data/');
define('DIR_FS_SESSIONS', DIR_FS_INCLUDES . 'sessions/');

// Filenames for the Project
define('FILENAME_LOGIN', 'user_login.php');
define('FILENAME_LOGOUT', 'user_logout.php');
define('FILENAME_REGISTER', 'user_register.php');
define('FILENAME_UPDATE', 'user_update.php');
define('FILENAME_FORGOT_USERNAME', 'user_forgot_username.php');
define('FILENAME_CHANGE_PASSWD', 'user_change_passwd.php');
define('FILENAME_FORGOT_PASSWD', 'user_forgot_passwd.php');
define('FILENAME_HELP', 'user_help.php');
define('FILENAME_MONTH_VIEW', 'month_view.php');
define('FILENAME_WEEK_VIEW', 'week_view.php');
define('FILENAME_DAY_VIEW', 'day_view.php');
define('FILENAME_DETAILS_VIEW', 'details_view.php');
define('FILENAME_ADD_EVENT', 'add_event.php');
define('FILENAME_DEFAULT_VIEW', 'month_view.php');
if (SCRIPT_NAME != FILENAME_MONTH_VIEW && SCRIPT_NAME != FILENAME_WEEK_VIEW &&
SCRIPT_NAME != FILENAME_DAY_VIEW && SCRIPT_NAME != FILENAME_ADD_EVENT) {
define('NAV_SCRIPT_NAME', FILENAME_DEFAULT_VIEW."");
} else {
define('NAV_SCRIPT_NAME', SCRIPT_NAME."");
}

// INCLUDE PATH CHANGE
// Extend the php INCLUDE_PATH
// Use ";" for Windows, and ":" for Unix!
if (TESTING_SERVER) { $del = ';'; } else { $del = ':'; }
ini_set("include_path", "" .
DIR_FS_DOCUMENT_ROOT . $del .
DIR_FS_DOCUMENT_ROOT . DIR_WS_INCLUDES . $del .
DIR_FS_DOCUMENT_ROOT . DIR_WS_FUNCTIONS . $del .
DIR_FS_DOCUMENT_ROOT . DIR_WS_WIDGETS . $del .
ini_get("include_path")
);

// INI Register Globals, Security Issue
ini_set('register_globals', "0");
// Use SuperGlobals instead!


// If enabled, the parse time will not store its time after the
// header(location) redirect. Used with the wrap_exit() function.
define('EXIT_AFTER_REDIRECT', 1);
define('STORE_PAGE_PARSE_TIME', 1); // store the time it takes to parse a page
define('STORE_PAGE_PARSE_TIME_LOG', DIR_FS_LOGS . 'parse_time_log.txt');
define('STORE_PARSE_DATE_TIME_FORMAT', '%d/%m/%Y %H:%M:%S');
if (STORE_PAGE_PARSE_TIME == '1') { $parse_start_time = microtime(); }
define('STORE_DB_TRANSACTIONS', 0);

// MAIL SETTINGS
// Rewrite Mail Settings for Windows
// Note, the mail settings have to be specific for the server!
if (TESTING_SERVER) {
ini_set('SMTP', 'smtp.yourdomain.com');
ini_set('sendmail_from', 'username@yourdomain.com');
define ('MAIL_MYNAME', 'Booking Calendar');
define ('MAIL_MYEMAIL', 'username@yourdomain.com');
} else { // Web Server
define ('MAIL_MYNAME', 'Booking Calendar');
define ('MAIL_MYEMAIL', 'username@yourdomain.com');
}
// set to "1" if extended email check function should be used
// If you're testing locally and your webserver has no possibility to query
// a dns server you should set this to "0"!
define('ENTRY_EMAIL_ADDRESS_CHECK', 0);

// define our database connection
if (TESTING_SERVER) {
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'username');
define('DB_SERVER_PASSWORD', 'password');
define('DB_DATABASE', 'databasename');
define('USE_PCONNECT', 0);
} else { // Web Server
define('DB_SERVER', 'localhost:3306');
define('DB_SERVER_USERNAME', 'stack2');
define('DB_SERVER_PASSWORD', '12345');
define('DB_DATABASE', 'senans');
define('USE_PCONNECT', 0);
}
// define the database tables
define('DATE_TIME_SCHEDULE_TABLE', 'booking_schedule');
define('BOOKING_EVENT_TABLE', 'booking_event');
define('BOOKING_USER_TABLE', 'booking_user');
// include the database functions
include_once(DIR_WS_FUNCTIONS . 'database.php');
// make a connection to the database... now
wrap_db_connect() or die('Unable to connect to database server!');

// some code to solve compatibility issues (magic quotes)
include_once(DIR_WS_FUNCTIONS . 'compatibility.php');

// SESSION INI CHANGES

// Change the session name for security purposes.
ini_set("session.name", "SID");
// Do not pass the session id thru the URL, use cookies only.
ini_set("session.use_trans_sid", 0);
// Change the session save path because we could be on a shared server.
ini_set("session.save_path", DIR_FS_SESSIONS);
// Use only cookies for session management.
ini_set("session.use_only_cookies", 1);
// define how the session functions will be used
include_once(DIR_WS_FUNCTIONS . 'sessions.php');

// lets start our session
if (@!SID && $_REQUEST[wrap_session_name()]) {
wrap_session_id( $_REQUEST[wrap_session_name()] );
}
wrap_session_start();
if (function_exists('session_set_cookie_params')) {
session_set_cookie_params(0, DIR_WS_SCRIPTS);
}

// define our general functions used application-wide
include_once(DIR_WS_FUNCTIONS . 'booking_db_fns.php');
include_once(DIR_WS_FUNCTIONS . 'calendar_fns.php');
include_once(DIR_WS_FUNCTIONS . 'common_fns.php');
include_once(DIR_WS_FUNCTIONS . 'general.php');
include_once(DIR_WS_FUNCTIONS . 'validations.php');

// Include the user and password crypto functions
include_once(DIR_WS_FUNCTIONS . 'user_auth_fns.php');
include_once(DIR_WS_FUNCTIONS . 'password_funcs.php');

// Set the Error Reporting to show critical errors and warnings.
error_reporting(E_ERROR | E_WARNING);



// BOOKING CALENDAR SETTINGS:

// The Time Interval for the Booking Calendar must stay constant after the
// calendar is in use, so choose wisely! It is also recommended not to change
// the max and min hour after the script is in use!
//
// These must remain constant after the Booking Calendar is in use!
define('BOOKING_TIME_INTERVAL', '30'); // 15, 30 or 60 minutes (Recommended: 30 or 60 mins)
define('MIN_BOOKING_HOUR', '7'); // 00-24 hours (including this hour)
define('MAX_BOOKING_HOUR', '20'); // 20 = 8 PM (NOT including this hour)
// Adjustable Settings
define('WEEK_START', '0'); // Weekday Start ('0' for Sunday or '1' for Monday)
define('DEFINE_AM_PM', true); // Set to 'true' for AM PM display.
define('DISPLAY_TIME_INTERVAL', '30'); // 15, 30 or 60 minutes (Recommended: 30 or 60 mins)
define('PAGE_REFRESH', '180'); // 30->up, number of seconds between page refreshes (Day/Week/Month Views)

// Location (Conference Rooms) Variables
// Associative DB Field Naming Array (key => db_field)
$location_db_name = array (
'loc1' => 'event_id_location_1',
'loc2' => 'event_id_location_2',
'loc3' => 'event_id_location_3',
);
// Associative Display Array (key => display_text)
$location_display = array (
'loc1' => 'Conference Room #1',
'loc2' => 'Conference Room #2',
'loc3' => 'Conference Room #3',
);
// Default Location Name Index
define('DEFAULT_LOCATION_NAME', 'loc1');
if (@$_REQUEST['loc'] == '') { $_REQUEST['loc'] = DEFAULT_LOCATION_NAME; }
// Default View
define('DEFAULT_VIEW', 'month');
if (@$_REQUEST['view'] == '') { $_REQUEST['view'] = DEFAULT_VIEW; }

// Require Username/Password Authentication Settings
define('REQUIRE_AUTH_FOR_ADDING_FLAG', true);
define('REQUIRE_AUTH_FOR_MODIFYING_FLAG', true);
define('REQUIRE_AUTH_FOR_DELETING_FLAG', true);
define('REQUIRE_AUTH_FOR_VIEWING_DETAILS_FLAG', false);
// Required User Settings
define('REQUIRE_MATCHING_USERNAME_FOR_MODIFICATIONS_FLAG', true);
define('REQUIRE_MATCHING_USERNAME_FOR_DELETIONS_FLAG', true);

// Create the needed date constants for the current & selected dates.
include_once('define_time_constants.php');

?>








it says line 125, which looks ok
Post Reply