-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcit.php
More file actions
111 lines (100 loc) · 2.74 KB
/
cit.php
File metadata and controls
111 lines (100 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
include("loginprotection.php");
if(isset($_POST['user']) && $_POST['uid']!=-1)
{
if(!empty($_POST['cit']))
{
addCit($_POST['uid'], $_POST['cit'], $_POST['teacher']=="true" || $_POST['teacher'] ===true);
}
}
else if(isset($_POST['user']) && $_POST['uid']==-1)
{
$id = getUserId($_POST['user']);
if($id == -1)
{
echo "<font style=\"color: #FF0000; font-size: 72px;\"> ES GIBT KEINEN ".$_POST['user']."... verschrieben?</font>";
}
else
{
if(!empty($_POST['cit']))
{
addCit($id[0], $_POST['cit'], $id[1]);
}
}
}
foreach(array_keys($_POST) as $name)
{
if(strpos($name, "id_") !== false)
{
$id = str_replace("id_", "", $name);
deleteCit($id);
}
}
?>
<html>
<head>
<title>Zitate</title>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="<?php echo $_SESSION['style']; ?>.css">
<script>
$(function() {
var names = [<?php
getAllJSON_cit();
?>
];
$( "#search" ).autocomplete({
minLength: 0,
source: names,
focus: function( event, ui ) {
$( "#search" ).val( ui.item.label );
return false;
},
select: function( event, ui ) {
$( "#search" ).val( ui.item.label );
$( "#id" ).val( ui.item.id );
$( "#teacher" ).val( ui.item.teacher );
//sub();
return false;
}
})
.data( "ui-autocomplete" )._renderItem = function( ul, item ) {
return $( "<li>" )
.append( "<a>" +((item.teacher=="true")?" <font color=\"#FF0000\" >":"")+ item.label + ((item.teacher=="true")?" </font>":"")+ "</a>" )
.appendTo( ul );
};
});
</script>
<script type="text/javascript">
function sub()
{
$("#searchform").submit();
$("#searchform").reset();
}
</script>
</head>
<body>
<?php echo "<font style=\"size: 42px;\">DUMP: ";
var_dump($_POST);
echo "</font>";?>
<h1>Zitate</h1>
<!-- <p> <br><br>Zitat hinzufügen: <br>
<form id="searchform" action="#" method="post">
<table width="300px" border="0" cellpadding="3" cellspacing="1">
<tr>
<td align="left"><input type="text" name="cit" size="100%"></td>
</tr>
<tr>
<td align="left">Von: <input type="hidden" id="teacher" name="teacher" value="0"><input type="hidden" id="id" name="uid" value="-1"><input id="search" type="text" name="user" value="" style="width:83%"><input type="submit" name="search" value="hinzufügen" onclick="sub()" ></td>
</tr>
<table>
</form>
</p>
<br>
<br> -->
<h2> Alle Zitate: </h2>
<?php listCit(); ?>
<p><a href="index.php">Menü</a><br><br><a href="logout.php">Logout</a><br>keks: <?php echo isset($_COOKIE['userid'])?"yep":"nope"; ?></p>
</body>
</html>