-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathregistration.php
More file actions
46 lines (36 loc) · 1.06 KB
/
registration.php
File metadata and controls
46 lines (36 loc) · 1.06 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
<?php
session_start();
if (empty($_SESSION['email'])) {
header('location:index.php');
} else {
$email = $_SESSION['email'];
$userpassword = $_SESSION['password'];
$servername = "localhost";
$username = "root";
$password = "PASSWORD";
$dbname = "fullcashback";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
echo "Connected successfully" . "<br>";
$sql = "INSERT INTO users (email, password)
VALUES ('$email', '$userpassword')";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully" . "<br>";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
//Close the connection
mysqli_close($conn);
setcookie("email", $_SESSION['email'], time() + (86400 * 30), "/");
setcookie("password", $_SESSION['password'], time() + (86400 * 30), "/");
//session_destroy();
//session_start();
//$_SESSION['loggedinemail'] = $email;
//echo $_SESSION['loggedinemail'];
header('location:home.php');
}
?>