Skip to content

Commit 0ce63f0

Browse files
committed
Changing the app to be PHP Camp
1 parent b30fdb4 commit 0ce63f0

File tree

3 files changed

+24
-16
lines changed

3 files changed

+24
-16
lines changed

data/setupDb.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313

1414
$query = <<<EOF
1515
16-
DROP TABLE IF EXISTS php_santa_letters;
16+
DROP TABLE IF EXISTS php_camp;
1717
18-
CREATE TABLE php_santa_letters (
18+
CREATE TABLE php_camp (
1919
id INTEGER PRIMARY KEY,
20-
content TEXT,
21-
received_at TIMESTAMP
20+
attendee TEXT,
21+
avatar_url TEXT
2222
);
2323
24-
INSERT INTO php_santa_letters VALUES(1,'A unified Request Response interface','2011-12-01');
25-
INSERT INTO php_santa_letters VALUES(2,'A package manager that''s fun to use!','2011-12-01');
24+
INSERT INTO php_camp VALUES(1,'weierophinney', 'http://i.vimeocdn.com/portrait/4175704_300x300.jpg');
25+
INSERT INTO php_camp VALUES(2,'fabpot','https://pbs.twimg.com/profile_images/443336758403424256/U5bzXI5l_400x400.jpeg');
26+
INSERT INTO php_camp VALUES(3, 'pmjones', 'https://pbs.twimg.com/profile_images/482556486824910848/Bb4fyXhn_400x400.jpeg');
27+
INSERT INTO php_camp VALUES(4, 'jmikola', '/images/wurstcon.jpg');
28+
2629
EOF
2730
;
2831

images/wurstcon.jpg

24.3 KB
Loading

index.php

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,29 @@
1414

1515
if ($uri == '/' || $uri == '') {
1616

17-
echo '<h1>Welcome to PHP Santa</h1>';
18-
echo '<a href="/letters">Read the letters</a>';
17+
echo '<h1>PHP Camp!</h1>';
18+
echo '<a href="/attendees">See the attendees</a>';
1919
if (isset($_GET['name'])) {
2020
echo sprintf('<p>Oh, and hello %s!</p>', $_GET['name']);
2121
}
2222

23-
} elseif ($uri == '/letters') {
23+
} elseif ($uri == '/attendees') {
2424

25-
$sql = 'SELECT * FROM php_santa_letters';
26-
echo '<h1>Read the letters to PHP Santa</h1>';
27-
echo '<ul>';
25+
$sql = 'SELECT * FROM php_camp';
26+
echo '<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" />';
27+
echo '<h1>PHP Camp Attendees</h1>';
28+
echo '<table class="table" style="width: 300px;">';
2829
foreach ($dbh->query($sql) as $row) {
29-
echo sprintf('<li>%s - dated %s</li>', $row['content'], $row['received_at']);
30+
echo sprintf(
31+
'<tr><td style="font-size: 24px;">%s</td><td><img src="%s" height="120" /></td></tr>',
32+
$row['attendee'],
33+
$row['avatar_url']
34+
);
3035
}
31-
echo '</ul>';
36+
echo '</table>';
3237

3338
} else {
3439
header("HTTP/1.1 404 Not Found");
3540
echo '<h1>404 Page not Found</h1>';
36-
echo '<p>This is most certainly *not* an xmas miracle</p>';
37-
}
41+
echo '<p>Find a boy (or girl) scout - they can fix this!</p>';
42+
}

0 commit comments

Comments
 (0)