Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch 3 #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 37 additions & 23 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
{
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
"-Wall",
"-Wextra",
"-Wpedantic"
],
"compilerPath": "gcc"
}
],
"version": 4
"configurations": [
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "${default}",
"cppStandard": "${default}",
"intelliSenseMode": "windows-gcc-x64",
"compilerArgs": [
"-Wall",
"-Wextra",
"-Wpedantic"
],
"compilerPath": "gcc"
},
{
"name": "windows-gcc-x64",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "windows-msvc-x64"
}
],
"version": 4
}
2 changes: 1 addition & 1 deletion Home.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<div id="wrapper">

<!-----------------Header & Navigation Bar----------------->
<!-----------------Header & Navigation Bar----------------->b

<?php include('header.php');
///////////////////////Display reviews///////////////////////
Expand Down
1 change: 1 addition & 0 deletions admin/disp.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$_SESSION =''
?>
<!doctype html>

<html>
<body>
<h1 align="center">Employee Details</h1>
Expand Down
2 changes: 1 addition & 1 deletion contactus.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div id="wrapper">

<!-----------------Header & Navigation Bar----------------->

//include te main code file
<?php
include('header.php');
?>
Expand Down
182 changes: 94 additions & 88 deletions header.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<li><a href="myprofile.php">My Profile</a></li>
</ul>
</div>

c
<?php
require ('db.php');
session_start();
Expand All @@ -24,8 +24,8 @@
/////////////////////////////Variables to store data/////////////////////////////
$MESSAGE_LOGIN = '';
$PRODUCT_ID = '';
/////////////////////////////Login/////////////////////////////
if (isset($_POST['login'])) {
/////////////////////////////Login user/////////////////////////////
///
if (!isset($_POST['username']) || !isset($_POST['password'])) {
$MESSAGE_LOGIN = "Username or Password Empty";
} //!isset($_POST['username']) || !isset($_POST['password'])
Expand Down Expand Up @@ -92,92 +92,98 @@
require('db.php');
/////////////////////////////Variables to store data/////////////////////////////
$MESSAGE_REGISTER = '';
/////////////////////////////Regster/////////////////////////////
if (isset($_POST["register"])) {
$USERNAME = $_POST['username'];
$USERNAME = mysqli_real_escape_string($con, $USERNAME);
$FIRST_NAME = stripslashes($_POST['firstname']);
$FIRST_NAME = mysqli_real_escape_string($con, $FIRST_NAME);
$LAST_NAME = stripslashes($_POST['lastname']);
$LAST_NAME = mysqli_real_escape_string($con, $LAST_NAME);
$E_MAIL = stripslashes($_POST['email']);
$E_MAIL = mysqli_real_escape_string($con, $E_MAIL);
$PHONE_NUMBER = stripslashes($_POST['phonenumber']);
$PHONE_NUMBER = mysqli_real_escape_string($con, $PHONE_NUMBER);
$PASSWORD = stripslashes($_POST['password']);
$PASSWORD = mysqli_real_escape_string($con, $PASSWORD);
$RE_TYPE_PASSWORD = stripslashes($_POST['retypepassword']);
$RE_TYPE_PASSWORD = mysqli_real_escape_string($con, $RE_TYPE_PASSWORD);
$SECURITY_QUESTION = stripslashes($_POST['securityquestion']);
$SECURITY_QUESTION = mysqli_real_escape_string($con, $SECURITY_QUESTION);
$SECURITY_ANSWER = stripslashes($_POST['securityanswer']);
$SECURITY_ANSWER = mysqli_real_escape_string($con, $SECURITY_ANSWER);
$select_user = "SELECT * FROM tblusers WHERE Username='$USERNAME' OR EmailAddress='$E_MAIL' LIMIT 1";
$result_select_user = mysqli_query($con, $select_user);
$USER = mysqli_fetch_assoc($result_select_user);
// if user exists
if ($USER) {
if ($USER['Username'] = $USERNAME) {
$MESSAGE_REGISTER = "OOPS! Username Is Already Taken!";
} //$USER['Username'] = $USERNAME
if ($USER['EmailAddress'] = $E_MAIL) {
$MESSAGE_REGISTER = "OOPS! Email Is Already Taken";
} //$USER['EmailAddress'] = $E_MAIL
} //$USER
// if fields are filled
else if (!isset($USERNAME) || !isset($FIRST_NAME) || !isset($LAST_NAME) || !isset($E_MAIL) || !isset($PHONE_NUMBER) || !isset($PASSWORD) || !isset($RE_TYPE_PASSWORD)) {
$MESSAGE_REGISTER = "OOPS! Fill Mandatory Fields!";
} //!isset($USERNAME) || !isset($FIRST_NAME) || !isset($LAST_NAME) || !isset($E_MAIL) || !isset($PHONE_NUMBER) || !isset($PASSWORD) || !isset($RE_TYPE_PASSWORD)
// if password matches
else if ($PASSWORD != $RE_TYPE_PASSWORD) {
$MESSAGE_REGISTER = "Password doesnt match!";
} //$PASSWORD != $RE_TYPE_PASSWORD
else if (strlen($PASSWORD) < '8') {
$MESSAGE_REGISTER= "Password Must Contain At Least 8 Characters!";
}
else if (!filter_var($E_MAIL, FILTER_VALIDATE_EMAIL)) {
$MESSAGE_REGISTER = "Invalid Email";
}

// enter user to database
else {
$insert_user = "INSERT INTO `tblusers`(`Username`, `FirstName`, `LastName`, `EmailAddress`, `PhoneNumber`, `Password`, `SecurityQuestion`, `SecurityAnswer`) VALUES ('$USERNAME','$FIRST_NAME','$LAST_NAME','$E_MAIL','$PHONE_NUMBER','" . md5($PASSWORD) . "','$SECURITY_QUESTION','$SECURITY_ANSWER')";
$result_insert_user = mysqli_query($con, $insert_user);
if ($result_insert_user) {
$MESSAGE_REGISTER = "successful";
} //$result_insert_user
else {
$MESSAGE_REGISTER = "Registration unsuccessful!";
}
}
mysqli_close($con); // Closing connection
} //isset($_POST["register"])
?>
/////////////////////////////Regster/////////////////////////////
if (isset($_POST["register"])) {
$USERNAME = $_POST['username'];
$USERNAME = mysqli_real_escape_string($con, $USERNAME);
$FIRST_NAME = stripslashes($_POST['firstname']);
$FIRST_NAME = mysqli_real_escape_string($con, $FIRST_NAME);
$LAST_NAME = stripslashes($_POST['lastname']);
$LAST_NAME = mysqli_real_escape_string($con, $LAST_NAME);
$E_MAIL = stripslashes($_POST['email']);
$E_MAIL = mysqli_real_escape_string($con, $E_MAIL);
$PHONE_NUMBER = stripslashes($_POST['phonenumber']);
$PHONE_NUMBER = mysqli_real_escape_string($con, $PHONE_NUMBER);
$PASSWORD = stripslashes($_POST['password']);
$PASSWORD = mysqli_real_escape_string($con, $PASSWORD);
$RE_TYPE_PASSWORD = stripslashes($_POST['retypepassword']);
$RE_TYPE_PASSWORD = mysqli_real_escape_string($con, $RE_TYPE_PASSWORD);
$SECURITY_QUESTION = stripslashes($_POST['securityquestion']);
$SECURITY_QUESTION = mysqli_real_escape_string($con, $SECURITY_QUESTION);
$SECURITY_ANSWER = stripslashes($_POST['securityanswer']);
$SECURITY_ANSWER = mysqli_real_escape_string($con, $SECURITY_ANSWER);
$select_user = "SELECT * FROM tblusers WHERE Username='$USERNAME' OR EmailAddress='$E_MAIL' LIMIT 1";
$result_select_user = mysqli_query($con, $select_user);
$USER = mysqli_fetch_assoc($result_select_user);
// if user exists
// check the stetment before run the fkg code
if ($USER) {
if ($USER['Username'] = $USERNAME) {
$MESSAGE_REGISTER = " Username Is Already Taken!";
} //$USER['Username'] = $USERNAME
if ($USER['EmailAddress'] = $E_MAIL) {
$MESSAGE_REGISTER = " Email Is Already Taken";
} //$USER['EmailAddress'] = $E_MAIL
} //$USER
// if fields are filled M
else if (!empty($USERNAME) || !empty($FIRST_NAME) || !empty($LAST_NAME) || !empty($E_MAIL) || !empty($PHONE_NUMBER) || !empty($PASSWORD) || !empty($RE_TYPE_PASSWORD)) {
$MESSAGE_REGISTER = "please Fill Mandatory Fields!";
} //!isset($USERNAME) || !isset($FIRST_NAME) || !isset($LAST_NAME) || !isset($E_MAIL) || !isset($PHONE_NUMBER) || !isset($PASSWORD) || !isset($RE_TYPE_PASSWORD)
// if password matches
else if ($PASSWORD != $RE_TYPE_PASSWORD) {
$MESSAGE_REGISTER = "Password doesnt match!";
} //$PASSWORD != $RE_TYPE_PASSWORD
else if (strlen($PASSWORD) < '8') {
$MESSAGE_REGISTER= "Password Must Contain At Least 8 Characters!";
}
else if (!filter_var($E_MAIL, FILTER_VALIDATE_EMAIL)) {
$MESSAGE_REGISTER = "please use a valid Email";
}

// enter user to database
else {
$insert_user= "INSERT INTO `tblusers`(`Username`, `FirstName`, `LastName`,
`EmailAddress`, `PhoneNumber`, `Password`, `SecurityQuestion`, `SecurityAnswer`) VALUES ('$USERNAME','$FIRST_NAME','$LAST_NAME','$E_MAIL','$PHONE_NUMBER','" . md5($PASSWORD) . "','$SECURITY_QUESTION','$SECURITY_ANSWER')";
$result_insert_user = mysqli_query($con, $insert_user);
if ($result_insert_user) {
$MESSAGE_REGISTER = "successful";
} //$result_insert_user
else {
$MESSAGE_REGISTER = "Registration unsuccessful!";
}
}
mysqli_close($con); // Closing connection
} //isset($_POST["register"])
// close the register sta
?>


<?php

///////View Products page and selct the products .php//

require('db.php');
////////Add products to cart//////
$MESSAGE_REVIEW = '';
if (isset($_POST['addtocart'])) {
if (!isset($_SESSION['username'])) {
$_SESSION['selectedproduct'] = $_POST['productid'];
$_SESSION['selectedquantity'] = $_POST['quantity'];
$_SESSION['crumbs'] = "1";
header("location: login.php");
} //!isset($_SESSION['username'])
else {
$PRODUCT_ID = $_POST['productid'];
$PRODUCT_QUANTITY = $_POST['quantity'];
$USERNAME = $_SESSION['username'];
$v_insert_to_cart = "INSERT into`tblcart` (ProductID, Username, Quantity) VALUES ('" . $PRODUCT_ID . "','" . $USERNAME . "','" . $PRODUCT_QUANTITY . "')";
$result_v_insert_to_cart = mysqli_query($con, $v_insert_to_cart);
header('location: cart.php');
}
} //isset($_POST['addtocart']) j



<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////View Products page related .php////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////
require('db.php');
///////////////////////Add products to cart///////////////////////
$MESSAGE_REVIEW = '';
if (isset($_POST['addtocart'])) {
if (!isset($_SESSION['username'])) {
$_SESSION['selectedproduct'] = $_POST['productid'];
$_SESSION['selectedquantity'] = $_POST['quantity'];
$_SESSION['crumbs'] = "1";
header("location: login.php");
} //!isset($_SESSION['username'])
else {
$PRODUCT_ID = $_POST['productid'];
$PRODUCT_QUANTITY = $_POST['quantity'];
$USERNAME = $_SESSION['username'];
$v_insert_to_cart = "INSERT into`tblcart` (ProductID, Username, Quantity) VALUES ('" . $PRODUCT_ID . "','" . $USERNAME . "','" . $PRODUCT_QUANTITY . "')";
$result_v_insert_to_cart = mysqli_query($con, $v_insert_to_cart);
header('location: cart.php');
}
} //isset($_POST['addtocart'])
///////////////////////Add a review///////////////////////
if (isset($_POST['addreview'])) {
if (!isset($_POST['productid']) || !isset($_POST['review'])) {
$MESSAGE_REVIEW = "Unable to Place Review!";
Expand Down
2 changes: 1 addition & 1 deletion ordersuccessful.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
b <!DOCTYPE html>
<html>
<head>
<title>Explorer Style</title>
Expand Down
Binary file removed ~$web-84.docx
Binary file not shown.