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

  • Committer: Daniel Johansson
  • Date: 2013-04-14 00:37:18 UTC
  • Revision ID: maila@danieljohansson.nu-20130414003718-kpkym00e9p91uub7
Added feed

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP
2
 
        echo '<form method="POST" action="">';
3
 
        echo '<input type="datetime" name="date">';
4
 
        echo '<input type="text" name="message">';
5
 
        echo '<button type="Submit" name="SuggestLunch">Föreslå lunch</button>';
6
 
        echo '</form>';
7
 
        
8
 
        $user2 = htmlspecialchars($_GET['uid']);
9
 
        if (isset($_POST['SuggestLunch'])) {
10
 
                $query = "INSERT INTO planLunch (
11
 
                user1,
12
 
                user2,
13
 
                message,
14
 
                date,
15
 
                accepted
16
 
                )
17
 
        
18
 
                VALUES(
19
 
                '{$username}',
20
 
                '{$user2}',
21
 
                '{$_POST['message']}',
22
 
                '{$_POST['date']}',
23
 
                'false'
24
 
                );";
25
 
                
26
 
                try {
27
 
                $lunchinfo = $db->query("SELECT * from planLunch WHERE(user1='$username' AND user2='$user2')");
28
 
                        $lunchquery = $lunchinfo->fetchAll();
29
 
                        if($lunchquery == array()) {
30
 
                                $db->exec($query);
31
 
                        }
32
 
                } catch (PDOException $err) {
33
 
                        var_dump($err);
34
 
                }
35
 
        }
36
 
?>
 
 
b'\\ No newline at end of file'