<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<!------ Include the above in your HEAD tag ---------->
<!DOCTYPE html>
<html> <head> <title>Register</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
</head>
<h1>Nybro</h1>
<body>
<?php
require 'connect.php';?>
<br>
<form name="register" action="createNewAccount.php" method = "POST" class="form-register">
<h2 class="form-signin-heading text-muted">Register</h2>
<input type="name" placeholder="First Last" name="name" class="form-control">
<input type="text" placeholder="Email Address" name="email" class="form-control">
<input type="text" placeholder="Major" name="major" class="form-control">
<textarea type="text" rows="5" cols="25" placeholder="Short Bio" name="bio" class="form-control"></textarea>
<textarea type="text" rows="2" cols="25" placeholder="MW: 4-6PM, TTH: 12-1PM" name="availability" class="form-control"></textarea>
<!--<div class="ui-widget">-->
<textarea type="text" rows="2" cols="25" placeholder="CSE 131, BME 140" name="tutor" id="auto" class="form-control"></textarea>
<textarea type="text" rows="2" cols="25" placeholder="CSE 332 Computer Science II" name="student" id="auto" class="form-control"></textarea>
<!--</div>-->
<input type="password" placeholder="Password" name="password" class="form-control">
<input type="submit" value="Register" name = "Register" class="btn btn-lg btn-primary btn-block"><br>
<div class="note" style="text-align:center">
<a href="register.php">Already have an Account? Login Here!</a>
</div>
</form>
<script type="text/javascript">
$(function() {
function split( val ) {
return val.split( /,\s*/ );
}
function extractLast( term ) {
return split(term).pop();
}
//autocomplete
$("#auto")
.autocomplete({
source: function(request, response) {
$.getJSON ("search.php", {
term: extractLast(request.term)
}, response);
};
search: function() {
var term = extractLast(this.value);
if (term.length < 1) {
return false;
}
},
focus: function() {
return false;
},
select: function(event, ui) {
var terms = split(this.value);
terms.pop();
terms.push(ui.item.value);
terms.push("");
this.value = terms.join(", ");
return false;
}
});
});
</script>
<?php
if (isset($_POST['Register'])) {
$stmt = $mysqli->prepare("SELECT email FROM users");
if(!$stmt){
printf("Query Prep Failed: %s\n", $mysqli->error);
exit;
}
$stmt->execute();
$result= $stmt->get_result();
while($row = $result->fetch_assoc()){
if($row['email'] == $_GET['email']){
header("Location: failedAttempt.php");
}
}
#If the user already exists
if(isset($_GET['invalid'])){
echo "Sorry, this user already exists.";
}
}
?>
</body>
</html>
body {
padding-top: 10px;
padding-bottom: 40px;
/*background-color: #eee;*/
/*background-image: url('https://vignette2.wikia.nocookie.net/clubpenguin/images/e/e9/Jess_Future_Party_Login_Screen_Background.png/revision/latest?cb=20160330140948');*/
background: #558C89; /* Old browsers */
background: -moz-radial-gradient(center, ellipse cover, #558C89 1%, #74AFAD 100%); /* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(1%,#558C89), color-stop(100%,#74AFAD)); /* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, #558C89 1%,#74AFAD 100%); /* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, #558C89 1%,#74AFAD 100%); /* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, #558C89 1%,#74AFAD 100%); /* IE10+ */
background: radial-gradient(ellipse at center, #558C89 1%,#74AFAD 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#558C89', endColorstr='#74AFAD',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
height:calc(100vh);
width:100%;
}
input,
textarea {
background: rgba(0, 0, 0, 0);
border: none;
outline: 0;
cursor: text;
}
textarea {
resize: none;
}
h1{
text-align: center;
font-size: 50px;
font-family: Futura,Trebuchet MS,Arial,sans-serif;
color: #ECECEA;
}
h2{
text-align: center;
font-size:30px;
color: #ECECEA;
font-family: Futura,Trebuchet MS,Arial,sans-serif;
}
.btn {
outline:0;
border:none;
border-top:none;
border-bottom:none;
border-left:none;
border-right:none;
box-shadow:inset 2px -3px rgba(0,0,0,0.15);
}
.form-register {
max-width: 600px;
padding: 15px;
margin: 0 auto;
margin-top:50px;
}
.form-register .form-signin-heading, .form-signin {
margin-bottom: 10px;
}
.form-register .form-control {
position: relative;
font-size: 16px;
height: auto;
padding: 10px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.form-register .form-control:focus {
z-index: 2;
}
.form-register input[type="text"]{
margin-bottom: -1px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top-style: none;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-color: #000;
}
.form-register textarea[type="text"]{
margin-bottom: -1px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top-style: none;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-color: #000;
}
.form-register input[type="name"] {
margin-bottom: -1px;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-color: #000;
}
.form-register input[type="password"] {
margin-bottom: 10px;
border-top-left-radius: 0;
border-top-right-radius: 0;
border-top-style: none;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-color: rgb(0,0,0);
border-top:1px solid rgba(0,0,0,0.08);
}
.form-signin-heading {
color: #fff;
text-align: center;
text-shadow: 0 2px 2px rgba(0,0,0,0.5);
}
input[type="submit"]{
font-family: Futura,Trebuchet MS,Arial,sans-serif;
background-color : #D9853B;
}
.note a {
color: #fff;
font-family: Futura,Trebuchet MS,Arial,sans-serif;
}