indian railway project report

170
Indian Railways Page No.: 1 Session : 2008-2009 TRINITY College \ Roll No.: 2088 BCA 2008-2009

Upload: hsshansra

Post on 19-Nov-2014

182 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: Indian Railway Project Report

Indian Railways Page No.: 1

Session : 2008-2009

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 2: Indian Railway Project Report

Indian Railways Page No.: 2

A project report on

Submitted in partial fulfillment of requirement

For the award of the degree

BACHELOR OF COMPUTER APPLICATIONS

Of

Guru Nanak Dev University, Amritsar

By

Under the guidance of

Internal Guide:

JANEET KAURLecturer,

Department of Computer Science & IT,P.C.M.S.D. College For Women,

Jalandhar – 144 001.

TRINITY COLLEGEJALANDHAR

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 3: Indian Railway Project Report

Indian Railways Page No.: 3

TRINITY COLLEGE

JALANDHAR

CERTIFICATE

This is to certify that project entitled

“TITLE OF THE PROJECT”

submitted by

Amita, Roll Number : 2088

in partial fulfillment of the requirement for award of the degree of Bachelor of Computer Applications of Guru Nanak Dev University Amritsar, is an bonafide work carried out by her during the academic session 2008-2009. The quality of work fairly fulfills all necessary requirements related to above said degree.

Internal Guide:

Miss. Jaspreet Thind Lecturer, Department of Computer Science & IT,P.C.M.S.D. College for Women,Jalandhar – 144 001.

Janeet Kaur, Head,

Department of Computer Science & IT,

P.C.M.S.D. College for Women,Jalandhar – 144 001.

Sister Stella Principal,

__________________ TRINITY College, Signature Jalandhar - 144001

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 4: Indian Railway Project Report

Indian Railways Page No.: 4

Sr. No.

Particulars Page No. Remarks

1 Abstract of the Project 6-191.1 - Introduction 61.2 - Reservation 6-131.3 - Printing of Ticket 13-151.4 - Cancel Ticket 15-161.5 - Duplicate Ticket 16-171.6 - Available Trains 17-181.7 - Railway Network 192 ASP (Active Server Pages) 20-483 Data Flow 493.1 - Data Flow of Adding 49-513.2 - Data Flow of Deleting 52-534 Project Home Page 545 Coding of Home Page 55-596 Reserve A Ticket 60-897 Show Ticket 90-978 Ticket Info 98-1059 Duplicate Ticket 106-11210 Cancel A Ticket 113-11811 Status of Cancelled Ticket 11912 Other Coding 120-125

____________________SIGNATURE

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 5: Indian Railway Project Report

Indian Railways Page No.: 5

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 6: Indian Railway Project Report

Indian Railways Page No.: 6

Introduction

Indian Railways provides the convenient mode of

transportation among most of the public in the present

scenario. It has been divided into 9 zones covering the

largest route length of over 63000 Kms of total Indian

boundary. The train runs at a speed of 60 km – 130 km

per hour depending on the type of trains e.g. Superfast

Trains, Shatabadi Express, etc.

IT’S IS THE MOST CONVENIENT WAY OF

TRAVELLING IF YOU ARE TRAVELLING ON A

BUDGET.

Reservation of Ticket

The Project offers to reserve a ticket for 3 Persons

at a time. In this project, only 2 trains are available for

which the ticket can be reserved. The train runs from ‘

Amritsar’ to ‘ New-Delhi ’ and Vice-versa.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 7: Indian Railway Project Report

Indian Railways Page No.: 7

It covers the following stations while travels from

their specific place to their destinations :

Amritsar

Jalandhar

Ludhiana

Ambala

Panipat

Sonipat

New-Delhi

***************************************************

For the above mentioned destinations, the following type of

trains are available to run :

Superfast

Shatabadi Express

Both the trains are of different types and have a

different fairs even for the same destinations. The

Superfast is slower than Shatabadi Express and is

made from the view point of the middle person. While

the Shatabadi Express is much faster than Superfast

and is made from the view point of higher class.

Shatabadi Express carries a high fare due to its nature.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 8: Indian Railway Project Report

Indian Railways Page No.: 8

Following is a Specimen form for reservation of a

ticket:

Reserve A Ticket

From To Train

Sr. Passenger Name Age Sex

1.

2.

3.

Date (mm/dd/yyyy) :

The date shown in the form is Auto-Generated

from the current system date to the next 10 days. It’s

help us to avoid the invalid credentials while entering

data. The date will be automatically shown for the next

10 days whenever it is loaded from the current system

date.

Calculation of Kms for the selected journey

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 9: Indian Railway Project Report

Indian Railways Page No.: 9

The Kms for the selected destination is to be

calculated on the following basis :

Journey From Journey To Kms

Amritsar Jalandhar 80

Jalandhar Ludhiana 60

Ludhiana Ambala 100

Ambala Panipat 100

Panipat Sonipat 60

Sonipat New-Delhi 60

The Kms is automatically selected on the above

basis. E.g. if the selected journey is Amritsar to Sonipat

then as per the data provided above it is provided as :

80+60+100+100+60 = 400 Kms

i.e. (Amritsar – Jalandhar) + (Jalandhar – Ludhiana) +

(Ludhiana – Ambala) + (Ambala – Panipat) + (Panipat

– Sonipat) = (Amritsar – Sonipat)

Validation Controls for Reserving A Ticket

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 10: Indian Railway Project Report

Indian Railways Page No.: 10

As we know that the validation is a necessary part

in every project in order to avoid the incorrect data

and for making the system stable. In this project, there

are some validation controls which are used to be

performed while reserving a ticket. Following are the

various validation controls for the same : -

Field Name Validation or Description

Travels From Must be Selected

Travels To Must be Selected

Travels From & TO Should not be the same value

Passenger’s(1)

Name

Should not be left blank

Passenger’s(1) Age Should not be left blank

Passenger’s(1) Age IsNumeric – Must be a numeric value

Passenger’s(1) Sex Should not be left blank

Passenger (2) Same validation controls as it is

specified in Passenger (1) if applicable

Passenger (3) Same validation controls as it is

specified in Passenger (1) if applicable

Train Type Should not be left blank

Calculation of Fair as per the selected Train

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 11: Indian Railway Project Report

Indian Railways Page No.: 11

The fair is to be auto calculated on the basis of the

selected train type. As earlier discussed, the fair of the

Shatabadi Express is much higher than the Superfast

due to its nature. So the fair for each fo the train is

calculated on the following basis :-

Each and every fair is calculated from the view

point of the distance covered and the type of train used

for traveling :

If the Train Type is Superfast then the fair is to

be calculated as

***************************************************

Kms * 0.75 * No. of Passengers = Total Fair

***************************************************

If the Train Type is Shatabadi Express then the

fair is to be calculated as

***************************************************

Kms * 1.25 * No. of Passengers = Total Fair

***************************************************

Selection of Seat Number and Coach for the Train

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 12: Indian Railway Project Report

Indian Railways Page No.: 12

The Seat is selected on the basis of the last seat

number which is already reserved. The last Seat

number and the Coach is stored in a separate table of

the database. Whenever the new ticket is to be

reserved, it reads from the database and then calculate

the further seat and coach number on the basis of the

number of passengers for which the ticket it to be

reserved.

The example for the selection of seat number and

coach for the train is shown below :

Suppose there are 2 persons applied for the

reservation of the ticket. The system reads from the

database for the last seat number and coach.

Let assume that the last seat number is 26 and

Coach is S1 then the persons who applied for the

reservation is allotted 27 and 28 seat numbers

respectively and S1 as the coach.

Now assume the the last seat number in the

database is 119 and Coach is S1 then the persons who

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 13: Indian Railway Project Report

Indian Railways Page No.: 13

applied for it is allotted 120 seat number and S1 Coach

for the 1st person and the another will get 1 seat

number and S2 Coach. This is because of only 120 seats

are available in a single coach.

Printing Of A Ticket

At the end of a reservation process, after passing

the validation and adding the data to the database, it

finally prints a ticket. The ticket contains the data

relates to Coach Number, Seat Number, Passenger’s

Name, Age, Sex, Travelling From – To, Train Type,

PNR No., Number of Kms, Fair, etc details which are

necessary for a person.

Following is the specimen of a ticket without

showing any details of a person:

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 14: Indian Railway Project Report

Indian Railways Page No.: 14

When the ticket finally reserved successfully, then

the details for the persons is to be printed on the above

ticket.

Ticket Info

Ticket Info is basically designed to view the quick

view for the Status of a Ticket.

Ticket Status

Enter PNR Number :                      

In order to view the status of the ticket, we need

to enter the PNR number which is issued at the time of

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 15: Indian Railway Project Report

Indian Railways Page No.: 15

reservation of a ticket. PNR number is a Unique

identification number which is issued to all the persons

who have reserved their tickets. This number is printed

on top-left side of the ticket.

As it is earlier discussed that this option is

designed to view the quick status of the ticket, so it does

not shows the whole details for the given PNR. It only

shows some data and hides rest of them. The data is

displayed in a simple format which also helps to load

the page quickly.

Cancel Ticket

It also offers to Cancel the reserved ticket Online.

To do so, all we need to enter the PNR number in order

to cancel the ticket corresponding to the given PNR.

Cancel A Ticket

Enter PNR Number :                      

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 16: Indian Railway Project Report

Indian Railways Page No.: 16

In order to cancel the reserved ticket, we nee to

enter the PNR number which is issued at the time of

reservation of a ticket. After submitting the specified

data, the details of the corresponding value is shown

and with this the ticket is also cancelled as it deleted

from the database.

After the deletion of a ticket, the whole data is not

to be removed from the database. The ticket data is

stored mainly in 2 different tables. When the ticket is

cancelled only the details of one table is to be removed

while the other is remained in the database which can

be used for future correspondence. Because a good

enterprise must maintain a data even if the item relates

to it doesn’t exist.

Duplicate Ticket

Duplicate Ticket link is a useful process in order

to print the ticket again if the first one is lost,etc. In

order to print the ticket again, we need to enter the

PNR of the ticket which is provided earlier. If one

doesn’t remembers the PNR no. of the ticket, than it is

not possible to print the ticket again or to retrieve the

data.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 17: Indian Railway Project Report

Indian Railways Page No.: 17

Duplicate Ticket

Enter PNR Number :                      

This link also generates the same ticket as

mentioned before while reserving the ticket. It also

shows the same result as before. The complete details

like PNR no, Travelling from – to , Distance covered,

Fair charged, Train Type, Passenger’s name, age, sex,

Seat No, Coach No., etc. The only difference between it

and the ticket printed before is that it also put an mark

‘ DUPLICATE ’ in top of the ticket which resembles

that this ticket is not the orginal one but it is printed on

Demand.

Available Trains

Available Trains : Superfast      And      Shatabadi Express

Route : Amritsar to New Delhi

Stations : Amritsar

Jalandhar

Ludhiana

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 18: Indian Railway Project Report

Indian Railways Page No.: 18

Ambala

Panipat

Sonipat

New Delhi

The available trains link is useful to provide the

information that the reservation is made to which

trains. It shows the details that the reservation can be

made by using which train and what are the different

destinations of then during the route so the persons can

make their own choice according to their needs.

Railway Network

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 19: Indian Railway Project Report

Indian Railways Page No.: 19

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 20: Indian Railway Project Report

Indian Railways Page No.: 20

Active Server Pages are Microsoft’s solution to

creating dynamic Web pages. With the explotion of the

Internet and the World Wide Web into our everyday lives,

Web site creation is quickly becoming one of the fastest

growing sectors. The ASP code is surrounded by a <% and

%>. To execute ASP pages on your computer, you need to

be running a Web server.

For Example : Imagine that we want to create a Web

site of Online Store. The programmatic design, creating the

Web pages that will collect and store user billing

information, for example, is more pressing than deciding

what background to use. For that, we need to build a

dynamic Web site – one that can interact with users –Active

Server Pages are an easy-to-use solution.

Features of ASP (Active Server Pages) :-

Working with Variables

VBScript Control Structures

Use VBScript’s Built-in Functions

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 21: Indian Railway Project Report

Indian Railways Page No.: 21

Working with Objects

Working with Response Object

Communicating with the user

Collection of Form Information

Working with Request Object

Maintaining Persistent Information on the Web

Reading and Writing Files on the Web Server

Error Handling

Communicating with Databases

Use SQL Commands to Query Data

Working with Advanced Database Technique

Practicing Intelligent Application Design

Working with Variables

A variable is a small section of a computer’s memory

that you give a name to. A variable may be of the following

types :-

DATA TYPES

INTEGER

FLOATING-POINT NUMBERS

STRING

DATE

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 22: Indian Railway Project Report

Indian Railways Page No.: 22

BOOLEAN

CURRENCY

CONSTANTS

ARRAYS

VBSCRIPT ASSIGNMENTS

Array is the major data type which is a sequence of

variables, with the same name, but distinguished by an

index. Array will often be used to group data of the same

type. For example, we might have an array of strings

containing the email addresses of the users.

Demonstrating Ways of Referencing Array Elements

<%@ Language=VBScript %>

<% Option Explicit %>

Dim arrDays(6), iIndex

%>

<html>

<body>

<%

iIndex=3

arrDays(0) = “Sunday”

arrDays(1) = “Monday”

arrDays(2) = “Tuesday”

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 23: Indian Railway Project Report

Indian Railways Page No.: 23

arrDays(3) = “Wednesday”

arrDays(4) = “Thursday”

arrDays(5) = “Friday”

arrDays(6) = “Saturday”

Response.Write(“iIndex has a value of ”)

Response.Write(iIndex)

%>

<br>

arrDays(1) has a value of

<%

Response.Write(arrDays(1))

%>

<br>

arrDays(iIndex) has a value of

<%

Response.Write(arrDays(iIndex))

%>

<br>

arrDays(2+3) has a value of

<%

Response.Write(arrDays(2+3))

%>

<br>

arrDays(iIndex+1) has a value of

<%

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 24: Indian Railway Project Report

Indian Railways Page No.: 24

Response.Write(arrDays(iIndex+1))

%>

</body>

</html>

OUTPUT

iIndex has a value of 3

arrDays(1) has a value of Monday

arrDays(iIndex) has a value of Wednesday

arrDays(2+3) has a value of Friday

arrDays(iIndex+1) has a value of Thursday

VBScript Control Structures

A control structure is a programming structure that

allows your program to make decisions based on the

information it is given. There are three major types of

control structures that programmers use. They allow control

over if, when, and how many times certain instructions are

executed. Mastering the use of these control structures is

critical to becoming skilled as a programmer. Fortunately,

the logic behind them is very natural.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 25: Indian Railway Project Report

Indian Railways Page No.: 25

Conditional Logic

Looping Logic

Branching Logic

CONDIITIONAL LOGIC

1) If…Then Statements

The If…Then statement is one of the most

commonly used control structures. It takes the form

If condition Then

Code block

End If

2) If…Then…Else Statements

Sometimes it is useful to have segment of code

that executes only if the condition fails. You can add an else

statement to the if…then structure:

If condition Then

Code block 1

Else

Code block 2

End If

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 26: Indian Railway Project Report

Indian Railways Page No.: 26

3) ElseIf Statement

The ElseIf statement simplifies one common type

of nested If structure. An If statement that looks like this :

If condition1 Then

Code block 1

Else

If condition2 Then

Code block 2 …

4) Select Case Statements

Select Case allows you to specify a sequence of

code blocks, one of which will be carried out depending on

the value of a numerical or string expression. The syntax

looks like this:

Select Case expression

Case value1

Code for when expression equals value1

Case value2

Code for when expression equals value2

Case valueN

Code for when expression equals valuen

End Select

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 27: Indian Railway Project Report

Indian Railways Page No.: 27

Even with the addition of the ElseIf, it can still be unwieldy

to use nested If statements if you are going more than two or

three levels deep.

There are also some more Controls like

Do…Loop Statements

Do While…Loop Statements

Do Until…Loop Statements

While…Wend Statements

For…Next Statements

For Each…Next Statements

Infinite Loop & Nested Loops

Using Sub Routines, etc

Use VBScript’s Built-in Functions

MATH Functions

Abs(number) Absolute Value

Atn(number) Arctangent

Cos(number) Cosine

Exp(number) e ^ number

Fix(number) Integer portion

Hex(number) Base 10 to hexadecimal

Int(number) Integer portion

Log(number) Natural logarithm

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 28: Indian Railway Project Report

Indian Railways Page No.: 28

Oct(number) Base 10 to octal

Rnd Random number

Round(number) Round to integer

Round(number, dec)Round to dec decimals

Sgn(number) Sign

Sin(number) Sine

Sqr(number) (number > 0) Square root

Tan(number) Tangent

DATE Functions

Working with Date Values

dtToday = Date

Response.Write(“Today is “ & Date)

dtCurrentTime = Time

Response.Write(“Current time is “ & Time)

dtRightNow = Now

DateAdd(interval, number, date) is used to add to

the date specified by date. Interval is a string that

represents whether you want to add days, months,

years, and so on. Number indicates the number of

intervals you want to add; that is, the number of

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 29: Indian Railway Project Report

Indian Railways Page No.: 29

days, months, years, and so on, that you want to

add.

The DateAdd function takes into account worries

such as “Is tomorrow the start of a new month?”

and “Is it a leap year?”

Examples

DateAdd(“m”, 1, #12/7/90#) would return

1/7/91

DateAdd(“d”, 1, Date) would return

tomorrow’s date.

DateAdd will not return an invalid date.

STRING Functions

It allow you to retrieve and change part or all of a

string or a series of strings. Many programmers

find string manipulation to be one of the most

annoying and tiresome aspects of programming,

but VBScript makes things much easier.

UCase(string) returns string with all its lowercase

letters converted to uppercase letters. For

Example, UCase(“Amit”) returns “AMIT”

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 30: Indian Railway Project Report

Indian Railways Page No.: 30

LCase(string) returns string with al its uppercase

letters converted to lowercase letters.

Trim(string) removes spaces from both the left

and the right sides.

Len(string) returns the number of characters in

string. Len(“Amit Dhir”) is 9

StrReverse(string) returns string with the

characters in reverse order. So

StrReverse(“Active Server Pages”) would return

“segaP revreS evitcA”

Working with Objects

What Are Objects?

Think about your car. You know that when you want to

start your car, you put the key into the ignition and turn it.

You probably have not thought too much about everything

that happens when you turn that key. You do, however,

know the result you expect. Your car executes a sequence of

steps to get ready for your next instruction.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 31: Indian Railway Project Report

Indian Railways Page No.: 31

Imagine if you had to specify each step yourself. It would be

difficult to keep it straight. You might occasionally forget a

step and cause serious damage. Further, if you ever wanted

to derive a different car, you would have to learn a whole

new set of instructions.

It is much easier to simply remember to put the key in the

ignition and turn it. This is and instruction you can

remember, and you can apply to any car.

This is the object-oriented way of thinking about your car.

You think about a couple of general things: the things that

describe your car and the things you can tell it to do. An

object is a reusable piece of software that contains related

data and functions that represents some real-life thing.

Built-in ASP Objects

Response Object

Response is used to send output. The Write

method sends output to the user’s Web browser. Response

can also control how and when data is sent and write cookies

to store information.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 32: Indian Railway Project Report

Indian Railways Page No.: 32

Request Object

Request is used to retrieve data from the client.

When the client’s Web browser makes a request for a

particular page, it sends some information along to the

server. That data is packaged together in the Request object.

Some of it may be useful to the requested page; some of it

may not be. Request allows the page to retrieve what it needs

– cookie information, information from a form, query string

data, and more.

Application Object

Application is used to share information among

several clients visiting the same group of pages. In ASP, the

term application refers to all the .asp pages in a directory

and its subdirectories. Only one instance of the Application

object is created per application. It is shared among all the

clients accessing that application.

Session Object

Session refers to a single client accessing an

application. Therefore, a new instance of the Session object

is created for each session. Session is important to carrying

information as a client travels between pages because

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 33: Indian Railway Project Report

Indian Railways Page No.: 33

Session variables persist for the entire session. One page can

store data into a Session variable, and that data can be

accessed from other page in the session.

Server Object

The Server object provides a few basic properties and

methods. Probably the most important of these is the

CreateObject method. CreateObject is used to create an

instance of server component. Components are packages of

related objects that you can use in your pages. They make

common ASP tasks easier, and add a great deal of power to

your pages. CreateObject is used in conjunction with the Set

statement.

Working with Response Object

Response object is used to send output to the

client. This output might be text displayed in a browser

window, cookie data, or it might have to do with how your

pages are sent to the client and stored.

Response.Write

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 34: Indian Railway Project Report

Indian Railways Page No.: 34

Response.Write(expression) is used to write the

information to the Web Browser.

Buffering ASP Pages

In addition to sending output to the client, Response

can control how and when output is sent to the client.

Output can be sent two different ways: buffered or

unbuffered.

Response.Buffer

You can specify whether you want buffering using

the Response property Response.buffer = True turns on

buffering, Response.buffer = False turns it off. Buffering

may seem unimportant. In most of your pages, the buffering

setting will not matter. In some circumstances it is helpful to

be able to specify it, though. If you have a page that will take

a long time to finish processing, you might want to turn off

buffering so that users can start reading part of your output

while the rest is processing.

Response.Clear

Suppose that you have buffering turned on. As

your script is executing, output is being sent to the buffer.

Calling Response.Clear causes that buffer to be wiped out.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 35: Indian Railway Project Report

Indian Railways Page No.: 35

Response.Flush

Like Response.Clear, Response.Flush flushes all

the data from the system buffer. However, Response.Flush

first sends it to the client. This is useful when you want to

send a chunk of the output on to the client. Like

Response.Clear, Response.Flush produces an error message

when buffering is turned off.

Response.End

Response.End ends execution of the script. If

buffering is turned on and there is any buffered data, it is

sent. Any statements after the Response.End are not carried

out. This is a more abrupt end than simply allowing the

script to end on its own, and so should be avoided if possible.

It can be useful, though, when problems (such as bad data)

are detected to prevent them from making things worse.

Using the Buffer

<%@ Language=VBScript %>

<% Option Explicit %>

<% Response.Buffer = True %>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 36: Indian Railway Project Report

Indian Railways Page No.: 36

<html>

<body>

<%

Dim lngCounter, lngTimeWaster

Response.Write(“It is now: “ & Now)

Response.Write(“<BR>”)

For lngCounter = 1 to 5000000

lngTimeWaster = lngTimeWaster + 1

Next

Response.Write(“It is now: “ & Now)

%>

</body>

</html>

Collection of Form Information

Sample Program

Calculating One’s Life Expectancy Has Never Been So Easy!

<html>

<body>

<form method=post action=”calculatelifeexpectancy.asp”>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 37: Indian Railway Project Report

Indian Railways Page No.: 37

<b>enter the below information to calculate your estimate

life expectancy!</b><hr>

How old are you? <input type=text name=age size=3><br>

What is your gender?<br>

<input type=radio name=gender value=Male CHECKED>

<input type=radio name=gender valud=Female>

<p>

What vitamins do you take regularly?<br>

<input type=checkbox name=E>Vitamin E<br>

<input type=checkbox name=A>Vitamin A<br>

<input type=checkbox name=B12>Vitamin B12<br>

<input type=checkbox name=C>Vitamin C<br>

<input type=checkbox name=ASP>Vitamin ASP<br>

<p>

What is your general disposition?<br>

<select name=Attitude>

<option value=Poor>Pessimistic

<option value=Average>Realistic

<option value=High>Optimistic

</select>

<p>

<input type=SUBMIT Value=”Calculate Life Expectancy”>

</form>

</body>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 38: Indian Railway Project Report

Indian Railways Page No.: 38

</html>

CalculateLifeExpenctancy.asp Determines One’s Life

Expectancy

<%@ Language=VBScript %>

<% Option Explicit %>

<%

‘Read in the form field values

Dim iAge, strGender, strE, strA

Dim strB12, strC, strASP, strAttitude

iAge = Request(“Age”)

strGender = Request(“Gender”)

strE = Request(“E”)

strA = Request(“A”)

strB12 = Request(“B12”)

strC = Request(“C”)

strASP = Request(“ASP”)

strAttitude = Request(“Attitude”)

‘We will calculate the user’s life expectancy by

‘calculating the number of estimated days they have

‘left to live. We assume the average man has

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 39: Indian Railway Project Report

Indian Railways Page No.: 39

’26,300 days of life, while the average woman has

’28,500 days of life.

Const iDaysMale = 26300

Const iDaysFemale = 28500

‘First, find out how many days the person has

currently been alive. (The users age times 365, since 365

days/year)

Dim iDaysAlive

iDaysAlive = iAge * 365

‘Now, find out how many days they have left to live by

‘subtracting the expected total days of life by the days

‘of life lived thus far (based upon gender)

Dim iDaysToLive

If strGender = “Male” then

iDaysToLive = iDaysMale – iDaysAlive

Else

‘The user is a woman

iDaysToLive = iDaysFemale – iDaysAlive

End If

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 40: Indian Railway Project Report

Indian Railways Page No.: 40

‘Now, add to their expected days to live based on what

vitamins they take regularly. Add 30 days to life expectancy

for each vitamin taken regularly

If strE = “on” then iDaysToLive = iDaysToLive + 30

If strA = “on” then iDaysToLive = iDaysToLive + 30

If strB12 = “on” then iDaysToLive = iDaysToLive + 30

If strC = “on” then iDaysToLive = iDaysToLive + 30

If strASP = “on” then iDaysToLive = iDaysToLive + 30

‘Now, if their attitude is pessimistic, subtract 365 days

from their life expectancy. If it is optimistic, add 365 days. If

it is average, do nothing

Select Case strAttitude

Case “Pessimistic”:

iDaysToLive = iDaysToLive – 365

Case “Optimistic”:

iDaysToLive = iDaysToLive + 365

Case “Average”:

‘Do nothing

End Select

‘We now know how many days we expect the person

left to live. If this is less than 0, they are lucky!

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 41: Indian Railway Project Report

Indian Railways Page No.: 41

If iDaysToLive < 0 then

Response.Write “You are lucky to be alive!<br>”

Response.Write “You are “ & Abs(iDaysToLive)

& _ “ days past your life expectancy!”

Else

‘ Display how many days they have left to live

Response.Write “You should live for another “ & _

FormatNubmer(iDaysToLive,0) & “ days.<br>”

‘Display how many seconds they have left to live

‘(There are 86,400 seconds in a day

Response.Write “You have “ &

FormatNumber(iDaysToLive * 86400,0) & _ “ seconds left

to live. Make the most of it!”

End If

%>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 42: Indian Railway Project Report

Indian Railways Page No.: 42

Working with Request Object

Request is used to retrieve data from the client. When

the client’s Web browser makes a request for a particular

page, it sends some information along to the server. That

data is packaged together in the Request object. Some of it

may be useful to the requested page; some of it may not be.

Request allows the page to retrieve what it needs – cookie

information, information from a form, query string data,

and more.

Using Cookies

Cookies are small bits of information, such as strings

and numeric values, stored on the client’s computer for a

specified amount of time. When cookies are created on the

client’s computer, the developer needs to specify when they

expire. After a cookie expires, it will automatically remove

itself from the client’s computer.

When one Web site writes a cookie to a client’s

computer, only that Web site can later read the cookie’s

value. It is the browser’s responsibility to keep track of

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 43: Indian Railway Project Report

Indian Railways Page No.: 43

which Web site created what cookie, and only allow cookied

to be read by the proper Web sites.

Reading Cookies

Cookies are stored and read using the HTTP headers.

Each time the browser requests a Web page, it send the

coolies that the current Web site created. You can use the

Cookie HTTP header to read the coolies. For example, if you

create and ASP page on your Web server that contains the

following code :

<% = Request.ServerVariables(“COOKIE”) %>

You will see a listing of all the current coolies on the

client’s computer that were created by scripts on your Web

site. The Request object contains yet another collection, the

Cookies collection. This collection is used to read the values

of coolies, and, because it is a collection, the syntax to read a

coolie is as follows:

Request.Cookies (cookiename) [(keyName)]

Writing Cookies

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 44: Indian Railway Project Report

Indian Railways Page No.: 44

Cookies are written to the client’s computer through

the use of the response headers. Therefore, it’s not

surprising to find that cookies are written to the browser

using the Response object.

The Response object, like the Request object, has a

Cookies collection. The following code writes a cookie to the

client’s computer:

Response.Cookies(“MyFirstCookie”) = “Hello,

World!”

Create the User Information Cookie and Keys

<%! Language=VBScript %>

<% Option Explicit %>

<%

‘Create the UserInformation coolie and

‘associated keys

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 45: Indian Railway Project Report

Indian Railways Page No.: 45

Response.Cookies(“UserInformation”)(“LastVisit”) =

Now

Response.Cookies(“UserInformation”)(“Name”) =

“Amit”

Resonse.Cookies(“UserInformation”)

(“UserAgentString”) =

Request.ServerVariables(“HTTP_USER_AGENT”)

Response.Redirect “ListAllCookies.asp”

%>

Maintaining state over the Web is tricky business.

Because a Web server may receive requests from hundreds,

if not thousands, of clients, it is implausible to expect the

server to maintain state for all the clients for any significant

length of time. It therefore makes sense to persist long-jterm

information on the client’s computer. This is accomplished

through the use of coolies.

Cookies are great to use when small amounts of data

need to be preserved over time. Cookies allow simple data

types to be saved on the client’s computer for days, months,

or even years.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 46: Indian Railway Project Report

Indian Railways Page No.: 46

Maintaining Persistent Information on the Web

Cookies, which can save small bits of simple

information on the user’s computer, can be used to maintain

state over long periods of time. Although cookies offer an

easy way to persist information over time, they do have

limitations.

To combat these shortcomings, ASP provides two built-

in- objects: the Session object and the Application object.

The Session object is designed to maintain state for each

visitor to your Web site for the duration of his or her visit.

The Application object provides a mechanism to persist non-

user-specific information for great lengths of time. By using

these two objects, you can maintain state across your Web

site.

The Session and Application objects are easier to use

than cookies. Because both the Session and Application

objects can save arrays and objects, something coolies can’t

do, many developers prefer to use these two objects in place

of using coolies.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 47: Indian Railway Project Report

Indian Railways Page No.: 47

There is one caveat, though: Because the Session and

Application objects save their information in the Web

server’s memory, these two objects, of overused, can lead to

major performance degradation on the Web server.

Using the Session Object to Maintain State

<%@ Language=VBScript %>

<% Option Explicit %>

<%

‘Read in the Name from the form

Dim strName

strName = Request(“Name”)

‘Write the user’s name to a session variable

Session(“UserName”) = strName

%>

<html>

<body>

Hello <%=strName%>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 48: Indian Railway Project Report

Indian Railways Page No.: 48

<p>

What interests you?<br>

<li>

<a href=”sports.asp”>Sports</a><br>

<li>

<a href=”politics.asp”>Politics</a><br>

<li>

<a href=”fashion.asp”>Fashion</a><br>

<li>

<a href=”events.asp”>Current Events</a><br>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 49: Indian Railway Project Report

Indian Railways Page No.: 49

This section refers to the flow of information

while executing the project. It relates to the various different

categories of flow of information. E.g.: While adding data to

the database, it relates to the step by step information

processing. The way in which the information is processing

is recognized as Data Flow.

Main categories covered under it are as follows :

Data Flow of Adding

Data Flow of Deleting

Data Flow of Adding

In this project, the data flow for adding the

information to the database is done using step by step

processing. After finishing the one task it redirects to the

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 50: Indian Railway Project Report

Indian Railways Page No.: 50

another page for the another processing, and so on. After

finalizing all the task at the end, it finally adds to the

database. The following are name of the files in which the

data flow for adding occurs:

Reserveticket.asp

Validatenewticket.asp

Addnewticket.asp

Showticket.asp (used for displaying added data)

The above are the file names which is currently

used in the project for reservation of ticket as directed by

the user Input.

The following diagram will show the flow of information:

reserveticket.asp

Inputs the Ticket Information

For reservation

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 51: Indian Railway Project Report

Indian Railways Page No.: 51

validatenewticket.asp

Validate the information filled

In reserveticket.asp and calculate

Kms, fair, Seat number and also

The coach.

addnewticket.asp

Adds the information to the database

To their required tables.

At last the page redirects to

showticket.asp to print the ticket with

the given information

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 52: Indian Railway Project Report

Indian Railways Page No.: 52

Data Flow of Deleting

In this project, the data flow for deleting the information

from the database is done in 2 steps. After finishing the first

task , it send the information to another page for achieving

task assigned. After finalizing all the tasks, it finally shows

the message that the data relates to the given PNR number is

successfully deleted. In this process, the following are the file

names which are used to do so:

Deleteticket.html

Deleteticketinfo.asp

Deleteticket.html

Inputs the Ticket PNR number

For Cancellation or Deletion

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 53: Indian Railway Project Report

Indian Railways Page No.: 53

Deleteticketinfo.asp

Get the data from the database

Relates to the given PNR number

And deletes the data whatever is

Displayed on the screen with the

Message.

After deleting the ticket, the information stored in one of the

table is deleted while the other table which contains the

information relates to the given PNR is still not deleted

which contains the details like PNR No, Passenger’s Name,

Age, Sex, Seat Number and Coach Number. This data which

is remain unleft can be used for future corresponsdence.

Hence, not deleted.

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 54: Indian Railway Project Report

Indian Railways Page No.: 54

Home Page

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 55: Indian Railway Project Report

Indian Railways Page No.: 55

*********************************

Index.htm

*********************************

<html>

<head>

<title>Indian Railways Project : Ticket Reservation,

Cancellation, Duplicate, Railway Network, etc</title>

</head>

<frameset cols="50,*,50" border="0">

<frame src="side.html" name="side1" noresize>

<frameset rows="140,*" border="0">

<frame src="top.html" name="top" noresize

scrolling="auto">

<frameset cols="200,*" border="0">

<frame src="links.html" name="links" noresize

scrolling="auto">

<frame src="main.html" name="main" noresize

scrolling="auto"></frameset>

</frameset>

<frame src="side.html" name="side2" noresize>

</frameset> </html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 56: Indian Railway Project Report

Indian Railways Page No.: 56

*********************************

Top.html

*********************************

<html>

<body>

<table align="center" cellpadding="0" cellspacing="0">

<tr>

<td><img src="images/lalu1.jpg" width="125"

height="100"></td>

<td><img src="images/mainpic1.jpg" height="100"

width="125"></td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

<td><img src="images/title.jpg"></td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

<td><img src="images/mainpic2.jpg" height="100"

width="125"></td>

<td><img src="images/lalu2.jpg" height="100"

width="125"></td>

</tr>

</table>

</body> </html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 57: Indian Railway Project Report

Indian Railways Page No.: 57

*********************************

Links.html

*********************************

<html>

<body alink="white" vlink="white" link="white">

<table align="center" cellpadding="0" cellspacing="0">

<tr><td><a href="main.html" target="main"><img

src="images/link0.jpg"></a></td></tr>

<tr><td><a href="reserveticket.asp" target="main"><img

src="images/link1.jpg"></a></td></tr>

<tr><td><a href="ticketinfo.html" target="main"><img

src="images/link2.jpg"></a></td></tr>

<tr><td><a href="cancelticket.html" target="main"><img

src="images/link3.jpg"></a></td></tr>

<tr><td><a href="ticket.html" target="main"><img

src="images/link4.jpg"></a></td></tr>

<tr><td><a href="trains.html" target="main"><img

src="images/link5.jpg"></a></td></tr>

<tr><td><a href="railnet.html" target="main"><img

src="images/link6.jpg"></a></td></tr>

<tr><td><font color="white">Indian

Railways</font></td></tr>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 58: Indian Railway Project Report

Indian Railways Page No.: 58

<tr><td><img src="images/leftlogo.jpg"></td></tr>

</table>

</body>

</html>

*********************************

Main.html

*********************************

<html>

<body>

<table align="center"><tr>

<td><img src="images/pic.jpg" style="border-

width:12px;border-color:salmon;border-style:ridge"></

td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>

<td align="center"><img src="images/mainlogo1.gif">

<br /><font style="font-family:times new

roman;color:blue;font-weight:bold">Welcome to my site !!

</font>

<br /><br /><div style="font-family:times new

roman;color:brown;font-weight:normal;text-

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 59: Indian Railway Project Report

Indian Railways Page No.: 59

align:justify;font-size:10pt">Indian Railways have been

divided into 9 Zones covering the largest route length of over

63000 Kms of total Indian boundary. The train runs at a

speed of 60 km - 130 km per hour depending on the type of

trains e.g. Passenger train, Super fast trains, Shatabadi

train, etc.<br /><br /><div style="font-weight:bold">It is a

most convenient way of travelling if you are travelling on a

budget.</div></div></td>

</tr></table>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 60: Indian Railway Project Report

Indian Railways Page No.: 60

*********************************

Reserveticket.asp

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 61: Indian Railway Project Report

Indian Railways Page No.: 61

*********************************

<html>

<body>

<h1 align="center"><font color="blue">Reserve A

Ticket</font></h1>

<form method="post" name="form"

action="validatenewticket.asp">

<table align="center">

<tr><th>From</th><th>To</th><th>Train</th><tr>

<tr><td><select

name="from"><option></option><option>Amritsar</optio

n><option>Jalandhar</option><option>Ludhiana</

option><option>Ambala</option><option>Panipat</

option><option>Sonipat</option><option>New-Delhi</

option></select></td><td><select

name="to"><option></option><option>Amritsar</option><

option>Jalandhar</option><option>Ludhiana</

option><option>Ambala</option><option>Panipat</

option><option>Sonipat</option><option>New-Delhi</

option></select></td><td><select

name="train"><option></option><option>Superfast</optio

n><option>Shatabadi Express</option></td></tr>

</table>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 62: Indian Railway Project Report

Indian Railways Page No.: 62

<table align="center">

<tr><th>Sr.</th><th>Passenger

Name</th><th>Age</th><th>Sex</th></tr>

<tr><td>1. </td><td><input type="text" size="20"

maxlength="18" name="name1"></td><td><input

type="text" size="2" maxlength="2"

name="age1"></td><td><Select

name="sex1"><option></option><option>M</option><opti

on>F</option></select></td></tr>

<tr><td>2. </td><td><input type="text" size="20"

maxlength="18" name="name2"></td><td><input

type="text" size="2" maxlength="2"

name="age2"></td><td><Select

name="sex2"><option></option><option>M</option><opti

on>F</option></select></td></tr>

<tr><td>3. </td><td><input type="text" size="20"

maxlength="18" name="name3"></td><td><input

type="text" size="2" maxlength="2"

name="age3"></td><td><Select

name="sex3"><option></option><option>M</option><opti

on>F</option></select></td></tr>

</table>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 63: Indian Railway Project Report

Indian Railways Page No.: 63

<table align="center">

<tr>

<td>Date (mm/dd/yyyy) : </td><td><select

name="date"><option><% = DateAdd("d",1,Date)

%></option><option><% = DateAdd("d",2,Date)

%></option><option><% = DateAdd("d",3,Date)

%></option><option><% = DateAdd("d",4,Date)

%></option><option><% = DateAdd("d",5,Date)

%></option><option><% = DateAdd("d",6,Date)

%></option><option><% = DateAdd("d",7,Date)

%></option><option><% = DateAdd("d",8,Date)

%></option><option><% = DateAdd("d",9,Date)

%></option><option><% = DateAdd("d",10,Date)

%></option></select></td>

</tr>

</table>

<br /><br />

<table align="center">

<tr>

<td><input type="submit" value="Reserve Ticket"

name="submit"></td>

<td><input type="reset" value="Reset Form"

name="reset"></td>

</tr>

</table>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 64: Indian Railway Project Report

Indian Railways Page No.: 64

</form>

</body>

</html>

*********************************

Validatenewticket.asp

*********************************

<%@ Language="VBScript"%>

<html>

<body>

<%

Const adOpenForwardOnly=0

Const adLockOptimistic=3

Const adLockPessimistic=2

Const adLockReadOnly=1

Const adCmdTable=2

Dim num

num=0

If(Request.Form("name2")="") then

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 65: Indian Railway Project Report

Indian Railways Page No.: 65

num=1

Else

If(Request.Form("name3")="") then

num=2

Else

num=3

End If

End If

If(num=1) then

If(Request.Form("name1")="" OR

Request.Form("age1")="" OR Request.Form("sex1")=""

OR IsNumeric(Request.Form("age1"))=False) then

Response.Redirect("invalid.htm")

End If

Else

If(num=2) then

If(Request.Form("name1")="" OR

Request.Form("age1")="" OR Request.Form("sex1")=""

OR IsNumeric(Request.Form("age1"))=False OR

Request.Form("name2")="" OR Request.Form("age2")=""

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 66: Indian Railway Project Report

Indian Railways Page No.: 66

OR Request.Form("sex2")="" OR

IsNumeric(Request.Form("age2"))=False) then

Response.Redirect("invalid.htm")

End If

Else

If(num=3) then

If(Request.Form("name1")="" OR

Request.Form("age1")="" OR Request.Form("sex1")=""

OR IsNumeric(Request.Form("age1"))=False OR

Request.Form("name2")="" OR Request.Form("age2")=""

OR Request.Form("sex2")="" OR

IsNumeric(Request.Form("age2"))=False OR

Request.Form("name3")="" OR Request.Form("age3")=""

OR Request.Form("sex3")="" OR

IsNumeric(Request.Form("age3"))=False) then

Response.Redirect("invalid.htm")

End If

Else

Response.Redirect("invalid.htm")

End If

End If

End If

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 67: Indian Railway Project Report

Indian Railways Page No.: 67

If(Request.Form("from")=Request.Form("to")) then

Response.Redirect("invalid.htm")

End If

Session("num") = num

Session("from") = Request.Form("from")

Session("to") = Request.Form("to")

Session("train") = Request.Form("train")

Session("date") = Request.Form("date")

If(num=1) then

Session("name1") = Request.Form("name1")

Session("age1") = Request.Form("age1")

Session("sex1") = Request.Form("sex1")

Else

If(num=2) then

Session("name1") = Request.Form("name1")

Session("age1") = Request.Form("age1")

Session("sex1") = Request.Form("sex1")

Session("name2") = Request.Form("name2")

Session("age2") = Request.Form("age2")

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 68: Indian Railway Project Report

Indian Railways Page No.: 68

Session("sex2") = Request.Form("sex2")

Else

If(num=3) then

Session("name1") = Request.Form("name1")

Session("age1") = Request.Form("age1")

Session("sex1") = Request.Form("sex1")

Session("name2") = Request.Form("name2")

Session("age2") = Request.Form("age2")

Session("sex2") = Request.Form("sex2")

Session("name3") = Request.Form("name3")

Session("age3") = Request.Form("age3")

Session("sex3") = Request.Form("sex3")

End If

End If

End If

Dim iPNRnew, iSeatnew, iSeat1, iSeat2, iSeat3, iCoach,

iCoach1, iCoach2, iCoach3

iPNRnew=0

iSeatnew=0

iCoach = 0

Dim objConn

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 69: Indian Railway Project Report

Indian Railways Page No.: 69

Set objConn =

Server.CreateObject("ADODB.Connection")

objConn.ConnectionString = "DSN=railway"

objConn.Open

Dim objRS

Set objRS =

Server.CreateObject("ADODB.Recordset")

objRS.Open "PNR", objConn, , adLockOptimistic,

adCmdTable

iPNRnew = objRS("PNR")

iSeatnew = objRS("Seat")

iCoach = objRS("Coach")

iPNRnew = iPNRnew + 1

If num=1 then

iSeat1 = iSeatnew + 1

If iSeat1>120 then

iSeat1 = 1

iCoach1 = iCoach + 1

Else

iCoach1 = iCoach

End If

Else

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 70: Indian Railway Project Report

Indian Railways Page No.: 70

If num=2 then

iSeat1 = iSeatnew + 1

If iSeat1>120 then

iSeat1 = 1

iCoach1 = iCoach + 1

Else

iCoach1 = iCoach

End If

iSeat2 = iSeat1 + 1

If iSeat2>120 then

iSeat2 = 1

iCoach2 = iCoach + 1

Else

iCoach2 = iCoach

End If

Else

If num=3 then

iSeat1 = iSeatnew + 1

If iSeat1>120 then

iSeat1 = 1

iCoach1 = iCoach + 1

Else

iCoach1 = iCoach

End If

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 71: Indian Railway Project Report

Indian Railways Page No.: 71

iSeat2 = iSeat1 + 1

If iSeat2>120 then

iSeat2 = 1

iCoach2 = iCoach + 1

Else

iCoach2 = iCoach

End If

iSeat3 = iSeat2 + 1

If iSeat3>120 then

iSeat3 = 1

iCoach3 = iCoach + 1

Else

iCoach3 = iCoach

End If

End If

End If

End If

objRS("PNR") = iPNRnew

If num=1 then

objRS("Seat") = iSeat1

Else

If num=2 then

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 72: Indian Railway Project Report

Indian Railways Page No.: 72

objRS("Seat") = iSeat2

Else

If num=3 then

objRS("Seat") = iSeat3

End If

End If

End If

objRS("Coach") = iCoach

objRS.Update

objRS.Close

Set objRS = Nothing

objConn.Close

Set objConn = Nothing

Session("PNR") = iPNRnew

Session("Seat1") = iSeat1

Session("Seat2") = iSeat2

Session("Seat3") = iSeat3

Session("Coach1") = iCoach1

Session("Coach2") = iCoach2

Session("Coach3") = iCoach3

Dim fair, kms

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 73: Indian Railway Project Report

Indian Railways Page No.: 73

If(Request.Form("from") = "Amritsar") then

If(Request.Form("from") = "Amritsar" AND

Request.Form("to") = "Jalandhar") then

kms = 80

Else

If(Request.Form("from") = "Amritsar" AND

Request.Form("to") = "Ludhiana") then

kms = 140

Else

If(Request.Form("from") = "Amritsar" AND

Request.Form("to") = "Ambala") then

kms = 240

Else

If(Request.Form("from") = "Amritsar" AND

Request.Form("to") = "Panipat") then

kms = 340

Else

If(Request.Form("from") = "Amritsar" AND

Request.Form("to") = "Sonipat") then

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 74: Indian Railway Project Report

Indian Railways Page No.: 74

kms = 400

Else

If(Request.Form("from") = "Amritsar" AND

Request.Form("to") = "New-Delhi") then

kms = 460

End If

End If

End If

End If

End If

End If

Else

If(Request.Form("from") = "Jalandhar") then

If(Request.Form("from") = "Jalandhar" AND

Request.Form("to") = "Amritsar") then

kms = 80

Else

If(Request.Form("from") = "Jalandhar" AND

Request.Form("to") = "Ludhiana") then

kms = 60

Else

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 75: Indian Railway Project Report

Indian Railways Page No.: 75

If(Request.Form("from") = "Jalandhar" AND

Request.Form("to") = "Ambala") then

kms = 160

Else

If(Request.Form("from") = "Jalandhar" AND

Request.Form("to") = "Panipat") then

kms = 260

Else

If(Request.Form("from") = "Jalandhar" AND

Request.Form("to") = "Sonipat") then

kms = 320

Else

If(Request.Form("from") = "Jalandhar" AND

Request.Form("to") = "New-Delhi") then

kms = 380

End If

End If

End If

End If

End If

End If

Else

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 76: Indian Railway Project Report

Indian Railways Page No.: 76

If(Request.Form("from") = "Ludhiana") then

If(Request.Form("from") = "Ludhiana" AND

Request.Form("to") = "Amritsar") then

kms = 140

Else

If(Request.Form("from") = "Ludhiana" AND

Request.Form("to") = "Jalandhar") then

kms = 60

Else

If(Request.Form("from") = "Ludhiana" AND

Request.Form("to") = "Ambala") then

kms = 100

Else

If(Request.Form("from") = "Ludhiana" AND

Request.Form("to") = "Panipat") then

kms = 200

Else

If(Request.Form("from") = "Ludhiana" AND

Request.Form("to") = "Sonipat") then

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 77: Indian Railway Project Report

Indian Railways Page No.: 77

kms = 260

Else

If(Request.Form("from") = "Ludhiana" AND

Request.Form("to") = "New-Delhi") then

kms = 320

End If

End If

End If

End If

End If

End If

Else

If(Request.Form("from") = "Ambala") then

If(Request.Form("from") = "Ambala" AND

Request.Form("to") = "Amritsar") then

kms = 240

Else

If(Request.Form("from") = "Ambala" AND

Request.Form("to") = "Jalandhar") then

kms = 160

Else

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 78: Indian Railway Project Report

Indian Railways Page No.: 78

If(Request.Form("from") = "Ambala" AND

Request.Form("to") = "Ludhiana") then

kms = 100

Else

If(Request.Form("from") = "Ambala" AND

Request.Form("to") = "Panipat") then

kms = 100

Else

If(Request.Form("from") = "Ambala" AND

Request.Form("to") = "Sonipat") then

kms = 160

Else

If(Request.Form("from") = "Ambala" AND

Request.Form("to") = "New-Delhi") then

kms = 220

End If

End If

End If

End If

End If

End If

Else

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 79: Indian Railway Project Report

Indian Railways Page No.: 79

If(Request.Form("from") = "Panipat") then

If(Request.Form("from") = "Panipat" AND

Request.Form("to") = "Amritsar") then

kms = 340

Else

If(Request.Form("from") = "Panipat" AND

Request.Form("to") = "Jalandhar") then

kms = 260

Else

If(Request.Form("from") = "Panipat" AND

Request.Form("to") = "Ludhiana") then

kms = 200

Else

If(Request.Form("from") = "Panipat" AND

Request.Form("to") = "Ambala") then

kms = 100

Else

If(Request.Form("from") = "Panipat" AND

Request.Form("to") = "Sonipat") then

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 80: Indian Railway Project Report

Indian Railways Page No.: 80

kms = 60

Else

If(Request.Form("from") = "Panipat" AND

Request.Form("to") = "New-Delhi") then

kms = 120

End If

End If

End If

End If

End If

End If

Else

If(Request.Form("from") = "Sonipat") then

If(Request.Form("from") = "Sonipat" AND

Request.Form("to") = "Amritsar") then

kms = 400

Else

If(Request.Form("from") = "Sonipat" AND

Request.Form("to") = "Jalandhar") then

kms = 320

Else

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 81: Indian Railway Project Report

Indian Railways Page No.: 81

If(Request.Form("from") = "Sonipat" AND

Request.Form("to") = "Ludhiana") then

kms = 260

Else

If(Request.Form("from") = "Sonipat" AND

Request.Form("to") = "Ambala") then

kms = 160

Else

If(Request.Form("from") = "Sonipat" AND

Request.Form("to") = "Panipat") then

kms = 60

Else

If(Request.Form("from") = "Sonipat" AND

Request.Form("to") = "New-Delhi") then

kms = 60

End If

End If

End If

End If

End If

End If

Else

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 82: Indian Railway Project Report

Indian Railways Page No.: 82

If(Request.Form("from") = "New-Delhi") then

If(Request.Form("from") = "New-Delhi" AND

Request.Form("to") = "Amritsar") then

kms = 460

Else

If(Request.Form("from") = "New-Delhi" AND

Request.Form("to") = "Jalandhar") then

kms = 380

Else

If(Request.Form("from") = "New-Delhi" AND

Request.Form("to") = "Ludhiana") then

kms = 320

Else

If(Request.Form("from") = "New-Delhi" AND

Request.Form("to") = "Ambala") then

kms = 220

Else

If(Request.Form("from") = "New-Delhi" AND

Request.Form("to") = "Panipat") then

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 83: Indian Railway Project Report

Indian Railways Page No.: 83

kms = 120

Else

If(Request.Form("from") = "New-Delhi" AND

Request.Form("to") = "Sonipat") then

kms = 60

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

End If

Session("kms") = kms

If(Request.Form("train") = "Superfast") then

If num=2 then

Session("fair") = kms * 0.75 * 2

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 84: Indian Railway Project Report

Indian Railways Page No.: 84

Else

If num=3 then

Session("fair") = kms * 0.75 * 3

Else

Session("fair") = kms * 0.75 * 1

End If

End If

Else

If num=2 then

Session("fair") = kms * 1.25 * 2

Else

If num=3 then

Session("fair") = kms * 1.25 * 3

Else

Session("fair") = kms * 1.25 * 1

End If

End If

End If

Response.Redirect("addnewticket.asp")

%>

</body>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 85: Indian Railway Project Report

Indian Railways Page No.: 85

</html>

*********************************

Addnewticket.asp

*********************************

<%@ Language=VBScript %>

<html>

<body>

<%

Const adOpenForwardOnly=0

Const adLockOptimistic=3

Const adLockPessimistic=2

Const adLockReadOnly=1

Const adCmdTable=2

Dim objConn

Set objConn =

Server.CreateObject("ADODB.Connection")

objConn.ConnectionString = "DSN=railway"

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 86: Indian Railway Project Report

Indian Railways Page No.: 86

objConn.Open

Dim RS

Set RS = Server.CreateObject("ADODB.Recordset")

RS.Open "ticket_info", objConn, , adLockOptimistic,

adCmdTable

RS.AddNew

RS("PNR") = Session("PNR")

RS("Fr") = Session("from")

RS("To") = Session("to")

RS("Dt") = Session("date")

RS("Kms") = Session("kms")

RS("Fair") = Session("fair")

RS("Pass") = Session("num")

RS("train") = Session("train")

RS.Update

RS.MoveFirst

Session("strPNR") = RS("PNR")

RS.Close

Set RS = Nothing

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 87: Indian Railway Project Report

Indian Railways Page No.: 87

Set RS = Server.CreateObject("ADODB.Recordset")

RS.Open "pass_info", objConn, , adLockOptimistic,

adCmdTable

If(Session("num") = 1) then

RS.AddNew

RS("PNR") = Session("PNR")

RS("PassName") = Session("name1")

RS("Age") = Session("age1")

RS("Sex") = Session("sex1")

RS("Seat") = Session("Seat1")

RS("Coach") = Session("Coach1")

RS.Update

Else

If(Session("num") = 2) then

RS.AddNew

RS("PNR") = Session("PNR")

RS("PassName") = Session("name1")

RS("Age") = Session("age1")

RS("Sex") = Session("sex1")

RS("Seat") = Session("Seat1")

RS("Coach") = Session("Coach1")

RS.Update

RS.AddNew

RS("PNR") = Session("PNR")

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 88: Indian Railway Project Report

Indian Railways Page No.: 88

RS("PassName") = Session("name2")

RS("Age") = Session("age2")

RS("Sex") = Session("sex2")

RS("Seat") = Session("Seat2")

RS("Coach") = Session("Coach2")

RS.Update

Else

If(Session("num") = 3) then

RS.AddNew

RS("PNR") = Session("PNR")

RS("PassName") = Session("name1")

RS("Age") = Session("age1")

RS("Sex") = Session("sex1")

RS("Seat") = Session("Seat1")

RS("Coach") = Session("Coach1")

RS.Update

RS.AddNew

RS("PNR") = Session("PNR")

RS("PassName") = Session("name2")

RS("Age") = Session("age2")

RS("Sex") = Session("sex2")

RS("Seat") = Session("Seat2")

RS("Coach") = Session("Coach2")

RS.Update

RS.AddNew

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 89: Indian Railway Project Report

Indian Railways Page No.: 89

RS("PNR") = Session("PNR")

RS("PassName") = Session("name3")

RS("Age") = Session("age3")

RS("Sex") = Session("sex3")

RS("Seat") = Session("Seat3")

RS("Coach") = Session("Coach3")

RS.Update

End If

End If

End If

RS.Close

Set RS = Nothing

objConn.Close

Set objConn = Nothing

Response.Redirect("showticket.asp")

%>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 90: Indian Railway Project Report

Indian Railways Page No.: 90

*********************************

Showticket.asp

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 91: Indian Railway Project Report

Indian Railways Page No.: 91

*********************************

<%@ Language=VBScript %>

<% Option Explicit %>

<!--#include file="definitions.asp"-->

<html>

<head>

<style>

#print {font-size:11pt;font-weight:bold}

#print2 {font-size:9pt;font-weight:bold;font-family:arial}

</style>

</head>

<body>

<h1 align="center"><font color="blue">Reservation

Successful !!</font></h1>

<div style="position:absolute;left:60;top:80">

<img src="images/ticket.jpg">

</div>

<div style="position:absolute;left:140;top:160">

<table border="0" id="print">

<tr><td><%=Session("PNR")%></td><td><font

color="white">...........................</font>

<%=Session("train")%></td></tr>

</table>

</div>

<div style="position:absolute;left:250;top:215">

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 92: Indian Railway Project Report

Indian Railways Page No.: 92

<% If Session("train") = "Superfast" then %>

<table id="print" border="0">

<tr><td><%=Session("from")%></td><td>To</td><td><

%=Session("to")%></td></tr>

</table>

</div>

<div style="position:absolute;left:100;top:270">

<table border="0" id="print2">

<tr><td><font color="white">.</font>S<

%=Session("Coach1")%></td><td><font

color="white">..........</font><%=Session("Seat1")%></td>

<td><font color="white">..........</font><%=Session("sex1")

%></td><td><font color="white">....</font><

%=Session("age1")%></td><td><font

color="white">..</font><%=Session("name1")%></td></tr

>

<% If Session("num") >= 2 then %>

<tr><td><font color="white">.</font>S<

%=Session("Coach2")%></td><td><font

color="white">..........</font><%=Session("Seat2")%></td>

<td><font color="white">..........</font><%=Session("sex2")

%></td><td><font color="white">....</font><

%=Session("age2")%></td><td><font

color="white">..</font><%=Session("name2")%></td></tr

>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 93: Indian Railway Project Report

Indian Railways Page No.: 93

<% End If

If Session("num") = 3 then %>

<tr><td><font color="white">.</font>S<

%=Session("Coach3")%></td><td><font

color="white">..........</font><%=Session("Seat3")%></td>

<td><font color="white">..........</font><%=Session("sex3")

%></td><td><font color="white">....</font><

%=Session("age3")%></td><td><font

color="white">..</font><%=Session("name3")%></td></tr

>

<% End If %>

</table>

</div>

<br />

<br />

<div style="position:absolute;left:325;top:400">

<table align="center">

<tr><td><a href="main.html"

target="main">Home</a></td></tr>

</table>

</div>

<div style="position:absolute;left:380;top:280">

<table border="0" id="print">

<tr><td><%=Session("fair")%>/-</td><td></td></tr>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 94: Indian Railway Project Report

Indian Railways Page No.: 94

<tr><td><font

color="white">...................</font></td><td><

%=Session("kms")%> Kms</td></tr>

</table>

<% Else %>

<table id="print" border="0">

<tr><td><%=Session("from")%></td><td>To</td><td><

%=Session("to")%></td></tr>

</table>

</div>

<div style="position:absolute;left:100;top:270">

<table border="0" id="print2">

<tr><td><font color="white">.</font>C<

%=Session("Coach1")%></td><td><font

color="white">..........</font><%=Session("Seat1")%></td>

<td><font color="white">..........</font><%=Session("sex1")

%></td><td><font color="white">....</font><

%=Session("age1")%></td><td><font

color="white">..</font><%=Session("name1")%></td></tr

>

<% If Session("num") >= 2 then %>

<tr><td><font color="white">.</font>C<

%=Session("Coach2")%></td><td><font

color="white">..........</font><%=Session("Seat2")%></td>

<td><font color="white">..........</font><%=Session("sex2")

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 95: Indian Railway Project Report

Indian Railways Page No.: 95

%></td><td><font color="white">....</font><

%=Session("age2")%></td><td><font

color="white">..</font><%=Session("name2")%></td></tr

>

<% End If

If Session("num") = 3 then %>

<tr><td><font color="white">.</font>C<

%=Session("Coach3")%></td><td><font

color="white">..........</font><%=Session("Seat3")%></td>

<td><font color="white">..........</font><%=Session("sex3")

%></td><td><font color="white">....</font><

%=Session("age3")%></td><td><font

color="white">..</font><%=Session("name3")%></td></tr

>

<% End If %>

</table>

</div>

<br />

<br />

<div style="position:absolute;left:325;top:400">

<table align="center">

<tr><td><a href="main.html"

target="main">Home</a></td></tr>

</table>

</div>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 96: Indian Railway Project Report

Indian Railways Page No.: 96

<div style="position:absolute;left:380;top:280">

<table border="0" id="print">

<tr><td><%=Session("fair")%>/-</td><td></td></tr>

<tr><td><font

color="white">...................</font></td><td><

%=Session("kms")%> Kms</td></tr>

</table>

<% End If %>

</div>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 97: Indian Railway Project Report

Indian Railways Page No.: 97

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 98: Indian Railway Project Report

Indian Railways Page No.: 98

*********************************

Ticketinfo.html

*********************************

<html>

<body>

<h1 align="center"><font color="blue">Ticket

Status</font></h1>

<form method="post" action="showticketinfo.asp">

<hr>

<table align="center">

<tr>

<td>Enter PNR Number : </td>

<td>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 99: Indian Railway Project Report

Indian Railways Page No.: 99

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;

</td>

<td>

<input type="text" maxlength="5" size="25"

name="pnrno">

</td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;

</td>

<td>

<input type="submit" value="Check Status"

name="PNRstatus">

</td>

</tr>

</table>

<hr>

</form>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 100: Indian Railway Project Report

Indian Railways Page No.: 100

*********************************

Showticketinfo.asp

*********************************

<%@ Language=VBScript %>

<% Option Explicit %>

<!--#include file="definitions.asp"-->

<html>

<body>

<h1 align="center">Ticket Information</h1>

<%

Dim ifound

ifound = 0

Dim objConn

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 101: Indian Railway Project Report

Indian Railways Page No.: 101

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.ConnectionString="DSN=railway"

objConn.Open

Dim objRS

Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open "ticket_info", objConn, , , adCmdTable

objRS.MoveFirst

Do While Not objRS.EOF

If objRS("PNR") = Request.Form("pnrno") then %>

<br /><table align="center">

<tr>

<td>PNR No. </td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;

</td><td> : </td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;</td><td><% = objRS("PNR") %></td>

</tr>

<tr>

<td>Travels From </td>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 102: Indian Railway Project Report

Indian Railways Page No.: 102

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&

nbsp;&nbsp;&nbsp;</td><td> : </td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&

nbsp;&nbsp;&nbsp;</td><td><% = objRS("fr") %></td>

</tr>

<tr>

<td>Travels To </td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;

</td><td> : </td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&

nbsp;&nbsp;&nbsp;</td><td><% = objRS("to")

%></td></tr>

<tr><td>Journey On </td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;

</td><td> : </td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&

nbsp;&nbsp;&nbsp;</td><td><% = objRS("dt") %></td>

</tr>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 103: Indian Railway Project Report

Indian Railways Page No.: 103

<tr>

<td>Fair </td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;

</td><td> : </td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&

nbsp;&nbsp;&nbsp;</td><td><% = objRS("fair") %></td>

</tr>

<tr>

<td>No. Of Passengers </td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;

</td><td> : </td>

<td>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

&nbsp;&nbsp;</td><td><% = objRS("pass") %></td>

</tr>

</table>

<% ifound = 1

End If

objRS.MoveNext

Loop

If (ifound=0) then

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 104: Indian Railway Project Report

Indian Railways Page No.: 104

Response.Write("Ticket Not Found")

End If

objRS.Close

Set objRS = Nothing

objConn.Close

Set objConn = Nothing

%>

<br />

<br />

<table align="center">

<tr>

<td>

<a href="main.html" target="main">Home</a>

</td>

</tr>

</table>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 105: Indian Railway Project Report

Indian Railways Page No.: 105

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 106: Indian Railway Project Report

Indian Railways Page No.: 106

*********************************

Ticket.html

*********************************

<html>

<body>

<h1 align="center"><font color="blue">Duplicate

Ticket</font></h1>

<form method="post" action="ticketduplicate.asp"

name="form1">

<hr>

<table align="center">

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 107: Indian Railway Project Report

Indian Railways Page No.: 107

<tr><td>Enter PNR Number :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td>

<td><input type="text" maxlength="5" size="25"

name="pnrno"></td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&

nbsp;&nbsp;&nbsp;</td>

<td><input type="submit" value="Get Duplicate Ticket"

name="PNRstatus"></td>

</tr>

</table>

<hr>

</form>

</body>

</html>

*********************************

Ticketduplicate.asp

*********************************

<%@ Language=VBScript %>

<% Option Explicit %>

<!--#include file = "definitions.asp"-->

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 108: Indian Railway Project Report

Indian Railways Page No.: 108

<html>

<head>

<style>

#print {font-size:11pt;font-weight:bold}

#print2 {font-size:9pt;font-weight:bold;font-family:arial}

</style>

</head>

<body>

<h1 align="center"><font color="blue">Duplicate

Ticket</font></h1>

<%

dim ifnd

ifnd=0

dim objConn

Set objConn =

Server.CreateObject("ADODB.Connection")

objConn.ConnectionString = "DSN=railway"

objConn.Open

dim objRS

Set objRS =

Server.CreateObject("ADODB.Recordset")

objRS.Open "ticket_info", objConn, , , adCmdTable

Do until objRS.EOF

If objRS("PNR") = Request.Form("pnrno") then

ifnd = 1

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 109: Indian Railway Project Report

Indian Railways Page No.: 109

Session("traintype") = objRS("train")

%>

<div style="position:absolute;left:60;top:80">

<img src="images/ticket.jpg">

</div>

<div style="position:absolute;left:140;top:160">

<table border="0" id="print">

<tr><td><%=objRS("PNR")%></td><td><font

color="white">...........................</font>

<%=objRS("train")%></td></tr>

</table>

</div>

<div style="position:absolute;left:380;top:280">

<table border="0" id="print">

<tr><td><%=objRS("fair")%>/-</td><td></td></tr>

<tr><td><font

color="white">...................</font></td><td><

%=objRS("kms")%> Kms</td></tr>

</table>

</div>

<div style="position:absolute;left:250;top:215">

<table id="print" border="0">

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 110: Indian Railway Project Report

Indian Railways Page No.: 110

<tr><td><%=objRS("fr")%></td><td>To</td><td><

%=objRS("to")%></td></tr>

</table>

</div>

<%

End If

objRS.MoveNext

Loop

objRS.Close

If ifnd = 0 then

Response.Write("Ticket Not Found")

End If

%>

<div style="position:absolute;left:100;top:270">

<table border="0" id="print2">

<%

If ifnd = 1 then

objRS.Open "pass_info", objConn, , , adCmdtable

objRS.MoveFirst

Do until objRS.EOF

If objRS("PNR") = Request.Form("pnrno") then

If Session("traintype") = "Superfast" then

%>

<tr><td><font color="white">.</font>S<

%=objRS("Coach")%></td><td><font

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 111: Indian Railway Project Report

Indian Railways Page No.: 111

color="white">..........</font><%=objRS("Seat")%></td><t

d><font color="white">..........</font><%=objRS("sex")

%></td><td><font color="white">....</font><

%=objRS("age")%></td><td><font

color="white">..</font><%=objRS("Passname")%></td></

tr>

<% Else %>

<tr><td><font color="white">.</font>C<

%=objRS("Coach")%></td><td><font

color="white">..........</font><%=objRS("Seat")%></td><t

d><font color="white">..........</font><%=objRS("sex")

%></td><td><font color="white">....</font><

%=objRS("age")%></td><td><font

color="white">..</font><%=objRS("Passname")%></td></

tr>

<% End If

End If

objRS.MoveNext

Loop

objRS.Close

Set objRS = Nothing

objConn.Close

Set objConn = Nothing

End If

%>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 112: Indian Railway Project Report

Indian Railways Page No.: 112

</table> </div>

<div style="position:absolute;left:200;top:120">

<font face="arial" color="gray" size=7 style="font-

weight:bold">DUPLICATE</font>

</div>

</body> </html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 113: Indian Railway Project Report

Indian Railways Page No.: 113

*********************************

Cancelticket.html

*********************************

<html>

<body>

<h1 align="center"><font color="blue">Cancel A

Ticket</h1>

<form method="post" action="cancelticketinfo.asp"

name="form">

<hr>

<table align="center">

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 114: Indian Railway Project Report

Indian Railways Page No.: 114

<tr><td>Enter PNR Number :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td>

<td><input type="text" maxlength="5" size="25"

name="pnrno"></td>

<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&

nbsp;&nbsp;&nbsp;</td>

<td><input type="submit" value="Cancel Ticket"

name="PNRstatus"></td>

</tr> </table>

<hr> </form>

</body> </html>

*********************************

Cancelticketinfo.asp

*********************************

<%@ Language=VBScript %>

<% Option Explicit %>

<!--#include file="definitions.asp"-->

<html>

<body>

<h1 align="center">Ticket Cancellation</h1>

<%

Dim found

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 115: Indian Railway Project Report

Indian Railways Page No.: 115

Dim objConn

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.ConnectionString="DSN=railway"

objConn.Open

Dim objRS

Set objRS = Server.CreateObject("ADODB.Recordset")

objRS.Open "ticket_info", objConn, , adLockOptimistic,

adCmdTable

objRS.MoveFirst

Do While Not objRS.EOF

If objRS("PNR") = Request.Form("pnrno") then %>

<br /><table align="center">

<tr><td>PNR No.

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td> :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td><% = objRS("PNR")

%></td></tr>

<tr><td>Travels From

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td> :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td><% = objRS("fr")

%></td></tr>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 116: Indian Railway Project Report

Indian Railways Page No.: 116

<tr><td>Travels To

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td> :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td><% = objRS("to")

%></td></tr>

<tr><td>Journey On

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td> :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td><% = objRS("dt")

%></td></tr>

<tr><td>Fair

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td> :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td><% = objRS("fair")

%></td></tr>

<tr><td>No. Of Passengers

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td> :

</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;&nbsp;&nbsp;&nbsp;</td><td><% = objRS("pass")

%></td></tr>

</table>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 117: Indian Railway Project Report

Indian Railways Page No.: 117

<% found = 1

objRS.Delete

End If

objRS.MoveNext

Loop

If (found=0) then

Response.Write("Ticket Not Found")

Else

%><h1 align="center"><font color="salmon">The

Above Ticket has been Cancelled !!</font></h1><%

End If

objRS.Close

Set objRS = Nothing

objConn.Close

Set objConn = Nothing

%>

<br /> <br />

<table align="center">

<tr><td><a href="main.html"

target="main">Home</a></td></tr>

</table>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 118: Indian Railway Project Report

Indian Railways Page No.: 118

Check the Status of

the Cancelled Ticket

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 119: Indian Railway Project Report

Indian Railways Page No.: 119

*********************************

Railnet.html

*********************************

<html>

<body>

<table align="center">

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 120: Indian Railway Project Report

Indian Railways Page No.: 120

<tr>

<td><img src="images/map.jpg" width="400"

height="600"></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nb

sp;</td>

<td><a href="railnetlarge.html" target="_blank">Click

Here To Explore The Map</a></td>

</tr>

</table>

</body>

</html>

*********************************

Railnetlarge.html

*********************************

<html>

<head>

<title>Indian Railways Project</title>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 121: Indian Railway Project Report

Indian Railways Page No.: 121

</head>

<body>

<img src="images/map.jpg">

</body>

</html>

*********************************

Trains.html

*********************************

<html>

<body>

<hr>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 122: Indian Railway Project Report

Indian Railways Page No.: 122

<table align="center">

<tr><td>Available Trains : <font

color="blue"><b>Superfast &nbsp;&nbsp;&nbsp;&nbsp;

And &nbsp;&nbsp;&nbsp;&nbsp; Shatabadi

Express</b></font></td></tr>

</table>

<hr><hr>

<table align="center">

<tr><td>Route : </td><td><b>Amritsar to New

Delhi</b></td></tr>

<tr><td>Stations : </td><td>Amritsar</td></tr>

<tr><td></td><td>Jalandhar</td></tr>

<tr><td></td><td>Ludhiana</td></tr>

<tr><td></td><td>Ambala</td></tr>

<tr><td></td><td>Panipat</td></tr>

<tr><td></td><td>Sonipat</td></tr>

<tr><td></td><td>New Delhi</td></tr>

</table>

<hr>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 123: Indian Railway Project Report

Indian Railways Page No.: 123

*********************************

Definitions.asp

*********************************

<%

Const adOpenForwardOnly=0

Const adLockOptimistic=3

Const adLockPessimistic=2

Const adLockReadOnly=1

Const adCmdTable=2

%>

*********************************

Side.html

*********************************

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 124: Indian Railway Project Report

Indian Railways Page No.: 124

<html>

<body bgcolor="621517">

</body>

</html>

*********************************

Invalid.html

*********************************

<html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009

Page 125: Indian Railway Project Report

Indian Railways Page No.: 125

<body>

<font color="red" size="5">We are Unable to process

further due to Invalid data.</font>

<br /><br />

<font color="blue" size="6">Please Try Again with Valid

Credentials !!</font>

</body>

</html>

TRINITY College \ Roll No.: 2088 BCA 2008-2009