diff --git a/.DS_Store b/.DS_Store index e91ae6b..a71ff80 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/booking.html b/booking.html deleted file mode 100644 index 1be4d9c..0000000 --- a/booking.html +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - Booking - - - - - - - - - - - - - - - - - -
- - -
- - -
- -
- - - - - - - - - \ No newline at end of file diff --git a/booking.php b/booking.php index 1c1d317..9ea3e9e 100644 --- a/booking.php +++ b/booking.php @@ -1,34 +1,78 @@ prepare("INSERT INTO booking (date, time, text) VALUES (?,?,?)"); - - // Bind the form values to the prepared statement - // The "sss" means all three parameters (date, time, and text) are strings - $query->bind_param("sss", $formatted_date, $user_time, $user_text); - - // Execute the query and check if it was successful + $query = $conn->prepare("INSERT INTO Booking (UserID, DateOfShoot, TimeOfShoot, TypeOfShoot, Message) VALUES (?, ?, ?, 'Portrait', ?)"); // TODO fix user id session + $query->bind_param("isss", $user_id,$formatted_date, $user_time, $user_text); + if ($query->execute()) { - // If the query is successful, output a success message - echo "added date: " . $formatted_date . " successfully"; + echo ""; } else { - // If there's an error with the query execution, output the error message - echo "error: " . $query->error; + echo ""; + } -} + $query->close(); -// Close the prepared query after execution to free up resources -$query->close(); +} +include ("header.php"); ?> + +
+ +
+ + + diff --git a/connection.php b/connection.php deleted file mode 100644 index d5e9934..0000000 --- a/connection.php +++ /dev/null @@ -1,14 +0,0 @@ - 0) { - die("No Connection " . mysqli_connect_errno()); - } - -?> \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..d0a573a --- /dev/null +++ b/footer.php @@ -0,0 +1,50 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..4a5655c --- /dev/null +++ b/header.php @@ -0,0 +1,74 @@ + + + + + + + +Home + + + + + + + + + + + + + + + + + +
+ + +
\ No newline at end of file diff --git a/index.html b/index.php similarity index 65% rename from index.html rename to index.php index 25f3a36..b931f33 100644 --- a/index.html +++ b/index.php @@ -1,66 +1,8 @@ - - + - - - Home - - - - - - - - - - - - - - - -
- - -
+?>
@@ -241,53 +183,6 @@

Contact By

- - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/justfooterandnav.html b/justfooterandnav.html deleted file mode 100644 index bb6dc76..0000000 --- a/justfooterandnav.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - - - Home - - - - - - - - - - - - - - - - -
- -
- -
- - -

Hoşgeldiniz, !

- -

Email:

-
- - - - - - - - \ No newline at end of file diff --git a/justfooterandnav.php b/justfooterandnav.php new file mode 100644 index 0000000..916de50 --- /dev/null +++ b/justfooterandnav.php @@ -0,0 +1,118 @@ + + + + + + + + + + Home + + + + + + + + + + + + + + + + + + +
+ +
+ + +
+ +

Welcome, !

+

Email:

+ +

Welcome, Guest!

+

Please log in to view your account.

+

Welcome, !

+ +
+ + + + + + + + + + + diff --git a/login.html b/login.php similarity index 87% rename from login.html rename to login.php index d6ed0a4..a72c341 100644 --- a/login.html +++ b/login.php @@ -1,3 +1,39 @@ +prepare("SELECT Username, Email, Passcode FROM Users WHERE Email = ?"); + $query->bind_param("s", $email); + $query->execute(); + $result = $query->get_result(); + + if ($result->num_rows === 1) { + $user = $result->fetch_assoc(); + if (password_verify($password, $user['Passcode'])) { + $_SESSION['Username'] = $user['Username']; + $_SESSION['Email'] = $user['Email']; + $_SESSION['UserID'] = $user['UserID']; + header("Location: justfooterandnav.php"); + } else { + echo "wrong passcode!"; + } + } else { + echo "cannot find user."; + } + + $query->close(); + $conn->close(); +} +?> + + + + + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..60ffaea --- /dev/null +++ b/logout.php @@ -0,0 +1,8 @@ + \ No newline at end of file diff --git a/signin.html b/signin.html index ce4207b..f16fcef 100644 --- a/signin.html +++ b/signin.html @@ -1,4 +1,10 @@ + + + + + + diff --git a/signin.php b/signin.php index ead3465..8cd59bc 100644 --- a/signin.php +++ b/signin.php @@ -1,35 +1,47 @@ prepare( "INSERT INTO signin (name, email, password) VALUES (?,?,?)"); - - // Bind the form data (name, email, and hashed password) to the SQL query placeholders - // The 'sss' parameter means all three values are strings - $query->bind_param("sss", $user_name, $user_email, $hashed_password); - - // Attempt to execute the query and check if it was successful - if ($query->execute()) { - // If the query is successful, display a success message - echo "added successfully"; - } else { - // If there's an error executing the query, display the error message - echo "error: " . $query->error; - } + // collect the data + $user_name = trim($_POST['userName']); + $user_email = trim($_POST['email']); + $user_password = $_POST['password']; + + + // if it s not empty + if (!empty($user_name) && !empty($user_email) && !empty($user_password)) { + // password hash + $hashed_password = password_hash($user_password, PASSWORD_DEFAULT); + echo $hashed_password; + // query + $query = "INSERT INTO Users (Username,Email, Passcode, ProfileImg) VALUES (?, ?, ?,?)"; + + if ($stmt = mysqli_prepare($conn, $query)) { + + mysqli_stmt_bind_param($stmt, "sss", $user_name, $user_email, $hashed_password); + + // run the query + if (mysqli_stmt_execute($stmt)) { + // direct to + header("Location: login.html"); + exit; + } else { + // write error + echo "something went wrong on query: " . mysqli_error($conn); + } + + // closing query + mysqli_stmt_close($stmt); + } else { + echo "something went wrong: " . mysqli_error($conn); + } + } else { + echo "fill up all area."; + } } -// Close the prepared query after execution to free up resources -$query->close(); - +// turn off conn +mysqli_close($conn); ?> +