0% found this document useful (0 votes)
3 views38 pages

OSS Lab Manual

The document outlines various programming exercises and projects using HTML, CSS, JavaScript, PHP, and Perl, including creating web pages, a simple calculator, user session details, and file operations. Each exercise includes the aim, code, and expected output. The document serves as a practical guide for learning web development and scripting languages.

Uploaded by

salman220lover
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views38 pages

OSS Lab Manual

The document outlines various programming exercises and projects using HTML, CSS, JavaScript, PHP, and Perl, including creating web pages, a simple calculator, user session details, and file operations. Each exercise includes the aim, code, and expected output. The document serves as a practical guide for learning web development and scripting languages.

Uploaded by

salman220lover
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

DATE EX.NO.

TITLE SINGNATURE

HTML & CASCADING STYLE SHEET

1. FRAMES AND TABLES USING HTML

2. WEB PAGE INCORPORATING CSS

LINUX

SHELL PROGRAM TO FIND THE FACTORIAL OF


3.
AN INTEGER POSITIVE NUMBER

SHELL PROGRAM TO FIND THE DETAILS OF A


4.
USER SESSION

JAVASCRIPT

5. SIMPLE CALCULATOR IN JAVASCRIPT

6. SCROLL TEXT IN THE TEXTBOX

PHP

CHECK MESSAGE PASSING MECHANISM


7.
BETWEEN PAGES

APPLICATION FOR EMAIL REGISTRATION AND


8.
LOGIN USING PHP AND MYSQL

9. CREATE A FILE AND WRITE THE DATA

PERL

10.
PERFORM THE STRING OPERATIONS
FRAMES AND TABLES USING HTML
EX.NO.: 1

DATE :

AIM:

To create a web page with frames and tables using html

CODE:

first.html

<html>

<head><title>Frame 1</title></head>

<body bgcolor=orange>

<center>

<h3>BCA</h3>

</center>

<hrcolor=white>

<h4>SIXTH SEMESTER</h4>

<ul type=circle>

<li>OPEN SOURCE PROGRAMMING

<li>ASP.NET

<li>NETWORK

<li>INTERNET
<li>MOBILE COMPUTING

</ul>

</body>

</html>

second.html

<html>

<body>

<center>

<table border=5 bordercolor=green bgcolor=yellow width="50%" height="50%">

<trbgcolor=red>

<th>Order</th>

<th>1</th>

<th>2</th>

<th>3</th>

<th>4</th>

<th>5</th>

</tr>

<tr align="center">

<td>I</td>

<td>OSS</td>
<td>M.M</td>

<td>D.C.N</td>

<td>Mob</td>

<td>Internet</td>

</tr>

<tr align="center">

<td>II</td>

<td>OSS</td>

<td>M.M</td>

<td>D.C.N</td>

<td>Mob</td>

<td>Internet</td>

</tr>

<tr align="center">

<td>III</td>

<td>OSS</td>

<td>M.M</td>

<td>D.C.N</td>

<td>Mob</td>

<td>Internet</td>

</tr>
<tr align="center">

<td>IV</td>

<td>OSS</td>

<td>M.M</td>

<td>D.C.N</td>

<td>Mob</td>

<td>Internet</td>

</tr>

<tr align="center">

<td>V</td>

<td>OSS</td>

<td>M.M</td>

<td>D.C.N</td>

<td>Mob</td>

<td>Internet</td>

</tr>

<tr align="center">

<td>VI</td>

<td>OSS</td>

<td>M.M</td>

<td>D.C.N</td>
<td>Mob</td>

<td>Internet</td>

</tr>

</table>

</body>

</html>

main.html

<html>

<frameset cols="20%,*">

<frame src="first.html" target="main">

<frame src="second.html" >

</frameset>

</html>
OUTPUT:
WEB PAGE INCORPORATING CSS
EX.NO.: 2

DATE :

AIM:

To create a web page incorporating CSS (Cascading Style Sheets)

CODE:

file.html

<html>

<head>

<link rel="stylesheet" type="text/css" href="file1.css">

</head>

<body bgcolor=black>

<h1>GOVERNMENT THIRUMAGAL MILLS COLLEGE</h1>

<h2>List of UG Courses:</h2>

<ul>

<li>BSc [C.S]

<li>BCA

<li>BSc [Maths]

<li>BSc [Physics]

<li>BSc [Botany]
<li>BSc [Chemistry]

<li>BA [English]

<li>BA [Tamil]

</ul>

<h2>List of PG Courses :</h2>

<ul>

<li>MCA

<li>Msc [C.S]

<li>Msc [Maths]

<li>Msc [Physics]

<li>Msc [Botany]

<li>Msc [Chemistry]

<li> MA [English]

<li> MA [Tamil]

</ul>

</body>

</html>
file1.css
h1

text-align:center;

color:white;

border-style:ridge;

border-color:orange;

border-width:20;

margin:10 250 10 250;

h2

color:yellow;

ul

color:white

}
OUTPUT:
PROGRAM TO FIND A FACTORIAL OF AN INTEGER POSITIVE
NUMBER
EX.NO.:3

DATE :

AIM:

To create a program to find the factorial of an integer positive number

CODE:

echo “Enter a number”

read n

fact = 1

i=1

while [ $i -le $n ]

do

fact = `expr $fact \* $i`

i=

`expr $i + 1`

done

echo “Factorial of $n is $fact”


OUTPUT:

Enter a number

Factorial of 5 is 120
SHELL PROGRAM TO FIND THE DETAILS OF A USER SESSION
EX.NO.:4

DATE :

AIM:

To create a program to check the given string is palindrome or not

CODE:

echo enter username


read name
who > test
if grep $name test
then
echo logged in
else
echo not logged in
fi

OUTPUT:

$ enter username
$ test
$ test tty1 2019-02-21 10:56 (:0)
$ test pts/0 2019-02-21 10:57 (:0)
$ test pts/1 2019-02-26 19:19 (:0)
$ logged in
SIMPLE CALCULATOR IN JAVASCRIPT
EX.NO.:5

DATE :

AIM:

To create a simple calculator in java script

CODE:

<html>

<head>

<script language="javascript">

varinput_data=""

functioncompute_ans(value)

input_data=input_data+value;

document.calculator.txt_input.value=input_data;

</script>

</head>

<body>

<center>

<table border=7 bordercolor="blue" bgcolor="orange">


<form name="calculator">

<tr><th>CALCULATOR</th></tr>

<tr align="center">

<td>

<input type="text" name="txt_input">

</td>

</tr>

<tr align="center">

<td>

<input type="button" value="1" onclick="compute_ans('1')">

<input type="button" value="2" onclick="compute_ans('2')">

<input type="button" value="3" onclick="compute_ans('3')">

</td>

</tr>

<tr align="center">

<td>

<input type="button" value="4" onclick="compute_ans('4')">

<input type="button" value="5" onclick="compute_ans('5')">

<input type="button" value="6" onclick="compute_ans('6')">

</td>

</tr>
<tr align="center">

<td>

<input type="button" value="7" onclick="compute_ans('7')">

<input type="button" value="8" onclick="compute_ans('8')">

<input type="button" value="9" onclick="compute_ans('9')">

</td>

</tr>

<tr align="center">

<td>

<input type="button" value="0" onclick="compute_ans('0')">

<input type="button" value="clear"


onclick="txt_input.value='';input_data=''">

<input type="button" value="="


onclick="txt_input.value=eval(input_data);">

</td>

</tr>

<tr align="center">

<td>

<input type="button" value="+" onclick="compute_ans('+')">

<input type="button" value="-" onclick="compute_ans('-')">

<input type="button" value="/" onclick="compute_ans('/')">

<input type="button" value="*" onclick="compute_ans('*')">


</td>

</tr>

</form>

</table>

</body></html>

OUTPUT:
SCROLL TEXT IN TEXTBOX
EX.NO.:6

DATE :

AIM:

To create a program to scroll a text in the textbox

CODE:

<html>

<head>

<script type="text/javascript" language="JavaScript">

var id;

varmsg="Welcome to GTMC";

function scroll()

varlchar;

lchar =msg.substring(0,1);

msg += lchar;

msg = msg.substring(1,msg.length);

document.JavaForm.display.value = msg.substring(0,55);
window.status = msg.substring(0,55);

id = setTimeout("scroll()",100);

</script>

</head>

<body onload="scroll()">

<center>

<h1>SCROLLING TEXT IN TEXTBOX</h1>

<form name="JavaForm">

<input type="TEXT" name="display">

</form>

</center>

</body>

</html>
OUTPUT:
CHECK MESSAGE PASSING MECHANISM BETWEEN PAGES
EX.NO.:7

DATE :

AIM:

To create a program to check message passing mechanism between pages

CODE:

msg.php

<html>

<head>

<title>Form</title>

</head>

<body>

<form method="post" action="handler.php">

<h1><center>SELECT YOUR FAVORITE COLOR</center></h1>

<hr>

<h2>What is your favoritecolor:</h2>

<input type="radio" name="favoritecolor" value="r" /> Red

<input type="radio" name="favoritecolor" value="g" /> Green

<input type="radio" name="favoritecolor" value="b" /> Blue </p>

<input type="submit" value="Submit" />


</form>

</body></html>

handler.php

<?php

switch ($_POST["favoritecolor"]) {

case "r":

$strBackgroundColor = "rgb(255,0,0)";

break;

case "g";

$strBackgroundColor = "rgb(0,255,0)";

break;

case "b":

$strBackgroundColor = "rgb(0,0,255)";

break;

default:

$strBackgroundColor = "rgb(255,255,255)";

break;

?>

<html>

<head><title>Form</title></head>
<body style="background: <?php echo $strBackgroundColor; ?>;">

<h1>YOUR FAVORITE COLOR</h1>

</body>

</html>
OUTPUT:
APPLICATION FOR EMAIL REGISTRATION AND LOGIN USING PHP
AND MYSQL
EX.NO.:8

DATE :

AIM:

To create a program to EMAIL registration and Login using PHP and MySQL.

CODE:

LOGOUT.PHP

<?php header('location:des.php');?>

DES.PHP

<?php

session_start();

if(@$_POST['submit1'])

$u = $_POST['text1'];

$p = $_POST['pwd'];

if($u =="[email protected]" && $p=="nithya@1986")

$_SESSION['luser'] = $u;

$_SESSION['start'] = time();

// taking now logged in time

$_SESSION['expire'] = $_SESSION['start'] + (1*60) ;


// ending a session in 1 minutes from the starting time header('Location: home.php');

else

$err= "<font color='red'>Invalid user login </font>";

?>

<html>

<head>

<title>Destroy Session after 1 minutes - Phptpoint.com</title>

</head>

<body>

<form name="form1" method="post">

<table align="center">

<tr>

<Td colspan="2"><?php echo @$err;?></Td>

</tr>

<tr>

<td>Username </td>

<td><input type="email" name="text1" placeholder="[email protected]"

required>
</td>

</tr>

<tr>

<td>Password</td>

<td><input type="password" name="pwd" placeholder="nithya@1986" required></td>

</tr>

<tr>

<td colspan="2" align="center">

<input type="submit" value="SignIn" name="submit1">

</td> </tr>

</table>

</form>

</body>

</html>

HOME.PHP

<?php session_start();

if(!isset($_SESSION['luser']))

echo "<p align='center'>Please Login again ";

echo "<a href='des.php'>Click Here to Login</a></p>";

else
{

$now = time();

// checking the time now when home page starts if($now > $_SESSION['expire'])

session_destroy();

echo "<p align='center'>Your session has expire ! <a href='login.php'>Login Here</a></p>";

else

?>

<html>

<head>

<title>Destroy Session after 1 minutes - Phptpoint.com</title>

</head>

<body>

<p style="background:#CCCCCC">

Welcome <?php echo $_SESSION['luser']; ?>

<span style="float:right"><a href='logout.php'>LogOut</a></span>

<p style="padding-top:20px;background:#CCCCCC; height:400px; text-align:center">

<span style="color:red;text-align:center">Your Session Will destroy after 1 minutes You will

redirected on next page</span>

<br/><br/>

<span>if you want to logout before 1minutes click on logout link </span>
</p>

</p>

<?php>

?>

</body>

</html>
OUTPUT:

LOGIN PAGE

OPEN HOME PAGE


DESTROY SESSION
CREATE A FILE TO WRITE AND READ THE DATA

EX.NO.:9

DATE :

AIM:

To create a file write and read the data into it using PHP

CODE:

<html>
<head>
<title>PHP File Create/Write Example</title>
</head>
<body>
<form method="POST">
<h3>Reading and Writing a File</h3>
Enter String:<input type="text" name="name"><br><br>
<input type="submit" name="Submit1" value="Write File">
<input type="submit" name="Submit2" value="Read File">
</form>
<?php
if(isset($_POST['Submit1']))
{
$myfile=fopen("abc.txt","a");
$text=$_POST["name"];
fwrite($myfile,$text);
fclose($myfile);
}
if(isset($_POST['Submit2']))
{
$myfile=fopen("abc.txt","r");
echo fgets($myfile);
fclose($myfile);
}
?>
OUTPUT:
STRING OPERATIONS USING PERL
EX.NO.:10

DATE :

AIM:

To create a perl program to perform the String Operations

CODE:

my $publisher="BCA Publications";

my $book="OSP";

print "\n Declaration and Initialization : $publisher wors for $book\n";

print "\n Inperpolation : Double Quotes - Welcome to \t Open Source Software\n";

print 'Interpolation : Single Quotes - Welcome to \t Open Source Software \n"';

my $constr=$publisher."released".$book."book";

print "\n Concatenate String: $constr\n";

my $repstr="$book"x4;

print "\n Repitition : $repstr\n";

my $str="\nOpen Source Software is code that is designed to be publicly accessible";

print "My original string is:$str\n";

my $substr1=substr($str,37);

print "\n My First substring is:$substr1\n";

my $substr2=substr($str,38,11);

print "\nMy Second substring is:$substr2\n";


print "\nlength of my string is:", length($str);

my $str1="hello";

my $str2="Hello";

if($str eq $str2)

print "\n str and str2 are same\n";

else

print "\n\n$str1 and $str2 is not same\n"

}
OUTPUT:

C:\Users\Sasmita\Documents>perl demo1.perl

Declaration and Initialization : BCA Publications wors for OSP

Inperpolation : Double Quotes - Welcome to Open Source Software


Interpolation : Single Quotes - Welcome to \t Open Source Software \n"
Concatenate String: BCA PublicationsreleasedOSPbook

Repitition : OSPOSPOSPOSP
My original string is:
Open Source Software is code that is designed to be publicly accessible

My First substring is: designed to be publicly accessible

My Second substring is:designed to

length of my string is:72

hello and Hello is not same

You might also like