Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (isset($_POST['submitted'])){
- include('php/connect-mysql.php');
- $champ_name= $_POST['champ_name'];
- $dojo_name= $_POST['dojo_name'];
- $c_email= $_POST['c_email'];
- $dojo_add= $_POST['dojo_add'];
- $c_pword= $_POST['c_pword'];
- $sqlinsert = "INSERT INTO register (champ_name, dojo_name, c_email, dojo_add, c_pword) VALUES ('$champ_name', '$dojo_name', '$c_email', '$dojo_add', '$c_pword')";
- // echo 'hey';
- // $sqlinsert = "INSERT INTO Ninja (n_name, n_level) VALUES ('$n_name', '$n_level')";
- if(!mysqli_query($dbcon, $sqlinsert)){
- die('error inserting new record');
- //check for qery if it works!!
- }// end of nsted if statement
- $newrecord= "1 record added to the database!";
- } //end of main if statement
- ?>
- <!DOCTYPE html>
- <!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
- <!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
- <!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->
- <!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
- <head>
- <meta charset="utf-8">
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Login Form</title>
- <link rel="stylesheet" href="css/register.css">
- <link href='http://fonts.googleapis.com/css?family=Raleway:400,100,300,700,600,500' rel='stylesheet' type='text/css'>
- <link href='http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic,700' rel='stylesheet' type='text/css'>
- <link rel="stylesheet" href="css/slicknav.css">
- <link rel="stylesheet" href="css/owl.theme.css">
- <link rel="stylesheet" href="css/owl.carousel.css">
- <link rel="stylesheet" href="css/owl.transitions.css">
- <link rel="stylesheet" href="css/font-awesome.min.css">
- <link rel="stylesheet" href="css/bootstrap.min.css">
- <link rel="stylesheet" href="css/main.css">
- <link rel="stylesheet" href="css/responsive.css">
- <script src="js/vendor/modernizr-2.6.2.min.js"></script>
- <!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
- </head>
- <body>
- <section id="header">
- <div class="container">
- <div class="row">
- <div class="col-md-6">
- <div class="block-left">
- <nav class="navbar navbar-default" role="navigation">
- <div class="container-fluid">
- <!-- 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>
- <div class="nav-logo">
- <a href="#"><img src="img/CPA.png" alt="logo" height = "100" width = "150"> </a>
- </div>
- </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 class="active"><a href="/CPA"><big><p>Home </big></p><span class="sr-only">(current)</span></a></li>
- <li><a href="https://coderdojo.com/"target="_blank"><big><p>CoderDojo</big></p></a></li>
- <li><a href="http://kata.coderdojo.com/wiki/Main_Page" target="_blank"><p> <big>Kata</big></p></a></li>
- <li><a href="log.html"><big><p>Log In</big></p></a></li>
- </ul>
- </div><!-- /.navbar-collapse -->
- </div><!-- /.container-fluid -->
- </nav>
- </div>
- </div><!-- .col-md-6 -->
- <!-- <div class="col-md-6">
- <div class="block-right">
- <div class="contact-area">
- <ul> -->
- <!-- <li><i class="fa fa-phone-square"></i>800-123-456</li> -->
- <!-- <li>Need help? Contact: <i class="fa fa-envelope-o"></i>leaveyr@tcd.ie</li>
- </ul>
- </div>
- </div>
- </div> --><!-- .col-md-6 close -->
- </div><!-- .row close -->
- </div><!-- .container close -->
- </section><!-- #heder close -->
- <section class="container">
- <div class="register">
- <h1>Register</h1>
- <form method="post" action="register.php">
- <input type = "hidden" name="submitted" value="true" />
- <!-- <p>Username: </br>
- <input id="field_username" title="Username must not be blank and contain only letters, numbers and underscores." type="text" required pattern="\w+" name="username">
- </p> -->
- <fieldset>
- <label> Your Name: </br>
- <input type="text" name="champ_name"/>
- </label>
- <label> Dojo Name: </br>
- <input type="text" name="dojo_name"/>
- </label>
- <label> Email: </br>
- <input type="email" name="c_email">
- </label>
- <label> Dojo's Address: </br>
- <input type="text" name="dojo_add"/>
- </label>
- <label> Password: </br>
- <input type="password" name="c_pword"/>
- </label>
- <!-- <label> Email: </br>
- <input id="email" title="Please enter a valid email." type="text" name="c_email">
- </label> -->
- <!-- <p>Password: </br>
- <input id="field_pwd1" title="Password must contain at least 6 characters, including UPPER/lowercase and numbers." type="password" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}" name="pwd1" name="champ_pword"></p> -->
- <!-- <p>Confirm Password: </br>
- <input id="field_pwd2" title="Please enter the same Password as above." type="password" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}" name="pwd2" name="champ_pword">
- </p> -->
- <!-- <p>Address: </br>
- <input id="address" title="Please enter your address" type="text" name="address">
- </p>
- <p>Dojo Name: </br>
- <input id="field_dojoName" title="Please enter the name of your Dojo" type="text" name="dojoName">
- </p> -->
- </fieldset>
- <!-- <p>
- <input type = "submit" name="submitted" value="REGISTER!" >
- </p> -->
- <button type="button" class="btn btn-primary" > <input type="submit" value="Register!"/> </button>
- <!-- <button type="button" class="btn btn-primary" > <input type="submit" value="REGISTER!"/> </button> -->
- </form>
- <?php
- echo $newrecord
- ?>
- </div>
- <div class="register-help">
- <p>Already a member? <a href="log.html">Click here to login!</a>.</p>
- </div>
- </section>
- <script type="text/javascript">
- document.addEventListener("DOMContentLoaded", function() {
- // JavaScript form validation
- var checkPassword = function(str)
- {
- var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}$/;
- return re.test(str);
- };
- var checkForm = function(e)
- {
- if(this.username.value == "") {
- alert("Error: Username cannot be blank!");
- this.username.focus();
- e.preventDefault(); // equivalent to return false
- return;
- }
- re = /^\w+$/;
- if(!re.test(this.username.value)) {
- alert("Error: Username must contain only letters, numbers and underscores!");
- this.username.focus();
- e.preventDefault();
- return;
- }
- if(this.pwd1.value != "" && this.pwd1.value == this.pwd2.value) {
- if(!checkPassword(this.pwd1.value)) {
- alert("The password you have entered is not valid!");
- this.pwd1.focus();
- e.preventDefault();
- return;
- }
- } else {
- alert("Error: Please check that you've entered and confirmed your password!");
- this.pwd1.focus();
- e.preventDefault();
- return;
- }
- alert("Both username and password are VALID!");
- };
- var myForm = document.getElementById("myForm");
- myForm.addEventListener("submit", checkForm, true);
- // HTML5 form validation
- var supports_input_validity = function()
- {
- var i = document.createElement("input");
- return "setCustomValidity" in i;
- }
- if(supports_input_validity()) {
- var usernameInput = document.getElementById("field_username");
- usernameInput.setCustomValidity(usernameInput.title);
- var pwd1Input = document.getElementById("field_pwd1");
- pwd1Input.setCustomValidity(pwd1Input.title);
- var pwd2Input = document.getElementById("field_pwd2");
- // var email = document.getElementById("email");
- // email.setCustomValidity(email.title);
- // input key handlers
- usernameInput.addEventListener("keyup", function() {
- usernameInput.setCustomValidity(this.validity.patternMismatch ? usernameInput.title : "");
- }, false);
- pwd1Input.addEventListener("keyup", function() {
- this.setCustomValidity(this.validity.patternMismatch ? pwd1Input.title : "");
- if(this.checkValidity()) {
- pwd2Input.pattern = this.value;
- pwd2Input.setCustomValidity(pwd2Input.title);
- } else {
- pwd2Input.pattern = this.pattern;
- pwd2Input.setCustomValidity("");
- }
- }, false);
- pwd2Input.addEventListener("keyup", function() {
- this.setCustomValidity(this.validity.patternMismatch ? pwd2Input.title : "");
- }, false);
- }
- }, false);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement