Online store via PHP and MySQL

You will allow visitors to

register on your shopping website. The visitor will also be able to log in (and

stay logged in). You will update the Description page to make it dynamically

show the different items you have listed in your database (depending on which

item was clicked on from the Items page). Users will be allowed to update their

profile information & image. Users will also be able to post a review for

the items available on your website.                                                                                       

                                                                                                                 

Review the submission instructions before starting. View my

current Assign4 for more information: http://3.83.90.210/hawkins_assign4/


1.     

On the register.php,

allow a visitor to register with the website. Check if the username is already

in the database BEFORE allowing the user to register. Reminder: a customers record needs the date of when the user account

was created.


2.     

On the login.php,

when the user has entered in valid information, create a session. If the customer

did not enter a valid user_name & password, make sure to destroy the

session.


3.     

On the header.php,

update the random variable to find out if the user is logged in. If the user is

logged in, make sure to output the name of that user that is logged in.


4.     

Update all

website pages to start a session. Update the logged-in pages to see if the user is logged in & if the user

is not logged in, send the user to the index.php

page.


5.     

Create a logout.php

file. Redirect the user to the home page.


6.     

Update the nav.php

to show the link to let a user log out.

                                                                           

7.     

On the items.php,

add in each item’s Item_Id to the

link to the Description page in order for this information to be retrieved from

the URL.


8.     

On the description.php,

use the columns from the items table that outputs the information to the page

appropriately (ie: the Item_Name would go in the H3 for the “Generic Name”,

Item_Price would be output to the Price location on the page) – make sure that

you GET the Item_Id from the URL in order to show just the item you clicked on.

Use the Item_Id to dynamically change the contents of your description page,

pulling in information that you have stored in the database about each item. Remember the user reviews.

·        

You will need an image for each of the items

listed in your database. Resize each image to be appropriate in size.

·        

Suggestion:

store your item images in an itemImages

folder to keep your main folder organized.

·        

You will need a different query to SELECT the

user reviews for that item and display them on the page. If there are no

reviews for that item, ask the user if they’d like to leave one.

·        

If the user does provide a review, update the

reviews table with the review, the item, the user, and the time the review was

posted.

·        

Reminder:

sanitize any information you receive from a user.


9.     

On the profile.php,

get any information stored in the customers table for the user who is logged

in.

·        

Use this information to dynamically change the

contents of the profile page, pulling the information stored in the database

and modifying it to be appropriate for the web page.

·        

Users should be able to update & change

their profile image. Allow images formats of GIF, JPEG, or PNG. Rename the

filename of the image to be the user’s name & the appropriate extension.

For easier maintenance, store these images in a custImages folder.


$location =

"custImages/" . $UserName . $ext;


move_uploaded_file($_FILES["image"]["tmp_name"],

$location);

Users should be able to update only the parts of their profile they want. If one of the form fields is filled in, UPDATE the customers table for that user with the information they have submitted. Remember to sanitize each field and provide a date of when the user has last updated their information

Get Help With a similar task to - Online store via PHP and MySQL

Login to view and/or buy answers.. or post an answer
Additional Instructions:

Assignment4/Assign4 (3).docx IT 3132 – Web Programming Assignment 4 Assignments must be completed on your own. Any evidence that students have collaborated on assignments will be considered a violation of the academic honesty code. You will allow visitors to register on your shopping website. The visitor will also be able to log in (and stay logged in). You will update the Description page to make it dynamically show the different items you have listed in your database (depending on which item was clicked on from the Items page). Users will be allowed to update their profile information & image. Users will also be able to post a review for the items available on your website. Review the submission instructions before starting. View my current Assign4 for more information: http://3.83.90.210/hawkins_assign4/ 1. On the register.php, allow a visitor to register with the website. Check if the username is already in the database BEFORE allowing the user to register. Reminder: a customers record needs the date of when the user account was created. 2. On the login.php, when the user has entered in valid information, create a session. If the customer did not enter a valid user_name & password, make sure to destroy the session. 3. On the header.php, update the random variable to find out if the user is logged in. If the user is logged in, make sure to output the name of that user that is logged in. 4. Update all website pages to start a session. Update the logged-in pages to see if the user is logged in & if the user is not logged in, send the user to the index.php page. 5. Create a logout.php file. Redirect the user to the home page. 6. Update the nav.php to show the link to let a user log out. 7. On the items.php, add in each item’s Item_Id to the link to the Description page in order for this information to be retrieved from the URL. 8. On the description.php, use the columns from the items table that outputs the information to the page appropriately (ie: the Item_Name would go in the H3 for the “Generic Name”, Item_Price would be output to the Price location on the page) – make sure that you GET the Item_Id from the URL in order to show just the item you clicked on. Use the Item_Id to dynamically change the contents of your description page, pulling in information that you have stored in the database about each item. Remember the user reviews. · You will need an image for each of the items listed in your database. Resize each image to be appropriate in size. · Suggestion: store your item images in an itemImages folder to keep your main folder organized. · You will need a different query to SELECT the user reviews for that item and display them on the page. If there are no reviews for that item, ask the user if they’d like to leave one. · If the user does provide a review, update the reviews table with the review, the item, the user, and the time the review was posted. · Reminder: sanitize any information you receive from a user. 9. On the profile.php, get any information stored in the customers table for the user who is logged in. · Use this information to dynamically change the contents of the profile page, pulling the information stored in the database and modifying it to be appropriate for the web page. · Users should be able to update & change their profile image. Allow images formats of GIF, JPEG, or PNG. Rename the filename of the image to be the user’s name & the appropriate extension. For easier maintenance, store these images in a custImages folder. $location = "custImages/" . $UserName . $ext; move_uploaded_file($_FILES["image"]["tmp_name"], $location); · Users should be able to update only the parts of their profile they want. If one of the form fields is filled in, UPDATE the customers table for that user with the information they have submitted. Remember to sanitize each field and provide a date of when the user has last updated their information. Submission Instructions (-100 points): · Upload all files in a folder (LastName_Assign4) on your Development Server. · (-100 [-25 * 4 files]) All files must validate to green status using the W3C Validators. Validate by URI – copy the URL address for each page and paste it into the Address location. · Do NOT ZIP your folder on your Development Server. · In the dropbox on Folio: · Upload your LastName_Assign4 folder that has been ZIPPED. · Paste the URL to your Assignment 4 folder on your Web Server in the comments section. · Assignment 4 will NOT be graded if it has not been uploaded to your Development Server AND to Folio. Assignment4/Assignment4/cart.php <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <!-- Author: Brandon McLean Date: February 6 2020 Assignment 1 Filename: index --> <head> <title>McLean: Shopping Site</title> <meta charset="utf-8"> <link rel="stylesheet" href="McLean_styles.css"> </head> <body> <header> <?php include 'header.php'; ?> <h1>Pandora's Secrets</h1> <h2>Welcome <?php echo $USERNAME ?></h2> </header> <main> <nav> <?php include 'nav.php'; ?> </nav> </main> <footer><?php include 'footer.php'; ?></footer> </body> </html> Assignment4/Assignment4/database.php <?php $HOST_NAME = 'localhost'; $DATABASE_NAME = 'McLean_shop_db'; $USERNAME = 'brandon'; $PASSWORD = '2020Ninochan!'; ?> Assignment4/Assignment4/description.php <?php session_start(); if(isset($_SESSION['username'])){ $username = $_SESSION['username']; } else { echo "You are not logged in."; } ?> <!DOCTYPE html> <html lang="en"> <!-- Author: Brandon McLean Date: February 6 2020 Assignment 1 Filename: index --> <head> <title>McLean: Shopping Site</title> <meta charset="utf-8"> <link rel="stylesheet" href="McLean_styles.css"> </head> <body> <header> <?php include 'header.php'; ?> <h1>Pandora's Secrets</h1> <h2>Welcome <?php echo $USERNAME . "<br>"; ?>!</h2> </header> <main> <nav> <?php require 'nav.php'; ?> </nav> <h3><?php ?></h3> <img src="Red_Pyramid.jpg" alt="Set's Pyramid"> <p>In Ancient Egypt pyramids were used as tombs for the pharoahs, gods in human form. The villaionus God of Chaos, Set, had this pyramid constructed in his image. Now, it could be yours!<br> Price: $79.99 USD</p> <form action="http://34.207.165.236/Assignment1/cart.php"> <button type="submit">Add to Cart</button></form> <h4>User Reviews</h4> <p>User1 - Date1<br> Wow! I can't believe that I could actually purchase this!<br></p> <p> User2 - Date 2<br> It has a huge gash in it, this item is just....CHAOTIC<br></p> <p> User3 - Date<br> This is the most expensive paperweight I've ever bought.</p> <h3>Leave a Review</h3> <textarea id="review" rows="5" cols="50"></textarea><button type="submit">Post Review</button> </main> <footer><?php include 'footer.php'; ?></footer> </body> </html> Assignment4/Assignment4/footer.php <footer> &copy; <?php echo date('F'); echo(","); echo(" "); echo date('d'); echo(" "); echo date ('Y'); echo(" "); echo date('g'); echo(":"); echo date('i'); echo(":"); echo date('s'); echo (" "); echo date ('a'); echo(" "); echo date('e'); ?> Web Programming <a href="mailto:bm05663@georgiasouthern.edu <br>">Brandon McLean</a> <?php echo ("Last Modified: " . date ("F d Y H:i:s.", getlastmod())); echo "<br>"; ?> </footer> Assignment4/Assignment4/header.php <?php require 'database.php'; $rand = rand(0,1); if ($rand = TRUE){ echo $USERNAME; } else { echo Guest ."<br>"; } ?> Assignment4/Assignment4/holygrail.jfif Assignment4/Assignment4/index.php Pandora's Secrets Welcome ! Username: Password Login Welcome to Pandora's Secrets Here at Pandora's Secrets, we have what your heart truly desires! Mythological items and trinkets will be updated periodically, occasionally by overwhelming demand. Sign up to be a registered member of Pandora's Secrets if you want to be the myth of your own legend! Your one stop shop for all the mythological items! Pandora's Secrets!! Pandora's Secrets is not liable for any curses, hexes, time loops, suffereing, or loss of life. Please use mythological artifacts responsibly and for their intended purpose. Assignment4/Assignment4/itemImages/ASandals.jpg Assignment4/Assignment4/itemImages/enkiduchain.jpg Assignment4/Assignment4/itemImages/gilgascept.jpg Assignment4/Assignment4/itemImages/GoH.jpg Assignment4/Assignment4/itemImages/ishtar.jpg Assignment4/Assignment4/itemImages/LBow.jpg Assignment4/Assignment4/itemImages/leifmap.jpg Assignment4/Assignment4/itemImages/modiba.jpg Assignment4/Assignment4/itemImages/Red_Pyramid.jpg Assignment4/Assignment4/itemImages/SVase.jpg Assignment4/Assignment4/itemImages/thorfinndagg.jpg Assignment4/Assignment4/itemImages/thorkellbs.jpg Assignment4/Assignment4/items.php <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <!-- Author: Brandon McLean Date: February 6 2020 Assignment 1 Filename: index --> <head> <title>McLean: Shopping Site</title> <meta charset="utf-8"> <link rel="stylesheet" href="McLean_styles.css"> </head> <body> <header> <h1>Pandora's Secrets</h1> <h2>Welcome <?php echo "$USERNAME"; ?>!</h2> </header> <main> <?php require "header.php"; require "database.php"; try { $myDBconnection = new PDO("mysql:host=$HOST_NAME;dbname=$DATABASE_NAME", $USERNAME, $PASSWORD); } catch (PDOException $e) { $error_message = $e > getMessage(); echo $error_message . "<br>"; } ?> <nav> <?php require "nav.php" ?> </nav> <h3>Greek Items</h3> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Greek';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php?item_id"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> <h3>Norse Items</h3> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Norse';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php?item_id"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> <h3>Mesopotamian Items</h3> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Meso';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php?item_id"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> <h3>Egyptian Items</h3> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Egypt';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php?item_id"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> <h3>Celtic Items</h3> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Celtic';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php?item_id"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> </main> <footer><?php include 'footer.php'; ?></footer> </body> </html> Assignment4/Assignment4/itemsz.php <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <!-- Author: Brandon McLean Date: February 6 2020 Assignment 1 Filename: index --> <head> <title>McLean: Shopping Site</title> <meta charset="utf-8"> <link rel="stylesheet" href="McLean_styles.css"> </head> <body> <header> <h1>Pandora's Secrets</h1> <h2>Welcome username!</h2> </header> <main> <?php require "database.php"; try { $myDBconnection = new PDO("mysql:host=$HOST_NAME;dbname=$DATABASE_NAME", $USERNAME, $PASSWORD); } catch (PDOException $e) { $error_message = $e > getMessage(); echo $error_message . "<br>"; } ?> <nav> <p>NOT LOGGED IN<br></p> <a href="index.php">Home</a>&nbsp;<a href="register.php">Register</a>&nbsp; <a href="login.php">Login</a>&nbsp; <p>LOGGED IN<br></p> <a href="index.php">Home</a> &nbsp; <a href="profile.php">Profile</a> &nbsp; <a href="items.php">Items</a> &nbsp; <a href ="cart.php">Cart</a> &nbsp; </nav> <h3>Greek Items</h3> <ul><li><a href="description.php">Spartan Vase</a></li></ul> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Greek2';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> ?> <ul> <li><a href="description.php">Achilles' Sandals</a></li></ul> <h3>Norse Items</h3> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Norse1';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> <ul><li> <a href="description.php">Modi's Battleaxe</a> </li><li><a href="description.php">Odin's Birdcage</a></li></ul> <h3>Mesopotamian Items</h3> <ul><li> <a href="description.php"> Gilgamesh's Scepter</a> </li> </ul> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Meso2';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> <ul><li><a href="description.php">Enkidu's Chains</a></li></ul> <h3>Egyptian Items</h3> <ul><li><a href="description.php">Sekhmet's Sarcophagus</a></li> <li><a href="description.php">Feather of Ra</a></li> <li><a href="description.php">Set's Pyramid</a></li></ul> <h3>Celtic Items</h3> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Norse1';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <ul><li><a href="description.php"> Thorfinn's Dagger</a></li> <li><a href="description.php">Leif Erikkson's Journal </a></li> </ul> <?php try { $itemName = "SELECT item_name, item_category FROM items WHERE item_category = 'Celtic3';"; $dbquery = $myDBconnection ->prepare($itemName); $dbquery -> execute(); $results = $dbquery -> fetchAll(); } catch (PDOException $e) { $error_message = $e -> getMessage(); echo $error_message . "<br>"; } ?> <?php foreach ($results as $forEachQueryRow){ ?> <ul><li><a href="description.php"> <?php echo $forEachQueryRow['item_name']; ?></a></li></ul> <?php } ?> </main> <footer><?php include 'footer.php'; ?></footer> </body> </html> Assignment4/Assignment4/login.php <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <!-- Author: Brandon McLean Date: February 6 2020 Assignment 1 Filename: index --> <head> <title>McLean: Shopping Site</title> <meta charset="utf-8"> <link rel="stylesheet" href="McLean_styles.css"> </head> <body> <header> <?php include 'header.php'; ?> <?php //submit form if(isset($_POST['sub'])){ //check for input if( !(empty($_POST['username'])) && !(empty($_POST['password']))) { //transfer input to variables $username = $_POST['username']; $password = $_POST['password']; //saniize input $username = sanitize($username); $password = sanitize(password); if ($username != "" && $password != "") { try { //check to match table values $query = 'SELECT user_name, password FROM customers WHERE user_name = :username AND password = :password;'; $statement = $myDBconnection -> prepare($query); $statement -> bindValue(':username', $username); $statement -> bindValue(':password', $password); $statement -> execute(); $result = $statement -> fetch(); } catch (PDOException $e) { $error_message = $e->getMessage(); echo "<p>An error occurred while trying to retrieve data from the table: $error_message </p>"; } if ($result['user_name'] == $username && $result['password'] == $password) { echo "You are an authorized user"; if(isset($_POST['userRemember'])) { $cookieName = "userRemember"; $cookieValue = "$username"; $cookieExpire = strtotime("+10 minutes"); setcookie($cookieName, $cookieValue, $cookieExpire); } else { $cookieName = "userRemember"; $cookieValue = ""; $cookieExpire = strtotime("-10 minutes"); setcookie($cookieName, $cookieValue, $cookieExpire); } } else { session_destroy(); } } } } ?> <h1>Pandora's Secrets</h1> <h2>Welcome <?php echo $USERNAME ?>!</h2> </header> <main> <nav> <?php include 'nav.php'; ?> </nav> <form method="post"> Username: <input type="text" name="uName" placeholder="Please enter your username"> Password <input type="text" name="pWord" placeholder="Please enter your password"> Login<input type="submit" name="sub" value="Login"> </form> </main> <footer><?php include 'footer.php'; ?></footer> </body> </html> Assignment4/Assignment4/logout.php <?php //logout session_start(); session_destroy(); header("Location: index.php"); ?> Assignment4/Assignment4/McLean_styles.css /*Brandon McLean 2/6 Assing1*/ head { text-align: center; font-family: Aria, Helvetica, sans-serif; } body { background-image: url(holygrail.jfif); background-color:#f4d03f;opacity:0.65; text-align:center; font-family: Arial, Helvetica, sans-serif; margin: auto; min-height:100%; } nav:a hover { background-color:darkseagreen; } main { background-color: #f4d03f; color: black; } footer { padding:3px; background-color:#fa2b10; color: #082213; text-align:center; } main { text-align: center; } nav { text-align:center; } li { text-align: left; } h3{ text-align:left; } Assignment4/Assignment4/nav.php <?php require 'header.php'; if ($rand = TRUE){ echo 'Logged in:' . ' ' . $USERNAME .'<br>'; echo '<a href="index.php">Home</a> &nbsp; <a href="profile.php">Profile</a> &nbsp; <a href="items.php">Items</a> &nbsp; <a href ="cart.php">Cart</a> &nbsp; <a href="logout.php">Logout</a> &nbsp;'; } else { echo 'Not Loggedin:' . Guest ."<br>"; echo 'Welcome Guest<br> <a href="index.php>Home</a>&nbsp; <a href="register.php">Register</a>&nbsp; <a href="login.php">Login</a>&nbsp; '; } Assignment4/Assignment4/profile.php <?php session_start(); if(isset($_SESSION['username'])){ $username = $_SESSION['username']; } else { echo "You are not logged in."; } ?> <!DOCTYPE html> <html lang="en"> <!-- Author: Brandon McLean Date: February 6 2020 Assignment 1 Filename: index --> <head> <title>McLean: Shopping Site</title> <meta charset="utf-8"> <link rel="stylesheet" href="McLean_styles.css"> </head> <body> <header> <?php include 'header.php'; ?> <h1>Pandora's Secrets</h1> <h2>Welcome <?php echo $USERNAME ?>!</h2> </header> <main> <nav> <?php include 'nav.php'; ?> </nav> <div>Update Information <form method="post"> Profile picture: <input type="file" name="profilepic"> <input type="submit" name="subpp" value="Upload"> <br> Location: <input type="text" name="location"> Age: <select id="age"> <option value="13 - 16">13 - 16</option> <option value="17 - 19">17 - 19</option> <option value="20 - 24">20 - 24</option> <option value="25 - 29">25 - 29</option> <option value="30+">30 and up</option> </select> Gender: <input type="radio" name="gender" value="male">Male<br> <input type="radio" name="gender" value="female">Female<br> <input type="radio" name="gender" value="other">Prefer not to say<br> Update Profile<input type="submit"> </form> </div> </main> <footer> <?php include 'footer.php'; ?> </footer> </body> </html> Assignment4/Assignment4/register.php <?php session_start(); ?> <!DOCTYPE html> <html lang="en"> <!-- Author: Brandon McLean Date: February 6 2020 Assignment 1 Filename: index --> <head> <title>McLean: Shopping Site</title> <meta charset="utf-8"> <link rel="stylesheet" href="McLean_styles.css"> </head> <body> <header> <?php include 'header.php'; ?> <h1>Pandora's Secrets</h1> </header> <main> <?php // connect to database require 'database.php'; ?> <nav> <?php include 'nav.php' ?> </nav> <?php # check for submission, if user exist echo Username already exists # if no user exists create new user if(isset($_POST['sub'])) { //inputs $username = mysqli_real_escapestring($db, $_POST['user_name']); $password = mysqli_real_escapestring($db, $_POST['password']); // check entry if (empty($user)) {echo "Username required.";} if (empty($password)) {echo "Password required.";} $user_check = "SELECT * FROM customers WHERE user_name='$user'"; $result = mysqli_query($db, $user_check); $user = mysqli_fetch_assoc($result); if ($user['user_name'] === $username){ echo "Username already exists"; } $query ="INSERT INTO customers (user_name, password) VALUES('$user', '$password')"; } mysqli_query($db, $query); $_SESSION['username'] = $username; $_SESSION['success'] = "Logged in"; ?> <form method="post"> Username: <input type="text" name="user_name" placeholder="Please enter a username"> Password: <input type="text" name="password" placeholder="Please enter a password"> Register<input type="submit" name="sub" value="Register"> </form> <h3>Why</h3> <p> who who</p> </main> <footer><?php include 'footer.php'; ?></footer> </body> </html> bmm0013132.ppk PuTTY-User-Key-File-2: ssh-rsa Encryption: none Comment: imported-openssh-key Public-Lines: 6 AAAAB3NzaC1yc2EAAAADAQABAAABAQCHBeh7TSQdlHK/gnqkXxaHSCebUtS1v9JD Z2x982+6RVKupdAEDiTDTYk8moN/Pd54sIeaIPnZ4GMkJ03BJLiMnTJRYGDCGWYl vPLHNVoM1YCMkqdMX0odNVdfMnO+J4g2QIxIobCQuCeUNvJJlf1jnIy1fyWZ+eV0 ui29Bf46PdBIiMfu1EizXVHs6vggUfONaBnBrgU2py4eHvIJaPipnpOyH9fjJFTx 2us7NCU1dinzpxYCWRbUSax37Dv6NE7scz/L+1nRveELAgKP1lXX/qBFkjxQsUC3 dZCUbmZG+Sl2UP6s7/qENoGR/T5K47PY+1YgH9hCuCr2JqOc0qLv Private-Lines: 14 AAABAEcEXoDr1AES4T/FOwhVUx4YX2ycpnBp0gfN0Ax3C97nM1PUtpJLdh6bG4Ga q2szeV31S31PttpX4Q1U9tqNm9upmpuem4W7ojRbKz6H2zNA4HoPcJsEy5CNS8Uw Xhw34rbWQHK7SIj1syuLsuftUfcgkgmsNHTGMV+xxPjUvCCZORL9eteeNEA69J1a L6P5bIf+8lTIT813p9DdT7hYjXDMSUVVIbjWRMmEBjhav36vVZcfbPqJHZ02J2c+ BvQAZbhtpub1jYed8QX1CKdqg/YjWu00zV8X3IDuYv+g10A8kY7HS2fen+WqKF1e CRuv07mhQ6/PMXlKG6vVfJKXcZEAAACBANVdhuFKjU8NC+/fRvHsyjtvE46gkPnO CSY9XjNbVr1au8bV2X2g5ZN3hYB04pEKsefsh0UQoSfcIzpiqIthjSF37A4Tb3sk eg6307AhKEhOXhpbffInmxcIvm/xVpN8el/HLT525W+XOr4ym90oigjsvQalwsoP FEeswiqbnkK9AAAAgQCiAN4ewAQL21nMdiENt0mguoD3xROQTfWVJUsdnHfBxE4K vjGI9VlB1+eXoSIX4JE4IcsqVTTdeDBklfHJRIriOx++ndnr26gEvQqYRSfbLe03 +VIqQYa5wWjGnCSPqPjmYs0b6G5y8zTng8DtrhXDCLmdSZfKoSxHxWF/u5YNGwAA AIBaKMAXmzViML5QFm6HwfhqToLWj31OoL90N9s/B1PtMRNbdUADo/nbwgkQDxck t3b+Pajmu4dogUofSzpo41KiT4YeGKhkAUjfnD4UD4womQ4N8RgDu+BtuT14NH0d 3DIkDOpZSXlmat9TgVtGZmwPhnT2iDoH5RfvvMo+OD22xw== Private-MAC: 3d119f0faa676261d2cf5c3538e6ceeb45d61036

Related Questions

Similar orders to Online store via PHP and MySQL
17
Views
0
Answers
Nested imbalanced design of expriment using Box-Adjusted wald-type test
I need to provide statistical analysis of a nested design non-balanced design of experiment. I am hoping to have the implementation in either R, SPSS, or both. I will need the answers to be provided as shown in the attached file (Project.docx), and also wo...
32
Views
0
Answers
CMPT 200 Coding Homework
Write a class called Fraction that can store a rational number (reminder: those numbers that can be expressed in the form a/b, where a and b are integers are rational numbers). For example, a variable with a value of ½ would be created using oneHalf ...
15
Views
0
Answers
Artificial Inteligence System Technique
This is a Master Degree course and I have attached example questions, there are 5 questions and only 3 need to be answered. We will get the actual questions on the day of the exam and they need to be completed within 2 hours, which means the expert has to ...
18
Views
0
Answers
Simulating Networks
Here are the details of first assignment for Computer Networks class. This is a pretty basic assignment with very little work but you will have to do initial setup for virtual box on your machine. Here are the details on how to do the setup: Download virt...