/extremedating/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/extremedating/trunk
49 by Daniel Johansson
Separated out files
1
<?PHP
2
if($profilename != $username) {
3
	$relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')");
4
	$relationquery = $relationinfo->fetchAll();
5
	if($relationquery != array()) {
6
		echo 'Du har visat intresse för en lunchdejt med den här personen';
7
		echo '<form method="POST" action="">';
8
		echo '<button type="Submit" name="Unsubscribe">Sluta visa intresse</button>';
9
		echo '</form>';
10
		$relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$profilename' AND user2='$username')");
11
		$relationquery = $relationinfo->fetchAll();
12
		if($relationquery != array()) {
13
			echo $profilename . ' vill gärna äta lunch med dig också, skicka ett mail och bestäm träff!';
14
		}
15
	} else {
16
		echo 'Vill du gå på lunch med den här personen?';
17
		echo '<form method="POST" action="">';
18
		echo '<button type="Submit" name="Subscribe">Visa intresse</button>';
19
		echo '</form>';
20
	}
21
	if (isset($_POST['Subscribe'])) {
22
		$relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')");
23
		$relationquery = $relationinfo->fetchAll();
24
		if($relationquery == array()) {
25
			$db->exec("INSERT INTO dateInterests VALUES ('$username', '$profilename')");
26
			echo 'Du har visat intresse för lunch med personen';
27
			sleep(.5);
28
			header("Location:./profile.php?uid=" . $profilename);
29
		}
30
	}
31
	if (isset($_POST['Unsubscribe'])) 
32
	{ 
33
		$db->exec("DELETE FROM dateInterests WHERE (user1='$username' AND user2='$profilename')");
34
		echo 'Du har slutat visa intresse för lunch med personen'; 
35
		sleep(.5);
36
		header("Location:./profile.php?uid=" . $profilename);
37
	}
38
}