College Forum
College Forum
Project report submitted in partial fulfillment of the requirement of the award of the
Degree of Bachelor of Technology
By
D.NAVEEN KUMAR DINESH RAJ
DINESH
07B81A0554 07B81A0523
07B81A0522
Department of Computer Science and
Engineering
CVR COLLGE OF ENGINEERING
(Affiliated to the JNT University, Hyderabad)
Mangalpally, Ibrahimpatnam
College Forum
CVR COLLEGE OF
ENGINEERING
VastuNagar, Mangalpally, Ibrahimpatnam-500 039, A.P.
(Affiliated to Jawaharlal Nehru Technological University)
Ph 08413-233355, 233672,Fax08413-232760.
Website www.cvrce.ac.in, [email protected]
CERTIFICATE
This is to certify that the project report entitled “College
Forum” being submitted by D.Naveen Kumar (07B81A0554), Dinesh Raj
(07B81A0523), Dinesh (07B81A0522) in partial fulfillment for the award of the Degree
of Bachelor of Technology in Computer Science and Engineering to the Jawaharlal
Nehru Technological University is a record of bonafide work carried out by them under
my guidance and supervision. The results embodied in this project report have not been
submitted to any other University or Institute for the award of any Degree or Diploma.
Head of the Department, CSE Guide
(Prof LC Siva Reddy, Professor & Head, CSE Dept.) (Mr P Manjunath, Asst Professor)
College Forum
CVR COLLEGE OF ENGINEERING
VastuNagar, Mangalpally, Ibrahimpatnam-500 039, A.P.
(Affiliated to Jawaharlal Nehru Technological University)
Ph 08413-233355, 233672,Fax08413-232760.
Website www.cvrce.ac.in,
[email protected] ACKNOWLEDGEMENT
The present project work is the culmination of our efforts made in understanding the
various aspects of “COLLEGE FORUM”. I would like to acknowledge and convey my
gratitude to all the individuals who worked behind the screens in making this endeavor, all the
more successful.
I take the opportunity to thank our guide, Mr P Manjunath, Asst Professor for his
relentless guidance and continuous encouragement ever since the dawn of the project work. I am
fully indebted to his immense patience and sapient advices without which no worthwhile
progress could have been made.
I would also like to convey my sincere thanks to PROF LC SIVA REDDY ,Head of
our department for his constant supervision and advice which immensely helped us to
complete the project work successfully.
College Forum
TABLE OF CONTENTS
1.Literature Survey…….……………………………………………………..……….….6
1.1. Overview…….………………………………………………………..……….….7
1.2. Types of users …………………………..…………………………..……………..8
2.Software requirements specification…………………………………..……………10
3. Design………………………………………………………………………..……………..12
3.1. Introduction to UML…….……………………………………………………….13
3.2. UML Diagrams…….………………………………………………………….......16
4. Implémentation……………… …………………………………………………….…...27
4.1. Code…………………………………………………………………...……….…..27
5. Testing…………………………………………………………………………...……..…..40
5.1. Introduction………………………………………………………….………..…..41
5.2 Test Cases……………………………………………………….……………….....42
6. Conclusion and Enhancemen………………………………………...……………….42
8. Bibliography ……………………………………………………………….……….….42
9. Appendix…………………………………………………………………………….….….42
College Forum
Chapter 1
Literature survey
College Forum
1. Literature survey
1.1 Overview
• Forum for college.
• Separate section for each branch.
• Separate section for each club.
• Shoutbox for the users to chat with each other.
• Notifications scrolling on the main page.
• 3 types of users
-Admin (privilege level -1)
-Moderator (privilege level -2)
-Normal User (privilege level -3)
1.2 Types of users
ADMIN:-
-Has privilege level of 1.
-Controls the database.
-Responsible for maintaining tables.
College Forum
-Can create topics & reply to posts.
-Controls posts made by users.
-Can chat with other members in the shoutbox.
-Assigns moderator level to few users.
-Can change member details.
-Can ban and unban users when they spam and abuse and use indecent language.
-Can remove a user from the forum.
-Can block a user having a specific IP address from logging in.
-Controls the contents of notifications scrolling on the main page.
MODERATOR
• Has privilege level of 2.
• Can delete topics created by users.
• Can create topics & reply to posts.
• Can chat with other members in the shoutbox.
• Doesn’t have access to ADMIN panel.
NORMAL USERS
• Has a privilege level of 3.
• Can register & login.
• Can create topics & reply to posts.
• Can chat with other members in the shoutbox.
College Forum
• Can view other users profile details.
Chapter 2
Software Requirements
Specification
College Forum
College Forum
2.1 Introduction
This supplementary specification document specifies the requirements for
the college forum .The College forum is for all the students of the college to interact with each
other and make posts .It is controlled my administrator and moderator and the users make use of
the forum. The Supplementary Specification captures the system requirements that are not
readily captured in the use cases of the use-case model. It includes Quality attributes of the
system to be built including usability , reliability ,performance and supportability requirements.
It also includes other requirements such as operating systems and environments, capability
requirements and design constraints.
2.1.1 Purpose
The Supplementary Specification captures the system requirements that are
not readily captured in the use cases of the use-case model. It includes Quality attributes of the
system to be built including usability , reliability ,performance and supportability requirements.
It also includes other requirements such as operating systems and environments, capability
requirements and design constraints
2.1.2 Scope
The Supplementary Specification refers to the College Forum .This forum is
for all the students of college .Every branch has got a section for their branch discussions .Every
student needs to have an account in the site ,failing to which hes not authorized to participate in
any sites. This specification defines the non-functional requirements of the system; such as
reliability, usability, performance, and supportability as well as functional requirements that are
common across a number of use cases. (The functional requirements are defined in the Use Case
Specifications.)
2.1.3 References
• www.w3schools.com
• www.tizag.com
College Forum
2. 2 Functionality
This section describes the functional requirements of the system for those
requirements which are expressed in the natural language style. Functional requirements are
captured via the defined use cases.
2.3 Usability
• The users should have basic knowledge on how to use browser .
• Moderators should be trained by the administrator on various privileges given to
them.
• Administrator should have complete knowledge about the coding and working.
2.4 Reliability
• Availability – The server is available for 24 hours every day will be unavailable
for a couple of hours every month due to maintenance work.
Note: We can build the software such that MTTR will be less, MTBF will be high and
the accuracy will be very high.
2.5 Performance
The performance characteristics are:
• Many number of students can access the site and can actively participate
concurrently.
• Response time for the query is in the order of 10-3 to 10-4 secs and depends on the
browsing speed for the display of result to the user.
• Resource Utilization- Memory for storing database , keyboard to enter data ,
monitor to display the content.
2.6 Supportability
Adobe Dreamweaver and a text editor for creating web pages and writing PHP code.
College Forum
2.7 Design Constraints
• Adobe Dreamweaver – For creating and editing CSS sheets.
• Notepad or wordpad – For entering PHP code.
• Easy PHP – To run the server for running php code.
• MySQL- Included with EasyPHP for performing queries on database.
• HTML Language – To create web pages.
• CSS- Cascading style sheets to enhance the webpages.
• PHP language – To write the code .
2.8 Purchased Components
Adobe Dreamweaver CS4
2.9 Interfaces
• User Interfaces- Microsoft GUI standards .
• Software Interfaces- EasyPHP to connect PHP with the MySql database.
• Communications Interfaces- A server to which many systems get connected.
10. Licensing Requirements
No licenses are required.
College Forum
Chapter 3
Design
College Forum
3.Design
3.1 Introduction to UML
The Unified Modeling Language (UML) is an open method used to specify,
visualize, modify, construct and document the artifacts of an object-oriented software
intensive system under development.
Structure diagrams
Structure diagrams emphasize what things must be in the system being modeled
Behavior diagrams
Behavior diagrams emphasize what must happen in the system being modeled
Activity diagram represents the business and operational step-by-step workflows of
components in a system. An activity diagram shows the overall flow of control.
Since behaviour diagrams illustrate the behaviour of system, they are used
extensively to describe the functionality of software systems.
Interaction diagrams
Interaction diagrams, a subset of behavior diagrams, emphasize the flow of
control and data among the things in the system being modeled
College Forum
Sequence diagram shows how objects communicate with each other in terms of a
sequence of messages. Also indicates the lifespans of objects relative to those
messages.
College Forum
Actor Catalog
Name Description
User The user can perform four functions:-
1)He can register, login and logout
2)He can add topics and reply to others posts
3)He can delete his account
4)He can chat with other users who are online
Moderator The moderator can perform the following functions:-
1)He can log in and log out from the forum
2)He can remove any posts or comments irrespective of
who has posted.
3) He can add topics and reply to others posts
Administrator The administrator has following functions:-
1)Update the forums table fields like add post, remove
post ,register, etc
2)He will check for any errors in the database
3)Selects moderators
4)Maintains the forum
Database Management Tool Database Administrator has following functions:-
1)It will check whether the username already exists
2)Inserts content into the tables
3)Deletes the desired content from the tables
4)Updates the database
College Forum
Use Case Diagram For College Forum:
Register
<<include>>
<<include>>
Login
<<include>>
<<include>>
User Add Topic
Update Databse
<<include>>
Change Password
Admin <<include>>
Student
Mod
Edit Profile
Ban user
Unban user Remove Topic
College Forum
Use Case Catalog:
Register:-
Brief Description-
This use case deals with the registration of students. It adds a user to the user database
only if the username is not already taken.
Sequence diagram for LOGIN:
Console Database
User : <Actor
Name>
Select Register
Enter all details
Enter details
Validate details
Check whether username alreadyexists
Successfulle Registered
Login to enter forum
College Forum
Login:-
Brief Description-
This use case checks whether the user is a valid user by checking the username and
password by comparing the entered details with that in the database and allows the user to login
only if they both match and a session is started.
Logout:-
Brief Description-
This use case ends the session of a particular session when a user wishes to logout.
Add Post:-
Brief Description-
This use case allows a user or a moderator to add a post in the forum , when he does this
then this use case inserts an entry into the database tables.
Remove Post:-
Brief Description-
This use case allows the user or moderator to remove a comment that they have posted,
when this is implemented then that entry is deleted from the database table.
College Forum
Sequence diagram for performing operations and logging out:
Console Database
User : <Actor
Name>
Click on LOGIN
Load LOGIN page
Enter username and password
Validate details
Check for username and corresponding password
Correct details
Successfully logged in
Select some operation
Select LOGOUT
Successfully logged out
College Forum
Delete user:-
Brief Description-
This use case removes the user from the table of registered users and updates the table.
Change Password:-
Brief Description-
This use case allows the registered users to change their password ,this use case asks the
user for existing password n new password .New password is updated in the user details only if
the existing password is correct.
College Forum
Register Use Case
1 . Brief Description
This use case deals with the registration of students .It adds a user to the user database
only if the username is not already taken
2. Basic Flow of Events
1) Enter the username ,password, email id and branch.
2) Check whether all the fields have been entered else go to F1.
3) Add the user to the database if the username is not already taken else go to F2.
4) Passwords must be kept secure.
3. Alternative Flows
F1) Notify the user to enter all the fields.
F2) Prompt the user to select another username.
4. Preconditions
The user should select unique password.
5. Post conditions
The user account should be correctly created
6. Special Requirements
The password generated should be secure, i.e the password field should be accessed only
by the administrator but not by any person.
College Forum
Login Use Case
1 . Brief Description
This use case checks whether the user is a valid user by checking the username and
password by comparing the entered details with that in the database and allows the user
to login only if they both match and a session is started.
2. Basic Flow of Events
1) Enter the username and password in the login form.
2) Check whether the password is correct else go to F1.
3) User is logged in and session is started
4) Session is ended when user logs out.
3. Alternative Flows
F1) User is given 2 more chances for entering correct username and password.
4. Preconditions
The user should have an account.
5. Post conditions
Restrictions are imposed on each user based on privileges.
6. Special Requirements
Administrator and moderator has control over the user.
College Forum
Logout Use Case
1 . Brief Description
This use case ends the session of a particular session when a user wishes to logout.
2. Basic Flow of Events
1) User clicks the logout button.
2) Session of the user is ended.
3) User is asked again whether he wants to log in.
3. Preconditions
The user should be logged in.
4. Post conditions
Session of the user should be ended.
5. Special Requirements
Administrator and moderator has control over the user.
College Forum
Add Post Use Case
1 . Brief Description
This use case allows a user or a moderator to add a post in the forum , when he does this
then this use case inserts an entry into the database tables.
2. Basic Flow of Events
1) Enter the username and password in the login form.
2) Check whether the password is correct else go to F1.
3) User is logged in and session is started
4) User selects add post option.
5) System provides a text field to enter text.
6) After user clicks submit button , the data is stored in the database.
3. Alternative Flows
F1) User is given 2 more chances for entering correct username and password.
4. Preconditions
The user should be logged in.
5. Post conditions
Restrictions are imposed on each user based on privileges and they cant delete other user
posts.
6. Special Requirements
Administrator and moderator has control over the user.
College Forum
Remove Post Use Case
1 . Brief Description
This use case allows the user or moderator to remove a comment that they have
posted ,when this is implemented then that entry is deleted from the database table.
2. Basic Flow of Events
1) Enter the username and password in the login form.
2) Check whether the password is correct else go to F1.
3) User is logged in and session is started
4) User selects remove post option.
5) The post is removed from the forum if it was posted by the user else go to F2.
6) Database is updated
3. Alternative Flows
F1) User is given 2 more chances for entering correct username and password.
F2) System prompts the user saying that the post was not posted by the user.
4. Preconditions
The user should be logged in.
5. Post conditions
The post is deleted from the database table and the database is updated.
6. Special Requirements
Administrator and moderator has control over the user.
College Forum
Remove User Use Case
1 . Brief Description
This use case removes the user from the table of registered users and updates the table.
2. Basic Flow of Events
1) Admin selects the user.
2) He deleted the users entry from users table in the database if he is found else go to F1.
3) Then the database is saved.
4) User cannot login unless he is registered again.
3. Alternative Flows
F1) System prompts that the user is not existing.
4. Preconditions
User should be present.
5. Post conditions
Users table in database is updated after deleting the users entry.
6. Special Requirements
Administrator and moderator has control over the user.
College Forum
Change Password Use Case
1 . Brief Description
This use case allows the registered users to change their password , this use case asks
the user for existing password n new password. New password is updated in the user details only
if the existing password is correct.
.2. Basic Flow of Events
1) User enters username and password
2) If correct details are entered the user is logged in or else go to F1.
3) User selects Change Password option.
4) User enters the new password and re-enters new password.
5) If both passwords match update new password else go to F2.
3. Alternative Flows
F1) User is given two more chances to login.
F2) System prompts the user to enter correct password.
4. Preconditions
User should be logged in.
5. Post conditions
Users table in database is updated after changing the password.
6. Special Requirements
Administrator and moderator has control over the user.
College Forum
Chapter 4
Implementation
College Forum
4.Implementation
4.1 Code
Connecting to a database
<?php
mysql_connect(“HOSTNAME",“USERNAME",“PASSWORD");
mysql_select_db(“DBNAME") or die ("Cannot connect to the database");
?>
Ex:-
<?php
mysql_connect("localhost","root","");
mysql_select_db("main") or die ("Cannot connect to the database");
?>
Starting and ending a session
session_start();
session_destroy();
Executing a query
$sql = "select count(*) from forum_question where catid='$ctid'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
College Forum
Home page of college forum
College Forum
Registration page
$username=$_POST["username"];
$name=$_POST["name"];
$password=$_POST["password"];
$rpassword=$_POST["rpassword"];
$branch=$_POST["branch"];
$email=$_POST["emailid"];
$day=$_POST["day"];
$month=$_POST["month"];
$year=$_POST["year"];
if($_POST["gender"]=="y")
{ $gender="m"; }
else
{ $gender="f"; }
mysql_query("insert into user VALUES
('','$username','$name','$branch','$gender','$date','$password','$email','3','','$added')");
College Forum
LOGIN PAGE
Log in
$sql="select * from user where username='$uname' and password='$pass'";
$result=mysql_query($sql);
Log out
session_start();
$uname=$_SESSION["username"];
mysql_query("delete from member_log
where username='$uname'");
if(isset($_SESSION['loggedin']))
{
unset($_SESSION['loggedin']);
session_destroy();
}
College Forum
CATEGORIES
College Forum
TOPICS
$catid=$_GET["catid"];
$query="select * from forum_question where catid='$catid' ORDER BY replies DESC";
$result=mysql_query($query);
$count=mysql_num_rows($result);
$num=$count;
$i=0;
while ($i < $num)
{ //begin while
$id=mysql_result($result,$i,"id");
$topic=mysql_result($result,$i,"name");
$detail=mysql_result($result,$i,"detail");
.
.
$added=mysql_result($result,$i,"added");
$i++;
College Forum
Replying to topics
College Forum
Shout Box
<iframe src="sb2.php" width="100%" height="210" frameborder="0" name="sb"></iframe>
<iframe src="sbtext.php" width="100%" height="70" frameborder="0"></iframe>
College Forum
ADMIN FEATURES
BAN & UNBAN
Banning user
$sql="select * from member_log where username='$uname'";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
$ip=$rows['ip'];
$timer=time();
$sql="insert into ban_user values('$uname','$timer','$timer'+86400,'$ip','$reason')";
mysql_query($sql);
echo $uname." is banned";
College Forum
Checking banned or unbanned
$rows=mysql_fetch_array(mysql_query("select * from ban_user where username='$uname'"));
if(mysql_num_rows(mysql_query("select * from ban_user where username='$uname'"))
&& time()<$rows["unbantime"])
{
// $rows=mysql_fetch_array(mysql_query("select * from ban_user where
username='$uname'"));
header ('Location: banbody.php'); exit();
}
College Forum
Add & remove mods
College Forum
Chapter 5
Testing
College Forum
5. Testing
5.1 Introduction
Unit testing - Testing of individual software components or modules. Typically
done by the programmer and not by testers, as it requires detailed knowledge of the
internal program design and code. may require developing test driver modules or test
harnesses.
Integration testing - Testing of integrated modules to verify combined
functionality after integration. Modules are typically code modules, individual
applications, client and server applications on a network, etc. This type of testing is
especially relevant to client/server and distributed systems.
System testing - Entire system is tested as per the requirements. Black-box type
testing that is based on overall requirements specifications, covers all combined parts of a
system.
College Forum
5.2 Test cases
Email is validated. Wont be accepted if it does not match with the regular expression.
When wrong USERNAME and PASSWORD are entered
Wrong ID or password
Or
Ur not registerd
Click here to register
When a user who is banned tries to log in gets the following error
message
College Forum
When a username is already taken
Username already taken BACK
6. Conclusion
The college forum helps the students to interact with one another and also to share
their ideas.People with similar interests can post their ideas in respective categories and other
students can help in implementing them or enhancing the ideas.Also the admin has complete
control over the users.He also controls the database of the site.This helps the students to browse
the content they are interested in rather than searching all the topics.Every user needs to get
registered in order to avail all the features.No user is allowed to post unless he logs in in the site.
7.Bibliography
• ^ PHP/FI release announcement, dated 1995-06-08. Retrieved 2010-07-27.
• ^ Lerdorf, Rasmus (1995-06-08). "Announce: Personal Home Page Tools (PHP
Tools)". comp.infosystems.www.authoring.cgi. (Web link).
• ^ "PHP Server-Side Scripting Language". Indiana University. 2007-04-04.
http://webmaster.iu.edu/PHPlanguage/index.shtml. Retrieved 2008-02-25.
• ^ "Embedding PHP in HTML". O'Reilly. 2001-05-03.
http://www.onlamp.com/pub/a/php/2001/05/03/php_foundations.html. Retrieved
2008-02-25.
• ^ "PHP and MySQL". University of Alabama. http://cs.ua.edu/457/Notes/PHP
%20and%20MySQL.ppt. Retrieved 2008-02-25.
College Forum
• ^ "History of MySQL, MySQL 5.1 Reference Manual". MySQL AB.
http://dev.mysql.com/doc/refman/5.1/en/history.html.
• http://www.w3.org/TR/html401/conform.html#deprecated
• ^ "Index of elements in HTML 4". World Wide Web Consortium.
• http://httpd.apache.org/ABOUT_APACHE.html
8. Appendix
Appendix A - How to execute the software
1. Install EasyPHP 2.0
2. Create the database named “main” with the required tables.
3.Right click on EasyPHP > Local Web > click on project
Appendix B - How to use software
1. The new user first has to enter register in the forum
2. User has to log in.
3. User can see the topics and posts.
4. User can chat with other users or comment on topics.