$show_project = $userprefs['show_project']; $show_redpoint = $userprefs['show_redpoint']; $show_flash = $userprefs['show_flash']; $show_onsight = $userprefs['show_onsight']; $minB = $userprefs['minV']; $maxB = $userprefs['maxV']; $minTR = $userprefs['minTR']; $maxTR = $userprefs['maxTR']; $minL = $userprefs['minL']; $maxL = $userprefs['maxL']; $boulderGradingID = $userprefs['boulderGradingSystemID']; $routeGradingID = $userprefs['routeGradingSystemID']; //Find out user's country $countryCode = $userService->getUserCountryCode($userid); //find user's main gym $mainClimbingAreas = $userService->getUserMainClimbingAreas($userid); $main_gymid = $mainClimbingAreas['main_gym']; $main_cragid = $mainClimbingAreas['main_crag']; ?> <!DOCTYPE HTML> <html> <head> <title>Gym Climbing Tracker</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Latest compiled and minified CSS --> <link rel="icon" href="images/favicon.ico" type="image/x-icon"> <link rel="stylesheet" type="text/css" href="css/bootstrap.css"> <link rel="stylesheet" type="text/css" href="css/datepicker.css"> <link rel="stylesheet" type="text/css" href="style.php/mycss.scss">
<?php include "./core/bootstrap.php"; //connect to database include 'dbconnect.php'; //check that user has a valid cookie, redirect if no valid cookie include 'php_common/cookiecheck.php'; //get user's country $userService = new UserService(); $countryCode = $userService->getUserCountryCode($userid); $main_gymid = $userService->getUserMainClimbingAreas($userid)["main_gym"]; $gym_options = '<option value="">Select a Gym...</option>'; include 'genGymOptions.php'; $eventAdded = 0; $note = ""; if (isset($_POST['event-submit'])) { //first check if event has already been added $stmt = $db->prepare("SELECT * FROM events WHERE LOWER(event_name)=LOWER(:event_name) AND gymid=:gymid AND event_startdate=:start_date"); $stmt->execute(array(':event_name' => $_POST['event-name'], ':gymid' => $_POST['gymid'], ':start_date' => $_POST['start-date'])); if ($stmt->rowCount() > 0) { //a duplicate event has been added $prev_event_result = $stmt->fetch(PDO::FETCH_ASSOC); $prev_event_id = $prev_event_result['event_id']; $note .= "<div class='container'><div class='alert alert-danger' style='text-align:center'>This <a href='event.php?event_id=" . $prev_event_id . "'>event</a> has already been added to the calendar.</div></div>"; } else { $stmt = $db->prepare("INSERT INTO events (event_name,gymid,event_startdate,event_enddate,event_desc,event_website,event_facebook) VALUES (:event_name,:gymid,:start_date,:end_date,:event_desc,:event_website,:event_facebook)"); $stmt->execute(array(':event_name' => $_POST['event-name'], ':gymid' => $_POST['gymid'], ':start_date' => $_POST['start-date'], ':end_date' => $_POST['end-date'], ':event_desc' => $_POST['event-desc'], ':event_website' => $_POST['event-website'], ':event_facebook' => $_POST['event-facebook'])); //get the last event id inserted $event_id = $db->lastInsertId(); $taglist = array('comp-tag', 'festival-tag', 'workshop-tag', 'party-tag', 'retail-tag', 'other-tag'); foreach ($taglist as $curr_tag) {