Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<!doctype html>
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="manifest" href="site.webmanifest">
<link rel="apple-touch-icon" href="icon.png">
<!-- Place favicon.ico in the root directory -->
<link href="https://fonts.googleapis.com/css?family=Lora" rel="stylesheet">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link href="https://fonts.googleapis.com/css?family=Alice|Amatic+SC|Bad+Script|Cutive+Mono|Fascinate+Inline|Homemade+Apple|Josefin+Slab|Lobster+Two|Lora|Oswald|Playfair+Display|Raleway|Raleway+Dots|Sacramento|Shadows+Into+Light+Two" rel="stylesheet">
<meta name="theme-color" content="#fafafa">
<style type="text/css">
body {
background-image:url(
img/bg.png);
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
font-family: 'Lora';
}
.fontresult {
font-family: 'Lora';
}
</style>
</head>
<body>
<?php
$servername = "4470.plesk.digitalmediauconn.org";
$username = "chelsea";
$password = '$4et7m5T';
try {
$conn = new PDO("mysql:host=$servername;dbname=chelsea", $username, $password);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
// echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
$Q1 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q1']))));
$Q2 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q2']))));
$Q3 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q3']))));
$Q4 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q4']))));
$Q5 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q5']))));
$Q6 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q6']))));
$Q7 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q7']))));
$Q8 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q8']))));
$Q9 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q9']))));
$Q10 = htmlspecialchars(trim(stripslashes(strip_tags($_POST['Q10']))));
$query = "SELECT category FROM quiz_key WHERE question IN ('$Q1','$Q2','$Q3','$Q4','$Q5','$Q6','$Q7','$Q8','$Q9','$Q10')";
$result = $conn->query($query);
$cat_a = $cat_b = $cat_c = $cat_d = $cat_e = 0;
while($row = $result->fetch()) {
$cat = $row['category'];
if ($cat == "A") { $cat_a += 1; }
elseif ($cat == "B") { $cat_b += 1; }
elseif ($cat == "C") { $cat_c += 1; }
elseif ($cat == "D") { $cat_d += 1; }
elseif ($cat == "E") { $cat_e += 1; }
}
$array = array('A' => $cat_a, 'B' => $cat_b, 'C' => $cat_c, 'D' => $cat_d, 'E' => $cat_e); $str = "";
foreach ($array as $i => $value) {
if ($value >= 5) {
$str = $i; break;
} elseif ($value >= 3) {
$str .= $i; break;
}
}
$query = "SELECT result FROM quiz_map WHERE result_category = '$str' LIMIT 1";
$result = $conn->query($query);
$row = $result->fetch();
?>
<div id=resultdiv>
<?php
foreach ( (array) $row as $result) {
if ($result == "Raleway") {
echo "You got " ?><br> <span id="raleway"> <?php echo "Raleway! " ?> </span> <br> <?php echo "This font is sleek, thin and organized. You may also be a traditional person with clean habits.";
}
else if ($result == "Playfair Display") {
echo "You got " ?> <br><span id="playfair"> <?php echo "Playfair Display! " ?> </span><br> <?php echo "This font is elegant and beautiful. It may not be great for taking notes, but it makes good headers!";
}
else if ($result == "Lora") {
echo "You got " ?> <br><span id="lora"> <?php echo "Lora! " ?> </span><br> <?php echo "This font is elegant and simple. It works well in any heading or body paragraph! ";
}
else if ($result == "Sacramento") {
echo "You got " ?> <br><span id="sacramento"> <?php echo "Sacramento! " ?> </span><br> <?php echo "This font is beautiful yet creative. Use it for short blurbs of text or headings!";
}
else if ($result == "Shadows Into Light Two") {
echo "You got " ?> <br><span id="shadows"> <?php echo "Shadows Into Light Two! " ?></span> <br> <?php echo "This font is elegant but messy, like the Queen wrote a quick note. Use it for a less formal project. ";
}
else if ($result == "Alice") {
echo "You got " ?> <br><span id="alice"> <?php echo "Alice! " ?> </span><br> <?php echo "This font is elegant and organized. Use it for headings!";
}
else if ($result == "Josefin Slab") {
echo "You got " ?> <br><span id="josefin"> <?php echo "Josefin Slab! " ?></span> <br> <?php echo "Simple and creative, Josefin Slab is a cute little modern font which makes a great addition to any body text.";
}
else if ($result == "Amatic SC") {
echo "You got " ?> <br><span id="amatic"> <?php echo "Amatic SC! " ?> </span><br> <?php echo "Simple yet messy, this font works well for people who are very busy and are good at multitasking.";
}
else if ($result == "Cutive Mono") {
echo "You got " ?> <br><span id="cutive"> <?php echo "Cutive Mono! " ?> </span><br> <?php echo "This font is simple and organized and adds a retro, typewriter effect to any copy. ";
}
else if ($result == "Lobster Two") {
echo "You got " ?> <br><span id="lobster"> <?php echo "Lobster Two! " ?> </span><br> <?php echo "This font is very creative, but it's got a big personality. Use it carefully!";
}
else if ($result == "Fascinate Inline") {
echo "You got " ?> <br><span id="fascinate"> <?php echo "Fascinate Inline! " ?> </span><br> <?php echo "This font is very creative but messy. Use it sparingly.";
}
else if ($result == "Raleway Dots") {
echo "You got " ?> <br><span id="ralewaydots"> <?php echo "Raleway Dots! " ?></span> <br> <?php echo "Raleway Dots is a great font for someone who is creative yet organized.";
}
else if ($result == "Homemade Apple") {
echo "You got " ?> <br><span id="apple"> <?php echo "Homemade Apple! " ?> </span><br> <?php echo "This font is messy but beautiful in its own way.";
}
else if ($result == "Bad Script") {
echo "You got " ?> <br><span id="bad"> <?php echo "Bad Script! " ?> </span><br> <?php echo "Ignore its name, Bad Script is a great font for someone who is messy but tries to be organized. We've all been there!";
}
else if ($result == "Oswald") {
echo "You got " ?><br> <span id="oswald"> <?php echo "Oswald! " ?> </span><br> <?php echo "Oswald is the font for someone organized and to the point. Thick yet narrow, the letters always make a statement.";
}
else{
echo "Oops! Something went wrong. Please try again.";
}
}
?>
<br>
<a href="index.php"><button class="btn" id="again">take it again!</button></a>
</div>
</body>