-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_events_export.php
More file actions
49 lines (43 loc) · 1.59 KB
/
Copy pathmy_events_export.php
File metadata and controls
49 lines (43 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
session_start();
include_once $_SERVER['DOCUMENT_ROOT'] . '/settings.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/utilities.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/database.php';
$authorized = user_authorized($_SESSION['username']);
header("Content-type: text/plain");
header("Content-Disposition: attachment; filename=my_events_export.csv");
print("Name, Location, Description, Date, Start Time, Stop Time\n");
$email = clean_input($_POST["email"]);
if( strlen($email) <= 0 ){
error_return("Please enter a valid email address.");
}
$res = get_email_signups($email);
while ($row = mysqli_fetch_array($res))
{
print( $row['name'] . ", ");
print( $row["location"] . ", ");
print( $row['description'] . ", ");
print( $row['start_date'] . ", ");
$start_hour = intval($row['start_hour']);
$start_ampm = "am";
if( $start_hour >= 12 )
{
if( $start_hour > 12 ){
$start_hour = $start_hour - 12;
}
$start_ampm = "pm";
}
$stop_hour = intval($row['stop_hour']);
$stop_ampm = "am";
if( $stop_hour >= 12 )
{
if( $stop_hour > 12 ){
$stop_hour = $stop_hour - 12;
}
$stop_ampm = "pm";
}
print( $start_hour . ":" . sprintf("%02s",$row["start_min"]) . " " . $start_ampm . ", ");
print( $stop_hour . ":" . sprintf("%02s", $row["stop_min"]) . " " . $stop_ampm . "\n");
}
print $content;
?>