-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_user.php
More file actions
24 lines (21 loc) · 958 Bytes
/
Copy pathadd_user.php
File metadata and controls
24 lines (21 loc) · 958 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
<?php
if (isset($_POST['register'])) {
$username = clear($_POST['username']);
$password = clear($_POST['password']);
$password = salt($password);
$email = clear($_POST['email']);
// name placeholder
//$sql = 'INSERT INTO users (username,password,email) VALUES (:username,:password,:email)';
$sql = 'INSERT INTO users SET username=:username,password=:password,email=:email';
$query = $db->prepare($sql);
$query->bindParam('username',$username,PDO::PARAM_STR); //bindparam vs pindvalue
$query->bindParam('password',$password,PDO::PARAM_STR);
$query->bindParam('email',$email,PDO::PARAM_STR);
$insert = $query->execute();
if ($insert == TRUE) {
$_SESSION['success'] = 'user has been added seccessfuly';
header('location:index.php');
}
}
require_once 'template/add_user.php';
?>