Sourcecode : here
This project is also a part of my COP (Computer Oriented Project). This project aims to have a simple web interface which will authenticate the user then a number of multipe choice questions appears on the page with the “Next” and “Finish” option. Once the person has given the test his account will be locked and he will not be able to appear test again. And on the very first page (/index.php) you can have a new account registeration . And also this can have an admin view , on which an admin (with attrib=2) can be able to view the status of this. In the admin page he can see the status (if the student has finished the exam or not) and the score (if finished) along with the user-name of the student. Again I am telling that this is one of my first codes so this may not be helpful in learning , but look through it to know how it works .(P.S : The design is very simple and not attractive). As this is very simple sql structure you can make a database named “objective” and import this code into that using phpmyadmin.If you need information about the installation of the servers please refer to my first post .
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `objective`
--
-- --------------------------------------------------------
--
-- Table structure for table `accounts`
--
CREATE TABLE IF NOT EXISTS `accounts` (
`username` varchar(64) NOT NULL,
`password` varchar(64) NOT NULL,
`attrib` int(11) NOT NULL,
`answered` varchar(1) NOT NULL,
`correct` int(11) NOT NULL,
`locked` varchar(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `questions`
--
CREATE TABLE IF NOT EXISTS `questions` (
`auto_ID` int(10) unsigned NOT NULL auto_increment,
`ques` varchar(64) NOT NULL,
`opt_1` varchar(64) NOT NULL,
`opt_2` varchar(64) NOT NULL,
`opt_3` varchar(64) NOT NULL,
`opt_4` varchar(64) NOT NULL,
`opt_ans` int(11) NOT NULL,
PRIMARY KEY (`auto_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
Also me and my friends are planning to do this from scratch using PHP .We are thinking of having a server with admin module and we will be having specific time for each exam. Also i am planning to design it well so that it does not look boring (
) .This will be using AJAX .So again a new area to learn . We will try to make it interactive . Also we are planning to do have a page for the admin , in which he can upload the question (may be in .csv or .sql format not yet decided). Once it is ready i will be posting about that .
Comments awaited
Sourcecode : here
As my 5th semester COP (Computer Oriented Project) I took some of the PHP development(with MySQL database) oriented project which is based on CMS . This is one of the first developments by me. I am not saying that this will help someone learning PHP . But a beginner (or who knows nothing about PHP) can understand the code and the total working process if he takes a close look at it. It is just a code which authenticates a user and allows him to give feedback on different subjects that he wants to .So this application is as simple as just getting the input from a end user and inserting the record to a database in the server . In this i used $_SESSION variables to store the session data of the user to use it in different pages . Also i have taken care so that the user can not submit the same feedback (intentionally or by mistake by pressing the submit button twice). This can be seen in submit.php file. This i am achieving by setting the $alreay_once flag to 1 if the same post has been submitted.
For trying this what you do is install LAMP-Server (in Linux platforms) or install any servers wamp,xampp(in Windows platforms) . It can be done by sudo apt-get install lamp-server^ in Linux platform or do a sudo tasksel in your terminal and installing from there. For windows users you can find the binary for installation of wamp server here.
Then you need to create the tables for the storage of the data in the MySQL database.So just login to your mysql console with proper privilege.Then create a database named ‘feedback’ using CREATE DATABASE feedback; in the database. Then type the following blocks one-by-one or just save it in a text file and import it in phpmyadmin.
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `feedback`
--
-- --------------------------------------------------------
--
-- Table structure for table `accounts`
--
CREATE TABLE IF NOT EXISTS `accounts` (
`username` varchar(64) NOT NULL,
`password` varchar(64) NOT NULL,
`attrib` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-- --------------------------------------------------------
--
-- Table structure for table `main`
--
CREATE TABLE IF NOT EXISTS `main` (
`username` varchar(64) NOT NULL,
`subject` varchar(600) NOT NULL,
`comment` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Now the sql part is done.Then you copy the feedback folder (the sourcecode in the begining) to your /var/www/ directory ( In Linux platforms ) or your document root directory (in Windows ) . Then you need to go to the feedback/config folder. And need to change the variables $db_user and $db_password to your actual mysql root user username and password.Now you are done with your settings. Now you need to test if it is working or not. So just open up your browser and go to the address http://localhost/feedback or http://127.0.0.1/feedback to check the site. Enjoy manipulating and testing or using it for your needs . Thank you . Please pass comments
N.B :In the MySQL database the attrib column is used to differentiate between the administrator and normal users . its value=2 means its admin and 1 means its normal user.
This may not be efficient because it is my very first PHP development and i have not looked into it after finishing it. So please feel free to modify it and use it as per your needs.
And please suggest me a proper site for file uploading .
Recent Comments