Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <? php
- session_start();
- if( isset($_SESSION['user'])!="" ){
- header("Location: profile.php");
- }
- include_once 'connect.php';
- if ( isset($_POST['sca']) ) {
- $username = trim($_POST['username']);
- $fname = trim($_POST['fname']);
- $lname = trim($_POST['lname']);
- $pass = trim($_POST['password']);
- $password = hash('sha256', $pass);
- $query = "insert into people(username,fname,lname,password)
- values(?, ?, ?, ?)";
- $stmt = $pdo->prepare($query);
- $stmt->execute([$username,$fname,$lname,$password]);
- $rowsAdded = $stmt->rowCount();
- if ($rowsAdded == 1) {
- $message = "Success! Go Log in now Buddy!";
- unset($fname);
- unset($lname);
- unset($pass);
- header("Location: login.php");
- }
- else
- {
- $message = "Failed! Try again Buddy!";
- }
- }
- ?>
- <html>
- <head>
- <title>Joseph Cook: Net300</title>
- <meta charset="utf-8" />
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <style type="text/css">
- h1 {color:orange;}
- body {
- background-color: #f0f0f2;
- margin: 0;
- padding: 0;
- font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
- }
- div {
- width: 600px;
- margin: 5em auto;
- padding: 50px;
- background-color: #fff;
- border-radius: 1em;
- }
- a:link, a:visited {
- color: #38488f;
- text-decoration: none;
- }
- @media (max-width: 700px) {
- body {
- background-color: #fff;
- }
- div {
- width: auto;
- margin: 0 auto;
- border-radius: 0;
- padding: 1em;
- }
- }
- </style>
- </head>
- <script>
- function Validate() {
- var w = document.forms["accountcreate"]["username"].value;
- if (w == "") {
- alert("Please choose a username");
- return false;
- }
- var x = document.forms["accountcreate"]["fname"].value;
- if (x == "") {
- alert ("Please provide your First Name");
- return false;
- }
- var y = document.forms["accountcreate"]["lname"].value;
- if (y == "") {
- alert ("Please provide your Last Name");
- return false;
- }
- var p = document.forms["accountcreate"]["password"].value;
- if (p == "") {
- alert ("Please provide your password");
- return false;
- }
- plength = p.length;
- if (plength < 10) {
- alert("Please ensure your password is at least 10 characters long")
- return false;
- }
- }
- </script>
- </head>
- <body>
- <div>
- <h1>Create Account</h1>
- <br />
- <form action="register3.php" method="post" name="accountcreate" onsubmit="return Validate()">
- Username: <input type="text" name="username"><br />
- First Name: <input type="text" name="fname"><br />
- Last Name: <input type="text" name="lname"><br />
- Password: <input type="password" name="password"><br />
- <input type="submit" Value="Sign Up" />
- </form>
- <p><a href="forgot.php">Forgot your password? Click here to reset your password</a></p>
- <p><a href="login.php">Return to Home Page</a></p>
- <img src="kmack.jpg" alt="khalil mack" height="100" width="100">
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement