/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 profile.php

  • Committer: Daniel Johansson
  • Date: 2013-04-13 23:33:25 UTC
  • Revision ID: maila@danieljohansson.nu-20130413233325-ube31nulwhf3z2s2
Fixed list of people in index.php

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
                <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
29
29
        </head>
30
30
        <?PHP
31
 
        if(isset($_SESSION ['userName'])){
32
 
        $username = $_SESSION ['userName'];
33
 
        include 'php/db.php';
34
 
        $userinfo = $db->query("SELECT firstName from Users WHERE loginName='$username'");
35
 
        $self = $userinfo->fetchAll();
36
 
        $firstName = $self [0]['firstName'];
37
 
        $userinfo = $db->query("SELECT surName from Users WHERE loginName='$username'");
38
 
        $self = $userinfo->fetchAll();
39
 
        $surName = $self [0]['surName'];
40
 
        ?>
41
 
        <body id="wrapper">
42
 
                <div id="profile">
43
 
                        <div id="profileheader">
44
 
                        <div class="logo">
45
 
                                <a href="index.php">
46
 
                                <img src="img/logo.png"/>
47
 
                                </a>
48
 
                        </div>
 
31
                if(isset($_SESSION ['userName'])){
 
32
                        $username = $_SESSION ['userName'];
 
33
                        include 'php/db.php';
 
34
                        $userinfo = $db->query("SELECT firstName from Users WHERE loginName='$username'");
 
35
                        $self = $userinfo->fetchAll();
 
36
                        $firstName = $self [0]['firstName'];
 
37
                        $userinfo = $db->query("SELECT surName from Users WHERE loginName='$username'");
 
38
                        $self = $userinfo->fetchAll();
 
39
                        $surName = $self [0]['surName'];
 
40
                ?>
 
41
                <body id="wrapper">
 
42
                        <div id="profile">
 
43
                                <div id="profileheader">
 
44
                                <div class="logo">
 
45
                                        <a href="index.php">
 
46
                                                <img src="img/logo.png"/>
 
47
                                        </a>
 
48
                                </div>
49
49
                                <form action="./logout.php" method="POST">
50
50
                                        <table id="logout">
51
51
                                                <tr>
62
62
                        <?PHP
63
63
                        $profilename = htmlspecialchars($_GET['uid']);
64
64
                        if($profilename != $username) {
65
 
                                $relationinfo = $db->query("SELECT * from dateInterests WHERE (user1='$profilename' AND user2='$username') OR (user1='$username' AND user2='$profilename')");
 
65
                                $relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')");
66
66
                                $relationquery = $relationinfo->fetchAll();
67
67
                                if($relationquery != array()) {
68
68
                                        echo 'Du har visat intresse för en lunchdejt med den här personen';
69
69
                                        echo '<form method="POST" action="">';
70
70
                                        echo '<button type="Submit" name="Unsubscribe">Sluta visa intresse</button>';
71
71
                                        echo '</form>';
 
72
                                        $relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$profilename' AND user2='$username')");
 
73
                                        $relationquery = $relationinfo->fetchAll();
 
74
                                        if($relationquery != array()) {
 
75
                                                echo $profilename . ' vill gärna äta lunch med dig också, skicka ett mail och bestäm träff!';
 
76
                                        }
72
77
                                } else {
73
78
                                        echo 'Vill du gå på lunch med den här personen?';
74
79
                                        echo '<form method="POST" action="">';
76
81
                                        echo '</form>';
77
82
                                }
78
83
                                if (isset($_POST['Subscribe'])) 
79
 
                                { 
80
 
                                        $db->exec("INSERT INTO dateInterests VALUES ('$profilename', '$username')");
81
 
                                        echo 'Du har visat intresse för lunch med personen'; 
 
84
                                {
 
85
                                        $relationinfo = $db->query("SELECT * from dateInterests WHERE(user1='$username' AND user2='$profilename')");
 
86
                                        $relationquery = $relationinfo->fetchAll();
 
87
                                        if($relationquery == array()) {
 
88
                                                $db->exec("INSERT INTO dateInterests VALUES ('$username', '$profilename')");
 
89
                                                echo 'Du har visat intresse för lunch med personen';
 
90
                                                sleep(.5);
 
91
                                                header("Location:./profile.php?uid=" . $profilename);
 
92
                                        }
82
93
                                }
83
94
                                if (isset($_POST['Unsubscribe'])) 
84
95
                                { 
85
 
                                        $db->exec("DELETE FROM dateInterests WHERE (user1='$profilename' AND user2='$username') OR (user1='$username' AND user2='$profilename')");
 
96
                                        $db->exec("DELETE FROM dateInterests WHERE (user1='$username' AND user2='$profilename')");
86
97
                                        echo 'Du har slutat visa intresse för lunch med personen'; 
 
98
                                        sleep(.5);
 
99
                                        header("Location:./profile.php?uid=" . $profilename);
87
100
                                }
88
101
                        }
89
102
                        $userinfo = $db->query("SELECT firstName from Users WHERE loginName='$profilename'");