/extremedating/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/extremedating/trunk

« back to all changes in this revision

Viewing changes to php/showinterest.php

  • Committer: Gustav Hatvigsson
  • Date: 2013-04-14 09:21:52 UTC
  • mto: This revision was merged to the branch mainline in revision 61.
  • Revision ID: gustav.hartvigsson@gmail.com-20130414092152-3k7gxmkvghh2y0g3
cleaning up codeC

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
        $relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')");
23
23
        $relationquery = $relationinfo->fetchAll();
24
24
        if($relationquery != array()) {
25
 
                echo 'Du har visat intresse för en lunchdejt med den här personen';
26
 
                echo '<form method="POST" action="">';
27
 
                echo '<button type="Submit" name="Unsubscribe">Sluta visa intresse</button>';
28
 
                echo '</form>';
 
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
29
31
                $relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$profilename' AND user2='$username')");
30
32
                $relationquery = $relationinfo->fetchAll();
31
33
                if($relationquery != array()) {
34
36
                        include 'showlunchsuggestions.php';
35
37
                }
36
38
        } else {
37
 
                echo 'Vill du gå på lunch med den här personen?';
38
 
                echo '<form method="POST" action="">';
39
 
                echo '<button type="Submit" name="Subscribe">Visa intresse</button>';
40
 
                echo '</form>';
 
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
41
45
        }
42
46
        if (isset($_POST['Subscribe'])) {
43
47
                $relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')");
44
48
                $relationquery = $relationinfo->fetchAll();
45
49
                if($relationquery == array()) {
46
50
                        $db->exec("INSERT INTO dateInterests VALUES ('$username', '$profilename')");
47
 
                        echo 'Du har visat intresse för lunch med personen';
 
51
                        echo '<p>Du har visat intresse för lunch med personen</p>';
48
52
                        sleep(.5);
49
53
                        header("Location:./profile.php?uid=" . $profilename);
50
54
                }
52
56
        if (isset($_POST['Unsubscribe'])) 
53
57
        { 
54
58
                $db->exec("DELETE FROM dateInterests WHERE (user1='$username' AND user2='$profilename')");
55
 
                echo 'Du har slutat visa intresse för lunch med personen'; 
 
59
                echo '<p>Du har slutat visa intresse för lunch med personen</p>'; 
56
60
                sleep(.5);
57
61
                header("Location:./profile.php?uid=" . $profilename);
58
62
        }