-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
112 lines (101 loc) · 3.6 KB
/
index.php
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
112
<?php
error_reporting(E_ALL);
ini_set('display_errors','On');
require_once('config.php');
require_once('functions.php');
$v = "v0.5a";
$e = "";
$n = "";
// cleanWhiteSpace();
// deleteDuplicates();
// dumpList();
if (!empty($_GET['delete']))
deleteEntry($_GET['delete']);
if (!empty($_GET['update']))
updateTags($_GET['update'], $_GET);
if (!empty($_POST['Names'])) {
$names = explode(",",$_POST['Names']);
$race = $_POST['Race'];
if (!empty($_POST['Contributor']))
$contributor = $_POST['Contributor'];
$female = 0;
if (!empty($_POST['Female']))
$female = 1;
$last = 0;
if (!empty($_POST['Last']))
$last = 1;
$e = insertName($names,$race,$female,$last,$contributor);
}
$n = mysqli_query($db, "SELECT * FROM names ORDER BY race,female,last_name,name");
$c = mysqli_fetch_object(mysql_query($db, "SELECT COUNT(id) as count FROM names"));
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="resources/css/default.css" />
<title>Name Contributor <? print $v; ?></title>
<script type="text/javascript" src="resources/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="resources/js/util.js"></script>
<script type="text/javascript">
$(document).ready(function(){
if (readCookie("contrib") != null){
contrib = readCookie("contrib");
$("#Contributor").val(contrib);
}
});
</script>
</head>
<body>
<h1>Name Contributor <? print $v; ?></h1>
<div><? print $e; ?></div>
<form method="post" action="/">
<input type="text" name="Contributor" id="Contributor" placeholder="Your Name!" onChange="createCookie('contrib', $('#Contributor').val(), 30);" /><label for="Contributor"> This is YOUR name. Used to identify who added these names</label><br />
<textarea name="Names" id="Names" placeholder="Names go here (Comma-separated)" style="resize: none; width: 400px; height: 75px;"></textarea><br /><br />
<select name="Race" id="Race">
<option value="Human">Human</option>
<option value="Human - Asian">Human - Asian</option>
<option vlaue="Human - German">Human - German</option>
<option value="Human - Spanish">Human - Spanish</option>
<option value="Human - Nordic">Human - Nordic</option>
<option value="Human - Russian">Human - Russian</option>
<option value="Dwarf">Dwarf</option>
<option value="Elf">Elf</option>
<option value="Drow">Drow (Dark-Elf)</option>
<option value="Orc">Orc</option>
<option value="Gnome">Gnome</option>
<option value="Halfling">Halfling</option>
<option value="Gnoll">Gnoll</option>
<option value="Demon">Demon</option>
<option value="Dragon">Dragon</option>
</select><label for="Race"> Race</label><br />
<input type="checkbox" name="Female" id="Female" /><label for="Female"> Female</label><br />
<input type="checkbox" name="Last" id="Last" /><label for="Last"> Last Name</label><br /><br />
<input type="submit" name="submit" id="submit" value="Submit" />
</form>
<div>
<?php
if ($n != "")
{
print "Names submitted (<strong>$c->count</strong>):<br />\n<hr />";
while ($list = mysqli_fetch_object($n))
{
//print "<a href=\"?delete=$list->id\">[delete] - </a>";
print "<span class=\"";
if ($list->last_name)
print "last_name";
else if ($list->female)
print "female_name";
else
print "male_name";
print "\">";
print $list->name." : ".$list->race."</span>";
$female = !$list->female;
if (empty($female)) $female = 0;
//print "<a href=\"?update=$list->id&female=$female\"> [change gender]</a>";
print "<br />\n";
}
print "<hr />\n";
}
?>
</div>
</body>
</html>