SHARE
TWEET

Untitled

a guest Oct 9th, 2019 177 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. <? php
  4. session_start();
  5. if( isset($_SESSION['user'])!="" ){
  6.  header("Location: profile.php");
  7. }
  8. include_once 'connect.php';
  9.  
  10. if ( isset($_POST['sca']) ) {
  11.  $username = trim($_POST['username']);
  12.  $fname = trim($_POST['fname']);
  13.  $lname = trim($_POST['lname']);
  14.  $pass = trim($_POST['password']);
  15.  $password = hash('sha256', $pass);
  16.  
  17.  
  18.  $query = "insert into people(username,fname,lname,password)
  19. values(?, ?, ?, ?)";
  20.  $stmt = $pdo->prepare($query);
  21.  $stmt->execute([$username,$fname,$lname,$password]);
  22.  $rowsAdded = $stmt->rowCount();
  23.  
  24.   if ($rowsAdded == 1) {
  25.    $message = "Success! Go Log in now Buddy!";
  26.    unset($fname);
  27.    unset($lname);
  28.    unset($pass);
  29.    header("Location: login.php");
  30.   }
  31.  else
  32.  {
  33.   $message = "Failed! Try again Buddy!";
  34.  }
  35. }
  36. ?>
  37.  
  38.  
  39. <html>
  40. <head>
  41.     <title>Joseph Cook: Net300</title>
  42.  
  43.     <meta charset="utf-8" />
  44.     <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
  45.     <meta name="viewport" content="width=device-width, initial-scale=1" />
  46.         <style type="text/css">
  47.         h1 {color:orange;}
  48.     body {
  49.         background-color: #f0f0f2;
  50.         margin: 0;
  51.         padding: 0;
  52.         font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  53.        
  54.     }
  55.     div {
  56.         width: 600px;
  57.         margin: 5em auto;
  58.         padding: 50px;
  59.         background-color: #fff;
  60.         border-radius: 1em;
  61.     }
  62.     a:link, a:visited {
  63.         color: #38488f;
  64.         text-decoration: none;
  65.     }
  66.     @media (max-width: 700px) {
  67.         body {
  68.             background-color: #fff;
  69.         }
  70.         div {
  71.             width: auto;
  72.             margin: 0 auto;
  73.             border-radius: 0;
  74.             padding: 1em;
  75.         }
  76.     }
  77.     </style>   
  78.    </head>
  79.  
  80.     <script>
  81.     function Validate() {
  82.         var w = document.forms["accountcreate"]["username"].value;
  83.         if (w == "") {
  84.             alert("Please choose a username");
  85.             return false;
  86.         }
  87.    
  88.         var x = document.forms["accountcreate"]["fname"].value;
  89.         if (x == "") {
  90.             alert ("Please provide your First Name");
  91.             return false;
  92.         }
  93.        
  94.         var y = document.forms["accountcreate"]["lname"].value;
  95.         if (y == "") {
  96.             alert ("Please provide your Last Name");
  97.             return false;
  98.         }
  99.        
  100.        
  101.         var p = document.forms["accountcreate"]["password"].value;
  102.         if (p == "") {
  103.             alert ("Please provide your password");
  104.             return false;
  105.         }
  106.          plength = p.length;
  107.         if (plength < 10) {
  108.             alert("Please ensure your password is at least 10 characters long")
  109.             return false;
  110.             }
  111.     }
  112.     </script>
  113. </head>
  114.  
  115. <body>
  116.     <div>
  117.         <h1>Create Account</h1>
  118.         <br />
  119.         <form action="register3.php" method="post" name="accountcreate"  onsubmit="return Validate()">
  120.             Username: <input type="text" name="username"><br />
  121.             First Name: <input type="text" name="fname"><br />
  122.             Last Name: <input type="text" name="lname"><br />
  123.             Password: <input type="password" name="password"><br />
  124.             <input type="submit" Value="Sign Up" />
  125.                 </form>
  126.                 <p><a href="forgot.php">Forgot your password? Click here to reset your password</a></p>
  127.                 <p><a href="login.php">Return to Home Page</a></p>
  128.                 <img src="kmack.jpg" alt="khalil mack" height="100" width="100">
  129.  
  130.     </div>
  131. </body>
  132. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top