This is the final assignment of the course.
You have to write a PHP script that will accept the user credentials that were given to it from your previous AJAX call, validate it and appropriately send a response back to the login webpage.
- Make a separate PHP page that checks the login, and upon "success" makes a new PHP session with the user ID, and then sends the response code back to the login page.
- In the login page, modify your code to read the response code and do the appropriate dynamic changes on the website - for example, show error if there is wrong credentials, or redirect the page upon success, etc.
- Modify the login, and welcome pages to be "PHP"-enabled - the users should NOT be able to see the login page if they're already logged in (redirect them to the welcome page), and the users should NOT be able to see the welcome page if they aren't logged in (redirect them to the login page)
- Submit the URL of the working website if you've hosted it on 000webhost.
- ZIP your project files and attach the zip if you've made the local server such that if I unzip and host your files on my local server, I should see a working website.
Username: admin@example.com
Password: admin123
$servername = "localhost";
$username = "id4362835_root";
$password = "root123";
$database = "id4362835_webtechproject";
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";
CREATE DATABASE IF NOT EXISTS `webtechproject` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `webtechproject`;
DROP TABLE IF EXISTS `info`;
CREATE TABLE `info` (
`id` int(11) NOT NULL,
`property` varchar(100) NOT NULL,
`value` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
INSERT INTO `info` (`id`, `property`, `value`) VALUES
(1, 'Written by', 'Nagaru Tanigawa'),
(2, 'Illustrated by', 'Noizi Ito'),
(3, 'Published by', 'Kadokawa Shoten'),
(4, 'Directed by', 'Tatsuya Ishihara'),
(5, 'Studio', 'Kyoto Animation'),
(6, 'Episodes', '14 (original)\r\n28 (rebroadcast)');
ALTER TABLE `info`
ADD PRIMARY KEY (`id`);
ALTER TABLE `info`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;
Or use the file webtechproject.sql to import the database. Make sure you change the settings in the details.php page as well.
Use the sample scripts taken from my website for your references.