-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.php
116 lines (87 loc) · 2.94 KB
/
main.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
113
114
115
116
<?php
include("users.php");
include("lexical-analysis.php");
?>
<HTML>
<TITLE>Lord of the Rings TCG Collection Database</TITLE>
<BODY>
<p>Welcome to the Lord of the Rings TCG Collection Database. Make your selection below.<p>
<br><br>
<p><form action="main.php" method="get"/>
Card Type: <input type ="text" name = "cardtype"/> From Set <input type ="text" name = "firstset"/> to <input type ="text" name = "lastset"/>
<input type="submit" value="Submit" />
</form></p>
<p><form action="main.php" method="get"/>
Card ID: <input type ="text" name = "cardid"/>
<input type="submit" value="Submit" />
</form></p>
<?php
if(isset($_GET['cardtype']))
{
$firstset = 0;
$lastset = 19;
if($_GET['cardtype'] != "all" and $_GET['cardtype'] != "everything")
{
$cardtype = card_type_number($_GET['cardtype']);
}
else
{
$cardtype = $_GET['cardtype'];
}
if(isset($_GET['firstset']))
{
if(!is_numeric($_GET['firstset']) or $_GET['firstset'] < 0)
{
echo("Malformed From Set. Defaulting to set 0.<br>");
$firstset = 0;
}
$firstset = $_GET['firstset'];
}
if(isset($_GET['lastset']))
{
if(!is_numeric($_GET['lastset']) or $_GET['lastset'] > 19)
{
echo("Malformed Last Set. Defaulting to set 19.<br>");
$lastset = 19;
}
$lastset = $_GET['lastset'];
}
if($firstset > $lastset)
{
echo("First Set greater than Last Set. Displaying all sets.");
}
if($cardtype == "all")
{
$sql = mysql_query("SELECT image FROM lotrtcg_cards_decipher WHERE set_number >='$firstset' AND set_number <='$lastset'");
}
else if($cardtype == "everything")
{
$sql = mysql_query("SELECT image FROM lotrtcg_cards_decipher");
}
else
{
$sql = mysql_query("SELECT image FROM lotrtcg_cards_decipher WHERE card_type='$cardtype' AND set_number >='$firstset' AND set_number <='$lastset'");
}
if(!$sql)
{
echo mysql_error();
}
while($row = mysql_fetch_array($sql))
{
$image = $row['image'];
echo("<img src=\"http://lotrtcgwiki.com/wiki/_media/cards:$image.jpg\"/>");
}
}
if(isset($_GET['cardid']))
{
$cardid = $_GET['cardid'];
if(!$sql = mysql_query("SELECT * FROM lotrtcg_cards_decipher WHERE id ='$cardid';"))
{
echo mysql_error();
}
$row = mysql_fetch_array($sql);
analyze_new_card($row);
}
?>
</BODY>
</HTML>