Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an html, php, JavaScript codes that makes a website for buying tickets for

ID: 3850786 • Letter: W

Question

Write an html, php, JavaScript codes that makes a website for buying tickets for cinema (two type of cinema tickets platinum and VIP). It should have: home page.html user.php products.php connection.php We need to use MySQL db for saving users in the database. home page should shows and display the website. user.php is the user login code. products is the cinema tickets types (platinum and VIP), place of the cinema (DUBAI MALL), name of the movie and timing of the movie. connection.php is the link between html and php. User should be able to choose between types of the tickets and timing of the movie.

Explanation / Answer

homepage.html

<!DOCTYPE html>
<html>
<head>
   <title>test</title>
   <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
Logo
</header>
<nav>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#about">About Us</a></li>
<li><a href="#gallery">Gallery</a></li>
<li><a href="#contact">Contact Us</a></li>
<li><a href="user.php">Login</a></li>
</ul>
</nav>
<div>
<img src="images/image1.jpg" alt="" height="400px"width="100%"/>
</div>

<section id="about" class="about-section">
<h1>About Us</h1>
<i>"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."
"There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain..."</i>
<p>
       Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
</p>
</section>
<section id="gallery" class="gallery-section">
<h1>Gallery</h1>
<div>
<img src="images/1.jpg" alt="">
<img src="images/2.jpg" alt="">
<img src="images/3.jpg" alt="">
<img src="images/4.jpg" alt="">
<img src="images/5.jpg" alt="">
<img src="images/6.jpg" alt="">
</div>
</section>

<section id="contact" class="contact-section">
<h1>Contact Us</h1>
<table align="center">
<tr><td><input type="text" placeholder="First Name"/></td><td><input type="text" placeholder="Last Name"/></td></tr>
<tr><td><input type="text" placeholder="Email" /></td><td><input type="text" placeholder="Phone No." /></td></tr>
<tr><td colspan="2"><textarea rows="10" cols="102" placeholder="Message"></textarea></td></tr>
<tr><td colspan="2"><button>Submit</button></td></tr>
</table>
</section>

<footer>
   &copy; &reg; Copyrights2016
</footer>
</body>
</html>

connection.php

<?php
$servername = "localhost";
$username = "root";
$password = "";
$db="phptaskdb";
// Create connection
$conn = mysqli_connect($servername, $username, $password,$db);

// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}

?>

logout.php

<?php
session_destroy(oid);
header('location:homepage.html');
?>

products.php

<?php
include('connection.php');
session_start();

if(isset($_POST["submit"])){


$sql = "INSERT INTO products (username, ticket_type,timings)
VALUES ('{$_SESSION['username']}','".$_POST["tickettype"]."','".$_POST["timings"]."')";

if ($conn->query($sql) === TRUE) {
echo "<script type= 'text/javascript'>alert('Book successfully');</script>";
} else {
echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>";
}

$conn->close();
}

?>
<!DOCTYPE html>
<html>
<head>
   <title>test</title>
   <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
Logo
</header>
<nav>
<ul>
<li><a href="logout.php">Logout</a></li>
</ul>
</nav>

<div>
<form action="" method="post">
<table align="center">
   <tr>
       <td> <label><b>Ticket type</b></label></td>
       <td>
       <select name="tickettype" required>
  
       <option value="">--select--</option>
           <option value="Platinum">Platinum</option>
           <option value="VIP">VIP</option>
       </select>
       </td>
   </tr>
       <tr>
       <td> <label><b>Timings</b></label></td>
       <td>
<select name="timings" required>
<option value="">--select--</option>
           <option value="10-12">10 AM - 12:30 PM</option>
           <option value="2-4:30">2 PM - 4:30 PM</option>
           <option value="6-8:30">6 PM - 8:30 PM</option>
           <option value="9-11:30">9 PM - 11:30 PM</option>
       </select>
       </td>
   </tr>
   <tr>
       <td colspan="2"><input type="submit" value="Book" name="submit"></td>
   </tr>
</table>
</form>
</div>

<footer>
   &copy; &reg; Copyrights2016
</footer>
</body>
</html>

register.php

<?php
include('connection.php');

if(isset($_POST["submit"])){

$sql = "INSERT INTO users (username, password)
VALUES ('".$_POST["uname"]."','".$_POST["psw"]."')";

if ($conn->query($sql) === TRUE) {
echo "<script type= 'text/javascript'>alert('New user created successfully');</script>";
} else {
echo "<script type= 'text/javascript'>alert('Error: " . $sql . "<br>" . $conn->error."');</script>";
}

$conn->close();
}
?>
<!DOCTYPE html>
<html>
<head>
   <title>test</title>
   <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
Logo
</header>
<nav>
<ul>
<li><a href="homepage.html">Home</a></li>
<li><a href="user.php">Login</a></li>
</ul>
</nav>

<div>
<form action="" method="post">
<table align="center">
   <tr>
       <td> <label><b>Username</b></label></td>
       <td> <input type="text" placeholder="Enter Username" name="uname" required></td>
   </tr>
       <tr>
       <td> <label><b>Password</b></label></td>
       <td> <input type="password" placeholder="Enter Password" name="psw" required></td>
   </tr>
   <tr>
       <td colspan="2"><input type="submit" value="Register" name="submit"></td>
   </tr>
</table>
</form>
</div>

<footer>
   &copy; &reg; Copyrights2016
</footer>
</body>
</html>

user.php

<?php
include('connection.php');
session_start();
if (isset($_POST['submit'])){

   $username = $_REQUEST['username'];
   $password = $_REQUEST['password'];

$query = "SELECT * FROM `users` WHERE username='$username'
and password='$password'";
   $result = mysqli_query($conn,$query) or die(mysql_error());
   $rows = mysqli_num_rows($result);
if($rows==1){
   $_SESSION['username'] = $username;
   header("Location: products.php");
}else{
   echo "<div class='form'>
<h3>Username/password is incorrect.</h3>
<br/>Click here to <a href="login.php">Login</a></div>";
   }
}
?>

<!DOCTYPE html>
<html>
<head>
   <title>test</title>
   <link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<header>
Logo
</header>
<nav>
<ul>
<li><a href="homepage.html">Home</a></li>
<li><a href="register.php">Register</a></li>
</ul>
</nav>

<div>
<form action="" method="post">
<table align="center">
   <tr>
       <td> <label><b>Username</b></label></td>
       <td> <input type="text" placeholder="Enter Username" name="username" required></td>
   </tr>
       <tr>
       <td> <label><b>Password</b></label></td>
       <td> <input type="password" placeholder="Enter Password" name="password" required></td>
   </tr>
   <tr>
       <td colspan="2"> <input type="submit" value="Login" name="submit"> <span><a href="register.php">Register</a></span></td>
   </tr>
</table>
</form>
</div>

<footer>
   &copy; &reg; Copyrights2016
</footer>
</body>
</html>

style.css

body{
       margin:0px;
   }
   header{
       background-color:#19AD98;
       color:#fff;
       padding:10px 50px;
       font-size:36px;

   }
   nav{
       background-color:#69B596;
       color: #fff;
       padding:0px 20px;
   }
   nav ul{
       list-style: none;
       margin-top:0px;
       margin-bottom:0px;
       text-align: right;
   }
   nav ul li{
       display: inline-block;
       padding:10px;
   }
   nav ul li a {
text-decoration: none;
color:#fff;
   }
   nav ul li a:hover{
color:#FFE3A2;
   }
   section{
       margin:40px 80px;
   }
   section h1{
       color:#19AD98;
       text-align: center;
   }
   .about-section {
text-align:justify;
color:#aaa;
   }
   .gallery-section img{
       height:250px;
       width:380px;
   }
   input{
       padding:12px;
       width:350px;
       border:1px solid #ccc;
   }
   textarea{
       padding:12px;
   border:1px solid #ccc;
   }
   button{
       background-color:#19AD98;
       color:#fff;
       padding:10px 40px;
       border:none;
   }
   footer{
       background-color:#19AD98;
       color:#fff;
       padding:10px;
       text-align: center;
   }

phptaskdb.sql (database script)

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `phptaskdb`
--

-- --------------------------------------------------------

--
-- Table structure for table `products`
--

CREATE TABLE `products` (
`id` int(11) NOT NULL,
`username` varchar(100) NOT NULL,
`ticket_type` varchar(100) NOT NULL,
`timings` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
`id` int(11) NOT NULL,
`username` varchar(100) NOT NULL,
`password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `products`
--
ALTER TABLE `products`
ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `products`
--
ALTER TABLE `products`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

images

please upload your images and replace that images in homepage.html

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote