-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.php~
More file actions
81 lines (75 loc) · 2.61 KB
/
setup.php~
File metadata and controls
81 lines (75 loc) · 2.61 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
<?php
session_start();
include_once "mysql_config.php";
include_once "color_list.php";
mysql_connect('localhost',$mysql_user,$mysql_pass);
mysql_select_db('itztag');
if (isset($_REQUEST))
{
foreach(array_keys($_REQUEST) as $k)
{
if (strstr($k,"remove"))
{
$tag=substr($k,7,4096);
mysql_query("DELETE FROM tags WHERE SessionID=".$_SESSION["id"]." AND Tag=\"".$tag."\";");
}
else if (strstr($k,"add"))
{
if ($_REQUEST["tag_new"]!="Neuer Tag...")
{
mysql_query("INSERT INTO tags (SessionID, Tag, Farbe) VALUES (".$_SESSION["id"].", \"".$_REQUEST["tag_new"]."\", \"".array_search($_REQUEST["color_new"],$colors)."\");");
}
}
else if (strstr($k,"tag"))
{
$ct=substr($k,4);
if ($k!="tag_new")
mysql_query("UPDATE tags SET Farbe=\"".array_search($_REQUEST["color_$ct"],$colors)."\" WHERE Tag=\"".$_REQUEST[$k]."\" AND SessionID=".$_SESSION["id"].";");
}
}
}
$result=mysql_query('SELECT * FROM tags WHERE SessionID="'.$_SESSION["id"].'";');
?>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript">
function change_color(pos,color)
{
element=document.getElementsByName("color_"+pos)[0];
element.value=color;
}
function select_color(pos)
{
get_color = window.open("color.php?pos="+pos,"Farbwähler","dependent=no,height=400,width=800,menubar=no");
}
</script>
<body>
<form action="setup.php" method="post">
<table>
<?php
$ct=0;
while($t=mysql_fetch_array($result))
{
echo "<tr>\n";
echo " <td><input type=\"text\" name=\"tag_$ct\" value=\"".$t["Tag"]."\" /></td>\n";
echo " <td><input type=\"text\" name=\"color_$ct\" size=\"8\" value=\"".$colors[$t["Farbe"]]."\" /></td>\n";
echo " <td><button type=\"button\" onclick=\"select_color($ct)\"><img src=\"images/button_".$t["Farbe"].".gif\"></button></td>\n";
echo " <td><input type=\"submit\" value=\"Entfernen\" name=\"remove_".$t["Tag"]."\" /></td>\n";
echo "</tr>\n";
$ct++;
}
?>
<tr>
<td><input type="text" name="tag_new" value="Neuer Tag..." /></td>
<td><input type="text" name="color_new" size="8" value="...neue Farbe" /></td>
<td><button type="button" onclick="select_color('new')"><img src="images/blank.gif"></button></td>
<td><input type="submit" value="Einfügen" name="add" /></td>
</tr>
<tr>
<td><input type="submit" value="Speichern"></td>
<td colspan=3><input type="button" value="Schließen und Editor neu laden" onclick="window.opener.location.reload(); window.close();" width="100%"></td>
</tr>
</table>
</form>
</body>
</html>