<?php if(!isset($_SESSION['user']) && !isset($_GET['clubId'])) { //Need to be authenticated to get to this page header("Location: index.php"); exit(); } $clubId = $_GET['clubId']; $username = $_SESSION['user']; require 'scripts/SQLUtils.php'; require 'scripts/index_utils.php'; require 'scripts/club_utils.php'; $conn = getSQLConnectionFromConfig(); $isLeader = isHeadOfClub($username, $clubId, $conn) | isAdmin($conn); if(!$isLeader) { header("Location: index.php"); $conn->close(); exit(); } $events = getClubEvents($clubId, $conn); ?> <table border="5" id="events"> <tr> <th>Title</th> <th>Location</th> <th>Date</th> <th>Time</th>
echo 'FATAL ERROR: MALFORMED QUERY->VALUE NOT SET'; } } else { if ($action == 'userclub' && isset($_SESSION['user'])) { $value = sanatizeInput($_GET['v']); $user = $_SESSION['user']; $query = "SELECT c.id as id, c.name as name, c.mission_statement as mission, CONCAT_WS(', ', GROUP_CONCAT(DISTINCT leader.preferred_name, ' ', leader.last_name SEPARATOR ', ')) as leader_name, advisor.preferred_name as advisor_first, advisor.last_name as advisor_last, c.status as status\n FROM taftclubs.club as c\n INNER JOIN sgstudents.seniors_data as advisor\n ON c.advisor = advisor.id\n INNER JOIN taftclubs.clubjoiners as leader_inClub\n ON c.id = leader_inClub.clubId\n INNER JOIN sgstudents.seniors_data as leader\n ON leader.id = leader_inClub.userId\n INNER JOIN taftclubs.clubjoiners as j\n ON c.id = j.clubId\n INNER JOIN sgstudents.seniors_data as student\n ON student.id = j.userId\n INNER JOIN taftclubs.clubcategories as category\n ON c.category = category.id\n WHERE leader_inClub.hasLeft = 0 AND leader_inClub.isLeader = 1 AND j.hasLeft = 0 AND (c.status != 3 OR c.status != 6) AND student.username = '******'"; $result = ""; if ($value == 'All') { $result = $conn->query($query . $endOfQuery); } else { $result = $conn->query($query . " AND category.data = '{$value}'" . $endOfQuery); } if ($result->num_rows > 0) { while ($item = $result->fetch_assoc()) { echo constructMyClubsWidgetString($item['name'], $item['id'], $item['leader_name'], $item['advisor_first'], $item['advisor_last'], $item['mission'], $item['status'], isHeadOfClub($user, $item['id'], $conn)); } } else { echo "Oops, There doesn't seem to be anything here yet! Join a club to have it displayed here!"; } } else { if ($action == 'adminsearch') { $value = sanatizeInput($_GET['v']); $query = "SELECT club.id, club.name, CONCAT_WS(', ', GROUP_CONCAT(DISTINCT people.preferred_name, ' ', people.last_name SEPARATOR ', ')) as leaders, CONCAT(advisor.preferred_name, ' ', advisor.last_name) as advisor, cstat.name as status\n \t FROM taftclubs.club as club\n \t INNER JOIN taftclubs.clubjoiners as j\n \t ON club.id = j.clubId\n \t INNER JOIN sgstudents.seniors_data as people\n \t ON j.userId = people.id\n \t INNER JOIN taftclubs.clubstatus as cstat\n \t ON cstat.id = club.status\n INNER JOIN sgstudents.seniors_data as advisor\n ON club.advisor = advisor.id\n \t WHERE (cstat.name = '{$value}' AND j.isLeader = 1 AND j.hasLeft = 0)\n \t GROUP BY club.id"; $result = $conn->query($query); if ($result->num_rows > 0) { while ($data = $result->fetch_assoc()) { $linkContents = ""; if ($value === "Active") { $linkContents = "<a data-index=\"{$data['id']}\">Delete Club?</a>"; } else {
<?php session_start(); if (!isset($_SESSION['user']) && !isset($_GET['clubId'])) { //Need to be authenticated to get to this page header("Location: index.php"); exit; } $clubId = $_GET['clubId']; $username = $_SESSION['user']; require 'scripts/SQLUtils.php'; require 'scripts/index_utils.php'; require 'scripts/club_utils.php'; $conn = getSQLConnectionFromConfig(); $isLeader = isHeadOfClub($username, $clubId, $conn); if (!$isLeader && !(isAdmin($conn) == 1)) { header("Location: index.php"); $conn->close(); exit; } $clubname = getClubName($clubId, $conn); ?> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" type="text/css" href="style/common.css"> <link rel="stylesheet" type="text/css" href="club_edit.css"> <link rel="stylesheet" type="text/css" href="stylesheet2.css"> <script src="js/jquery-2.1.4.min.js"></script>
<?php echo $clubname . " Page"; ?> </span> </div> <div class="nav"> <ul> <a href="index.php"><li>Home</li></a> <a><li class="active">About Us</li></a> <a><li>Events</li></a> <a id="club_join_button"> <li><?php $isPart = $isLeader = 0; if (isset($_SESSION['user'])) { $isPart = isPartOfClub($_SESSION['user'], $clubId, $conn); $isLeader = isHeadOfClub($_SESSION['user'], $clubId, $conn) | isAdmin($conn); } if ($isLeader == 1) { echo "Edit Club"; } else { if ($isPart == 0) { echo "Join Club"; } else { echo "Leave Club"; } } ?> </li> </a> <a class="login_nav_bar"><li> <?php