[go: up one dir, main page]

0% found this document useful (0 votes)
72 views29 pages

OSS - Lab - Exc Final

The document contains examples of creating web pages using frames, tables, style sheets and JavaScript in HTML. It also contains examples of shell scripting in bash to perform tasks like calculating factorials, displaying user session details. Further examples demonstrate form validation and message passing in PHP, creating and writing files in PHP, string operations in Perl.

Uploaded by

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

OSS - Lab - Exc Final

The document contains examples of creating web pages using frames, tables, style sheets and JavaScript in HTML. It also contains examples of shell scripting in bash to perform tasks like calculating factorials, displaying user session details. Further examples demonstrate form validation and message passing in PHP, creating and writing files in PHP, string operations in Perl.

Uploaded by

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

Ex1: Creating Web Page with Frames and Tables

Main.html
<html>
<head>
<title>Personal Details
</title>
<frameset rows="25%,75%">
<frame src ="front.html">
<frameset cols="15%,*">
<frame src="menu.html">
<frame src="myself.html" name="sf">
</frameset>
</html>

Menu.html
<html>
<head>
<title>Links
</title>
</head>
<body bgcolor="Silver">
<h5>MyLinks</h5>
<ul type ="disc">
<li><a href="myself.html" target=”sf”> Home </a>
<li><a href="likes.html" target=”sf”> Likes </a>
<li><a href="dislikes.html" target=”sf”> Dislikes </a>
<li><a href="hobbies.html" target="sf"> Hobbies </a>
<li><a href="qualification.html" target="sf"> Qualification </a>
</body>
</html>
Front.html
<html>
<head>
<title> Title Page </Title>
</head>
<body>
<font face="monotype corsiva" size="7" color="pink">Periyar Arts College
Student</font>
<marquee><h5> Welcome to my personal Page </marquee>
</body>
</html>

Hobbies.html
<html>
<head>
<title> Hobbies </Title>
</head>
<body bgcolr="silver">
<h3>My Hobbies</h3>
<ul type "square">
<li>Listening Music
<li> Watching TV
<li> Playing Games
<li>Reading Books
<li> Stamp Collection
</ul>
</body>
</html>
Dislikes.html
<html>
<head>
<title> Dislikes </Title>
</head>
<body bgcolor="silver">
<h3>My Dislikes</h3>
<ul type "square">
<li>Telling Lies
<li> Negative Thoughts
<li> Gambling
<li>Stealing
</ul>
</body>
</html>

Likes.Html
<html>
<head>
<title> My Likes </Title>
</head>
<body bgcolr="silver">
<h3>My Likes</h3>
<ul type "square">
<li>Friends
<li> Family
<li> Games
<li>Sweets
<li> Ice Creams
</ul>
</body>
</html>
Myself.html
<html>
<head>
<title> About Myself </Title>
</head>
<body>
<center><h3> About Myself </h3></center>
<hr><h3>Anbu</h3><br>
no.33, K.K Nagar,<br>Thirupapuliyur,<br>Cuddalore<br>
<h4> Objective<h4>
I like to become a software Engineer and achive in that field. I did my B.Sc and will go
for higher studies next year.
</body>
</html>

Qualification.Html
<html>
<head>
<title> Qualification</Title>
</head>
<body >
<table cellspacing="4" cellpadding="3" border="2">
<tr><th> Qualification </th>
<th> Total </th>
<th> Percentage </th>
</tr>
<tr><td> SSLC </td>
<td> 400 </td>
<td> 80 </td>
</tr>
<tr><td> HSC </td>
<td> 1080 </td>
<td> 90 </td>
</tr>
<tr><td> B.SC </td>
<td> 2500 </td>
<td> 85 </td>
</tr>
</body>
</html>

Output
Ex2: Creating Web Page using Style Sheets

<HTML>
<HEAD>
<TITLE> Style Sheet</TITLE>
<STYLE Type="text/css">
BODY{margin-top:5%}
H1{font-family:arial, helvetica;font-size:26pt;color:red}
P{font-size:12pt;font-style:normal;font-
weight:bold;color:green;}
UL{list-style:lower-roman}
</STYLE></HEAD>
<BODY><H1>Silicon Chips</H1>
<P>Silicon Chips is a private limited Company. Its nature of
work is manufacturing computer H/W including motherboard,
Keyboard, RAM etc., Our Products are
<B><UL>
<LI>Mother Board
<LI>RAM
<LI>KeyBoard
<LI>Printer
<LI>Mouse
</UL></B>
</BODY>
</HTML>
Output
Ex3: Finding the factorial of an integer positive number:
echo “Enter a positive number”
read n
f=1
until [ $n –lt 1 ]
do
f= ‘expr $f \* $n’
n=’expr $n – 1’
done
echo “Factorial is $f”

Output:
Enter a positive number
4
Factorial is 24
Ex4: shell program to find details of a users session:
#!/bin/bash

echo -e "\n
[ 1 ] for listing all the user accounts name \n
[ 2 ] for counting the number of logged-in user accounts \n
[ 3 ] for listing the names of currently logged-in users\n
[ 4 ] for checking the groups to which the current user belong
\n"

read userInput
case $userInput in
1)
lslogins -o USER
;;
2)
who --count | grep users
;;
3)
who -q | grep -v users
;;
4)
groups
;;
*)
echo -e "Please Enter Correct Input \n"
;;
esac

Output:
5. Create a simple calculator in java script.
<html>
<head><title>calculator</title>
<script language=”javascript”>
var inputstring=” ”;
function updatestring(value)
{inputstring=inputstring+value;
document.calculator.input.value=inputstring;
}
</script>
</head>
<body background=flow-yellow.jpg>
<form name=”calculator”>
<table border=5 bordercolor=pink bgcolor=”#ffffcc”>
<tr><td>
<input type=”text” name=”input” maxlenght=15 size=27><br/>
<input type=”button” value=”clear” onclick=”input.value=’ ’;inputstring=’ ’ ”>
<input type=”button” value=”mod” onclick=”updatestring(%)”>
<input type=”button” value=”*” onclick=”updatestring(‘*’)”><br/>
<input type=”button” value=”7”onclick=”updatestring(‘7’)”>
<input type=”button” value=”8”onclick=”updatestring(‘8’)”>
<input type=”button” value=”9”onclick=”updatestring(‘9’)”>
<input type=”button” value=”/”onclick=”updatestring(‘/’)”><br/>
<input type=”button” value=”4”onclick=”updatestring(‘4’)”>
<input type=”button” value=”5”onclick=”updatestring(‘5’)”>
<input type=”button” value=”6”onclick=”updatestring(‘6’)”>
<input type=”button” value=”-”onclick=”updatestring(‘-’)”><br/>
<input type=”button” value=”1”onclick=”updatestring(‘1’)”>
<input type=”button” value=”2”onclick=”updatestring(‘2’)”>
<input type=”button” value=”3”onclick=”updatestring(‘3’)”>
<input type=”button” value=”+”onclick=”updatestring(‘+’)”><br/>
<input type=”button” value=”0”onclick=”updatestring(‘0’)”>
<input type=”button” value=”00”onclick=”updatestring(‘00’)”>
<input type=”button” value=”.”onclick=”updatestring(‘.’)”>
<input type=”button” value=”=”
onclick=”input.value=eval(inputstring);”>
</td></tr>
</table>
</form>
</body>
</html>

Output:
6. Write a javascript program to scroll your name in the scroll bar.
<html>
<head>
<script language=”javascript”>
document.write(‘ <style type =”text/css”>’);
document.write(“#textarea { “);
document.write(“background-color: #009999; “);
document.write(“SCROLLBAR-HIGHLIGHT-COLOR: #000099; “);
document.write(“</style>”);
</script>
</head>
<body>
<textarea id=”textarea” rows=”10” cols=”30”>
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
Periyar Arts College
</textarea>
</body></html>
Output:
Ex 7: Program to check message passing mechanism
entry.html:
<html>
<head>
<title>my form</title>
</head>
<body>
<form action="messagepass.php" method ="post">
<b>Student name</b>
<br><input type="text" name="nam"><br><br>

<b>Address</b><br>
<input type="text" name="addr"><br><br>

<b>Phone</b><br>
<input type="text" name="phone" ><br><br>

<b>Age</b><br>
<input type="text" name="age"><br><br>

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


</form>
</body></html>

messagepass.php:
<html>
<head>
<title>pass message</title>
</head>
<?php
$sn=$_REQUEST['nam'];
$adr=$_REQUEST['addr'];
$ph=$_REQUEST['phone'];
$ag=$_REQUEST['age'];
?>
<body>
<?php
echo $sn;
echo $adr;
echo $ph;
echo $ag;
?>
</body>
</html>

Output
Ex 8: Application for Email Registration and Login using PHP and MySQL.
register.html
<html>
<head>
<title>my form</title>
<script>
function matchPassword(form) {
var pw1=form.pass1.value;
var pw2=form.pass2.value;
if(pw1 != pw2)
{
alert("Passwords did not match");
}
}
</script>
</head>

<body>
<form action="mailreg.php" method ="post">
<b>My sign in name</b>
<br><input type="text" name="user"><br><br>

<b>My password</b><br>
<input type="text" name="pass1"><br><br>

<b>Confirm password</b><br>
<input type="text" name="pass2" onfocusout ="matchPassword(form)" ><br><br>

<b>Gender</b><br>
<input type="text" name="gender"><br><br>

<b>Phone number</b><br>
<input type="text" name="phone"><br><br>
<input type="submit" value="Submit">
</form>
</body></html>

db_con.php
<?php
$user = 'root';
$password = '';

$database = 'sample1';

$servername='localhost:3306';
$mysqli = new mysqli($servername, $user, $password, $database);

if (!$mysqli){
echo "Connection Unsuccessful!!!";
}
if ($mysqli){
echo "Connection successful!!!";
}

?>

mailreg.php
<?php
require 'db_con.php';

$nam=$_REQUEST['user'];
$pas=$_REQUEST['pass1'];
$gen=$_REQUEST['gender'];
$phon=$_REQUEST['phone'];

$query="insert into maildb values('$nam','$pas','$gen',$phon)";


if ($is_query_run = mysqli_query($mysqli,$query))
{
echo "New mailuser registered";
}
else
{
echo "Error in execution!";
}
?>

signin.html
<html>
<head>
<title>my form</title>
</head>
<body>
<form action="verify_login.php" method =post>
My sign in name
<br><input type="text" name="user"><br>
My password
<br>
<input type="text" name="pass">
<input type="submit" name="submit" value="Sign in">
</form>
</body></html>

verify_login.php
<?php
require 'db_con.php';
$un=$_REQUEST['user'];
$pw=$_REQUEST['pass'];

$query = "SELECT * FROM `maildb` where username='$un' and password='$pw'";


if ($result = mysqli_query($mysqli,$query))
{ $rowcount = mysqli_num_rows( $result );

if($rowcount>0)
{header("Location: index.html");
}
else
{ echo("login failed");
}
}
else
{
echo "Error in execution!";
}
?>

Index.html
<html>
<head>
<title> Title Page </Title>
</head>

<body>
<marquee><h1> Welcome to my personal Page </marquee>
</body>
</html>
Output
Ex 9: Program to Create a File and write the Data into it using PHP.

<?php
$myfile = fopen("newfile.txt", "w");
$txt = "Good Morning\n";
fwrite($myfile, $txt);
$txt = "Welcome to all\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
Ex 10: Program to implement String Operations using perl.
#!"C:\xampp\perl\bin\perl.exe"

print "Content-type: text/plain; charset=iso-8859-1\n\n";


my $s = "Periyar Arts College";

print("1. The length of the given string is : ");


print(length($s),"\n");

print("2. To lower case: ");


print(lc($s),"\n");

print("3. To Upper Case: ");


print(uc($s),"\n");

my $subs = "Arts";
my $r = index($s, $subs);
print(qq\4. The substring $subs found at position $r in string $s\,"\n");

my $s2="Cuddalore";
print("5. To Concatenate: ");
my $fs=$s." ".$s2;
print($fs,"\n");

$str_result = $subs x 5;
print "6. To repeat : ";
print "$str_result";

You might also like