Ejemplo n.º 1
0
<?php 
include 'connect.php';
session_start();
$user = $_SESSION['user'];
echo "<br>";
$debug = $_SESSION['debug'];
$start = $_POST['start'];
$end = $_POST['end'];
echo '<br><a href="index.php">Home</a><br>';
$squery = "SELECT event_id, group_name, title, an_event.description descr, DATE_FORMAT(`start_time`, '%Y-%m-%d %H:%i') start_time, DATE_FORMAT(`end_time`, '%Y-%m-%d %H:%i') end_time, lname, street, city, zip \n    FROM a_group JOIN an_event ON a_group.group_id=an_event.group_id JOIN location USING (lname, zip)\n\t  WHERE start_time >= date('{$start}') AND start_time < date('{$end}') ORDER BY an_event.start_time ASC";
displayQry($squery, $debug);
$sresult = $sql->query($squery);
if ($sresult->num_rows > 0) {
    echo "<h2>Events:</h2>";
    echo "<table border = '1'>\n";
    echo "<tr style='font-weight:bold'>";
    echo "<td>RSVP</td><td>Group</td><td>Event</td><td>Description</td><td>Start Time</td><td>End Time</td><td>Location</td><td>Address</td>";
    echo "</tr>";
    while ($row = $sresult->fetch_array()) {
        echo "<tr><td>";
        include "RSVP_control.php";
        RSVP($row['event_id']);
        echo "</td><td>" . $row['group_name'] . "</td><td>" . $row['title'] . "</td><td>" . $row['descr'] . "</td><td>" . $row['start_time'] . "</td><td>" . $row['end_time'] . "</td><td>" . $row['lname'] . "</td><td>" . $row['street'] . ", " . $row['city'] . " " . $row['zip'] . "</td>";
    }
    echo "</table>\n";
} else {
    echo "No events found.<br>";
}
<?php

include "connect.php";
session_start();
$debug = $_SESSION['debug'];
$group_id = $_POST['group_id'];
$interest = $_POST['interest'];
echo "\nrecieved:<br>\n{$group_id}<br>\n{$interest}<br>\n";
$iTOgQry = "INSERT INTO groupinterest\n(interest_name, group_id)\nVALUES\n('{$interest}','{$group_id}')";
displayQry($iTOgQry, $debug);
if ($sql->query($iTOgQry)) {
    echo "successful";
} else {
    echo "unsuccessful";
}
echo '
	<meta http-equiv="refresh" content="2; url=index.php">
<form action="index.php">
	<input type="submit" value="Home">
</form>
	';
<?php

//session_start();
include "connect.php";
session_start();
$DEBUG = $_SESSION['debug'];
$lname = $_POST['lname'];
$zip = $_POST['zip'];
$street = $_POST['street'];
$city = $_POST['city'];
$desc = $_POST['desc'];
$lon = $_POST['lon'];
$lat = $_POST['lat'];
echo "\n\tData gathered<br>\n\t{$lname}<br>\n\t{$zip}<br>\n\t{$street}<br>\n\t{$city}<br>\n\t{$desc}<br>\n\t{$lon}<br>\n\t{$lat}<br>\n\t";
$lQry = "INSERT INTO location (lname, zip, street, city, description, latitude, longitude)\n\tVALUES\n\t('{$lname}','{$zip}','{$street}','{$city}','{$desc}','{$lon}','{$lat}')";
displayQry($lQry, $DEBUG);
if ($sql->query($lQry)) {
    echo "successful";
} else {
    echo "error:<br>";
    echo $sql->error;
    echo "<br>";
}
echo '
	<meta http-equiv="refresh" content="2; url=index.php">
<form action="index.php">
	<input type="submit" value="Home">
</form>
	';
Ejemplo n.º 4
0
<?php

include "connect.php";
session_start();
$DEBUG = $_SESSION['debug'];
$user = $_SESSION['user'];
$gqry = "SELECT G.group_id, G.group_name FROM a_group AS G JOIN groupuser AS U ON G.group_id=U.group_id WHERE U.username='******'";
displayQry($gqry, $DEBUG);
$gresult = $sql->query($gqry);
displayQry($gqry, $DEBUG);
while ($grow = $gresult->fetch_assoc()) {
    echo "\n  <option value=" . $grow['group_id'] . ">" . $grow['group_name'] . "</option>\n  ";
}
Ejemplo n.º 5
0
<?php

include "connect.php";
session_start();
$user = $_SESSION['user'];
$event_id = $_POST['submit'];
$debug = $_SESSION['debug'];
$rQry = "INSERT INTO eventuser (event_id, username, rsvp, rating)\n\tVALUES\n\t('{$event_id}','{$user}', '1', '0')";
displayQry($rQry, $debug);
if (isset($_SESSION) && $_SESSION['user'] != '') {
    if ($sql->query($rQry)) {
        echo "successfully RSVP'd";
    } else {
        echo "Unsuccessful: ";
        echo $sql->error;
    }
} else {
    echo "you are not logged in";
}
echo '
	<meta http-equiv="refresh" content="2; url=index.php">
<form action="index.php">
	<input type="submit" value="Home">
</form>
	';
Ejemplo n.º 6
0
<?php

include "connect.php";
session_start();
$user = $_SESSION['user'];
$group_id = $_POST['group_id'];
$debug = $_SESSION['debug'];
if ($debug) {
    echo "\n{$user}<br>\n{$group_id}<br>\n";
}
$uQry = "INSERT INTO groupuser (group_id, username, authorized)\nVALUES\n('{$group_id}', '{$user}', '0')";
displayQry($uQry, $debug);
if ($sql->query($uQry)) {
    echo "successful";
} else {
    echo "unsuccessful";
}
echo '
	<meta http-equiv="refresh" content="2; url=index.php">
<form action="index.php">
	<input type="submit" value="Home">
</form>
	';
<?php

include "connect.php";
session_start();
$DEBUG = $_SESSION['debug'];
$interest = $_POST['interest'];
$iQry = "INSERT INTO interest\n  (interest_name)\n  VALUES\n  ('{$interest}')";
displayQry($iQry, $DEBUG);
if ($sql->query($iQry)) {
    echo "successfully added";
} else {
    echo "unsuccessful<br>";
    echo $sql->error;
    echo "<br>";
}
echo '
	<meta http-equiv="refresh" content="2; url=index.php">
<form action="index.php">
	<input type="submit" value="Home">
</form>
	';
Ejemplo n.º 8
0
$cresult = $sql->query($cquery);
while ($crow = $cresult->fetch_assoc()) {
    echo "<h2>Creator of group " . $group . ": " . $crow['username'] . "</h2><br>";
}
$mquery = "SELECT a_group.username as creator, groupuser.username as member\n\t\t\t\tFROM a_group JOIN groupuser ON a_group.group_id=groupuser.group_id\n        WHERE a_group.username != groupuser.username AND a_group.group_id='{$group}'\n\t\t\t\tORDER BY member ASC";
displayQry($mquery, $debug);
$mresult = $sql->query($mquery);
if ($mresult->num_rows > 0) {
    echo "<h2>Members:</h2>";
    while ($row = $mresult->fetch_assoc()) {
        echo $row['member'] . "<br>";
    }
} else {
    echo "No members found.";
}
//ADD A FRIEND (can't add yourself as a friend and can't add people you're already friends with)
$fquery = "SELECT username \n\t\t\t\tFROM groupuser \n\t\t\t\tWHERE group_id='{$group}' AND username != '{$user}' AND username NOT IN (SELECT friend_name FROM friend WHERE username = '******')\n\t\t\t\tORDER BY username ASC";
displayQry($fquery, $debug);
$fresult = $sql->query($fquery);
if ($fresult->num_rows > 0) {
    echo '<h2>Add a friend:</h2>
	  <form action="addedFriend.php" method="post">
    <select name = "friend">';
    while ($frow = $fresult->fetch_assoc()) {
        echo "<option value=" . $frow['username'] . ">" . $frow['username'] . "</option>";
    }
    echo '</select>
	  <input type="submit" value="Add friend">
	  </form><br><br>';
}
echo '<br><a href="index.php">Home</a>';
Ejemplo n.º 9
0
<?php 
include 'connect.php';
session_start();
$DEBUG = $_SESSION['debug'];
$user = $_SESSION['user'];
include 'displayEvent2.php';
//can only rate past events
$equery = "SELECT event_id FROM an_event WHERE start_time >= date('{$start}') AND start_time < date(now())";
displayQry($equery, $DEBUG);
$eresult = $sql->query($equery);
echo '<h2>Rate an event out of 5 stars</h2>
	<form action="rateEvent3.php" method="post">
	Event ID: 
    <select name = "event">';
while ($row = $eresult->fetch_assoc()) {
    echo "<option value=" . $row['event_id'] . ">" . $row['event_id'] . "</option>";
}
echo '</select><br>

	Rating: 
	<select name = "rating">
		<option value="1">1 star</option>
		<option value="2">2 stars</option>
		<option value="3">3 stars</option>
		<option value="4">4 stars</option>
		<option value="5">5 stars</option>
	</select><br>
	<input type="submit" value="Rate"></form><br><br>';
Ejemplo n.º 10
0
$end = $_POST['end'];
$lTemp = $_REQUEST['locationName'];
$lTemp2 = explode('-', $lTemp, 2);
$zip = $lTemp2[0];
$lname = $lTemp2[1];
if ($DEBUG) {
    echo "Data gathered: <br>";
    echo "{$groupID}<br>";
    echo "{$title}<br>";
    echo "{$desc}<br>";
    echo "{$start}<br>";
    echo "{$end}<br>";
    echo "{$lname}<br>";
    echo "{$zip}<br>";
}
$eQry = "INSERT INTO an_event\n\t(title, description,start_time, end_time, group_id, lname, zip)\n\tVALUES\n\t('{$title}', '{$desc}', '{$start}', '{$end}', '{$groupID}', '{$lname}', '{$zip}')";
//if($DEBUG) echo "<br>running SQL:<br>$eQry<br>";
displayQry($eQry, $DEBUG);
if ($sql->query($eQry)) {
    echo "successful<br>";
} else {
    echo "Error: ";
    echo $sql->error;
    echo "<br>";
}
echo '
	<meta http-equiv="refresh" content="2; url=index.php">
<form action="index.php">
	<input type="submit" value="Home">
</form>
	';