Fixed the registration.

This commit is contained in:
Batuhan Berk Başoğlu 2024-06-08 16:35:17 -04:00
parent 4551398c05
commit 1897a3eaad
5 changed files with 16 additions and 66 deletions

2
.gitattributes vendored Normal file
View file

@ -0,0 +1,2 @@
* linguist-vendored
*.php linguist-vendored=false

6
README.md vendored
View file

@ -2,7 +2,7 @@
A cool shopping site made using PHP, CSS, Javascript and MySQL. A cool shopping site made using PHP, CSS, Javascript and MySQL.
Note: Adding and Removing items to Carts/Wishlist and Registration needs be fixed. Note: Adding and Removing items to Carts/Wishlist needs to be fixed.
# Installation # Installation
@ -31,11 +31,11 @@ Note: Adding and Removing items to Carts/Wishlist and Registration needs be fixe
Here are some existing users for login Here are some existing users for login
* Admin: * Admin:
* E-Mail: admin@gmail.com * E-Mail: admin@domain.com
* Password: 123456789 * Password: 123456789
* User 1: * User 1:
* E-Mail: sample@gmail.com * E-Mail: user@domain.com
* Password: password * Password: password
# Mirrors # Mirrors

View file

@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Host: localhost -- Host: localhost
-- Generation Time: May 16, 2024 at 05:54 AM -- Generation Time: Jun 08, 2024 at 10:33 PM
-- Server version: 10.4.32-MariaDB -- Server version: 10.4.32-MariaDB
-- PHP Version: 8.1.25 -- PHP Version: 8.1.25
@ -47,7 +47,7 @@ CREATE TABLE `admin_info` (
-- --
INSERT INTO `admin_info` (`admin_id`, `admin_name`, `admin_email`, `admin_password`) VALUES INSERT INTO `admin_info` (`admin_id`, `admin_name`, `admin_email`, `admin_password`) VALUES
(1, 'admin', 'admin@gmail.com', '25f9e794323b453885f5181f1b624d0b'); (1, 'admin', 'admin@domain.com', '25f9e794323b453885f5181f1b624d0b');
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -358,7 +358,7 @@ CREATE TABLE `user_info` (
-- --
INSERT INTO `user_info` (`user_id`, `first_name`, `last_name`, `email`, `password`, `mobile`, `address1`, `address2`) VALUES INSERT INTO `user_info` (`user_id`, `first_name`, `last_name`, `email`, `password`, `mobile`, `address1`, `address2`) VALUES
(25, 'John', 'Doe', 'sample@gmail.com', 'password', '1234567890', 'Montreal', ''); (1, 'John', 'Doe', 'user@domain.com', 'password', '1234567890', 'Montreal', '');
-- --
-- Triggers `user_info` -- Triggers `user_info`
@ -392,7 +392,7 @@ CREATE TABLE `user_info_backup` (
-- --
INSERT INTO `user_info_backup` (`user_id`, `first_name`, `last_name`, `email`, `password`, `mobile`, `address1`, `address2`) VALUES INSERT INTO `user_info_backup` (`user_id`, `first_name`, `last_name`, `email`, `password`, `mobile`, `address1`, `address2`) VALUES
(25, 'John', 'Doe', 'sample@gmail.com', 'password', '1234567890', 'Montreal', ''); (1, 'John', 'Doe', 'user@domain.com', 'password', '1234567890', 'Montreal', '');
-- -------------------------------------------------------- -- --------------------------------------------------------

View file

@ -138,7 +138,7 @@ session_start();
echo ' echo '
<div class="dropdownn"> <div class="dropdownn">
<a href="#" class="dropdownn" data-toggle="modal" data-target="#myModal" ><i class="fa fa-user-o"></i> HI '.$row["first_name"].'</a> <a href="#" class="dropdownn" data-toggle="modal" data-target="#myModal" ><i class="fa fa-user-o"></i> Hi '.$row["first_name"].'</a>
<div class="dropdownn-content"> <div class="dropdownn-content">
<a href="myorders.php" ><i class="fa fa-shopping-basket" aria-hidden="true"></i>My Order</a> <a href="myorders.php" ><i class="fa fa-shopping-basket" aria-hidden="true"></i>My Order</a>
<a href="" data-toggle="modal" data-target="#profile"><i class="fa fa-user-circle" aria-hidden="true" ></i>My Profile</a> <a href="" data-toggle="modal" data-target="#profile"><i class="fa fa-user-circle" aria-hidden="true" ></i>My Profile</a>

View file

@ -109,11 +109,14 @@ if(empty($f_name) || empty($l_name) || empty($email) || empty($password) || empt
"; ";
exit(); exit();
} else { } else {
$db_sql = "SELECT * FROM user_info";
$db_query = mysqli_query($con, $db_sql);
$count_db = mysqli_num_rows($db_query);
$sql = "INSERT INTO `user_info` $sql = "INSERT INTO `user_info`
(`user_id`, `first_name`, `last_name`, `email`, (`user_id`, `first_name`, `last_name`, `email`,
`password`, `mobile`, `address1`, `address2`) `password`, `mobile`, `address1`, `address2`)
VALUES (NULL, '$f_name', '$l_name', '$email', VALUES ($count_db + 1, '$f_name', '$l_name', '$email',
'$password', '$mobile', '$address1', '$address2')"; '$password', '$mobile', '$address1', '$address2')";
$run_query = mysqli_query($con,$sql); $run_query = mysqli_query($con,$sql);
$_SESSION["uid"] = mysqli_insert_id($con); $_SESSION["uid"] = mysqli_insert_id($con);
@ -131,59 +134,4 @@ if(empty($f_name) || empty($l_name) || empty($email) || empty($password) || empt
} }
?>
?>