PHP Micro Project
PHP Micro Project
TITLE OF PROJECT
ART GALLERY
CERTIFICATE
This is to certify that Mr. Kedar Sitaram Hadke Roll No. 25 of 6th Semester of Diploma in
Computer Engineering of Institute, LOGMIEER’S POLYTECHNIC, NASHIK (Code: 1477) has
completed the Micro Project satisfactorily in Subject- Web Application Development
Using PHP (22619) for the academic year 2023- 2024 as prescribed in the curriculum.
Seal of institute
ANEEXURE II
Prof. B.S.Chaudhary
PROGRESS REPORT
MICRO PROJECT
INDEX
1 Rationale
2 Aims/Benefits
3 Literature Review
5 Flowchart
6 Coding
8 Outputs
9 Skills Developed
10 Applications
Acknowledgement
Micro-Project Report
Art Gallery
1. Rationale
PHP is a server-side scripting language that is embedded in HTML. It is used to manage dynamic
content, databases, session tracking, even build entire data management sites. It is integrated with a
number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and
Microsoft SQL Server. A server-side dynamic web page is a web page whose construction is
controlled by an application server processing server-side script in the back end. A dynamic web page
is a web page that displays different content each time it is viewed while retaining the same layout and
design. To understand and implement PHP for practical purposes, we chose Employee Record
Management System website using PHP as our project.
The purpose of this micro project is to develop a web-based art gallery platform that allows users to
browse and view artworks, artists, exhibitions, and related information. The project aims to provide an
engaging and interactive experience for art enthusiasts while showcasing a diverse range of artistic
works.
4. Literature Review
In today’s world where mankind is moving towards automation to increase the efficiency of their work,
there should be system to motivate artists to make better art. People nowadays hardly want to move from
their places for shopping and not even for eating this is because of their hectic schedule. In such
circumstances, we have decided to create a system for online purchase of arts. The existing traditional
system of art gallery has large number of drawbacks such as time consuming procedure, formation of
crowd in malls, problem of bargaining, etc. This problems waste time of customers and manpower of
artist and also de-motivates them. Hence to overcome this problem the decided to introduce Online Art
Gallery.
About PHP :-
PHP is a server-side scripting language that is embedded in HTML. It is used to manage dynamic
content, databases, session tracking, even build entire e-commerce sites. It is integrated with a number
of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL
Server.
Step 1: Start
Step 2: Display the index page with options for users to browse artworks, artists, and exhibitions.
Step 3: Display information about added artworks and artists on the Home page.
Step 3.1: Display artwork information including title, artist, medium, dimensions, and price.
Step 3.2: Display artist information including name, biography, portfolio, and contact details.
Step 3.3: Include buttons for users to add new artworks, update existing artworks, and delete
artworks.
Step 4.1: Accept all necessary details such as title, artist, medium, dimensions, price, and upload
image.
Step 4.2: Validate the details to ensure they meet required formats and criteria.
Step 4.3: Save the new artwork data to the database and display a toast message confirming the
addition.
Step 5.1: Accept updated details for the artwork, such as title, artist, medium, dimensions, price, and
image.
Step 5.2: Validate the updated details and ensure they meet criteria.
Step 5.3: Update the artwork data in the database and display a toast message confirming the
update.
Step 6.1: Show a confirmation box to recheck if the user wants to delete the artwork.
Step 6.2: If confirmed, delete the artwork from the database and display a toast message confirming
the deletion.
Step 7: Stop
6. Methodology followed
6.1 Step wise work done:
• In this micro project, first of all we have focused on selection of appropriate topic for the
micro-project.
• We have decided our topic i.e. “Art Gallery”
• Then we did literature survey on our topic and gained knowledge about existing and
proposed system.
• Then we gathered all information based on the topic of micro-project.
• We executed our code.
• We have done analysis and study of our topic in detail.
• By doing all the above methodologies we have successfully done our micro project.
7. Code
1. Login Page
<html>
<head>
<title>Login</title>
<style>
Body
{
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: azure ;
color: palevioletred;
font-family: verdana;
font-size: 100%
}
h1
{
color: indigo;
font-family: verdana;
font-size: 100%; }
h3
{
color: indigo;
font-family: verdana;
font-size: 100%;
}
</style>
</head>
<body>
<center><h1>WELCOME TO ONLINE ART GALLERY</h1></center>
<p><a href="register.php">Register</a> | <a href="login.php">Login</a></p>
<center><h3>Login Form</h3> </center>
<form action="" method="POST">
<legend><fieldset><center>
Username: <input type="text" name="user"><br><br>
Password: <input type="password" name="pass"><br><br>
<input type="submit" value="Login" name="submit" onclick="cart.php" style="background-color:
lightblue; color: darkblue" >
</center></fieldset></legend></form>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['user']) && !empty($_POST['pass'])) {
$user=$_POST['user'];
$pass=$_POST['pass'];
$con=mysqli_connect('localhost','root','','product2') or die(mysql_error());
//mysqli_select_db('product2',$con) or die("cannot select DB");
$numrows=mysqli_num_rows($query);
if($numrows!=0)
{
while($row=mysqli_fetch_assoc($query))
{
$dbusername=$row['name'];
$dbpassword=$row['password'];
}
if($user == $dbusername && $pass == $dbpassword)
{
session_start();
$_SESSION['sess_user']=$user;
/* Redirect browser */
header("Location: cart.php");
}
} else {
echo "Invalid username or password!";
} } else {
echo "All fields are required!"; }
} ?>
</body>
</html>
2. Registration Page
<html>
<head>
<title>Register</title>
<style>
body{
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: azure ;
color: palevioletred;
font-family: verdana;
font-size: 100%
}
h1 {
color: indigo;
font-family: verdana;
font-size: 100%;
}
h2 {
color: indigo;
font-family: verdana;
font-size: 100%;
}</style>
</head>
<body>
<td>CITY:</td>
<td><input type=text name=city size=30></td>
</tr>
<tr>
<td>PASSWORD:</td>
<td><input type=password name=pass size=30></td>
</tr>
<tr>
<td><input type=submit value="REGISTER" name="submit"
style="background-color: white; color: darkblue"></td>
<td><input type=reset style="background-color : white; color:
darkblue"></td>
</tr>
</table>
</fieldset>
</legend>
</form>
<?php
if(isset($_POST["submit"])){
if(!empty($_POST['user']) && !empty($_POST['contact']) && !empty($_POST['email']) &&
!empty($_POST['city']) && !empty($_POST['pass']) ) {
$user=$_POST['user'];
$num=$_POST['contact'];
$email=$_POST['email'];
$city=$_POST['city'];
$pass=$_POST['pass'];
$con=mysqli_connect('localhost','root','','product2') or die(mysql_error());
//mysqli_select_db('user_registration') or die("cannot select DB");
$query=mysqli_query($con,"SELECT * FROM user WHERE name='".$user."'");
$numrows=mysqli_num_rows($query);
if($numrows==0)
{
$sql="INSERT INTO user(name,contact,email,city,password)
VALUES('$user','$num','$email','$city','$pass')";
$result=mysqli_query($con,$sql);
if($result){
echo "Account Successfully Created";
} else {
echo "Failure!";
}
} else {
echo "That username already exists! Please try again with another.";
}
} else {
echo "All fields are required!";
}
}
?>
</body>
</html>
3. Cart Page
<?php
session_start();
$connect = mysqli_connect("localhost", "root", "", "product2");
$tot=0;
if(isset($_POST["add_to_cart"]))
{
if(isset($_SESSION["shopping_cart"]))
{
$item_array_id = array_column($_SESSION["shopping_cart"], "item_id");
if(!in_array($_GET["id"], $item_array_id))
{
$count = count($_SESSION["shopping_cart"]);
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][$count] = $item_array;
}else{
echo '<script>alert("Item Already Added")</script>';}
}else{
$item_array = array(
'item_id' => $_GET["id"],
'item_name' => $_POST["hidden_name"],
'item_price' => $_POST["hidden_price"],
'item_quantity' => $_POST["quantity"]
);
$_SESSION["shopping_cart"][0] = $item_array;}}
if(isset($_GET["action"]))
{if($_GET["action"] == "delete") {
foreach($_SESSION["shopping_cart"] as $keys => $values)
{if($values["item_id"] == $_GET["id"])
{
unset($_SESSION["shopping_cart"][$keys]);
echo '<script>alert("Item Removed")</script>';
//echo '<script>window.location="cart.php"</script>';
}} }}
if(isset($_POST["submit"]))
{
header("Location:bill.php");
}
?>
<html><head> </head><body>
<h2>Welcome, <?=$_SESSION['sess_user'];?>! <a href="logout.php">Logout</a></h2>
<br/><br/><br/><br/>
<h3 align="center"><title="Online Art Gallery">Online Art Gallery</h3><br /><br/><br />
<?php
$query = "SELECT * FROM tbl_product ORDER BY id ASC";
}
?>
<tr>
<td colspan="3" align="right">Total</td>
<td align="right"> <?php echo number_format($total, 2); ?></td>
</tr>
<?php
?>
</table><form method="post"><input type="submit" value="Proceed to Checkout"
name="submit"></form></div></div></div></body></html>
4. Billing page
<?php
session_start();
$connect = mysqli_connect("localhost", "root", "", "product2");
$query=mysqli_query($connect,"SELECT * FROM user WHERE name='".$_SESSION['sess_user']."'");
$numrows=mysqli_num_rows($query);
$name=$num=$em=$city=" ";
if($numrows!=0)
{
while($row=mysqli_fetch_assoc($query)) {
$name=$row['name'];
$num=$row['contact'];
$em=$row['email'];
$city=$row['city'];
}}
$total=$_SESSION['tot'];
?>
<html> <head> <title>Bill</title> <style>
body{
margin-top: 100px;
margin-bottom: 100px;
margin-right: 150px;
margin-left: 80px;
background-color: azure ;
color: palevioletred;
font-family: verdana;
font-size: 100% }
h1 {
color: indigo;
font-family: verdana;
font-size: 100%;
}
h2 {
color: indigo;
font-family: verdana;
font-size: 100%;
}
</style>
</head>
<body>
<form action="" method="POST">
<table border="1px" cellpadding="5px" align="center" style="color: black; text-align: center;
background-color: lightgrey"><br/>
<tr>
<td>NAME:</td>
<td><input type=text name=user size=30 value=<?php echo $name;?> ></td </tr>
<tr>
<td>CONTACT:</td>
<td><input type=text name=contact size=30 value=<?php echo $num;?>></td>
</tr>
<tr>
<td>E-MAIL:</td>
<td><input type=email name=email size=30 value=<?php echo $em;?>></td>
</tr>
<tr>
<td>CITY:</td>
<td><input type=text name=city size=30 value=<?php echo $city;?>></td>
</tr>
<tr>
<td>Total Amount:</td>
<td><?php echo "Rs.".$_SESSION['tot'];?></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Confirm Order" name="submit"></td>
</tr></table></form></body></html>
<?php
if(isset($_POST["submit"]))
{
$n=$_POST["user"];
$c=$_POST["contact"];
$e=$_POST["email"];
$ci=$_POST["city"];
require_once('C:\xampp\lib\class.phpmailer.php');
require_once('C:\xampp\lib\class.smtp.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Host = "smtp.gmail.com";
$mail->Port = 25;
$mail->Username ="[email protected]";
$mail->Password ="asmeeta2001 @";
$mail->setFrom('[email protected]');
$mail->addAddress($e);
$mail->IsHTML(true);
$mail->Subject='Your order has been placed successfully.';
$mail->Body = "
<html>
<body>
<table style='width:600px;'>
<tbody>
<tr>
order_place(name,contact,email,city,total)VALUES('$n','$c','$e','$ci','$total')";
$retval = mysqli_query($connect, $sql);
if($retval ) {
//echo "New Record Inserted";
echo "Order Successfully Placed";
}
else echo "Error" .$sql."<br>".mysqli_error($connect);
}
}
?>
8. Project Output
10. Applications
• This project can be used by artist to introduce their art online and connect with people.
• Can be used by people to buy online art of their interest.
• HARDWARE
RAM 2GB
• SOFTWARE
XAMPP 7.4.29
12.Conclusion:
With the help of the project we learned different new concept of PHP. We got knowledge about different built
in features available in PHP. We learnt how to implement online art gallery system, how to establish
communication between server and host system.
13. References:
• https://projectworlds.in/free-projects/php-projects/online-art-gallery-project-on-php/
• https://www.kashipara.com/project/php/2875/art-gallery-managemet
• https://www.freeprojectz.com/php-mysql-project/art-gallery-management-system
• https://www.freestudentprojects.com/java-projects/online-art-gallery/
• https://sourceforge.net/directory/os:windows/?q=online+art+gallery