0% found this document useful (0 votes)
28 views59 pages

Oss Lab Final Edit

The document describes creating a web page with frames and tables. It includes: 1) Creating a frameset with multiple frames to divide the webpage. Data like student details and marks are displayed in different frames using HTML files. 2) Tables are used within the HTML files to display the student and mark details in a tabular format with rows and columns. 3) The output generated shows the webpage divided into frames with tables displaying the student and mark details.

Uploaded by

lingeshwaran2506
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)
28 views59 pages

Oss Lab Final Edit

The document describes creating a web page with frames and tables. It includes: 1) Creating a frameset with multiple frames to divide the webpage. Data like student details and marks are displayed in different frames using HTML files. 2) Tables are used within the HTML files to display the student and mark details in a tabular format with rows and columns. 3) The output generated shows the webpage divided into frames with tables displaying the student and mark details.

Uploaded by

lingeshwaran2506
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/ 59

SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO : 01 CREATE A WEB PAGE WITH FRAMES AND TABLES


DATE :

Aim:
To create a web page with frame and tables.

Procedure:
Step 1: Open notepad from All programs->Accessories->Notepad.
Step 2: Create a closet frame on a web page using html tags.
Step 3: Then form a table with a table tag which includes cell spacing, cell
Padding, rowspan, colspan in one frame.
Step 4: Fill the table with data.
Step 5: Displaying the text in the second frame.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Main.html:
<html>
<frameset rows=25%,75%>
<frame name=border src="border.html">
<frameset cols=40%,75%>
<frame name=detail src="detail.html">
<frame name=display src="display.html">
</frameset>
</frameset>
</html>

Border.html:
<html>
<body>
<center>
<ol style="color:black">
<font name="Times New Roman" size=7>
S.S ARTS AND SCIENCE COLLEGE<br>
Department of Computer Applicaions<br>Villupuram
(Affiliated by Thiruvalluvar University).
</font>
</center>
</body>
</html>

Display.html:
<html>
<body>
<h3>Features:<br>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<ul type="square">
<font name="Times New Roman" size=5>
<li>Hygenic canteen and food faculties.
<li>Very fast transport facility with two buses.
<li>very Hi-Tech labs with high speed internet.
<li>Very big playground with lot of sports.
<li>Air-conditioned class rooms.
</h3>
</body>
</html>

Details.html:
<html>
<body>
<b>STUDENT INFORMATION:</b><br>
<a href="student.html" target="display">Student Details</a><br>
<a href="mark.html" target="display">Mark Details</a><br>
</body>
</html>

Student.html:
<html>
<body>
<center>
<table border=2>
<b><center><font size=15>Student Details</font></center></b>
<tr>
<th>Roll Number</th>
<th>Student Name</th>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<th>Department</th>
</tr>
<tr>
<td>101</td>
<td>K.Devanathan</td>
<td>BCA</td>
</tr>
<tr>
<td>102</td>
<td>M.Manikandan</td>
<td>BCA</td>
</tr>
<tr>
<td>103</td>
<td>Raja.RJ</td>
<td>BCA</td>
</tr>
<tr>
<td>104</td>
<td>G.Siva</td>
<td>BCA</td>
</tr>
<tr>
<td>105</td>
<td>R.Manohar</td>
<td>BCA</td>
</tr>
<tr>
<td>106</td>
<td>P.Ezhil</td>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<td>BCA</td>
</tr>
</table>
</body></html>

Mark.html:
<html>
<body>
<center>
<table border=2>
<b><center><font size=15>Mark Details</font></center></b>
<tr>
<th>Roll Number</th>
<th>Student Name</th>
<th>OSS</th>
<th>MM</th>
<th>DCN</th>
<th>SE</th>
<th>Total</th>
<th>Result</th>
</tr>
<tr>
<td>101</td>
<td>K.Devanathan</td>
<td>82</td>
<td>50</td>
<td>80</td>
<td>70</td>
<td>282</td>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<td>Pass</td>
</tr>
<tr>
<td>102</td>
<td>M.Manikandan</td>
<td>92</td>
<td>70</td>
<td>50</td>
<td>80</td>
<td>292</td>
<td>Pass</td>
</tr>
<tr>
<td>103</td>
<td>Raja.RJ</td>
<td>91</td>
<td>80</td>
<td>87</td>
<td>60</td>
<td>318</td>
<td>Pass</td>
</tr>
<tr>
<td>104</td>
<td>G.Siva</td>
<td>50</td>
<td>80</td>
<td>50</td>
<td>60</td>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<td>240</td>
<td>Pass</td>
</tr>
<tr>
<td>105</td>
<td>R.Manohar</td>
<td>98</td>
<td>80</td>
<td>60</td>
<td>90</td>
<td>328</td>
<td>Pass</td>
</tr>
<tr>
<td>106</td>
<td>P.Ezhil</td>
<td>88</td>
<td>70</td>
<td>69</td>
<td>91</td>
<td>328</td>
<td>Pass</td>
</tr>
</table>
</body></html>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above program creating a web pages with frames and tables has been
executed successfully and output is verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO: 02 CASCADING STYLE SHEETS


DATE:

Aim:
To create a web page implementing cascading style sheets.

Procedure:
Step 1: Open a notepad from All programs->Accessories->notepad.
Step 2: Create a webpage using the html tags.
Step 3: Using style sheet display the background color, font size, ordered link.
Step 4: Using the style sheet the formatting properties can be predefined in a
single link.
Step 5: Create another webpage and same the file as with extension css.
Step 6: Make a link page to HTML file.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Main.html:
<html>
<head>
<h1><center>ALL STYLE SHEETS</center></h1>
<title>Use In EX style sheets</title>
<link rel="stylesheet" href="ezhil.css" type="text/css">
<style type="text/css">
.vid{font-family:verdana;font-style:italic;color:red;text-align:center}
.ani{font-family:tahoma;font-style:italic;color:red;text-align:center;}
font{font-family:georgia;color:black;font-size:20}
ul{list-style-type:cicle}
</style>
</head>
<body>
<ol style="color:black">
<b><center><font size=20>
<b><center>S.S ARTS AND SCIENCE COLLEGE,VILLUPURAM,TAMILNADU.</b></ol>
<br>
<ol style="list-style-type:lower-alpha">
<li>Department of Computer Apllications
<li>Department of Computer Sciences
<li>Department of mathematics
<li>Department of physchology
<li>Department of criminology
</ol>
<p style="font-size:16pt;color:brown">(Mrs.MALAR)HOD of Computer Applications,</p>
<p class="ani">S.S ARTS AND SCIENCE COLLEGE<br>
(Affiliated by Thiruvalluvar university)<br></p>
<font><h2>List of Courses Offered</h2>
<ul>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<li>B.Sc(computer science)</li>
<li>BBA(Cooperate assotiative)</li>
<li>Bsc.physics</li>
<li>BCA(Ehical hacking with cyber world)</li>
<li>BA.literature</li>
<li>Bsc.maths</li>
</ul>
</font>
<h3>Results of BCA Students:</h3>
<table width="60%" cellspacing="2" cellpadding="2" border="5">
<tr>
<th>Name</th>
<th>Marks</th>
<th>Result</th>
</tr>
<tr>
<td align="center">Ezhil</td>
<td align="center">100</td>
<td align="center">Pass</td>
</tr>
<tr>
<td align="center">Deva</td>
<td align="center">100</td>
<td align="center">Pass</td>
</tr>
<tr>
<td align="center">Manohar</td>
<td align="center">100</td>
<td align="center">Pass</td>
</tr>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

</table>
</body>
</html>

color.css:
h3{font-family:arial:font-size:15;color:red}
table{border-color:"green"}
td{font-size:20pt;color:magenta}

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above html and css program has been executed successfully and the output was
verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:03 FACTORIAL OF POSITIVE INTEGER

DATE:

Aim:
To create a shell program to find the factorial of a positive integer number.

Procedure:
Step 1:Click start to All Programs->Oracle VM Virtual BOX then start the process,
then start into LINUX or UNIX based operating systems then login.
Step 2: Open Applications->Gedit text editor, andenter the shell script.
Step 3: Save the shell script in as Factorial.sh
Step 4: Compile the program using the command->„chmod x+ factorial.sh‟.
Step 5: Run the program using the command-> „bash factorial.sh‟.
Step 6: Stop the process.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Source code:
echo “FACTORIAL OF A GIEN NUMBER”
echo “ENTER THE NUMBER”
read num
i=1
fact=1
while [$i –le $num ]
do
fact = $(($fact*$i)
i= $(($ + 1))
done
echo “Facorial of $num is $fact”

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above shell script program has been executed successfully and the output
was verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:04 PALINDROME
DATE:

Aim:
To create a shell program to find the given string is a palindrome or not.

Procedure:
Step 1:Click start to All Programs->Oracle VM Virtual BOX then start the process,
then start into LINUX or UNIX based operating systems then login.
Step 2: Open Applications->Gedit text editor, andenter the shell script for a given
string is palindrome or not.
Step 3: Save the shell script in as Palinedrome.sh
Step 4: Compile the program using the command-> „chmod x+ palindrome.sh‟.
Step 5: Run the program using the command-> „bash palindrome.sh‟.
Step 6: Stop the process.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Source code:
echo “Enter the string”
read str
len= `echo $str| wc –c`
len= `echo $len – 1`
i=1
while [ $i –le $len ]
do
ch= `echo $str| cut –c$i`
ch1= `echo $str| cut –c$len`
if [ $ch != $ch1 ]
then
echo “The given string is not a PalinDroMe”
exit
fi
len= `expr $len – 1`
i= `expr $i + 1`
done
echo “The given string is a PalinDroMe”

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above shell script program for palindrome has been executed successfully and the
output was verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:05 SIMPLE CALCULATOR.


DATE:

Aim:
To create a simple calculator using form fields.

Procedure:
Step 1: Start the process.
Step 2:Open a notepad from All programs->Accesseries->notepad.
Step 3:Create a webpage.
Step 4:Using Javascript allow‟s the user to do plus, minus, multiplication,
division.
Step 5:Function and invoke the operations[+,-,*,/]
Step 6: Stop the process.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Calc.html:
<html>
<head>
<script language="JavaScript">
var inputstring="";
function updatestring(value)
{
inputstring+=value;
document.calculater.input.value=inputstring;

}
</script>
</head>
<body>
<form name="calculater">
<center>
<table border=3 bordercolor="black">
<tr>
<td>
<input type="text" name="input" maxlenght=15 size=28><br>
<input type="button" value="CLEAR" onclick="input.value='';inputstring=''";>
<input type="button" value="MOD" onclick="updatestring('%')" style="width:60">
<input type="button" value="+" onclick="updatestring('+')" style="width:50"><br>
<input type="button" value="7" onclick="updatestring('7')" style="width:40">
<input type="button" value="8" onclick="updatestring('8')" style="width:40">
<input type="button" value="9" onclick="updatestring('9')" style="width:40">
<input type="button" value="-" onclick="updatestring('-')" style="width:50"><br>
<input type="button" value="4" onclick="updatestring('4')" style="width:40">
<input type="button" value="5" onclick="updatestring('5')" style="width:40">
<input type="button" value="6" onclick="updatestring('6')" style="width:40">
<input type="button" value="*" onclick="updatestring('*')" style="width:50"><br>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<input type="button" value="1" onclick="updatestring('1')" style="width:40">


<input type="button" value="2" onclick="updatestring('2')" style="width:40">
<input type="button" value="3" onclick="updatestring('3')" style="width:40">
<input type="button" value="/" onclick="updatestring('/')" style="width:50"><br>
<input type="button" value="0" onclick="updatestring('0')" style="width:40">
<input type="button" value="." onclick="updatestring('.')" style="width:40">
<input type="button" value="00" onclick="updatestring('00')" style="width:40">
<input type="button" value="=" onclick="input.value= eval (inputstring)”
style="width:50";
</td>
</table>
</form>
</body>
</html>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above javascript program simple calculator has been executed successfully and
the output was verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:06 JAVASCRIPT PROGRAM TO SCROLL YOUR


NAME IN THE SCROLL BAR
DATE:

Aim:
To write a program to scroll the name in the scroll bar.

Procedure:
Step 1: Start the process.
Step 2: Open notepad from AllPrograms->Accessories->Notepad.
Step 3: Create a web page.
Step 4: Using Javascript to display the text in the Scroll Bar using text area.
Step 5: Stop the process.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Scroll.html:
<html>
<head>
<title>SCROLLING USING JAVASCRIPT</title>
<script type="text/javascript"src="scroll.js">
</script>
<link rel="stylesheet"type="text/css"href="scroll.css">
</head>
<body>
<h1>SCROLLING NAME</h1>
<div id ="thewindow">
<div id ="thetext">
<p></p><br><br>
<p>ezhilarasan</p><br><br>
<p>Manohar</p><br><br>
<p>Raja RJ</p><br><br>
<p>Mani mk</p><br><br>
<p>Deva K</p><br><br>
<p>Siva</p><br><br></div>
</body>
</html>

Scroll.js:
var pos=100;
function Scroll(){
obj=document.getElementById("thetext");
pos-=1;

if(pos<0-obj.offsetHeight+130)return;
obj.style.top=pos;
window.setTimeout("Scroll();",10);

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

}
window.onload=Scroll;

Scroll.css:
#thewindow{
position:relative;
Width:180;
height:150;
overflow:Scroll;
border:2px solid red;
}
#thetext{
position:absolute;
width:170;
left:5;
top:100;
}

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above javascript program for scroll bars has been executed successfully and the
output was verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:07 MESSAGE PASSING MECHANISM


DATE:

Aim:
To develop a program and check message passing mechanism between pages.

Procedure:
Step 1: Open notepad from All program->Accessories->Notepad.
Step 2: Create a form with action as PHP file and textbox, submit button in
html.
Step 3: create a php page, to display the message passed by html page.
Step 4:Run the html page in browser‟s server page(wamp/xampp).

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Main.html:
<HTML>
<HEAD>
<TITLE><CENTER><FONT COLOR="RED"><U>MY
FORM</U></FONT></CENTER></TITLE>
</HEAD>
<BODY>
<FORM ACTION ="myshow.php" METHOD=POST>
<FONT COLOR="BLUE">MY NAME IS :<BR/></FONT>
<BR><INPUT TYPE="TEXT" NAME="YOUR_NAME">
<BR/>
<BR/>
<FONT COLOR="BLUE">MY FAVORITE POWER RANGER IS :</FONT>
<BR/><INPUT TYPE="TEXT" NAME="FAVORITE_WORD">
<BR/>
<BR/>
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="THAT'S RIGHT">
</FORM>
</BODY>
</HTML>

Myshow.php:
<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>
<?PHP
$YOUR_NAME=$_REQUEST['YOUR_NAME'];
$FAVORITE_WORD=$_REQUEST['FAVORITE_WORD'];
?>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<P>
HI <B><?PHP PRINT $YOUR_NAME;?></B>
<P>
YOUR FAVOUITE POWER RANGER'S IS<B>
<?PHP PRINT $FAVORITE_WORD;?>!?!</B>
</BODY>
</HTML>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above php program for message passing between pages has been executed
successfully and the output was verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:08 FILE SYSTEM FUNCTION & DATE AND


TIMEFUNCTION.
DATE:

Aim:
To write a PHP program to process the file system function and date, time functions.

Procedure:
Step 1: Start the process.
Step 2: Open any text file in a read mode using fopen function.
Step 3: Check whether the text file is fully displayed using feof function.
Step 4: Using the date and time function display the date and time.
Step 5: Stop the process.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

“FILE SYSTEM FUNCTIONS”:

Main.php:
<?php
$demofile = fopen('admin.txt', 'r') or die('File cannot be opened!');
echo fread($demofile, filesize('admin.txt'));
fclose($demofile);
?>

Admin.txt:
<html>
<head>
</head>
<body>
<ol style="color:black">
<b>*S.S ARTS AND SCIENCE COLLEGE*:</b><br/>
<b> UG Courses </b></br>
<ol type="1">
<li> B.E </li>
<li> BBA </li>
<li> BCA </li>
<li> B.sc </li>
<li> B.Com </li>
</ol>
<b> PG Courses </b></br>
<ol type="1">
<li> M.Tech </li>
<li> M.E </li>
<li> MBA </li>
</ol></body></html>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

“DATE AND TIME FUNCTION”:

Datetime.php:
<?php

echo("<h3>S.S ARTS AND SCIENCE COLLEGE,Villupuram</h3><br/>");


echo("<h3>Working day's Date:</h3><br/>");
echo "Today is " . date("Y/m/d") . "<br>";
echo "Today is " . date("Y.m.d") . "<br>";
echo "Today is " . date("Y-m-d") . "<br>";
echo "Today is " . date("l");
echo("<h3>Period duration Time:</h3><br/>");
date_default_timezone_set("America/New_York");
echo "The time is " . date("h:i:sa") . "<br>";
echo "The time is " . date("h/i/sa") . "<br>";
echo "The time is " . date("h-i-sa") . "<br>";
?>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above php program for file system and date and time has been executed
successfully and the output was verified.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:09 MYSQL MANIPULATING RECORDS.


DATE:

Aim:
To create a student database table in MYSQL and manipulate records with operations
like insert, delete, and update.

Procedure:
Step 1: Start the process.
Step 2: Then on the wamp/xampp menu go to MySQL->MySQL console.
Step 3: Then click on the MySQL console and press Enter to run database.
Step 4: Then go to the localhost server and go tohttp://localhost/phpmyadmin/ and
type the default user_name as „root‟ then login into the phpmyadmin database web
server.
Step 5: Then create a „database name‟ with „utf8_general-ci‟ code and then create
your database.
Step 6: Then create tables with number of columns and view description of table
using structure menu.
Step 7: Then insert values into the table with SQL insert queries and view the table
using browse menu.
Step 7: Then delete values in the table with SQL deletion queries and view the table
using browse menu.
Step 7: Then update values into the table with SQL update queries and view the table
using browse menu.
Step 8: Stop the process.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Creating a table:
Enter the table_name and no.of columns needed.

Description of the Table:

1. Inserting records into the table:

INSERT INTO `bca result` (`id`, `studname`, `course`, `email`) VALUES ('0011', 'Raja', 'BCA',
'[email protected]');

INSERT INTO `bca result` (`id`, `studname`, `course`, `email`) VALUES ('0012', 'Mani mk',
'BCA', '[email protected]');

2 rows inserted.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

INSERT INTO `bca result` (`id`, `studname`, `course`, `email`) VALUES ('0013', 'Ezhilarasan',
'BCA', '[email protected]');

INSERT INTO `bca result` (`id`, `studname`, `course`, `email`) VALUES ('0014', 'Siva', 'BCA',
'[email protected]');

2 rows inserted.

INSERT INTO `bca result` (`id`, `studname`, `course`, `email`) VALUES ('0015', 'Deva', 'BCA',
'[email protected]');

INSERT INTO `bca result` (`id`, `studname`, `course`, `email`) VALUES ('0016', 'Mano', 'BCA',
'[email protected]');

2 rows inserted.

View table after inserted records:

SELECT*FROM`bca result`

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

2. Delete records from table:

DELETEFROM`bca result` WHERE `id`= 0016;

1 row(s) affected.

DELETEFROM`bca result` WHERE `id`= 0014;

1 row(s) affected.

View table after deleted records:

SELECT*FROM`bca result`

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

3. Updating records in table:

UPDATE `bca result` SET `course`= 'MCA(Cyber security)' WHERE `id`= 0011;

1 row(s) affected.

UPDATE `bca result` SET `course`= 'MBA' WHERE `id`= 0013;

1 row(s) affected.

View table after updating records:

SELECT*FROM`bca result`

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Truncating table:

TRUNCATE TABLE `bca result`;

Table truncated.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the above MySQL database program has been executed and output is verified
successfully.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

EX.NO:10 COOKIES AND SESSIONS.


DATE:

Aim:
To write a php program for demonstrating the cookies and session concept.

Procedure:
Step 1: Start the process for cookie.
Step 2: Start the cookie program by initializing values of cookie variables like
cookie_name and cookie_value.
Step 3: Click to proceed to know the cookie‟s user name and value.
Step 4: Print the values of the cookie variables along with the name of the
person.
Step 5: Stop the process.
Step 6: Start the process for session.
Step 7: Start the session program by initializing value of session to know the last visited
session time
Step 8: Click to proceed to know the user‟s visited session time.
Step 9: Print the values of the session time.
Step 10: Stop the process.

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Cookiemain.html:
<HTML>
<HEAD>
<TITLE>MY COOKIE FORM</TITLE>
<ol style="color:red">
<P>WELCOME TO AVENGERS DATABASE</P><br>
</HEAD>
<BODY>
<FORM ACTION ="cookies2.php" METHOD=POST>
<FONT COLOR="BLUE">Know your user_name to Access your AVENGER
database:<BR/></FONT>
<BR/>
<BR/>
<FONT COLOR="BLUE">Click below to proceed:</FONT>
<BR/>
<BR/>
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Yes you can proceed! ACCESS
GRANTED">
</FORM>
</BODY>
</HTML>

Cookie.php:
<?php
$cookie_name = "Avengers";
$cookie_value = "Ironman";
setcookie($cookie_name, $cookie_value, time() + (86400 * 30), "/"); // 86400 = 1 day
?>
<html>
<body>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

<?php
if(!isset($_COOKIE[$cookie_name])) {
echo "Cookie named '" . $cookie_name . "' is not set!";
} else {
echo "Cookie '" . $cookie_name . "' is set!<br>";
echo "User is: " . $_COOKIE[$cookie_name];
}
?>
</body>
</html>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sessionmain.html:
<HTML>
<HEAD>
<TITLE>MY SESSION FORM</TITLE>
<ol style="color:red">
<P>WELCOME TO AVENGERS SESSION</P><br>
</HEAD>
<BODY>
<FORM ACTION ="session.php" METHOD=POST>
<FONT COLOR="navy">Are you looking for your session?<BR/></FONT>
<BR/>
<BR/>
<FONT COLOR="blue">Click below for your last visit:</FONT>
<BR/>
<BR/>
<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Yes you can proceed! ACCESS
GRANTED to your session">
</FORM>
</BODY>
</HTML>

Session.php:
<?php
session_start();
if( isset( $_SESSION['counter'] ) ) {
$_SESSION['counter'] += 1;
}else {
$_SESSION['counter'] = 1;
}
$msg = "You have visited this page ".
$_SESSION['counter'];

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

$msg .= "in this session.";


?>
<html>
<head>
<title>Setting up a PHP session</title>
</head>
<body>
<?php
echo ( $msg ); ?>
</body>
</html>

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Sample output:

PAGE NO:
SIDDHAR SIVAGNAANI ARTS AND SCIENCE COLLEGE

Result:
Thus the cookie and session program has been executed and output is verified
successfully.

PAGE NO:

You might also like