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!";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement