/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 06:33:30 UTC
  • mfrom: (57.1.2 extremedating)
  • Revision ID: maila@danieljohansson.nu-20130414063330-yheeoj2a0q1rtmat
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php ?>
 
2
<form method="POST" action="">
 
3
  <div id="datetimepicker" class="input-append date">
 
4
    <input data-format="yyyy-MM-dd hh:mm:ss" type="datetime" name="date"> </input>
 
5
    <span class="add-on">
 
6
      <i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
 
7
    </span>
 
8
  </div>
 
9
  </script>
 
10
    <script type="text/javascript">
 
11
      $('#datetimepicker').datetimepicker({
 
12
     });
 
13
  </script>
 
14
  </body>
 
15
  <input type="text" name="message">
 
16
  <button type="Submit" name="SuggestLunch">Föreslå lunch</button>
 
17
        </form>
 
18
        <?php
 
19
        $user2 = htmlspecialchars($_GET['uid']);
 
20
        if (isset($_POST['SuggestLunch'])) {
 
21
                $query = "INSERT INTO planLunch (
 
22
                user1,
 
23
                user2,
 
24
                message,
 
25
                date,
 
26
                accepted
 
27
                )
 
28
        
 
29
                VALUES(
 
30
                '{$username}',
 
31
                '{$user2}',
 
32
                '{$_POST['message']}',
 
33
                '{$_POST['date']}',
 
34
                'false'
 
35
                );";
 
36
                
 
37
                try {
 
38
                $lunchinfo = $db->query("SELECT * from planLunch WHERE(user1='$username' AND user2='$user2')");
 
39
                        $lunchquery = $lunchinfo->fetchAll();
 
40
                        if($lunchquery == array()) {
 
41
                                $db->exec($query);
 
42
                        }
 
43
                } catch (PDOException $err) {
 
44
                        var_dump($err);
 
45
                }
 
46
        }
 
47
?>