bzr branch
http://gegoxaren.bato24.eu/bzr/extremedating/trunk
|
49
by Daniel Johansson
Separated out files |
1 |
<?PHP
|
|
49.1.1
by Gustav Hatvigsson
Added licensing information to some files |
2 |
/*
|
3 |
ExtremeDating - a Hackathon 2013 project.
|
|
4 |
Copyright (C) 2013 Gustav Hartvigsson <gustav.hartvigsson@gmail.com>
|
|
5 |
Copyright (C) 2013 Daniel Johansson <maila@danieljohansson.nu>
|
|
6 |
||
7 |
||
8 |
This program is free software: you can redistribute it and/or modify
|
|
9 |
it under the terms of the GNU Affero General Public License as
|
|
10 |
published by the Free Software Foundation, either version 3 of the
|
|
11 |
License, or (at your option) any later version.
|
|
12 |
||
13 |
This program is distributed in the hope that it will be useful,
|
|
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16 |
GNU Affero General Public License for more details.
|
|
17 |
||
18 |
You should have received a copy of the GNU Affero General Public License
|
|
19 |
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20 |
*/
|
|
|
49
by Daniel Johansson
Separated out files |
21 |
if($profilename != $username) { |
22 |
$relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')"); |
|
23 |
$relationquery = $relationinfo->fetchAll(); |
|
24 |
if($relationquery != array()) { |
|
|
59.1.1
by Gustav Hatvigsson
cleaning up codeC |
25 |
?>
|
26 |
<p>Du har visat intresse för en lunchdejt med den här personen<p />
|
|
27 |
<form method="POST" action="">
|
|
28 |
<button type="Submit" name="Unsubscribe">Sluta visa intresse</button>
|
|
29 |
</form>
|
|
30 |
<?php |
|
|
49
by Daniel Johansson
Separated out files |
31 |
$relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$profilename' AND user2='$username')"); |
32 |
$relationquery = $relationinfo->fetchAll(); |
|
33 |
if($relationquery != array()) { |
|
34 |
echo $profilename . ' vill gärna äta lunch med dig också, skicka ett mail och bestäm träff!'; |
|
|
53
by Daniel Johansson
added support for accepts and declines in a ugly way |
35 |
include 'planlunch.php'; |
36 |
include 'showlunchsuggestions.php'; |
|
|
49
by Daniel Johansson
Separated out files |
37 |
}
|
38 |
} else { |
|
|
59.1.1
by Gustav Hatvigsson
cleaning up codeC |
39 |
?>
|
40 |
<p>Vill du gå på lunch med den här personen?</p>
|
|
41 |
<form method="POST" action="">
|
|
42 |
<button type="Submit" name="Subscribe">Visa intresse</button>
|
|
43 |
</form>
|
|
44 |
<?php |
|
|
49
by Daniel Johansson
Separated out files |
45 |
}
|
46 |
if (isset($_POST['Subscribe'])) { |
|
47 |
$relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')"); |
|
48 |
$relationquery = $relationinfo->fetchAll(); |
|
49 |
if($relationquery == array()) { |
|
50 |
$db->exec("INSERT INTO dateInterests VALUES ('$username', '$profilename')"); |
|
|
59.1.1
by Gustav Hatvigsson
cleaning up codeC |
51 |
echo '<p>Du har visat intresse för lunch med personen</p>'; |
|
49
by Daniel Johansson
Separated out files |
52 |
sleep(.5); |
53 |
header("Location:./profile.php?uid=" . $profilename); |
|
54 |
}
|
|
55 |
}
|
|
56 |
if (isset($_POST['Unsubscribe'])) |
|
57 |
{
|
|
58 |
$db->exec("DELETE FROM dateInterests WHERE (user1='$username' AND user2='$profilename')"); |
|
|
59.1.1
by Gustav Hatvigsson
cleaning up codeC |
59 |
echo '<p>Du har slutat visa intresse för lunch med personen</p>'; |
|
49
by Daniel Johansson
Separated out files |
60 |
sleep(.5); |
61 |
header("Location:./profile.php?uid=" . $profilename); |
|
62 |
}
|
|
63 |
}
|