Sie sind auf Seite 1von 59

About L&T InfoTech:

L&T InfoTech is one of the most famous Indian


software companies that employ standards of the Software
Engineering Institute's Capability Maturity Mode. Originally
founded as L&T Information Technology Ltd (LTITL), a
wholly-owned subsidiary of Larsen & Toubro Ltd (L&T), the
company changed its name to L&T InfoTech on 1 April,
1997. In 2004, it tied up with Fidelity Information Services,
a division of Fidelity National Financial to provide banking
solutions for the Indian banking industry. In 2005, L&T
InfoTech was rated amongst the top 5 preferred employers
for the class of 2005 by AC Nielsen.
In December 2006, L&T InfoTech acquired GDA
Technologies (a privately held electronic design firm based
in California, USA) and all of its design centers in USA and
India, for an undisclosed consideration. In April 2007, The
Economic Times reported that L&T InfoTech Ltd. is looking
to buy three to four firms with revenues of $50 million or
less in the banking and financial services segment. In
February 2008, L&T InfoTech stated that it will acquire a
US firm in the manufacturing vertical for about $300
million within a year. L&T InfoTech has recently signed
Global Partnership with SAP.
Larsen & Toubro Limited (L&T) is a technology,
engineering, construction and manufacturing company. It
is one of the largest and most respected companies in
India's private sector. Seven decades of a strong,
customer-focused approach and the continuous quest for
world-class quality have enabled it to attain and sustain
leadership in all its major lines of business. L&T has an
international presence, with a global spread of offices. A
thrust on international business has seen overseas
earnings grow significantly. It continues to grow its
overseas manufacturing footprint, with facilities in China
and the Gulf region. The company's businesses are
supported by a wide marketing and distribution network,
and have established a reputation for strong customer
support.
L&T believes that progress must be achieved in
harmony with the environment. A commitment to
community welfare and environmental protection are an
integral part of the corporate vision.

Project Synopsis:
The project is titled “Designer’s Forum”. An Internet
forum, or message board, is an online discussion site. It
originated as the modern equivalent of a
traditional bulletin board, and a technological evolution of
the dialup bulletin board system. From a technological
standpoint, forums or boards are web
applications managing user-generated content. People
participating in an Internet forum may cultivate social
bonds and interest groups for a topic may form from the
discussions.
This is one of the modules in a full fledged functional
webpage/database of a multinational company managing
many services. This is related to the construction services
provided by the company and is a website forum built for
the help of the designers in and outside of the company.
This site maintains a Forum and not only a forum but also a
database of all talented designers in the world. This serves
as a platform in sharing the ideas with the Design Manager
of the company through the discussion board and also
gives tips and ideas to get improved in the forum. Talented
designers are even allowed to upload their design on this
site which on the review of the Design Manager will be
selected and those of the best designs will be contacted for
an interior designing project from the company.
Rules on forums usually apply to the entire user body
and often have preset exceptions, most commonly
designating a section as an exception. For example, in
an IT forum any discussion regarding anything but
computer programming languages may be against the
rules. When rules are broken several steps are commonly
taken. First a warning is usually given; this is commonly in
the form of a private message but recent development has
made it possible for it to be integrated into the software.
Subsequently, if the act is ignored and warnings do not
work, the member is – usually – first exiled from the forum
for a number of days. Denying someone access to the site
is called a ban (as in "you have been banished"). Bans can
mean the person can no longer log in or even view the site
anymore. If the offender, after the warning sentence,
repeats the offense, another ban is given, usually this time
a longer one. Continuous harassment of the site eventually
leads to a permanent ban. However, in most cases this
simply means the account is locked. Offending content is
usually deleted. Sometimes if the topic is considered the
source of the problem, it is locked; often a poster may
request a topic expected to draw problems to be locked as
well, although the moderators decide whether to grant it.
In a locked thread, members cannot post anymore. In
cases where the topic is considered a breach of rules it –
with all of its posts – may be deleted.

Project Description:
This is a webpage designed as a part of all the services
done by a MNC. This belongs to the Designers section
where a company is responsible to provide interior
designing service outsourcing. This site is maintained by
the administrator in the company. This site is mainly a
structured Forum in which there is a discussion on panel
between the Design Manager in the company with various
designers all over the world. The admin has a separate
module and the users have a separate module. The users
being designers have to register before using this site and
started to posting. While they register they should provide
their company name and contact details. On verification by
executives in the company their log-on is allowed and they
become a member in the forum. They will be able to
discuss various design ideas and suggestions with the
manager in the panel. Most importantly they will be
allowed to upload their designs online where the manager
can view it. If the designs are selected the respective
designer or the company is contacted for the MNC project.
Each user will have their own login and view only their own
photo database because of privacy. The message board is
common to all the users and they can view it only if they
login. The communication between the manager and the
designers is done through private mails sent form this
website. The users have been given a contact form for the
submission of any query to the MNC. The images can be
uploaded only if he is approved member of the forum.
The admin has privileges to view all the photos
categorized by the name of the users, to approve and
disapprove a user, to delete unwanted posts, users and
photos, and send any anonymous mail to the users. The
admin is able to ban the users by simple deleting of their
accounts and sending them a mail. If in more adverse
conditions he may need to set a IP ban incase they login
via another account as a new user. He may also see the
report of all the messages updated up to date, all the mails
sent and who are all the users in this forum. The users are
not allowed to send anonymous mails.
The user has privileges only to view their own gallery
and edit their own information in the database. They can
view the message board for common, and they have a
facility to contact the admin or the Manager whoever
maintains this site and database on this site.

Some of its significant features are:


 Program package is quite small, so it is easy to
distribute.
 Data can be easily extracted from the database,
without any conflict.
 The webpage and forum is user friendly and easy to
operate.
 The data is secure and the whole page is password
protected. Appropriate use of sessions and cookies has
been made.
 This can be easily installed on any computer having
PHP and ACCESS.
 Executions of all the features in the web pages are
very clear and needs no guidance. It’s even easy to
maintain.
 The design is user friendly and feasible to the viewers.
 There is no complexity in the operations of the features
in the page.

The users are been delivered the following pages for the
usage of the webpage:

 A “register first” page where he can register his usage


info and company details.
 A login screen to access the benefits and features in
this site.
 An interface where he can upload his designes/photos.
 An interface where he is able to contact the
administrator.
 An interface where he is able to post messages to
communicate with other users.
 A common message board where he can see all the
post posted by various users.

Existing System:
One of the major challenges faced by many of the
organizations and companies are recruiting candidates
who are talented and efficient. This needs announcement
of dates for interviews and contacting the candidates and
sending mails etc,. Even then there arises a great difficulty
by having interviews and filtering the candidates. On the
other hand there is no communication existing between
the candidates and the management and so the
management doesn’t know the nature and talents of the
candidates even at the time of the interview. Only after a
months work, they will come to know the potential of the
candidate. And even there may be not strong
communication between the candidates so that they can
exchange ideas amongst themselves for strengthening
their career. It is impossible to make friends, get their mail
ids, fix a time and chat, or send and respond to mails in the
busy schedules of student’s lives.

Proposed System:
This system is specifically designed to overcome the
drawbacks of the existing system. The answer to all of the
problems above is a Forum, message board or a blog. In
this system, the candidates will allowed to post a message
and the other can view it and reply it whenever he gets
time to it and the most important idea of creating this
forum is that it is available to public and thus everyone
who is interested in the topic can share their ideas and
gain knowledge out of it. It serves as a pool of information.
In this system there is a communication with the
management in the company wherein they monitor the
post and uploaded works of the candidates and thus send a
intimation to those talented candidates who are worth for
the job at their company. People participating in an
Internet forum may cultivate social bonds and interest
groups for a topic may form from the discussions.

Hardware configuration:
Processor : P4 with minimum 1.0 GHz
RAM : 256 MB
Hard Memory: Minimum 10 GB

Software configuration:

Operating System : Windows XP, Vista


Web Server : Apache, Wamp or Xamp
RDBMS : MS Access
Languages : PHP, javaScript
Web Browser : Internet Explorer 6.0, Mozilla Firefox,
Google Chrome.

JavaScript:

JavaScript is an object-oriented scripting


language used to enable programmatic access to objects
within both the client application and other applications. It
is primarily used in the form of client-side JavaScript,
implemented as an integrated component of the web
browser, allowing the development of enhanced user
interfaces and dynamic websites. JavaScript is a dialect of
the ECMA Script standard and is characterized as
a dynamic, weakly typed, prototype-based language
with first-class functions. JavaScript was influenced by
many languages and was designed to look like Java, but to
be easier for non-programmers to work with.
The primary use of JavaScript is to write functions that
are embedded in or included from HTML pages and interact
with the Document Object Model (DOM) of the page. Some
simple examples of this usage are:
 Opening or popping up a new window with

programmatic control over the size, position, and


attributes of the new window (e.g. whether the menus,
toolbars, etc. are visible).
 Validation of web form input values to make sure that

they will be accepted before they are submitted to the


server.
 Changing images as the mouse cursor moves over

them: This effect is often used to draw the user's


attention to important links displayed as graphical
elements.

Because JavaScript code can run locally in a user's


browser (rather than on a remote server) it can respond to
user actions quickly, making an application feel more
responsive. Furthermore, JavaScript code can detect user
actions which HTML alone cannot, such as individual
keystrokes. Applications such as Gmail take advantage of
this: much of the user-interface logic is written in
JavaScript, and JavaScript dispatches requests for
information (such as the content of an e-mail message) to
the server. The wider trend of Ajax programming similarly
exploits this strength.

HTML:

HTML, which stands for Hyper Text Markup Language,


is the predominant markup language for web pages. It
provides a means to create structured documents by
denoting structural semantics for text such as headings,
paragraphs, lists etc as well as for links, quotes, and other
items. It allows images and objects to be embedded and
can be used to create interactive forms. It is written in the
form of HTML elements consisting of "tags" surrounded
by angle brackets within the web page content. It can
include or can load scripts in languages such
as JavaScript which affect the behavior of HTML processors
like Web browsers; and Cascading Style Sheets (CSS) to
define the appearance and layout of text and other
material. The W3C, maintainer of both HTML and CSS
standards, encourages the use of CSS over explicit
presentational markup. Hyper Text Markup Language
(HTML) is the encoding scheme used to create and format
a web document.

PHP:
PHP, or PHP: Hypertext Preprocessor, is a widely used,
general-purpose scripting language that was originally
designed for web development, to produce dynamic web
pages. It can be embedded into HTML and generally runs
on a web server, which needs to be configured to process
PHP code and create web page content from it. It can be
deployed on most web servers and on almost every
operating system and platform free of charge. PHP is
installed on over 20 million websites and 1 million web
servers. PHP is free software released under the PHP
License, which is incompatible with the GNU General Public
License (GPL) because of restrictions on the use of the
term PHP. PHP has evolved to include a command line
interface capability and can also be used instand
alone graphical applications. PHP is a general-purpose
scripting language that is especially suited for web
development. PHP generally runs on a web server. Any PHP
code in a requested file is executed by the PHP runtime,
usually to create dynamic web page content. It can also be
used for command-line scripting and client-
side GUI applications. PHP can be deployed on most web
servers, many operating systems and platforms, and can
be used with many relational database management
systems. It is available free of charge, and the PHP Group
provides the complete source code for users to build,
customize and extend for their own use.
PHP primarily acts as a filter, taking input from a file or
stream containing text and/or PHP instructions and outputs
another stream of data; most commonly the output will be
HTML. Since PHP 4, the PHP parser compiles input to
produce bytecode for processing by the Zend Engine,
giving improved performance over
its interpreter predecessor.
Originally designed to create dynamic web pages, PHP
now focuses mainly on server-side scripting, and it is
similar to other server-side scripting languages that
provide dynamic content from a web server to a client,
such as Microsoft's Active Server Pages, Sun Microsystems'
Java Server Pages, and mod perl. PHP has also attracted
the development of many frameworks that provide building
blocks and a design structure to promote rapid application
development (RAD). Some of these
include CakePHP, Symfony, CodeIgniter, and Zend
Framework, offering features similar to other web
application frameworks.
The LAMP and WAMP architectures have become
popular in the web industry as a way of deploying web
applications. PHP is commonly used as the P in this bundle
alongside Linux, Apache and MySQL, although the P may
also refer to Python or Perl.

MS Access:

Microsoft Access is used by programmers and non-


programmers to create their own
simple database solutions. Access tables support a variety
of standard field types, indices, and referential integrity.
Access also includes a query interface, forms to display
and enter data, and reports for printing. The underlying Jet
database, which contains these objects, is multiuser-
aware and handles record-locking and referential integrity
including cascading updates and deletes.
Microsoft offers a wide range of template databases
within the program and for download from their website.
These options are available upon starting Access and allow
users to quickly use and enhance a database with pre-
defined tables, queries, forms, reports, and macros.
Popular templates include tracking contacts, assets, issues,
events, projects, and tasks. Templates do not
include VBA code.
Microsoft Access' role in web development is
limited. User interface features of Access, such as forms
and reports, only work in Windows. The Microsoft Jet
Database Engine, core to Access, can be accessed through
technologies such as ODBC or OLE DB. The data (i.e.,
tables and queries) can be accessed by web-based
applications developed in ASP.NET, PHP, or Java.
Many ISPs offer Microsoft Access as a data storage option.
Microsoft Access' role in web development is
limited. User interface features of Access, such as forms
and reports, only work in Windows. The Microsoft Jet
Database Engine, core to Access, can be accessed through
technologies such as ODBC or OLE DB. The data (i.e.,
tables and queries) can be accessed by web-based
applications developed in ASP.NET, PHP, or Java.
Many ISPs offer Microsoft Access as a data storage option.
Microsoft Access offers parameterized queries. These
queries and Access tables can be referenced from other
programs like VB6 and .NET through DAO or ADO. From
Microsoft Access, VBA can reference parameterized stored
procedures via ADO.
The desktop editions of Microsoft SQL Server can be
used with Access as an alternative to the Jet Database
Engine. This support started with MSDE (Microsoft SQL
Server Desktop Engine), a scaled down version of Microsoft
SQL Server 2000, and continues with the SQL Server
Express versions of SQL Server 2005 and 2008.
Microsoft Access is a file server-based database.
Unlike client-server relational database management
systems (RDBMS), Microsoft Access does not
implement database triggers, stored procedures,
or transaction logging. Access 2010 (not released) does
have table level triggers and stored procedures built into
the ACE data engine.

WAMP Server Usage:

WAMP is a form of mini-server that can run on almost


any Windows Operating System. WAMP includes Apache
2, PHP 5 (SMTP ports are disabled), and MySQL
(phpMyAdmin and SQLitemanager are installed to manage
your databases) preinstalled. An icon on the taskbar tray
displays the status of WAMP, letting you know if; a)
WAMP is running but no services are opened (the icon
will appear red), b) WAMP is running and one service is
opened (the icon will appear yellow) or c) WAMP is
running with all services opened (the icon will appear
white). Apache and MySQL are considered to be services
(they can be disabled by left-clicking on the taskbar icon,
guiding your cursor over the service you wish to disable
and selecting "Stop Service"). The files/web pages that
are hosted on your WAMP server can be accessed by
typing http://localhost/ or http://127.0.0.1/ in the address
bar of your web browser. WAMP must be running in order
to access either of the above addresses.
If you would like to share your files/web pages with
others, click on the icon located on your taskbar tray and
select "Put Online." You must have access to the Internet
in order to continue.

System Testing:

System testing of software or hardware is testing


conducted on a complete, integrated system to evaluate
the system's compliance with its specified requirements.
System testing falls within the scope of black box testing,
and as such, should require no knowledge of the inner
design of the code or logic.
As a rule, system testing takes, as its input, all of the
"integrated" software components that have successfully
passed integration testing and also the software system
itself integrated with any applicable hardware system(s).
The purpose of integration testing is to detect any
inconsistencies between the software units that are
integrated together (called assemblages) or between any
of the assemblages and the hardware. System testing is a
more limiting type of testing; it seeks to detect defects
both within the "inter-assemblages" and also within the
system as a whole.
System testing is performed on the entire system in
the context of a Functional Requirement Specification(s)
(FRS) and/or a System Requirement Specification (SRS).
System testing is an investigatory testing phase, where the
focus is to have almost a destructive attitude and tests not
only the design, but also the behaviour and even the
believed expectations of the customer. It is also intended
to test up to and beyond the bounds defined in the
software/hardware requirements specification(s).

Database Design:

Database connectivity:

A database is created in Access and is stored under a


desired name in the same folder where all of the PHP files
are residing. Make a note of it since this method will be
error free and easy to access. The required tables are
developed in access and are stored in the database. In this
project we will need a table to store the usernames and
passwords, other user information and the comments. The
following are the coding in PHP to be taken note of, to get
connected to the database and do a data transfer.

$connect = odbc_connect('forum','' ,'');


$sqlst = "SELECT * FROM auth WHERE user = '$idd'";
$rs = odbc_exec($connect, $sqlst);
while(odbc_fetch_row($rs)); { }
odbc_close($connect);

Consider the above coding. Here in our project the


table name is ‘forum’. The first statement is used to give
the basic connection to the database. The odbc_connect
command is used and the database name is specified. The
second statement bears the SQL command where there is
a selection of records from the table named ‘auth’ in the
database on a condition that its value must be equal to the
specified variable. This query is now made to run in the
third statement. Odbc_exe tell it to execute the query thus
selecting all the records since a * is specified.
The fourth command odbc_fetch_row is used to read
the data in a row one by one. The required manipulations
on the data are placed inside the curly braces. After all the
operations on the data in a database is over, it is closed
promptly using the command odbc_close.

while(odbc_fetch_row($result))
{
$username = odbc_result($result,"user");
$passs = odbc_result($result,"pass");
echo "<tr>";
echo "<td> $username </td>";
echo "<td> $passs </td>";
echo "</tr>"; }

The piece of code given tells us how the data from the
access table can be processed inside the body of the while
loop. The values from the table and taken out using the
command odbc_result into another temporary variable in
the loop and made to display on the webpage using echo.
This goes on till the end of the loop which is specified
implicitly when the while loop is defined.

Forms:

A web form on a web page allows a user to enter data


that is sent to a server for processing. Web forms resemble
paper forms because internet users fill out the forms using
checkboxes, radio buttons, or text fields. For example, web
forms can be used to enter shipping or credit card data to
order a product or can be used to retrieve data.

Server-side programs can do a vast assortment of


tasks to create dynamic web sites — from authenticating a
login through, for example, Lightweight Directory Access
Protocol to retrieving and storing data in a database to
spell checking to sending e-mail — quite unlike client-side
programs. Most server-side program requests must pass
through the web server's Common Gateway Interface to
execute the program to actually perform the tasks.

The advantage of server-side over client-side is the


concentration of functionality onto one computer (the
server) instead of relying on each web browser
implementing all of the various functions the same. This
very problem is quite evident to any developer who writes
JavaScript code for multiple browsers.

Consider the following piece of code:

<FORM method='post' action='mainlogin.php'>


USERNAME : <INPUT TYPE=TEXT NAME=userid> <BR>
PASSWORD : <INPUT TYPE=password
NAME=password> <BR>
<font size="1" face="Comic Sans MS" color =
"white">
<INPUT type=submit name=submit value=' Enter '>
</FORM>

The ACTION attribute is a URL specifying the location


to which the contents of the form is submitted to elicit a
response. If the ACTION is missing, the URL for the
document itself is assumed. The way data is submitted
varies with the access protocol of the URL, and with the
values of the METHOD and ENCTYPE attributes.

The METHOD specifies variations in the protocol used


to send the form contents. It is currently restricted to GET
(the default) or POST. The attribute was introduced to
inform user agents which HTTP methods the server
supports. The values specified for the name attribute in the
<form> tag is the main for transferring data from the form
to PHP. See the following piece of code.

$submit = $_POST[submit];
$idd = $_POST[userid];
$pas = $_POST[password];

The values submitted from the form are taken by PHP


by the use of the command $_POST[value]. This means
that it is the value posted from the form. This value is
assigned to a PHP variable and the manipulations on that
data are done with the use of that initialized variable. Even
the command $_POST[value] can be used directly in place
of the PHP variable.

A sample dataflow:

Have a look at the following piece of code which is the


complete code for the login page of the project. All the
above pieces of code have been fixed together and thus
forms a flow as indicated below.

Form WebPHP
page Database
<?php

$connect = odbc_connect('forum','' ,'');


$submit = $_POST[submit];
$idd = $_POST[userid];
$pas = $_POST[password];

if(isset($submit))
{
if (($_POST[userid]=="admin") &&
($_POST[password]=="admin"))
{ header( "Location:
http://localhost/project/admin.php"); }

else if (($_POST[userid]=="") ||
($_POST[password]==""))
{ echo "<script>alert('Invalid data - try
again')</script>"; }
else
{
$sqlst = "SELECT * FROM auth WHERE user = '$idd'";
$rs = odbc_exec($connect, $sqlst);

while(odbc_fetch_row($rs));
{
$ipass = odbc_result($rs, "pass");
if($pas == $ipass)
{ header( "Location:
http://localhost/project/forum.php"); }
else
echo "<script>alert('User not found - Try
Again')</script>";
}
}}
odbc_close($connect);

?>

<body background = "back.gif">


<table border = "2" cellpadding = "50">
<tr><td>
<font size="1.5" face="Comic Sans MS" color =
"black">

<FORM method='post' action='mainlogin.php'>


USERNAME : <INPUT TYPE=TEXT NAME=userid> <BR>
PASSWORD : <INPUT TYPE=password
NAME=password> <BR>
<font size="1" face="Comic Sans MS" color =
"white">
<INPUT type=submit name=submit value=' Enter '>
</FORM>
</font>
</font>
</td></tr></table>
The header tag is used to jump to the web page
specified as the location inside the header. Note that alert
box in JavaScript is embedded in PHP.

Posts displaying:

Displaying all the posts in an order in the forums page


is a great deal since it involves a tree and node concept.
You the see that the comments posted as a reply to the
main comment will always be displayed below it but with
an indent. And further below if there is any reply it goes
more indented.

In Access we use the concept Auto number and make


one column as the indexing for all the elements adding up
in the table. The second row consists of an hidden info
passed by PHP. If the comment is posted as main the value
for the column at this row will be zero otherwise if it is a
reply, then the Autonumber value at the position of the
main thread will return as the second column info which is
know as the parent code in this project.

<?
echo "<table border = \"1\" cellpadding=\"50\">
<tr><td>";
shownode(0); // display all the main threads
function shownode($nodecode) {
global $connect; // using the global variable for
connection
$noderesult = odbc_exec($connect,"select * from foru
where parentcode = $nodecode");
echo "<UL type='square'>";

while(odbc_fetch_row($noderesult)) // get all the rows


{
$code = odbc_result($noderesult,"code");
$title = odbc_result($noderesult,"title");
$uname = odbc_result($noderesult,"uname");
$email = odbc_result($noderesult,"email");
$descrip = odbc_result($noderesult,"description");
$dat = odbc_result($noderesult,"datss");
echo "<br>";
echo "<font size=\"4\">";
echo "<LI>";
echo "<A HREF='node.php?node=$code'> $title
</A><br>";
echo "</font>";
echo "--- [by $uname] [$email] [$dat]<br>";
echo "<font size=\"4\">";
echo $descrip;
echo"</font>";
shownode($code);

}
echo "</UL>";
}
echo "</td>";
echo "<th>";
?>
Now while displaying the information’s, the search is
made first by the index key and then by the parent code. If
zero means it will display as it is, if any number comes, it
searches for the number under Auto number and displays
below the comment with an indent. The indent is given
here by means of <li> tag. This is considered to be a
nested list and hence an Indent is made.

Sessions and Security:

As a website becomes more sophisticated, so must the


code that backs it. When you get to a stage where your
website needs to pass along user data from one page to
another, it might be time to start thinking about using PHP
sessions. A normal HTML website will not pass data from
one page to another. In other words, all information is
forgotten when a new page is loaded. This makes it quite a
problem for tasks like a shopping cart, which requires data
(the user's selected product) to be remembered from one
page to the next.

A PHP session solves this problem by allowing you to


store user information on the server for later use (i.e.
username, shopping cart items, etc). However, this session
information is temporary and is usually deleted very
quickly after the user has left the website that uses
sessions. It is important to ponder if the sessions'
temporary storage is applicable to your website. If you
require a more permanent storage you will need to find
another solution, like a MySQL database.
Sessions work by creating a unique identification(UID)
number for each visitor and storing variables based on this
ID. This helps to prevent two users' data from getting
confused with one another when visiting the same
webpage.

<?php
session_start();

When you start a session, it must be at the very


beginning of your code, before any HTML or text is sent.
When you want to store user data in a session use the
$_SESSION associative array. This is where you both store
and retrieve session data. In previous versions of PHP there
were other ways to perform this store operation, but it has
been updated and this is the correct way to do it.

<?php
session_start();
$_SESSION['uid'] = $_POST[userid];
$_SESSION['ipas'] = $_POST[password];
$connect = odbc_connect('forum','' ,'');

Now that you are able to store and retrieve data from the
$_SESSION array, we can explore some of the real
functionality of sessions. When you create a variable and
store it in a session, you probably want to use it in the
future. However, before you use a session variable it is
necessary that you check to see if it exists already!
This is where PHP's isset function comes in handy. isset
is a function that takes any variable you want to use and
checks to see if it has been set. That is, it has already been
assigned a value. We can also use ‘session_is_registered’.

<?php
session_start();
if(session_is_registered('idd'))
{

Although a session's data is temporary and does not


require that you explicitly clean after yourself, you may
wish to delete some data for your various tasks.

<?php
session_start();
if(session_is_registered('idd'))
{
session_unset();
session_destroy();
}

Imagine that you were running an online business and a


user used your website to buy your goods. The user has
just completed a transaction on your website and you now
want to remove everything from their shopping cart. You
can also completely destroy the session entirely by calling
the session_destroy function. Destroy will reset your
session, so don't call that function unless you are entirely
comfortable losing all your stored session data!

Dealing with Images:


The images are uploaded through a form in the
comments posting page. On clicking the submit button the
following code is triggered.

if(isset($sub))
{
$target_path = "uploadss/";
$target_path = $target_path . basename(
$_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']
['tmp_name'], $target_path))
{ echo "The file ".
basename( $_FILES['uploadedfile']['name'])." has
been uploaded";}
else
{echo "There was an error uploading the file,
please try again!";}
echo"<br> The type of file is : ";
echo $_FILES['uploadedfile']['type'];
}

A new folder is to be created to store all of the images


uploaded by the users. Care should be taken that it is
created In the same path as the PHP files are stored in.
In the above code we set the path to a variable. We move
all the images to the folder based on a FILE concept. We
get the name of the file(here image) and other details if
necessary and then move it to the targeted path through
the path set variable. This is done by the command
move_uploaded_file.
Displaying images from the folder in this project is
handled in a different way by the usage of directory
concept. Consider the following coding which displays all
the images in the folder on the web page.

$path = "uploadss/";
$dir_handle = @opendir($path) or die("Unable to
open $path");
while ($file = readdir($dir_handle))
{
if($file == "." || $file == ".." || $file == "index.php"
)
continue;
echo "<a href=\"http://localhost/project/uploadss/
$file\" target = \"frame2\">$file</a><br>"; }
closedir($dir_handle);

Again here the path of the folder is stored in a variable.


The path is opened by using opendir command. In a while
loop the values (here images) of the directory folder is read
one by one and is displayed along with the link to the
photos. The if loop checks whether there is any file
available to display or not.

Table Description:

User_info table:

Username : text
Password : text
Name : text
Company_name : text
Address : memo
Location : text
Phone : number
Email : text
Approved : text

Posts table:

Username : text
Reply_to : text
Company_name : text
Date : date
Time : date
Subject : text
Body : memo

Sent_mails:

From : text
To : text
Subject : text
Body : memo
Date : date

<?php
$connect = odbc_connect('forum','','');
$submit = $_POST[submit];
if(isset($submit))
{
header( "Location: admin.php");
}
echo "<img src=\"uom.jpg\" align=\"right\"
width=\"100\" height=\"100\">";
echo "<hr>";
echo "<h2><center>University Of Madras -
Discussion Board </h2></center>";
echo "<hr>";
?>

<center>
<table border = "2" cellpadding = "5">
<tr> <th> Usernames </th> <th> Password </th>
</tr>
<?
$result = odbc_exec($connect,"select * from auth");
while(odbc_fetch_row($result))
{
$username = odbc_result($result,"user");
$passs = odbc_result($result,"pass");
echo "<tr>";
echo "<td> $username </td>";
echo "<td> $passs </td>";
echo "</tr>";
}
?>
</table>
</center>
<body background = "back.gif">
<center>
<FORM method='post' action='userdata.php'>
<INPUT type=submit name=submit value=' back '>
</center>

<?php
echo "<font color = \"pink\" face=\"Comic Sans MS\">";
echo "<h2>Photo Gallery</h2><br>";
echo "</font>";

$arr = array();
$i =0;
$path = "uploadss/";
$dir_handle = @opendir($path) or die("Unable to open
$path");
while ($file = readdir($dir_handle))
{
if($file == "." || $file == ".." || $file == "index.php" )
continue;
//echo "<IMG SRC=\"http://localhost/project/uploadss/
$file\" border=\"0\" width=\"100\" height=\"100\">";
//echo "<a href=\"http://localhost/project/uploadss/
$file\" target = \"frame2\">$file</a><br>";
$arr[$i] = $file;
$i = $i +1;
}
closedir($dir_handle);
$r = sizeof($arr);
echo "<table border = \"2\" cellpadding = \"45\"
cellspacing = \"20\">";
echo "<tr>";
for ($num=0; $num < $r; $num++ )

{
echo "<td>";
echo "<IMG SRC=\"http://localhost/project/uploadss/
$arr[$num]\" border=\"0\" width=\"200\"
height=\"200\">";
echo "</td>";
//echo "||||||||||||||||||||";
if((($num+1) % 3) == 0)
{
echo "<tr>";
//echo "<br><br><br>";
}}
echo "</tr></tr></table>";
?>

<head>
<META HTTP-EQUIV="imagetoolbar" CONTENT="no">
</head>
<body background = "one.gif">
<SCRIPT language="JavaScript">
var message=" Login in to copy the images \n -copyright
protected";
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) {
alert(message);
return false;}}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;}}}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
</SCRIPT>

<?php
echo "<h3>Photo Gallery</h3><br>";
$path = "uploadss/";
$dir_handle = @opendir($path) or die("Unable to open
$path");
while ($file = readdir($dir_handle))
{
if($file == "." || $file == ".." || $file == "index.php" )
continue;
echo "<a href=\"uploadss/$file\" target
= \"frame2\">$file</a><br>";
}
closedir($dir_handle);
?>
<style type ="text/css">
body {background-image: url(fire.gif);
background-position: bottom right;
background-repeat: no-repeat;}
</style>

<?
session_start();
if(session_is_registered('name'))
{
echo "<img src=\"uom.jpg\" align=\"right\" width=\"100\"
height=\"100\">";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board</h2>";
echo "<hr><br><br>";
$uidd = $_SESSION['name'];
$connect = odbc_connect('forum','' ,'');
$da = date("d-m-Y H:i");
$submit = $_POST[submit];

if(isset($submit)) // check if submitted button is clicked


{
if (($_POST[title] == '')||($_POST[description]=='')||
($_POST[email]==''))
{
echo "<script>alert('Invali data - Re enter')</script>";
}
else
{
// insert the record in the database
$resultupdate= odbc_exec($connect,"INSERT INTO foru
(parentcode,title,description,uname,email,datss) VALUES
('$_POST[node]','$_POST[title]','$_POST[description]','$ui
dd','$_POST[email]','$da')");
echo "<script language=\"javascript\">window
location=\"forum.php\";</script>";}}

else {
header( "Location: mainlogin.php" );
}
?>

<?
$node = $GET_[node];
if ( $node != 0 )
{
// Displaying the details of the thread
echo "<HR>";
$noderesult = odbc_exec($connect,"select * from foru
where code = $node");
$noderow=odbc_fetch_row($noderesult);
$title = odbc_result($noderesult,"title");
$description = odbc_result($noderesult,"description");
$uname = odbc_result($noderesult,"uname");
$email = odbc_result($noderesult,"email");
echo "$title by ($uname) $email<BR>";
echo "$description <BR><HR>"; }
?>
<!-- Form to enter the message -->
<body background = "back.gif">
<table border = "2" cellpadding = "40">
<tr><td>
<font size="1" face="Comic Sans MS" color = "black">

<FORM method='post' action='node.php'>


Name : <?php echo $uidd; ?> <BR> <br>
EMail : <INPUT TYPE=TEXT NAME=email size =40> <BR>
Title : <INPUT TYPE=TEXT NAME=title VALUE = ''
size=40> <BR> <br>
Description : <BR> <TEXTAREA name=description
rows=10 cols=45></TEXTAREA>

<!-- we need a hidden field to store the node -->


<INPUT TYPE=hidden NAME=node value='<?php echo
$_GET[node];?>'> <BR>
<INPUT type=submit name=submit value='Post
Message'>
</FORM>
</font>
</td></tr></table><br><br>

<?
echo "<a href = \"home.php\"><img src=\"uom.jpg\"
align=\"right\" width=\"100\" height=\"100\"></a>";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board</h2>";
echo "<hr><br><br>";
$connect = odbc_connect('forum','' ,'');
$submit = $_POST[submit];
$idd = $_POST[userid];
if(isset($submit))
{
$sqlst = "SELECT * FROM auth WHERE user = '$idd'";
$rs = odbc_exec($connect, $sqlst);
while(odbc_fetch_row($rs));
{
$id = odbc_result($rs, "user");
}
if ($id == $_POST[userid])
{
echo "<script>alert('User already Exists - Try Another
name')</script>";
}
else
if($_POST[password] != $_POST[password2])
{
echo "<script>alert('Check whether Password
matches')</script>";
}
else
{
$update= odbc_exec($connect,"INSERT INTO auth
(user,pass) VALUES
('$_POST[userid]','$_POST[password]')");
echo "<script>alert('You have been Registered- Log in
to start posting')</script>";
echo "<script
language=\"javascript\">window.location=\"home.php\";</
script>";
}}
?>

<body background = "back.gif">


<!-- Form to enter login details -->
<br><br>
<table border = "2" cellpadding = "50">
<tr><td>
<font size="1.5" face="Comic Sans MS" color = "black">
<FORM method='post' action='login.php'>
USERNAME : <INPUT TYPE=TEXT NAME=userid> <BR>
PASSWORD : <INPUT TYPE=password NAME=password>
<BR>
CONFIRM <br>PASSWORD : <INPUT TYPE=password
NAME=password2> <BR>
<font size="1" face="Comic Sans MS" color = "white">
<INPUT type=submit name=submit value='Register'>
</FORM>
</font>
</font>
</td></tr></table>

<?php
//session_start();
//$_SESSION['uid'] = $_POST[userid];
//$_SESSION['ipas'] = $_POST[password];
$connect = odbc_connect('forum','' ,'');
$submit = $_POST[submit];
$idd = $_POST[userid];
$pas = $_POST[password];

if(isset($submit))
{
if (($_POST[userid]=="admin") &&
($_POST[password]=="admin"))
{
session_start();
session_register('idd');
header( "Location: admin.php");
}
else if (($_POST[userid]=="") || ($_POST[password]==""))
{
echo "<script>alert('Invalid data - try again')</script>";
}
else
{
$sqlst = "SELECT * FROM auth WHERE user = '$idd'";
$rs = odbc_exec($connect, $sqlst);

while(odbc_fetch_row($rs));
{
$ipass = odbc_result($rs, "pass");
if($pas == $ipass)
{
session_start();
session_register('idd');
header( "Location: forum.php");
//echo "<script language=\"javascript\">window
//location=\"forum.php\";</script>"; }
else
echo "<script>alert('User not found - Try
Again')</script>"; }}}
echo "<a href = \"home.php\"><img src=\"uom.jpg\"
align=\"right\" width=\"100\" height=\"100\"></a>";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board</h2>";
echo "<hr><br><br>";
odbc_close($connect);
?>

<body background = "back.gif">


<!-- Form to enter login details -->
<br><br>
<table border = "2" cellpadding = "50">
<tr><td>
<font size="1.5" face="Comic Sans MS" color = "black">

<FORM method='post' action='mainlogin.php'>


USERNAME : <INPUT TYPE=TEXT NAME=userid> <BR>
PASSWORD : <INPUT TYPE=password NAME=password>
<BR>

<font size="1" face="Comic Sans MS" color = "white">


<INPUT type=submit name=submit value=' Enter '>
</FORM>
</font>
</font>
</td></tr></table>
<html>
<head></head>
<body background = "back.gif">
<div style="text-align: center">
<h2><br><br><br><br><br><br><br><br>
You can <br> view ur photos <br> in this pane
</div></body>
</html>
<?php
session_start();
if(session_is_registered('idd'))
{
session_unset();
session_destroy();
}
//echo "<META HTTP-EQUIV=Refresh CONTENT=\"3\">";
//include ("design.php");
echo "<img src=\"uom.jpg\" align=\"right\" width=\"100\"
height=\"100\">";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board</h2>";
echo "<hr><br><br>";
echo "<font size=\"4\" face=\"Comic Sans MS\" color
= \"black\">";
echo "This is a forum created by the students of 'MCA - Iyr'
as a part of our practical assesments.<br>";
echo "Its user friendly and easy to use.<br>";
echo "Users new to this discussion panel have to register
themselves in order to post a comment<br>";

echo "<br><br>";
echo "<center>";
echo "<table border = \"0\" cellpadding = \"10\">";
echo "<tr>";
echo "<td><a href = \"mainlogin.php\"><img
src=\"icons/login.png\" width=\"80\" height=\"80\" title
= \"login into your Account\"></a></td>";
echo "<td><a href = \"for_dup.php\"><img
src=\"icons/post.png\" width=\"80\" height=\"80\" title
= \"see the posts here\"></a></td>";
echo "<td><a href = \"test.php\"><img
src=\"icons/camera.png\" width=\"80\" height=\"80\" title
= \"See the image gallery\"></a></td>";
echo "<td><a href = \"login.php\"><img
src=\"icons/register.png\" width=\"80\" height=\"80\" title
= \" New users - register here\"></a></td>";

echo "</tr></table>";
echo "</center>";
echo "</font>";
?>

<body background = "back.gif">


<br><br>
<center>
<font size="4" face="Comic Sans MS" color = "black">
Click on the UOM stamp <br> to return / logoff <br> to the
homepage
</font>
<?php
session_start();
if(session_is_registered('idd'))
{
$connect = odbc_connect('forum','','');
ini_set( "display_errors", 0);
echo "<a href = \"home.php\"><img src=\"uom.jpg\"
align=\"right\" width=\"100\" height=\"100\"></a>";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board </h2></center>";
echo "<hr>";
$name = $_SESSION['idd'];
echo "<h3>welcome <font color
= \"red\">$name</font>,</h3>";
/*if (!$connect)
{exit("Connection Failed: " . $conn);}
else
{echo "connection ok<br>";}*/
session_register('name');}
else
{header( "Location: mainlogin.php" );}
?>

<p style="text-align: right;">


<font size="4" face="Comic Sans MS" color = "black">
<table border = "0" cellpadding = "3"><tr><td><A
HREF='node.php?node=0'>Post New Message </A> --
</td>
<td> <A HREF='#' onclick =
"window.open('photoframe.html','photos','width=500,heigh
t=500,resizable=yes')"> View all photos </A></td>
</table>
</p>
</font>

<?
echo "<table border = \"1\" cellpadding=\"50\">
<tr><td>";
shownode(0); // display all the main threads
// This function is a recursive function which shall display
all the branches
// and sub branches of the threads
function shownode($nodecode) {
global $connect; // using the global variable for
connection
// Get a list of all the sub nodes which specific parentcode
$noderesult = odbc_exec($connect,"select * from foru
where parentcode = $nodecode");

echo "<UL type='square'>";


while(odbc_fetch_row($noderesult)) // get all the rows
{
$code = odbc_result($noderesult,"code");
$title = odbc_result($noderesult,"title");
$uname = odbc_result($noderesult,"uname");
$email = odbc_result($noderesult,"email");
$descrip = odbc_result($noderesult,"description");
$dat = odbc_result($noderesult,"datss");
echo "<br>";
echo "<font size=\"4\">";
echo "<LI>";
echo "<A HREF='node.php?node=$code'> $title
</A><br>";
echo "</font>";
echo "--- [by $uname] [$email] [$dat]<br>";
echo "<font size=\"4\">";
echo $descrip;
echo"</font>";
shownode($code);

}
echo "</UL>";
}
echo "</td>";
echo "<th>";
?>

<body background = "back.gif">


<form enctype="multipart/form-data" action="forum.php"
method="POST">
<input type="hidden" name="MAX_FILE_SIZE"
value="100000" />
<p style="text-align: left;">
Choose an Image to upload: <br>
(only GIFs and JPEGs)<br>
<input name="uploadedfile" type="file"><br><br>
<input type="submit" value="Upload File" name
="submit"><br>
</form>
<br><br><br><br><br><br></p>

<?php
$sub = $_POST[submit];

if(isset($sub))
{
$target_path = "uploadss/";
$target_path = $target_path .
basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'],
$target_path))
{
echo "The file ". basename( $_FILES['uploadedfile']
['name'])." has been uploaded";
}
else
{
echo "There was an error uploading the file, please try
again!";
}
echo"<br> The type of file is : ";
echo $_FILES['uploadedfile']['type'];
}
?>

<?php
echo "</th></tr></table>";
?>
<?php
$connect = odbc_connect('forum','','');
$submit = $_POST[submit];
if(isset($submit))
{
header( "Location: admin.php" );
}
?>

<?
echo "<img src=\"uom.jpg\" align=\"right\" width=\"100\"
height=\"100\">";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board</h2></center>";
echo "<hr><br><br>";
echo "<table border = \"1\" cellpadding=\"60\">
<tr><td>";
shownode(0);
function shownode($nodecode) {
global $connect;
$noderesult = odbc_exec($connect,"select * from foru
where parentcode = $nodecode");
echo "<UL type='square'>";

while(odbc_fetch_row($noderesult))
{
$code = odbc_result($noderesult,"code");
$title = odbc_result($noderesult,"title");
$uname = odbc_result($noderesult,"uname");
$email = odbc_result($noderesult,"email");
$descrip = odbc_result($noderesult,"description");
$dat = odbc_result($noderesult,"datss");
echo "<br>";
echo "<font size=\"4\" color = \"Blue\">";
echo "<LI>";
echo "$title";
echo "</font>";
echo "--- [by $uname] [$email] [Date: $dat]<br>";
echo "<font size=\"3\">";
echo $descrip;
echo"</font>";
shownode($code);
}
echo "</UL>";
} echo "</td>";

?>
<body background = "back.gif">
<td>
<center>
<FORM method='post' action='for_admin.php'>
<INPUT type=submit name=submit value=' back '>
</center>
</td></tr></table>
<?php
$connect = odbc_connect('forum','','');
/*if (!$connect)
{
exit("Connection Failed: " . $conn);
}
else
{
echo "connection ok<br>";
}*/
?>

<?
echo "<a href = \"home.php\"><img src=\"uom.jpg\"
align=\"right\" width=\"100\" height=\"100\"></a>";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board</h2></center>";
echo "<hr><br><br>";
echo "<table border = \"1\" cellpadding=\"60\">
<tr><td>";
shownode(0);

function shownode($nodecode) {
global $connect;
$noderesult = odbc_exec($connect,"select * from foru
where parentcode = $nodecode");
echo "<UL type='square'>";
while(odbc_fetch_row($noderesult))
{
$code = odbc_result($noderesult,"code");
$title = odbc_result($noderesult,"title");
$uname = odbc_result($noderesult,"uname");
$email = odbc_result($noderesult,"email");
$descrip = odbc_result($noderesult,"description");
$dat = odbc_result($noderesult,"datss");
echo "<br>";
echo "<font size=\"4\" color = \"Blue\">";
echo "<LI>";
echo "$title";
echo "</font>";
echo "--- [by $uname] [$email] [Date: $dat]<br>";
echo "<font size=\"3\">";
echo $descrip;
echo"</font>";
shownode($code);
}
echo "</UL>";
}
echo "</td>";
echo "<td> Register to post ur Comments if
interested<br><br>";
?>

<body background = "back.gif">


<?php
echo "<style type =\"text/css\">
body {background-image: url(mm.gif);
background-position:;
background-repeat: no-repeat;
background-attachment: fixed;}
</style>";
?>

<?php
session_start();
if(session_is_registered('idd'))
{
$connect = odbc_connect('forum','','');
ini_set( "display_errors", 0);
echo "<a href = \"home.php\"><img src=\"uom.jpg\"
align=\"right\" width=\"100\" height=\"100\"></a>";
echo "<hr>";
echo "<h2><center>University Of Madras - Discussion
Board </h2></center>";
echo "<hr>";
$name = $_SESSION['idd'];
echo "<h3>welcome <font color
= \"red\">$name</font>,</h3>";
}
else
{
header( "Location: mainlogin.php");
}
$blo = $_POST[block];
$del = $_POST[delete];
$na = $_POST[uname];
$tit = $_POST[titl];
$picd = $_POST[deletepic];
$picn = $_POST[picname];

if(isset($blo))
{
$sql = "DELETE FROM auth where user = '$na'";
$res = odbc_exec($connect, $sql);
echo "<script>alert('This user can no longer log-in
')</script>";
}

if(isset($picd))
{
$temp = "uploadss/$picn";
if (! unlink ($temp)) {
echo "<script>alert(' Image could not be deleted - error
')</script>";
} else {
echo "<script>alert(' Image deleted ')</script>";}}

if(isset($del))
{
$sql = "DELETE FROM foru where title = '$tit'";
$res = odbc_exec($connect, $sql);
echo "<script>alert(' Post Deleted ')</script>";
}
echo "<table border = \"0\" cellpadding
= \"10\"><tr><td>";
echo "<p style=\"text-align: left\">";
echo "<a href = \"home.php\"> Log Out </a><br><br>";
echo "<a href = \"userdata.php\"> View Users database
</a><br><br>";
echo "<A HREF='#' onclick
= \"window.open('photoframe.html','photos','width=500,he
ight=500,resizable=yes')\"> View updated Photos
</A><br><br>";
echo "<a href=\"for_admin.php\"> View Posts </a>";
echo "</p>";
echo "<br><br><br><br><br><br><br><br><br>";
?>
</td><td>

<body background = "back.gif">


<center>
<table border = "2" cellpadding = "40">
<tr><td>
<h3>Block a user:</h3>
<FORM method='post' action='admin.php'>
Enter username: <INPUT TYPE=TEXT NAME=uname>
<br>
<INPUT type=submit name=block value='Block '>
<br><br><br><br>
<h3>Delete a Comment:</h3>
Enter the title: <INPUT TYPE=TEXT NAME=titl>
<br>
<INPUT type=submit name=delete value='Delete '>

</td></tr></table><br><br>
</center>
<td>
<center>
<table border = "2" cellpadding = "40">
<tr><td>
<h3>Delete an Image:</h3>
Enter the name of the picture: <INPUT TYPE=TEXT
NAME=picname>
<br>
<INPUT type=submit name=deletepic value='Delete '>
</td></tr>
</center>
</form>
</td></tr></table>
References:

Installed PHP 5 and Apache 2 as per guidelines given by


the following site:
http://www.tanguay.info/wamp/installPhp5.php5?step=1

Studied PHP concepts and database connectivity from the


various sites below:

http://www.pageresource.com/jscript/jwinopen.htm
http://www.plus2net.com/php_tutorial/php_login_script.php
#
http://www.w3schools.com/html/html_forms.asp
http://www.tizag.com/phpT/phpcookies.php
http://www.devarticles.com/c/a/Java/Multithreading-in-
Java/2/
Conclusion:
This application as a Forum allows users to
communicate with one another and also expose their
talents to the outside world. Since this is a web-based
application this can be easily accessed throughout the
world. Thus I like to conclude my application mainly used in
MNCs for better communication and recruiting candidates.

Future Enhancements:
In future many added benefits can be embedded into
this application. It is made user friendly as to add many
other services. Other services like candidate resume
uploading, management sending appointment letter or
interview call in an ordered format, a chat program for the
management and the candidates, online help desk etc,.
can be extended in this web-based application.

Das könnte Ihnen auch gefallen