Iwt Lab 7TH Sem
Iwt Lab 7TH Sem
LAB MANUAL
Internet and Web Technology LAB
SEMESTER <7th>
RUNGTA COLLEGE
Rungta Educational Campus,
Kohka-Kurud Road, Bhilai,
Chhattisgarh, India
Phone No. 0788-6666666
MANAGED BY : SANTOSH RUNGTA GROUP OF INSTITUTIONS
RUNGTA COLLEGE OF ENGINEERING & TECHNOLOGY
DEPARTMENT OF Computer Science and Engineering
LAB MANUAL
DOs:
▪ Come prepared in the lab regarding the experiment to be performed in the lab.
▪ Take help from the Manual / Work Book for preparation of the experiment.
▪ For any abnormal working of the machine consult the Faculty In-charge/ Lab Assistant.
▪ Shut down the machine and switch off the power supply after performing the experiment.
DON’Ts :
▪ Do not tamper the instruments in the Lab and do not disturb their settings.
LIST OF EXPERIMENTS
AS PER THE SYLLABUS PRESCRIBED BY THE UNIVERSITY
Program / Semester: B.Tech (VII) Branch: Computer Science &Engineering
Subject: Internet and Web Technology Lab Course Code: D022722(022)
Total / Minimum-Pass Marks(End Semester L: 0 T: 0 P: 2 Credits: 1
Exam):40 / 20
a) Input: A number n obtained using prompt, Output: The first n Fibonacci numbers
2
b) Input: A number n obtained using prompt, Output: A table of numbers from 1 to n and their
squares using alert
To Develop and demonstrate a XHTML file that includes Javascript script that uses functions for the
following problems:
3
a) Parameter: A string, Output: The position in the string of the left-most vowel
b) Parameter: A number, Output: The number with its digits in the reverse order
To Develop and demonstrate, using Javascript script, a XHTML document that collects the RollNo ( the
valid format is: A digit from 1 to 4 followed by two upper-case characters followed by two digits
followed by two upper-case characters followed by three digits; no embedded spaces allowed- e.g.
4
1AB23CD356, 1GC13CS345) of the user. Event handler must be included for the form element that
collects this information to validate the input. Messages in the alert windows must be produced when
errors are detected.
5 To Modify the above program to get the current semester also (restricted to be a number from 1 to 8)
To Develop and demonstrate, using JavaScript script, a XHTML document that contains three short
paragraphs of text, stacked on top of each other, with only enough of each showing so that the
6
mouse cursor can be placed over some part of them. When the cursor is placed over the exposed
part of any paragraph, it should rise to the top to become completely visible.
To Modify the above document so that when a paragraph is moved from the top stacking position, it
7 returns to its original position rather than to the bottom
To Design an XML document to store information about a student in an engineering college affiliated to
8 CSVTU. The information must include RollNo, Name, Name of the College, Branch, Year of Joining,
and e-mail id. Make up sample data for 5 students. Create a CSS style sheet and use it to display the
document.
To Create an XSLT style sheet for one student element of the above document and use it to create a
9
display of that element.
To Write a Perl program to display various Server Information like Server Name, Server Software, Server
10
protocol, CGI Revision etc.
To Write a Perl program to accept UNIX command from a HTML form and to display the output of the
11
command executed.
12 To Write a Perl program to accept the User Name and display a greeting message randomly chosen from
a list of 4 greeting messages.
To Write a Perl program to keep track of the number of visitors visiting the web page and to display this
13
count of visitors, with proper headings.
14 To Write a Perl program to display a digital clock which displays the current time of the server.
To Write a Perl program to insert name and age information entered by the user into a table created
15
using MySQL and to display the current contents of this table.
To Write a PHP program to store current date-time in a COOKIE and display the “Last visited on” date-
16
time on the web page upon reopening of the same page.
To Write a PHP program to store page views count in SESSION, to increment the count on each refresh,
17
and to show the count on web page.
Create a XHTML form with Name, Address Line 1, Address Line 2, and E-mail text fields. On submitting,
18 store the values in MySQL table. Retrieve and display the data based on Name.
Experiment-1
Aim-To Develop and demonstrate a XHTML document that illustrates the use external style sheet,
ordered list, table, borders, padding, color, and the <span> tag.
p,table,li, // mystyle.css
{
font-family: "lucida calligraphy", arial, 'sans serif';
margin-left: 10pt;
}
p { word-spacing: 5px; }
body { background-color:rgb(200,255,205); }
td { padding: 0.5cm; }
th {
text-align:center;
font-size: 85%;
}
table
{
border-style: outset;
background-color: rgb(100,255,105);
}
li {list-style-type: lower-roman;}
span
{
color:blue;
background-color:pink;
font-size: 29pt;
font-style: italic;
font-weight: bold;
}
<?xml version = "1.0" encoding = "utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head> <!-- lab1.html -->
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title> Lab program1 </title>
</head>
<body>
<h1>This header is 36 pt</h1>
<h2>This header is blue</h2>
<p>This paragraph has a left margin of 50 pixels</p>
<table border="4" width="5%"> <!-- table with name & email -->
<tr>
<th width="204">Name </th>
<th>Email</th>
</tr>
<tr>
<td width="204">Sunil Kumar Sahu</td>
<td>[email protected]</td>
</tr>
<tr>
<td width="204">Shiv</td>
<td>[email protected]</td>
</tr>
<tr>
<td width="204">Dr.Manoj</td>
<td>[email protected]</td>
</tr>
<tr>
<td width="204">Dr.Ganesh</td>
<td>[email protected]</td>
</tr>
</table>
<hr> <!-- horizontal line -->
<ol> <!-- ordered list -->
<li> CCWT</li>
<li>Compiler Design </li>
<li>Computer Network</li>
</ol>
<p>
<span>This is a text.</span> This is a text. This is a text. This is a text.
This is a text. This is a text. This is a text. This is a text. This is a
text. <span>This is a text.</span>
</p>
</body>
</html>
Output-
Experiment-2
Aim-To Develop and demonstrate a XHTML file that includes Javascript script for the following
problems:
a) Input: A number n obtained using prompt
Output: The first n Fibonacci numbers
<!--lab2a.htm -->
<script type="text/javascript">
var fib1=0,fib2=1,fib=0;
var num = prompt("Enter a number : \n", "");
for(i=3;i<=num; i++)
{
fib= fib1 + fib2;
document.write("<h1> " + fib + "</h1>");
fib1=fib2;
fib2=fib;
}
}
else
alert("No Proper Input");
</script>
</body>
</html>
Output-
b) Input: A number n obtained using prompt
Output: A table of numbers from 1 to n and their squares using alert
<!-- 2b.html
A trivial document
-->
Output-
<head>
<script type="text/javascript">
function disp(num)
{
var alphaExp = /^[0-9]+$/;
if(!num.value.match(alphaExp))
{
alert("Input should be positive numeric");
return false;
}
var rn=0, n= Number(num.value);
while(n!=0)
{
r = n%10;
n = Math.floor(n/10);
rn = rn*10 + r;
}
alert("The " + num.value + " in reverse is " + rn);
}
</script>
</head>
<body>
Enter a number :
<input type=text name=number>
<input type="button" value="Click me!" onclick="disp(number)" >
</body>
</html>
Output-
Output-
<STUDENT>
<USN>USN : 3GN16CS029</USN>
<NAME>NAME : KESHAV POLA</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : [email protected]</EMAIL>
</STUDENT>
<STUDENT>
<USN>USN : 3GN16CS027</USN>
<NAME>NAME : KARAN DANGE</NAME>
<COLLEGE>COLLEGE : GNDECB</COLLEGE>
<BRANCH>BRANCH :CSE</BRANCH>
<YEAR>YEAR : 2019</YEAR>
<EMAIL>E-MAIL : [email protected]</EMAIL>
</STUDENT>
</students>
OUTPUT:
output:
#!/usr/bin/perl
use CGI':standard'; # 10.pl
print "content-type:text/html","\n\n";
print "<html>\n";
print "<head> <title> About this server </title> </head>\n";
print "<body><h1> About this server </h1>","\n";
print "<hr>";
print "Server name :",$ENV{'SERVER_NAME'},"<br>"; print
"Running on port :",$ENV{'SERVER_PORT'},"<br>"; print
"Server Software :",$ENV{'SERVER_SOFTWARE'},"<br>"; print
"CGI-Revision :",$ENV{'GATEWAY_INTERFACE'},"<br>"; print
"<hr>\n";
print "</body></html>\n";
exit(0);
Output-
#!/usr/bin/perl
use CGI':standard'; # 11.pl
print "content type: text/html \n\n";
$c=param('com');
system($c);
exit(0);
Output-
#!/usr/bin/perl
use CGI ':standard';
use CGI::Carp qw(warningsToBrowser);
@coins = ("Welcome to Web Programming Lab","Have a nice time in lab",
"Practice all the programs", "well done Good Day");
$range = 4;
$random_number = int(rand($range));
if(param)
{
print header();
print start_html(-title=>"User Name",-bgcolor=>"Pink",-text=>"blue");
$cmd=param("name");
print b("Hello $cmd, $coins[$random_number]"),br();
print start_form();
print submit(-value=>"Back");
print end_form();
print end_html();
}
else
{
print header();
print start_html(-title=>"Enter user name",-bgcolor=>"yellow",-
text=>"blue");
print start_form(),textfield(-name=>"name",-value=>" "), submit(-
name=>"submit",-value=>"Submit"),reset();
print end_form();
print end_html();
}
#!/usr/bin/perl
use CGI ':standard';
use CGI::Carp qw(warningsToBrowser);
print header();
print start_html(-title=>"WebPage Counter", -
bgcolor=>"Pink",-text=>"blue");
open(FILE,'<count.txt');
$count=<FILE>;
close(FILE);
$count++;
open(FILE,'>count.txt');
print FILE "$count";
print b("This page has been viewed $count times");
close(FILE);
print end_html();
Output-
#!/usr/bin/perl
($s,$m,$h)=localtime(time);
Output-
#! /usr/bin/perl
while ( ($name,$age)=$qh->fetchrow())
{
print "<tr><td>$name</td><td>$age</td></tr>";
}
print "</table>";
$qh->finish();
$dbh->disconnect();
print"</HTML>";
<html>
<body>
<form action="http://localhost/9.pl">
Name : <input type="text" name="name"> <br>
Age :<input type="text" name="age"> <br>
<input type="submit" value="Submit">
</form>
</html>
Experiment-16
Aim-To Write a PHP program to store current date-time in a COOKIE and display the ‘Last visited on’
date-time on the web page upon reopening of the same page.
<?php
date_default_timezone_set('Asia/Calcutta');
$inTwoMonths = 60 * 60 * 24 * 60 + time();
if(isset($_COOKIE['lastVisit']))
{
$visit = $_COOKIE['lastVisit'];
echo "Your last visit was - ". $visit;
}
else
Experiment-17
Aim-To Write a PHP program to store page views count in SESSION, to increment the count on each
refresh, and to show the count on web page.
<?php session_start();
session_register("count");
if (!isset($_SESSION))
{
$_SESSION["count"] = 0;
echo "<p>Counter initialized</p>\n";
}
else { $_SESSION["count"]++; }
Output-
Experiment-18
Aim-To Create a XHTML form with Name, Address Line 1, Address Line 2, and E-mail text fields. On
submitting, store the values in MySQL table. Retrieve and display the data based on Name.
if(isset($_POST['name']))
{
$nme = $_POST['name'];
$ad1 = $_POST['add1'];
$ad2 = $_POST['add2'];
$eml = $_POST['email'];
if($nme != "" && $ad1 != "")
{
$query = "INSERT INTO contact VALUES
('$nme', '$ad1', '$ad2', '$eml')";
$result = mysql_query($query) or die(mysql_error());
}
else
echo "one of the field is empty";
}
mysql_close($dbh);
?>
<FORM ACTION="<?=$self?>" METHOD="POST">
<P>
Name: <INPUT TYPE=text NAME="name" value=""> <BR>
Address 1:<INPUT TYPE=text NAME="add1" value=""><BR>
Address 2:<INPUT TYPE=text NAME="add2" value=""><BR>
email:<INPUT TYPE=text NAME="email" value=""><BR>
<INPUT TYPE=submit>
</FORM>
</body>
</html>
$n=$_POST["name"];
print "Entered Name is $n \n";