-
Notifications
You must be signed in to change notification settings - Fork 1
/
actor.php
71 lines (52 loc) · 1.9 KB
/
actor.php
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<<<<<<< HEAD:actor.php
<?php
// will be replacing this with the compiling class
$actor = array_key_exists('actor', $_GET) ? $_GET['actor'] : null;
$date = array_key_exists('date', $_GET) ? $_GET['date'] : null;
$date = substr($date, 8, 2) . '-' . substr($date, 5, 2);
// Connect to database
$m = new Mongo();
$db = $m->actor_birthdays;
// Get the collection
$actors = $db->actor_birthdays->actor_birthdays;
$data = array();
// Query
if ($actor) {
$date = $actors->findOne(array('name' => $actor));
$months = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$day = substr($date['date'], 0, 2);
$month = (int) substr($date['date'], 3, 2);
$data[] = "{$day} {$months[$month]}";
}
else {
$actors_list = $actors->find(array('date' => $date));
foreach ($actors_list as $actor) {
$data[] = $actor['name'];
}
}
=======
<?php
$actor = array_key_exists('actor', $_GET) ? $_GET['actor'] : null;
$date = array_key_exists('date', $_GET) ? $_GET['date'] : null;
$date = substr($date, 8, 2) . '-' . substr($date, 5, 2);
// Connect to database
$m = new Mongo("http://54.247.71.60:27017");
$db = $m->actor_birthdays;
// Get the collection
$actors = $db->actor_birthdays->actor_birthdays;
$data = array();
// Query
if ($actor) {
$date = $actors->findOne(array('name' => $actor));
$months = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
$day = substr($date['date'], 0, 2);
$month = (int) substr($date['date'], 3, 2);
$data[] = "{$day} {$months[$month]}";
}
else {
$actors_list = $actors->find(array('date' => $date));
foreach ($actors_list as $actor) {
$data[] = $actor['name'];
}
}
>>>>>>> 244d666a68f69b7718a5c16189cb81d90c67500c:interface/html/actor.php