1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
mario62 [17]
3 years ago
13

You need to implement a web application that is split in three parts, namely, Webpage, PHP and MySQL. Each of them will be used

accordingly to solve a simple problem described below. Remember to implement the logic in the most secure way of your knowledge.
PHP

Implement a PHP function that reads in input a string from the user and store it in a table (e.g., in a field called "Content Name").
The function should be able to read the content of the file and store it in a table (e.g., in a field called "File Content").
The web application should be able to implement a logic to log in and sign up users.
Each user will have exclusive access to her/his uploaded material.
When a user logs in, all her/his private content will be displayed on the web page.
If no user has logged in yet, no information from the database are printed on the webpage.

Webpage

The user must be able to upload a text file (and nothing more!).
The user must be able to input a string, using a text box.
The webpage allows users to input their credentials for both logging in and signing up.
After a user logs in, the webpage prints in output her/his personal material from the database, that is, the content of each file with the specified name.
If there is no material yet, nothing is showed for that specific user.

MySQL

You need to create a database that contains at least two tables. One to store the information in input to the webpage, the other to store the users credentials.
The "credentials table" should contain at least these fields: email, username and password.
SUBMISSION

You need to submit your web application in a .php file, no other formats is allowed.
You don't need to submit your 'login.php' file.
No details about the database need to be submitted.
Computers and Technology
1 answer:
Anastasy [175]3 years ago
6 0

Answer:

Check the explanation

Explanation:

index.php

<!DOCTYPE html>

<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->

<head>

</head>

<body>

<section class="container">

   <div class="login">

     <h1>Login Portal</h1>

     <form method="post" action="login.php" name="frm" onSubmit="return f1();">

       <p><input type="email" name="email" value="" placeholder="Enail"></p>

       <p><input type="password" name="pwd" value="" placeholder="Password"></p>

       <p class="submit"><input type="submit"   value="Login"></p>

     </form>

       <p class="submi"><a href="admin_signup.php" > <input type="button"   value="Signup"></a></p>

   </div>

</section>

</body>

</html>

login.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$e=$_POST["email"];

$p=$_POST["pwd"];

$sql="select * from `account` where `email`='$e' and `password`='$p'";

$res=mysqli_query($con,$sql);

if(mysqli_num_rows($res)>0)

{

$_SESSION["email"]=$e;

include 'profile.php';

}

else {

echo "no such username";

include 'admin.php';

}

mysqli_close($con);

?>

admin_signup.php

<!DOCTYPE html>

<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->

<head>

</head>

<body>

<section class="container">

   <div class="login">

     <h1>Signup Portal</h1>

     <form method="post" action="signup.php" name="frm" onSubmit="return f1();">

        <p><input type="email" name="email" value="" placeholder="Email id"></p>

       <p><input type="text" name="uname" value="" placeholder="Admin name"></p>

       <p><input type="password" name="pwd" value="" placeholder="Password"></p>

       <p class="submit"><input type="submit"   value="Signup"></p>

     </form>

       <p class="submi"><a href="admin.php" > <input type="button"   value="Login"></a></p>

   </div>

</section>

</body>

</html>

signup.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$u=$_POST["uname"];

$e=$_POST["email"];

$p=$_POST["pwd"];

$sql="INSERT INTO `account`(`email`, `username`, `password`) VALUES ('$e','$u','$p')";

mysqli_query($con,$sql);

mysqli_close($con);

include 'admin.php';

?>

upload file (profile.php)

<!DOCTYPE html>

<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->

<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->

<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->

<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->

<head>

</head>

<body>

<section class="container">

   <div class="login">

     <h1>Login Portal</h1>

     <form method="post" action="content.php" name="frm" onSubmit="return f1();" enctype="multipart/form-data" >

       <p><input type="test" name="docname" value="" placeholder="docname"></p>

       <p><input type="file" name="filename" value="" placeholder="file path"></p>

       <p class="submit"><input type="submit"   value="upload"></p>

     </form>

     <p > <a href="view.php">to view your content , click here</a></p>

   </div>

</section>

</body>

</html>

content.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$handle = $_FILES['filename']['tmp_name'];

echo $handle;

$d=$_POST["docname"];

$e=$_SESSION["email"];

$c=file_get_contents($handle);

$sql="INSERT INTO `info`(`email`, `docname`, `content`) VALUES ('$e','$d','$c')";

mysqli_query($con,$sql);

mysqli_close($con);

include 'admin.php';

?>

to view content , view.php

<?php

session_start();

$con=mysqli_connect("localhost","root","","storage");

if(!$con)

{

die("connection failed" .mysqli_connect_error());

}

$e=$_SESSION["email"];

$sql="select * from `info` where `email`='$e' ";

$res=mysqli_query($con,$sql);

if(mysqli_num_rows($res)>0)

{

while($show=mysqli_fetch_assoc($res))

{

echo $show["docname"]."\n".$show["content"];

}

}

else {

echo "no content till now";

}

mysqli_close($con);

?>

You might be interested in
// This pseudocode segment is intended to compute the number
Harlamova29_29 [7]

DEBUG01-01

//This pseudocode is intended to describe

//computing the price of an item on sale for 10% off

START

  input origPrice

  discount = origPrice * 0.10

  finalPrice = origPrice - discount

  output finalPrice

STOP

DEBUG01-02

//This pseudocode is intended to compute the number

//of miles per gallon you get with your automobile.

START

  input milesTraveled

  input gallonsOfGasUsed

  milesPerGallon = milesTraveled / gallonsOfGasUsed

     //milesPerGallon is computed using division

  output milesPerGallon

     //miles is misspelled, and the P in milesPerGallon should be uppercase

STOP

  //Program should end with stop

DEBUG01-03

//This pseudocode is intended to describe

//computing the per day cost of your rent

//in a 30-day month

START

  input rent

  costPerDay = rent / 30

     // Comment indicates 30-day month

  output costPerDay

     // output should be costPerDay

STOP

<h3>What is an algorithm?</h3>

An algorithm can be defined as a standard formula which comprises a set of finite steps and instructions that must be executed by a software program, in order to proffer solutions to a problem on a computer, under appropriate conditions.

         

<h3>What is a pseudocode?</h3>

A pseudocode can be defined as a description of the steps that are contained in an algorithm, especially through the use of a plain (natural) language.

<u>Note:</u> The indentation may change due to Brainly's text editor.

Read more on pseudocode here: brainly.com/question/13208346

#SPJ1

<u>Complete Question:</u>

Your downloadable files for Chapter 1 include DEBUG01-01.txt, DEBUG01-02.txt, and DEBUG01-03.txt. Each file starts with some comments (lines that begin with two slashes) that describe the program. Examine the pseudocode that follows the introductory comments, then find and correct all the bugs.

4 0
2 years ago
Which term is used to identify the connection of computers that are physically close to one another?
marta [7]

Answer: Local Area Network (LAN)

Explanation:

A Local Area Network (LAN) is a computer network that interconnects computers within a limited physical area such as a residence, school, laboratory, university campus or office building.

An example of  LAN network is "Phone, Computer and TV connected to a single network (such as a Home Network) via Cables, Wifi, Bluetooth or Hotspot". When the devices are interconnected or connected to a LAN, it becomes accessible between each other.

A simplest example of a LAN Device is a <em>Home Router.</em>

6 0
3 years ago
Read 2 more answers
Thiết kế biểu đồ thực thể liên kết và tập lược đồ cơ sở dữ liệu quan hệ cho các bài toán quản lý sau:
Paladinen [302]

Answer:

sorry please write in English than i help.you i don't understand your language

3 0
3 years ago
How to hard reset a iphone 7 without computer
kondor19780726 [428]
You cant go to a specialist if you cannot figure it out or to someone who knows how to hack because the way iCloud is set up you wont be able to unless you can factory reset it by downloading jail break
4 0
3 years ago
Read 2 more answers
Select the risks associated with the Internet.
tino4ka555 [31]
Sharing your personal information and identity theft but if you’re supposed to choose one then sharing your personal information must be right
3 0
2 years ago
Other questions:
  • For some brand-name computers, the hard drive contains a partition that can be used to reinstall windows. what is the name for t
    6·1 answer
  • To specify grouping and sorting for a report, click the ____ button on the design tab in layout view.
    14·1 answer
  • Help me out for this one
    12·1 answer
  • A(n) ____ string contacts the data source and establishes a connection with the database using the Data Source Configuration Wiz
    5·1 answer
  • What could be a summary sentence or phrase that captures your writing experience?
    11·1 answer
  • Using the world_x database you installed in Module 1, list the countries and the capitals of each country. Modify your query to
    11·1 answer
  • Write all the hexadecimal numbers in sequence from 9F7H to A03H
    9·1 answer
  • Facts and statistics collected together to be used for different purposes is
    14·1 answer
  • The post-closing trial balance shows the balances of only the ____ accounts at the end of the period.
    12·1 answer
  • Which feature is not in ms PowerPoint​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!