WEB TECHNOLOGY 150160116070
Practical-9
AIM: Create valid XML and XML Schema file for Student Information.
• student.xsd :
<?xml version="1.0"? encoding="ISO-8859-1">
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema-instance">
<xs:element name="student">
<xs:complexType>
<xs:sequence>
<xs:element name="name" type="xs.string"/>
<xs:element name="address" type="xs.string"/>
<xs:element name="rollno" type="xs.string"/>
<xs:element name="department" type="xs.string"/>
<xs:element name="hobby" type="xs.string"/>
<xs:element name="contact number" type="xs.string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
• studentinfo.xml :
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/css" href="book1.css"?>
<student xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="student.xsd">
<h3>@@Student Information@@ </h3>
<student>
<name>Piyush</name>
<address>Himmatnagar</address>
Page 18
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
<rollno>01</rollno>
<hobby>cricket</hobby>
<contact>13453215</contact>
</student>
<student>
<name>dishant </name>
<address>vadodra</address>
<rollno>02</rollno>
<hobby>cricket </hobby>
<contact>1432515</contact>
</student>
</student>
• book1.css :
student
{
display: block;
text-align:center;
font-family:arial;
color:red;
font-size:18px
}
name
{
margin-right:100px;
font-family:Times New Roman;
color:Green;
font-size:14px
Page 19
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
address,rollno{
text-align:center;
display:block;
font-family:Times New Roman;
color:orange;
font-size:14px
}
department{
text-align:center;
display:block;
font-family:Times New Roman;
color:#F707AE;
font-size:14px
}
hobby,contact{
text-align:center;
display:block;
font-family:Times New Roman;
color:#70262F;
font-size:14px
Page 20
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
Output:
Page 21
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
Practical-10
AIM: Create student mark sheet in XML and display in tabular
format using XSLT.
• stud.xsl :
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Student Details - Transformation</title>
</head>
<body>
<table border="1px">
<caption>Student Details</caption>
<tr>
<th>Name</th><th>Department</th><th>Roll No</th><th> Total
Marks</th>
</tr>
<xsl:for-each select="/studInfo/stud">
<tr>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="dept"/></td>
<td><xsl:value-of select="rno"/></td>
<td><xsl:value-of select="spi"/></td>
</tr>
</xsl:for-each>
</table>
Page 22
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
</body>
</html>
</xsl:template>
</xsl:transform>
• stud.xml :
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="stud.xsl"?>
<studInfo>
<stud>
<name>Abhilash</name>
<dept>CE</dept>
<rno>01</rno>
<spi>6.5</spi>
</stud>
<stud>
<name>Akhila</name>
<dept>CE</dept>
<rno>02</rno>
<spi>6.1</spi>
</stud>
<stud>
<name>Anaswara</name>
<dept>CE</dept>
<rno>03</rno>
<spi>7.5</spi>
</stud>
<stud>
<name>Nil</name>
<dept>CE</dept>
<rno>04</rno>
Page 23
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
<spi>6.5</spi>
</stud>
<stud>
<name>Anuj</name>
<dept>IT</dept>
<rno>05</rno>
<spi>7.0</spi>
</stud>
</studInfo>
Output:
Page 24
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
PRACTICAL 11
Aim: Create log in page with PHP and MYSQL.
Code:
Prac11.php:
<!DOCTYPE html>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<fieldset>
<legend><h2>Log in</h2></legend>
<form method="post" action="sn1.php">
<table>
<tr>
<td>
User_ID:
</td>
<td>
<input type="text" name="id" placeholder="Id">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="pasw" placeholder="Password">
</td>
</tr>
Page 25
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
<tr>
<td><input type="submit" name="log" value="Login"></td>
<td><a href="sn.php">Sign Up</a></td>
</tr>
</table>
</form>
</fieldset>
</body>
</html>
sn.php:
<?php
mysql_connect('localhost','root','');
mysql_select_db('clg');
if(isset($_POST['signup'])){
$s1=mysql_real_escape_string($_POST['name']);
$s2=mysql_real_escape_string($_POST['eid']);
$s3=mysql_real_escape_string($_POST['pas']);
$s4=mysql_real_escape_string($_POST['pas1']);
if($s3==$s4){
$q1=mysql_query('INSERT INTO prac(name,eid,password) VALUES
("'.$s1.'","'.$s2.'","'.$s3.'")');
echo "<h2 style='color:green'>Successful Sign up</h2>";
}else{
echo "<h2 style='color:red'>Enter Same Password!</h2>";
}
}
?>
<!DOCTYPE html>
<html>
<body>
<?php
Page 26
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
echo '<fieldset>
<legend><h2>Sign Up</h2></legend>
<form method="post" action="sn.php">
<table>
<tr>
<td>
UserName:
</td>
<td>
<input type="text" name="name" placeholder="Name">
</td>
</tr>
<tr>
<td>
User_ID:
</td>
<td>
<input type="text" name="eid" placeholder="Id">
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type="password" name="pas" placeholder="Password">
</td>
</tr>
<tr>
<td>
Confirm Password:
</td>
Page 27
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
<td>
<input type="password" name="pas1" placeholder="Password">
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="signup" value="SignUp"></td>
</tr>
</table>
</form>
</fieldset>';
?>
</body>
</html>
Sn1.php:
<?php
mysql_connect('localhost','root','');
mysql_select_db('clg');
if(isset($_POST['log'])){
$w1=mysql_real_escape_string($_POST['id']);
$w2=mysql_real_escape_string($_POST['pasw']);
$u1=mysql_query('select * from prac where eid="'.$w1.'"');
$row=mysql_fetch_array($u1);
if($w2==$row['password']){
echo '<h2 style="color:#7722ff">Welcome</h2><h1
style="color:#009999">'.$row['name'].'</h1>';
}else{
echo "<h2 style='color:red'>Failed LogIn</h2>";
}
}
?>
Page 28
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
Output:
Page 29
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
PRACTICAL 12
Aim: Demonstrate Add, Update and Delete using PHP and MYSQL.
Code:
Prac12.php:
<?php
mysql_connect('localhost','root','');
mysql_select_db('clg');
session_start();
if(isset($_POST['submit'])){
$s1=mysql_real_escape_string($_POST['class']);
$s2=mysql_real_escape_string($_POST['en']);
$s3=mysql_real_escape_string($_POST['status']);
$s4=mysql_real_escape_string($_POST['fac']);
date_default_timezone_set('Asia/Calcutta');
$dt=date(" d/m/y");
$q2=mysql_query("SELECT * FROM attd");
$row=mysql_fetch_array($q2);
$q1=mysql_query('INSERT INTO attd(class,en,status,dt,faculty)
VALUES("'.$s1.'","'.$s2.'","'.$s3.'","'.$dt.'","'.$s4.'")');
}
?>
<html><head>
<style type="text/css">
fieldset{
background: white;
font-family: Calibri Light;
border-radius: 20px;
}
Page 30
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
table{
border-top: 0px;
border-left: 0px;
}
td{
border-bottom: 0px;
border-right: 0px;
}
th{
border-bottom: 0px;
border-right: 0px;
}
</style>
</head>
<body bgcolor="#E0E0E0">
<fieldset>
<legend><h2>Register</h2></legend>
<form method="post" action="prac12.php">
<table>
<tr>
<td><label>Class Name:</label>
</td>
<td><select name="class">
<option>CE 1</option>
<option>CE 3</option>
<option>CE 5</option>
<option>CE 7</option>
</select>
</td>
</tr>
Page 31
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
<tr>
<td>
<label>Enrollment:</label>
</td>
<td>
<input type="text" name="en">
</td>
</tr>
<tr>
<td>
<label>Status:</label>
</td>
<td><select name="status">
<option>A</option>
<option>P</option>
</select>
</td>
</tr>
<tr>
<td>
<label>Faculty:</label>
</td>
<td>
<input type="text" name="fac">
</td>
</tr>
<tr>
<td>
</td>
<td>
Page 32
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
<input type="submit" name="submit" value="SUBMIT">
</td>
</tr>
</table>
</form>
</fieldset>
</body>
<fieldset>
<?php
echo "<legend><h2>Attendance list</h2></legend>";
echo '</table>';
echo "<table border='1px' cellspacing='0px'>";
echo "<tr>";
echo "<th>No.";
echo "</th>";
echo "<th>Enrollment";
echo "</th>";
echo "<th>Class";
echo "</th>";
echo "<th>Status";
echo "</th>";
echo "<th>Faculty";
echo "</th>";
echo "<th>Date";
echo "</th>";
echo "<th>";
echo "</th>";
echo "<th>";
echo "</th>";
echo "</tr>";
Page 33
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
$i=1;
$q5=mysql_query("SELECT * FROM attd");
while($row3=mysql_fetch_array($q5)){
echo "<tr>";
echo "<td>".$i;
echo "</td>";
echo "<td>".$row3['en'];
echo "</td>";
echo "<td>".$row3['class'];
echo "</td>";
echo "<td>".$row3['status'];
echo "</td>";
echo "<td>".$row3['faculty'];
echo "</td>";
echo "<td>".$row3['dt'];
echo "</td>";
echo "<td>";
echo "<a href='prac122.php?id=".$row3['id']."'>DEL</a>";
echo "</td>";
echo "<td><a href='prac123.php?val=".$row3['id']."'>Edit</a>";
echo "</td>";
echo "</tr>";
$i=$i+1;
}
echo '</table>';
?>
</fieldset>
</html>
Page 34
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
Prac122.php:
<?php
mysql_connect('localhost','root','');
mysql_select_db('clg');
$qw1=mysql_query(sprintf("DELETE FROM attd WHERE id='%s'",$_GET['id']));
ob_end_clean();
include 'prac12.php';
?>
prac123.php:
<?php
mysql_connect('localhost','root','');
mysql_select_db('clg');
session_start();
if(isset($_POST['ups']))
{}else
{
$q1=mysql_query('select*from attd where id="'.$_GET['val'].'"');
$ro=mysql_fetch_array($q1);
$_SESSION['uid']=$ro['en'];
$_SESSION['bd']=$_GET['val'];
}
?>
<html>
<head>
<style type="text/css">
fieldset{
Page 35
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
background: white;
font-family: Calibri Light;
border-radius: 20px;
}
</style>
</head>
<body bgcolor="#E0E0E0">
<fieldset>
<legend><h2>Edit Here</h2></legend>
<form method='post' action='prac123.php'>
<table>
<tr>
<td>Enrollment:
</td>
<td>
<?php echo '<input type="text" name="eu" value="'.$_SESSION['uid'].'" >';
?>
</td>
<td>
<select name="status">
<option>A</option>
<option>P</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="ups" value="Update">
</td>
Page 36
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
</tr>
</table>
</form>
</fieldset>
<?php
if(isset($_POST['ups'])){
$u1=mysql_real_escape_string($_POST['eu']);
$u2=mysql_real_escape_string($_POST['status']);
if($qw1=mysql_query("UPDATE attd SET status='".$u2."' WHERE
id='".$_SESSION['bd']."'"))
{
echo "success";
}else{
echo "failed";
}
ob_end_clean();
session_commit();
include 'prac12.php';
}
?>
</body>
</html>
Page 37
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
Output:
Page 38
th
GEC, Modasa (6 IT (A3))
WEB TECHNOLOGY 150160116070
Page 39
th
GEC, Modasa (6 IT (A3))