A
Lab Journal
Of
“Advanced Internet Technologies"
By
VAIBHAV BHAGWAN SHINDE
Seat No:- 22659
Roll No:- 65
Div:- B
Submitted in partial fulfillment of
First Year Master in Computer Application
Savitribai Phule Pune University
Under the Guidance
Of
Prof. Shubham Sir
1
INDEX
Subject: Advance Internet Technologies
Sr.
Title Page No
No.
1 Program to implement Audio and Video features for your web page 3
Program to Design form using HTML5 element, attribute and 5
2 Semantics.
3 Programs using Canvas and SVG. 8
Programs to demonstrate external and internal styles in the web page
4 using font, text, background, borders, opacity and other CSS 3 10
properties.
Implement Transformation using Translation, Rotation and Scaling in
5 your web page. 14
6 Program to show current date and time using user defined module 17
Program using built-in modules to split the query string into readable
7 parts 18
8 Program using NPM which will convert entered string into either case 19
Write a program to create a calculator using Node JS. (Install and 20
9 configure Node JS and Server.
Write a program form validation on angular
10 23
Program to demonstrate the ngif, ngfor, ngswitch statements.
11 25
Create angular project which will demonstrate the usage of
12 component directive, structural directive and attribute directives. 29
Create angular project which has HTML template and
handle the click event on click of the button 31
13 (Installation of Angular and Bootstrap 4 CSS
Program for basic operations, array and user interface
14 handling. 34
Program to demonstrate session management
15 using various techniques 36
Program to perform the CRUD Operations using PHP 37
16 Script.
2
Assignment:1
1.Program to implement Audio and Video features for your web page.
Source Code:
<html>
<head>Program_01</head>
<body>
<hr>
<h1>Video </h1>
<center> <video controls>
<source src="Nature.mp4" type="video/mp4">
<source src="Nature.mp4=" type="video/webm">
<p>Your browser doesn't support HTML5 video. Here is a
<a href="Nature.mp4">link to the video</a> instead.</p>
</video>
</center>
<hr>
<h2>Audio</h2>
<center>
<audio controls>
<source src="ring.mpeg" type="audio/mp3">
<source src="ring.mpeg" type="audio/ogg">
<p>Your browser doesn't support HTML5 audio. Here is a
<a href="ring.mpeg">link to the audio</a> instead.</p>
</audio>
</center>
<hr>
</body>
</html>
3
4
Assignment:2
2.Program to design form using HTML5 elements, attributes and Semantics
Source Code:
<html>
<head>
<title>Online Payment</title>
</head>>
<body>
<h1 style="align-items: center; color: blueviolet;">Online Payment </h1>
<section>
<h2 style="color: brown;">Contact:</h2>
<fieldset>
<legend>Gender</legend>
<ul>
<li>
<label for="title_1">
<input type="radio" id="title_1" name="title" value="K" >
Mr
</label>
</li>
<li>
<label for="title_2">
<input type="radio" id="title_2" name="title" value="Q" >
Mrs
</label>
</li>
</li>
</ul>
</fieldset>
<p>
<label for="name">
<span>Name: </span>
<strong><abbr
title="required">*</abbr></strong> </label>
<input type="text" id="name" name="username">
</p>
<p>
5
<label for="mail">
<span>E-mail: </span>
<strong><abbr
title="required">*</abbr></strong> </label>
<input type="email" id="mail" name="usermail">
</p>
<p>
<label for="pwd">
<span>Password: </span>
<strong><abbr
title="required">*</abbr></strong> </label>
<input type="password" id="pwd"
name="password"> </p>
</section>
<section>
<h2 style="color: coral;align-items: center;">Payment
Information</h2> <p>
<label for="card">
<span>Card type:</span>
</label>
<select id="card" name="usercard">
<option value="visa">Visa</option>
<option value="mc">Mastercard</option>
<option value="amex">American Express</option>
</select>
</p>
<p>
<label for="number">
<span>Card number:</span>
<strong><abbr
title="required">*</abbr></strong> </label>
<input type="tel" id="number" name="cardnumber">
</p>
<p>
<label for="date">
<span>Expire date:</span>
<strong><abbr
title="required">*</abbr></strong>
<em>formatted as mm/dd/yyyy</em> </label>
<input type="date" id="date" name="expiration">
</p>
<p>
<button type="submit" style="color: coral;">Payment</button>
6
</p>
</section>
</body>
</html>
7
Assignment:3
3. Programs using Canvas and SVG.
SVG(Scalable Vector Graphics)
Source Code:
<html>
<head>Program_03</head>
<script>
window.onload=function() {
var canvas1=document.getElementById("CanvasTag");
var convas2=canvas1.getContext('2d');
convas2.fillStyle='rgb(0,0,255)';
convas2.fillRect(30,30,300,300);
convas2.fillStyle='rgba(0,255,0,0.5)';
convas2.fillRect(60,60,300,300);
convas2.fillStyle='rgba(255,0,0,0.25)';
convas2.fillRect(90,90,300,300);
}
</script>
<body>
<br>
<h1><u style="height: 10px;">Scalable Vector Graphics (SVG) :-</u></h1>
<center>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-
width="4" fill="yellow" />
<h2>SVG Circle</h2>
</svg>
<br>
<hr width="50%" height="10 rem " color="black">
<svg width="400" height="100">
<rect width="400" height="100" style="fill:rgb(0,0,255);stroke-
width:10;stroke:rgb(0,0,0)" />
<h2>SVG Rectangle</h2>
</svg>
<hr width="50%" height="10 rem " color="black">
</center>
<br>
<h1><u style="height: 10px;">HTML Canvas Graphics:-</u></h1>
8
<center>
<canvas id="CanvasTag" width="400" height="400"></canvas>
<h2>Creating a canvas with Transparency</h2>
</center>
</body>
</html>
9
Assignment:4
4.Programs to demonstrate external and internal styles in the web page using font, text,
background, borders, opacity and other CSS 3 properties.
Source Code:
***** Internal CSS*****
<!DOCTYPE html>
<html>
<head>
<title>internal css</title>
<style >
body{
background-color: gray;
}
h1{
font-family: sans-serif;
background-color: red;
color:blue;
border-color: black;
}
h3{
font-size: 24px;
font-family: serif;
background-color: lightblue;
border-style: dashed;
}
hr{
border-color:red;
border-style: dotted;
border-color: purple;
}
p{
font-size: 30px;
font-style: bold;
10
font-style: italic;
}
</style>
</head>
<body>
<center>
<h1>Dr.D.Y Patil School of MCA Lohegaon,Pune</h1>
<hr>
</center>
<h3>
<center>Assignment- Internal CSS</center>
<hr>
</h3>
<P> What is internal css? <br> Ans- As Inline has the highest priority, any
styles that are defined in the internal and external style sheets are overridden
by Inline styles. <br> Internal or Embedded stands second in the priority list
and overrides the styles in the external style sheet. External style sheets have
the least priority.</P>
<hr>
<p></p>
</body>
</html>
*****Internal CSS*****
*****External CSS*****
<!DOCTYPE html>
<html>
<head>
<title>USING CSS3</title>
11
<link rel="stylesheet" type="text/css" href="externalcss.css">
</head>
<body>
<center>
<h1>Dr.D.Y Patil School of MCA Lohegaon,Pune</h1>
<hr>
</center>
<h3>
<center>Assignment- External CSS</center>
<hr>
</h3>
<P> What is External css? <br> Ans- An external style sheet is a separate
CSS file that can be accessed by creating a link within the head section of the
webpage. <br> Multiple webpages can use the same link to access the stylesheet.
The link to an external style sheet is placed within the head section of the
page.</P>
<hr>
<p></p>
</body>
</html>
*****CSS FILE*****
body{
background-color:gray;
}
h1{
font-family: sans-serif;
background-color: red;
color:blue;
border-color: black;
}
h3{
font-size: 24px;
font-family: serif;
background-color: lightblue;
border-style: dashed;
}
hr{
border-color:red;
border-style: dotted;
12
border-color: purple;
}
p{
font-size: 30px;
font-style: bold;
font-style: italic;
}
13
Assignment:5
5.Implement Transformation using Translation, Rotation and Scaling in your web page.
Source Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="rotation.css">
</head>
<body style="background-color: gray">
<center>
<h1>Original Cube</h1>
</center>
<hr style="border-style: dashed; border-color:blue;">
<div id="translation"><center><h1>Translation</h1></center></div>
<div id="rotation"><center><h1>Rotation</h1></center></div> <div
id="scaling"><center><h1>Scaling</h1></center></div> <hr
style="border-style: dashed; border-color:blue;">
<center>
<h1>After Changes Translation,Rotation and Scaling</h1>
</center>
<hr style="border-style: dashed; border-color:blue;">
<div id="After_translation"><center><h1>Translation X And
Y position</h1></center></div>
<div id="After_rotation"><center><h1>Rotation X And Y
position</h1></center></div>
<div id="After_scaling"><center><h1>Scalings X And Y postion</h1></center></div>
<hr style="border-style: dashed; border-color:blue;"> </body>
</html>
*****CSS FILE*****
/* background-color: orange;
color: blue;
transform: matrix(2,1,1,2,70,-200);
transform: rotate(45deg);
transform: scaleY(2);
transform: skewY(20deg);
transform: translateX(50px);
14
background-color: gray;
height: 200px;
margin: 200px auto;
width: 200px;
body{
div{
}
}*/
#translation{
background-color: orange;
height: 200px;
width: 200px;
color: black;
float: left;
}
#rotation{
background-color: orange;
color: black;
height: 200px;
width: 200px;
float:right;
}
#scaling{
background-color: orange;
color: black;
height: 200px;
width: 200px;
margin: 0 auto;
}
#After_translation{
background-color: orange;
height: 200px;
width: 200px;
color: black;
float: left;
transform: perspective(400px)translateX(200px);
transform: perspective(400px)translateY(50px);
}
#After_rotation{
background-color: orange;
color: black;
height: 200px;
width: 200px;
15
float:right;
transform: perspective(400px) rotateY(48deg);
transform: perspective(400px) rotateX(28deg);
}
#After_scaling{
background-color: orange;
color: black;
height: 200px;
width: 200px;
margin: 0 auto;
transform: perspective(400px) scaleX(3);
transform: perspective(400px) scaleY(1.5);
}
16
Assignment:6
6.Program to show current date and time using user defined module
Source Code:
<!DOCTYPE html>
<html>
<head>
<script>
var now = new Date();
document.write(now);
</script>
</head>
<body>
</body>
</html>
17
Assignment:7
7.Program using built-in modules to split the query string into readable parts
Source Code:
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
18
Assignment:8
8.Program using NPM which will convert entered string into either case
Source Code:
var fruits = ["Banana", "Orange", "Apple", "Mango"];
string = fruits.join(' ').toUpperCase();
console.log("convert the string lowercase to uppercase",string)
19
Assignment:9
9.Write a program to create a calculator using Node JS. (Install and configure Node JS
and Server.
Source Code:
//Hapi framework
const Hapi = require('hapi');
//Address and port
const host = 'localhost';
const port = 3000;
//Create server
const server = Hapi.Server({
host: host,
port: port
});
//Routes
require('./routes')(server);
//Start server
const init = async () => {
await server.start();
console.log("Server up! Port: " + port);
}
//Start App
init();
module.exports = function (server) {
//route - about
server.route({
method: 'GET',
path: '/calculadora/about',
handler: function (request, h) {
var data = {
message: 'Calculator API - made by Bernardo Rocha'
};
return data;
}
});
//route - sum
server.route({
20
method: 'GET',
path: '/calculator/sum/{num1}+{num2}',
handler: function (request, h) {
const num1 = parseInt(request.params.num1);
const num2 = parseInt(request.params.num2);
var data = {
answer: num1 + num2
};
return data;
}
});
//route - subtraction
server.route({
method: 'GET',
path: '/calculator/sub/{num1}-{num2}',
handler: function (request, h) {
const num1 = parseInt(request.params.num1);
const num2 = parseInt(request.params.num2);
var data = {
answer: num1 - num2
};
return data;
}
});
//route - multiplication
server.route({
method: 'GET',
path: '/calculator/multi/{num1}*{num2}',
handler: function (request, h) {
const num1 = parseInt(request.params.num1);
const num2 = parseInt(request.params.num2);
var data = {
answer: num1 * num2
};
return data;
}
});
//route - division
server.route({
method: 'GET',
path: '/calculator/div/{num1}/{num2}',
handler: function (request, h) {
const num1 = parseInt(request.params.num1);
21
const num2 = parseInt(request.params.num2);
var data = {
answer: num1 / num2
};
return data;
}
});
}
22
Assignment:10
10.Write a program form validation on angular
Source Code:
import { Component, OnInit } from '@angular/core';
import validator and FormBuilder
import { FormGroup, FormControl, Validators, FormBuilder } from '@angular/forms';
@Component({
selector: 'app-test',
templateUrl: './test.component.html',
styleUrls: ['./test.component.css']
})
export class TestComponent implements OnInit {
//Create FormGroup
requiredForm: FormGroup;
constructor(private fb: FormBuilder) {
this.myForm();
}
//Create required field validator for
name myForm() {
this.requiredForm = this.fb.group({
name: ['', Validators.required ]
});
}
ngOnInit()
{
}
}
<div>
<h2>
Required Field validation
</h2>
<form[formGroup]="requiredForm" novalidate>
<div class="form-group">
<label class="center-block">Name:
<input class="form-control" formControlName="name">
</label>
</div>
<div *ngIf="requiredForm.controls['name'].invalid &&
requiredForm.controls['name'].touched" class="alert alert-danger">
23
<div *ngIf="requiredForm.controls['name'].errors.required"
> Name is required.
</div>
</div>
</form>
<p>Form value: {{ requiredForm.value | json }}</p>
<p>Form status: {{ requiredForm.status | json }}</p>
</div>
24
Assignment:11
11.Program to demonstrate the ngif, ngfor, ngswitch statements.
Source Code:
import { Component, OnInit } from '@angular/core'; @Component({
selector: 'app-server2',
templateUrl: './server2.component.html', styleUrls:
['./server2.component.css']
})
export class Server2Component implements OnInit { allowNewServer =
false; serverCreationStatus = 'No server is created.';
serverName = 'TestServer'; serverCreated = false;
/*constructor() { setTimeout(() =>{ this.allowNewServer = true;
Submit }, 5000);
}*/ ngOnInit() {
onCreateServer() { this.serverCreated = true;
this.serverCreationStatus = 'Server is created. Name of the server is' +
this.serverName;
}
OnUpdateServerName(event: Event) {
this.serverName = (<HTMLInputElement>event.target).value;
}
25
Ngif :
@Component({
selector: 'ngif-example', template: `
<h4>NgIf</h4>
<ul *ngFor="let person of people">
<li *ngIf="person.age < 30"> (1)
{{ person.name }} ({{ person.age }})
</li>
</ul>
`
})
class NgIfExampleComponent {
people: any[] = [
{
"name": "Douglas Pace", "age": 35
},
{
"name": "Mcleod Mueller", "age": 32
},
{
"name": "Day Meyers", "age": 21
},
{
"name": "Aguirre Ellis", "age": 34
},
{
"name": "Cook Tyson", "age": 32
}
];
}
26
Ngswitch:
<ul * ngFor="let person of people">
< li * ngIf="person.country ==='UK'"
class="text-success"> {{ person.name }} ({{ person.country }})
</li>
<li * ngIf=" person.country === 'USA'"
class =" text-primary"> {{ person.name }} ({{ person.country } }
) </li>
< li * ngIf = "person.country === 'HK' "
class="text-danger"> {{ person.name }} ({{ person.country }})
</li>
<li * ngIf ="person.country !== 'HK' && person.country !== 'UK' && person.country
!== 'USA'" class="text-warning">{{ person.name }} ({{ person.country }})
</li>
</ul>
.html @Component({
selector: 'ngswitch-example',
template: `<h4>NgSwitch</h4>
<ul *ngFor="let person of people"
[ngSwitch]="person.country"> (1)
<li *ngSwitchCase="'UK'" (2)
class="text-success">{{ person.name }} ({{ person.country }})
</li>
<li *ngSwitchCase="'USA'"
class="text-primary">{{ person.name }} ({{ person.country }})
</li>
<li *ngSwitchCase="'HK'"
class="text-danger">{{ person.name }} ({{ person.country }})
</li>
<li *ngSwitchDefault (3)
class="text-warning">{{ person.name }} ({{ person.country }})
</li>
</ul>`
})
class NgSwitchExampleComponent {
people: any[] = [
{
27
"name": "Douglas Pace",
"age": 35,
"country": 'MARS'
},
{
"name": "Mcleod Mueller", "age": 32,
"country": 'USA'
},
{
"name": "Day Meyers", "age": 21,
"country": 'HK'
},
{
"name": "Aguirre Ellis", "age": 34,
"country": 'UK'
},
{
"name": "Cook Tyson", "age": 32,
"country": 'USA'
}
];
}
28
Assignment:12
12.Create angular project which will demonstrate the usage of component
directive, structural directive and attribute directives.
Source Code:
import { BrowserModule } from '@angular/platform-browser'; import { NgModule
} from '@angular/core';
import { AppComponent } from './app.component';
// Custom directive imported here by Angular CLI
import { ChangeColorDirective } from './change-color.directive';
@NgModule({ declarations: [
AppComponent,
ChangeColorDirective // Custom directive is declared in declartions array by
Angular CLI
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
import { BrowserModule } from '@angular/platform-browser'; import { NgModule
} from '@angular/core';
import { AppComponent } from './app.component';
// Custom directive imported here by Angular CLI
import { ChangeColorDirective } from './change-color.directive';
@NgModule({ declarations: [
AppComponent,
ChangeColorDirective // Custom directive is declared in declartions array by
Angular CLI
],
29
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
change-color.directive.ts
import { Directive } from
'@angular/core'; @Directive({
selector: '[appChangeColor]'
})
export class ChangeColorDirective {
constructor() { }
}
App.component.html
<div style="text-align:center">
<img width="250" alt="Angular Logo"
src="data:image/svg+xml;base64,jcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCB
maWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAx
NC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0i
TTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJ
IMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgog IDwvc3ZnPg==">
<div style="padding-top: 30px">
// appChangeColor custom Directive
<h1 appChangeColor>I got colored by Angular Custom Directive</h1>
</div>
</div>
30
Assignment:13
13.Create angular project which has HTML template and handle the click event
on click of the button (Installation of Angular and Bootstrap 4 CSS Framework)
Source Code:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Angular Bootstrap Demo</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-
scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-
BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
</head>
<body>
<app-root>Loading...</app-root>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-
hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-
Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa "
crossorigin="anonymous"></script>
</body>
</html>
<div class="container">
<div class="jumbotron">
<h1>Welcome</h1>
<h2>Angular & Bootstrap Demo</h2>
</div>
31
<div class="panel panel-primary">
<div class="panel-heading">Status</div>
<div class="panel-body">
<h3>{{title}}</h3>
</div>
</div>
</div>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Angular Bootstrap Demo</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-
scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-
BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
crossorigin="anonymous">
</head>
<body>
<app-root>Loading...</app-root>
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-
hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-
Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa "
crossorigin="anonymous"></script>
</body>
</html>
<div class="container">
<div class="jumbotron">
<h1>Welcome</h1>
<h2>Angular & Bootstrap Demo</h2>
</div>
32
<div class="panel panel-primary">
<div class="panel-heading">Status</div>
<div class="panel-body">
<h3>{{title}}</h3>
</div>
</div>
</div>
33
Assignment:14
14. Program for basic operations, array and user interface handling.
Source Code:
<?php
class myclass implements ArrayAccess { private $arr = array();
public function construct() {
$this->arr = array("Mumbai", "Hyderabad", "Patna");
}
public function offsetSet($offset, $value) { if (is_null($offset))
{ $this->arr[] = $value;
} else {
$this->arr[$offset] = $value;
}
}
public function offsetExists($offset) { eturn isset($this->arr[$offset]);
}
public function offsetUnset($offset) { unset($this->arr[$offset]);
}
public function offsetGet($offset) {
return isset($this->arr[$offset]) ? $this->arr[$offset] : null;
}
$obj = new myclass();
var_dump(isset($obj[0])); var_dump($obj[0]);
unset($obj[0]); var_dump(isset($obj[0]));
$obj[3] = "Pune";
var_dump($obj[3]);
$obj[4] = 'Chennai';
$obj[] = 'NewDelhi';
$obj[2] = 'Benguluru'; print_r($obj);
?>
<?php
class myclass implements ArrayAccess { private $arr = array();
public function construct() {
$this->arr = array("Mumbai", "Hyderabad", "Patna");
34
public function offsetSet($offset, $value) { if (is_null($offset))
{ $this->arr[] = $value;
} else {
$this->arr[$offset] = $value;
}
}
public function offsetExists($offset) { eturn isset($this->arr[$offset]);
}
public function offsetUnset($offset) { unset($this->arr[$offset]);
}
public function offsetGet($offset) {
return isset($this->arr[$offset]) ? $this->arr[$offset] : null;
}
$obj = new myclass();
var_dump(isset($obj[0])); var_dump($obj[0]);
unset($obj[0]); var_dump(isset($obj[0]));
$obj[3] = "Pune";
var_dump($obj[3]);
$obj[4] = 'Chennai';
$obj[] = 'NewDelhi';
$obj[2] = 'Benguluru'; print_r($obj);
?>
35
Assignment:15
Program to demonstrate session management using various techniques
Source Code:
<?php
// Start the session session_start();
?>
<!DOCTYPE html>
<html>
<body>
<?php
// Set session variables
$_SESSION["favcolor"] = "green";
$_SESSION["favanimal"] = "cat"; echo "Session variables are
set."; ?>
</body>
</html>
36
Assignment:16
16.Program to perform the CRUD Operations using PHP Script.
Source Code:
/* Attempt MySQL server connection. Assuming you are running MySQL server
with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root",
""); // Check connection if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Print host information
echo "Connect Successfully. Host info: " . mysqli_get_host_info($link);
?>
37