-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsignup-form.php
More file actions
50 lines (39 loc) · 1.28 KB
/
Copy pathsignup-form.php
File metadata and controls
50 lines (39 loc) · 1.28 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
if(isset($_GET['sign-up'])){
$firstName = $_GET['firstName'];
$lastName = $_GET['lastName'];
$userName = $_GET['userName'];
$password = $_GET['password'];
$Credit = $_GET['creditCard'];
$Address = $_GET['address'];
try {
$connection = new PDO("mysql:host=localhost;dbname=security", "root", "rewind95591");
// set the PDO error mode to exception
$connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/*
$query = "SELECT * FROM customer";
$query .=" WHERE Username = '" . $userName ."'";
$result = $connection ->prepare($query);
$result->execute();
$result = $result->fetchAll();
if(count($result) < 0){
echo "$userName already exist";
header( "Refresh:1; url=Index.php", true, 303);
}
else{*/
$sql = " INSERT INTO customer (First_Name,Last_Name,Username,Password,Credit_Card, Address) ";
$sql .= " VALUES ('$firstName', '$lastName', '$userName', '$password', '$Credit', '$Address')";
$connection->exec($sql);
header( "Refresh:1; url=Index.php", true, 303);
//}
}
catch(PDOException $e)
{
echo $e->getMessage();
}
$connection = null;
}
else if(isset($_GET['btn-login'])){
header('Location: Index.php');
}
?>