-
Notifications
You must be signed in to change notification settings - Fork 0
/
charaters_insert.php
146 lines (111 loc) · 5.06 KB
/
charaters_insert.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CS340: Final Project</title>
<!--
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="icon" type="image/png" href="/favicon.png" />
<link rel="stylesheet" type="text/css" href="style.css" />
-->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<!-- Add to home screen for apple & android devices -->
<link rel="apple-touch-icon" href="img/webicons/Linkhub.png">
<link rel="icon" sizes="192x192" href="img/webicons/Linkhub_icon.png">
<link href="css/index_CSS.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Josefin+Slab' rel='stylesheet' type='text/css'>
</head>
<body background="http://www.zryxsw.com/data/out/87/1133884-the-elder-scrolls-wallpaper.png">
<header class = "navbar-inverse" role = "banner">
<div class= "container">
<nav role = "navigation">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">HOME</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="About.html">About <span class="sr-only">(current)</span></a></li>
<li><a href="Characters.php">Characters <span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">Provinces<span class="caret"></span></a>
<ul class="dropdown-menu" role="menu">
<li><a href="blackmarsh.html">Black Marsh</a></li>
<li><a href="cyrodiil.html">Cyrodiil</a></li>
<li><a href="elsweyr.html">Elsweyr</a></li>
<li><a href="hammerfell.html">Hammerfell</a></li>
<li><a href="highrock.html">High Rock</a></li>
<li><a href="morrowind.html">Morrowind</a></li>
<li><a href="skyrim.html">Skyrim</a></li>
<li><a href="smmerset.html">Summerset Isles</a></li>
<li><a href="valenwood.html">Valenwood</a></li>
</ul>
</li>
</ul>
</div>
</nav>
</div>
</header>
<div>
<h1> Your Submission is Recorded! </h1>
</div>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script src="scripts/main.js"> </script>
<script>
$(function(){
$('#p1').on('click',function(){
$('#p1b').slideToggle(200);
});
});
</script>
</body>
</html>
<?php
$dbhost = 'oniddb.cws.oregonstate.edu';
$dbname = 'guox-db';
$dbuser = 'guox-db';
$dbpass = 'RCellOvATpqTBbX5';
$conn = new mysqli($dbhost, $dbname, $dbpass, $dbuser);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$name = mysql_real_escape_string($_POST['name']);
$homeland = mysql_real_escape_string($_POST['homeland']);
$bio = mysql_real_escape_string($_POST['bio']);
$race = mysql_real_escape_string($_POST['race']);
$guild = mysql_real_escape_string($_POST['guild']);
$sql = "INSERT INTO Characters (name, aid, bio, race, cid, homeland) VALUES (
'$name',
(SELECT id FROM Homelands WHERE name='$homeland'),
'$bio',
'$race',
(SELECT id FROM Guilds WHERE name='$guild'),
'$homeland')";
if ($conn->query($sql) === TRUE) {
echo " ";
} else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
?>