forked from mtdagar/TravelBuddy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactions.php
More file actions
26 lines (23 loc) · 719 Bytes
/
actions.php
File metadata and controls
26 lines (23 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
require_once("conn.php");
if(isset($_POST['save'])){
$fname=$_POST['fname'];
$lname =$_POST['lname'];
$email=$_POST['email'];
$password=$_POST['password'];
$hash = password_hash($password, PASSWORD_DEFAULT);
if($fname=="" || $lname=="" || $email=="" || $password==""){
$_SESSION[error][msg] = "ALL FIELDS ARE REQUIRED";
header("Location:register.php");
}
else{
$sql=$conn->prepare("INSERT INTO users(fname, lname, email, password) VALUES (:fname, :lname, :email, :password)");
$sql->bindParam('fname', $fname);
$sql->bindParam('lname', $lname);
$sql->bindParam('email', $email);
$sql->bindParam('password', $hash);
$sql->execute();
header("Location:index.php");
}
}
?>