0% found this document useful (0 votes)
17 views41 pages

OSS Record

The document contains a series of HTML, PHP, and shell script examples demonstrating various web development concepts including frames, CSS, user sessions, a simple calculator, and email registration. Each section includes code snippets for creating web pages, handling user input, and performing operations like factorial calculation and string manipulation. Additionally, it showcases how to create and write to files using PHP.

Uploaded by

lavanya naren007
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)
17 views41 pages

OSS Record

The document contains a series of HTML, PHP, and shell script examples demonstrating various web development concepts including frames, CSS, user sessions, a simple calculator, and email registration. Each section includes code snippets for creating web pages, handling user input, and performing operations like factorial calculation and string manipulation. Additionally, it showcases how to create and write to files using PHP.

Uploaded by

lavanya naren007
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/ 41

1.

CREATION OF TABLE & FRAME

//first.html

<html>

<head>

<title>FRAMES</title>

</head>

<frameset cols="25%,75%">

<frame src="frames.html">

<frame name="display" src="blank.html">

</frameset>

<noframes></noframes>

</html>

//blank.html

<html>

<head>

<title>WELCOME</title>

</head>

<body background="C:\Users\Admin\Downloads\book.avif">

<h1 align="center" style="color:red;">WELCOME TO MY PAGE</h1>

</body>

</html>
//frames.html

<html>

<head>

<title>FRAMES</title>

</head>

<body bgcolor="Silver">

</br>

</br>

<h2 align="center" style="background-color:DodgerBlue;">ABOUT</h2>

<a href="myself.html" target="display">About Myself </a>

<a href="table.html" target="display">Qualification </a>

</body>

</html>

//myself.html

<html>

<head>

<title>Welcome Page</title>

</head>

<body bgcolor="Pink">

<h1 align="center"> ABOUT MYSELF</h1></br>

</br>

<font type="arial black" color="blue">


<p> My name is <b>priyadharshini</b>, I am from Arcot.</p>

<p> Currently ,I am doing my BCA final year at ASMWC.</p>

<p> As a beginner ,I want to build my caree with a well-known organization where


i can apply my knowledge and skills and gain hands-on experience.

</br> And my long-term goal is to be number one in my field.

</p>

</font>

</body>

</html>

//table.html

<html>

<head>

<title> TABLE & FRAME </title></head>

<body bgcolor="Cyan">

<table border="1" align="center" width="50%" bgcolor="pink" cellpading="8"


cellspacing="4">

<caption><h1>MY QUALIFICATION</h1></caption>

<th colspan="5"> STUDENT DETAILS</th>

<tr>

<th>STAND</th>

<th>BOARD</th>

<th>PERCENTAGE</th>

</tr>

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

<td>STATE BOARD</td>

<td>87%</td>

</tr>

<tr align="center">

<td>HSLC</td>

<td>STATE BOARD</td>

<td>82%</td>

</tr>

<tr align="center">

<td>BCA</td>

<td>THIRUVALLUVAR</td>

<td>90%</td>

</tr>

</table>

<br/><br/>

<center><a href="www.google.com"> click here to google.com</a></center>

</body>

</html>
OUTPUT:
2.CASCADING STYLE SHEET

<html>

<head>

<title>CASCADING STYLE SHEET

</title>

<style type="text/css">

body

background-color:chocolate; font-family:palatino

a:link{color:red} a:visited{color:green} a:active{color:blue}

address.col{color:red}

h1{color:green}

</style>

</head>

<body>

<h1><center><u>ABOUT MYSELF</u></center></h1>

</br><p><b>The page says about myself such as mylikes and my hobbies,also


links to my email id.The link is placed at the bottom of the page. </b></p>

<h2> MY LIKES</h2>

<p> <ol type="i">

<li>GOOD BOOKS<br/>

<li>TEMPLES<br/>

<li>CLASSICAL MUSIC<br/></ol>
</p><br/>

<h3> MY HOBBIES</h3>

<p><ul type="square"><li>SEARCH ON WEB</li>

<li> COOKING.</li>

<li> CRAFT WORK.</li>

</ul><p><br/>

<center>

<address class=col><h3> THIS IS FOOTER</h3>

</address>

<hr size="20" noshade>

<address>

click here to mail me:

<br/>

<a href="mailto:[email protected]">

<h1>THIRD CA</h1></a>

</address> </center>

</body>

</html>
OUTPUT:
3.FACTORIAL

echo “Enter the value”


read n
f=1
until [ $n –lt 1 ]
do
f=`expr $f \* $n`
n=`expr $n – 1`
done
echo “Factorial is $f”
OUTPUT:

Enter the value


5
Factorial is 120
4.USER SESSION

echo –e “\n USER SESSION DETAILS


1.For Counting the number of logged –in user
2.For Listing the currently logged-in users
3.For Checking the groups to which the current user belongs
4.For Display all details of current logged in user”
read input
case $input in
1)
who –count | grep users
;;
2)
who –q | grep -v users
;;
3)
groups
;;
4)
who –a
;;
*)
echo –e “Please enter correct input\n”
;;
esac
OUTPUT:
USER SESSION DETAILS

1.For Counting the number of logged –in user


2.For Listing the currently logged-in users
3.For Checking the groups to which the current user belongs
4.For Display all details of current logged in user

# users=7

USER SESSION DETAILS

1.For Counting the number of logged –in user


2.For Listing the currently logged-in users
3.For Checking the groups to which the current user belongs
4.For Display all details of current logged in user

user user user user user user user


5.CALCULATOR PROGRAM

<html>

<head>

<title> Simple Calculator </title>

<style>

input[type="button"] {

width:100%;

padding:5px;

font-weight:bold;

input[type="text"] {

width:93%;

padding:5px;

</style>

<script language="javascript">

function calculate() {

var eStr = form1.calc.value;

var result;

if (eStr.lastIndexOf('='))

var sStr = eStr.substr(eStr.lastIndexOf('=')+1);


result = eval(sStr);

else {

result = eval(eStr);

form1.calc.value += "="+result;

</script>

</head>

<body bgcolor="pink">

<center>

<h1> Simple Hand Calculator </h1>

<form name = "form1">

<table width="18%" border=1 bgcolor="light grey">

<tr><td colspan="4"><input type ="text" name = "calc"/></td></tr>

<tr>

<td><input type = "button" value = "1" onclick = "form1.calc.value += '1'


"/></td>

<td><input type = "button" value = "2" onclick = "form1.calc.value += '2'


"/></td>

<td><input type = "button" value = "3" onclick = "form1.calc.value += '3'


"/></td>

<td><input type = "button" value = "+" onclick = "form1.calc.value += '+'


"/></td>

</tr>

<tr>
<td><input type = "button" value = "4" onclick = "form1.calc.value += '4'
"/></td>

<td><input type = "button" value = "5" onclick = "form1.calc.value += '5'


"/></td>

<td><input type = "button" value = "6" onclick = "form1.calc.value += '6'


"/></td>

<td><input type = "button" value = "-" onclick = "form1.calc.value += '-' "/></td>

</tr>

<tr>

<td><input type = "button" value = "7" onclick = "form1.calc.value += '7'


"/></td>

<td><input type = "button" value = "8" onclick = "form1.calc.value += '8'


"/></td>

<td><input type = "button" value = "9" onclick = "form1.calc.value += '9'


"/></td>

<td><input type = "button" value = "*" onclick = "form1.calc.value += '*'


"/></td>

</tr>

<tr>

<td><input type = "button" value = "/" onclick = "form1.calc.value += '/' "/></td>

<td><input type = "button" value = "0" onclick = "form1.calc.value += '0'


"/></td>

<td><input type = "button" value = "." onclick = "form1.calc.value += '.' "/></td>

<td><input type = "button" value = "=" onclick = "calculate()"/></td>

</tr>

<tr><td colspan="4">

<input type = "button" value = "Clear All" onclick = "form1.calc.value = ' ' "/>
</td></tr>

</table> <br>

</form>

</center>

</body>

</html>
OUTPUT:
6.SCROLLING NAME
<html>

<head>

<title>My Example</title>

<style>

body {

margin-bottom: 200%;

.myBox {

border: none;

padding: 5px;

font: 24px/36px sans-serif;

width: 200px;

height: 200px;

::-webkit-scrollbar {

width: 12px;

height: 12px;

::-webkit-scrollbar-track {

background: gold;

border-radius: 10px;

}
::-webkit-scrollbar-thumb {

border-radius: 10px;

background: yellowgreen;

::-webkit-scrollbar-thumb:hover {

background: #88ba1c;

::-webkit-scrollbar-button {

border-style: solid;

height: 13px;

width: 16px;

::-webkit-scrollbar-button:single-button:vertical:decrement {

border-width: 0 8px 8px 8px;

border-color: transparent transparent #555555 transparent;

::-webkit-scrollbar-button:single-button:vertical:decrement:hover {

border-color: transparent transparent #777777 transparent;

::-webkit-scrollbar-button:single-button:vertical:increment {

border-width: 8px 8px 0 8px;

border-color: #555555 transparent transparent transparent;

</style>
</head>

<body bgcolor="DodgerBlue">

<h1 align="center">SCROLLING NAME</h1>

<textarea class="myBox" width=75 height=40>

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

BCA DEPARTMENT

</textarea>

</body>

</html>
OUTPUT:
7.MESSAGE PASSING

//formpage.html

<html>

<head><title>MyForm</title></head>

<body>

<form action=”favorite.php” Method="post">

My Name is: <br>

<input type=”text” name=”YourName”>

My Favorite Word is: <br>

<input type=”text” name=”FavoriteWord”><br>

<input type=”submit” value=”That’s Right!”>

</form>

</body>

</html>
//favorite.php

<html>

<head><title>Perv!</title></head>

<?php

$YourName=$_REQUEST['YourName'];

$FavoriteWord=$_REQUEST['FavoriteWord'];

?>

<body >

<center><br/><br/>

<table border=6 bgcolor="violet">

<tr>

<td>

<p><h1>

Hi"<?php print $YourName;?>"

<p>You like the word"<b><?php print $FavoriteWord; ?>"!?!</b>

</h1>

</td>

</tr>

</table>

</center>

</body>

</html>
OUTPUT:
9.FILE CREATION AND WRITE DATA

<html>

<head>

<title>PHP FILE CREATE WRITE</title>

</head>

<body>

<form method="post">

Enter string:<input type="text" name="name"><br/>

<br/>

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

</form>

<?php if(isset($_POST['submit1']))

$createFile=fopen("createNew.txt","w");

$text=$_POST['name'];

fwrite($createFile,$text);

fclose($createFile);

?>

</body>

</html>
OUTPUT:
8. EMAIL REGISTRATION AND LOGIN
//config.php

<?php

session_start();

$conn=mysqli_connect("localhost","root","","bcalogin");

?>

//registration.php

<?php

require 'config.php';

if(!empty($_SESSION["id"]))

header("Location: index.php");

if(isset($_POST["submit"]))

$username= $_POST["username"];

$email=$_POST["email"];

$password=$_POST["password"];

$confirmpassword=$_POST["confirmpassword"];

$duplicate=mysqli_query($conn,"SELECT * FROM usr WHERE username=


'$username' OR email = '$email'");

if(mysqli_num_rows($duplicate)>0)

{
echo"<script> alert('Username or Email Has Already Taken'); </script>";

else{

if($password==$confirmpassword)

$query = "INSERT INTO usr VALUES('


','$username','$email','$password','$confirmpassword')";

mysqli_query($conn,$query);

echo"<script>alert('RegistrationSuccessful');</script>";

else

echo"<script> alert('Password Does Not Match'); </script>";

?>

<html>

<head>

<title>Registration</title>

</head>

<body style="background-color:skyblue;">

<h2>Registration</h2>

<form class="" action="" method="post" >


<label for="username">Username:</label>

<input type="text" name="username" id="username" requiredvalue="">

<br>

<label for="email">Email:</label>

<input type="email" name="email" id="email" requiredvalue=""><br>

<label for="password">Password:</label>

<input type="password" name="password" id="password" required


value=""><br>

<label for="confirmpassword">ConfirmPassword:</label>

<input type="password" name="confirmpassword" id="confirmpassword"


required value=""><br>

<button type="submit" name="submit">Register</button>

</form>

<br>

<a href="login.php">Login</a>

</body>

</html>

//login.php

<?php

require 'config1.php';

if(!empty($_SESSION["id"]))

header("Location: index.php");

}
if(isset($_POST["submit"]))

$usernameemail=$_POST["usernameemail"];

$password=$_POST["password"];

$result=mysqli_query($conn,"SELECT * FROM usr WHERE


username='$usernameemail' OR email = '$usernameemail'");

$row = mysqli_fetch_assoc($result);

if(mysqli_num_rows($result) > 0)

if($password == $row['password'])

$_SESSION["login"]=true;

$_SESSION["id"]=$row["id"];

header("Location: index.php");

else

echo "<script> alert('Wrong Password'); </script>";

else

echo "<script> alert('UserNotRegistered'); </script>";

}
?>

<html>

<head>

<title>Login</title>

</head>

<body style="background-color:pink;">

<h2>Login</h2>

<form class="" action="" method="post" >

<label for="usernameemail">UsernameorEmail:</label>

<input type="text" name="usernameemail" id="usernameemail" required


value=""><br>

<label for="password">Password:</label>

<input type="password" name="password" id="password" required


value=""><br>

<button type="submit" name="submit">Login</button>

</form><br>

<a href="registration.php">Registration</a></body></html>

//logout.php

<?php

require'config.php';

$_SESSION=[];

session_unset();

session_destroy();

header("Location:login.php");
?>

//index.php

<?php

require 'config.php';

if(!empty($_SESSION["id"])){

$id =$_SESSION["id"];

$result=mysqli_query($conn,"SELECT * FROM usr WHERE id= $id");

$row=mysqli_fetch_assoc($result);

else{

header("Location:login.php");

?>

<html>

<head>

<title>Index</title>

</head>

<body style="background-color:HotPink;">

<h1>Welcome<?php echo $row["username"];?></h1>

<a href="logout.php">Logout</a></body></html>
OUTPUT:
10.STRING OPERATION

print"\t\t\t\tPERL STRING OPERATION";


print "\n\t\t\t\t *********************";
print"\n\t\t\tCONCATENATION OPERATION";
$string1="welcome";
$string2="to asmwc";
$concat_string=$string1.$string2;
print"\nString after concatenation=$concat_string\n";
print "\n\t\t\t REPETITION ";
$str_result=$string1 x 5;
print"\n$str_result\n";
print "\n\t\t\t SUB STRING()\n";
$sub_result = substr($string2, 2);
print $sub_result;
print "\n\t\t\t STRING REPLACE\n";
$var1 = "Welcome to ASM.";
$var1 =~ s/ASM/PERL/;
print "$var1\n";
$str = "Welcome you all for the perl string operation";
$n=length($str);
print "\n\t\t\tSTRING LENGTH\n";
print "$n";
print"\n\t\t\t STRING COMPARSION";
if($string1 eq $string2)
{
print"\n nstring1 and string2 are equal.\n";
}
else
{
print"\nstring1 and string2 is Mismatch!\n";
}
OUTPUT:
PERL STRING OPERATION
*********************
CONCATENATION OPERATION
String after concatenation=welcome to asmwc

REPETITION
welcomewelcomewelcomewelcomewelcome

SUB STRING()
asmwc
STRING REPLACE
Welcome to PERL.

STRING LENGTH
45
STRING COMPARSION
string1 and string2 is Mismatch!

You might also like