You are on page 1of 14

Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

Virtual Laboratory (PHP / MySQL)


4th Semester (CSE)

Department of Computer Science & Engineering


Bhilai Institute of Technology Raipur
(Session Jan – Jun ..2021..)

Virtual Laboratory (PHP / MySQL)Page 1


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

Submitted by:

Name of the student :


Roll Number :

Department of Computer Science & Engineering


Bhilai Institute of Technology Raipur
(Session Jan – Jun ..2021..)

Virtual Laboratory (PHP / MySQL)Page 2


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

This is to certify that

Shri/ Ku. ______________________________________________

Of B.E.__________4th__________Semester (Branch________C.S.E_________)

Has completed the practical's of Virtual Laboratory (PHP / MySQL)


In due course of time.

Head of Department Prof. In charge


Prof. Seira Shinde Prof. S.Zishan Ali

Date: Date:

Virtual Laboratory (PHP / MySQL)Page 3


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

Marking Scheme:

1. Distribution of 40 marks is as follows


25 % for the attendance
25 % for the Lab record and internal viva voce
50 % for the external viva voce

If the attendance is 85% + then Marks awarded = 10


If the attendance is 80 to 84% then Marks awarded = 08
If the attendance is 75 to 79% then Marks awarded = 06
If the attendance is 70 to 74 % then Marks awarded = 04
If the attendance is less than 70% then Marks awarded = 01 to 03 decided by the concerned lab
faculty

2. For the lab record and internal viva voce 25 % marks is awarded, it is suggested that to avail good
number, submit the lab record and get it sign within 7 working days from the date of experiment
performed in the lab.
For the instructor, it is suggested that, if the lab record is submitted within 3 working days award A+
grade subject to lab experiment performed is without any mistakes, if it is submitted within 4
working days award A grade, if it is submitted within 5 working days award B+, within 6 working days
award B, and within 7 working days award C. After 7 working days mark Late on the Lab experiment.

Virtual Laboratory (PHP / MySQL)Page 4


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

INDEX
S.N TOPIC PAGE NUMBER
O.
1 Create a PHP webpage and print “hello world”
2 Write a PHP program to find maximum of three numbers

3 Write a PHP program Create a switch statement


4 Write a PHP program to compute factorial of a number using While loop

Write a PHP program to compute factorial of a number using


5
recursion.
Write a program for Student Mark List Processing by executing
6
DDL, DML, DCL commands on MySQL database.
7 Write a PHP script to display source code of a webpage .

8 Write a PHP script to get the client IP address.


Write a e PHP script to display string, values within a table.
9

Write a PHP script to display source code of a webpage.


10

Virtual Laboratory (PHP / MySQL)Page 5


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

Virtual Laboratory (PHP / MySQL)Page 6


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

(experiment 4)

<?php  

$num = 4;  

$factorial = 1;  

for ($x=$num; $x>=1; $x--)   

{  

  $factorial = $factorial * $x;  

}  

echo "Factorial of $num is $factorial";  

?>  

Virtual Laboratory (PHP / MySQL)Page 7


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

(experiment 5)

<?php  
function fact ($n)  
{  
    if($n <= 1)   
    {  
        return 1;  
    }  
    else   
    {  
        return $n * fact($n - 1);  
    }  
}  
  
echo "Factorial of 6 is " .fact(6);  
?>

Virtual Laboratory (PHP / MySQL)Page 8


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

(experiment 6)

Write a program for Student Mark List Processing by executing DDL, DML, DCL
commands on MySQL database.

Same as ur database practical


So do yourself

Virtual Laboratory (PHP / MySQL)Page 9


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

(experiment 7)

<?php
// pass valid/invalid emails
$email = "mail@example.com";
if (filter_var($email, FILTER_VALIDATE_EMAIL))
{
echo '"' . $email . '" = Valid'."\n";
}
else
{
echo '"' . $email . '" = Invalid'."\n";
}
?>

Virtual Laboratory (PHP / MySQL)Page 10


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

(experiment 8)

<?php
//whether ip is from share internet
if (!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip_address = $_SERVER['HTTP_CLIENT_IP'];
}
//whether ip is from proxy
elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip_address = $_SERVER['HTTP_X_FORWARDED_FOR'];

Virtual Laboratory (PHP / MySQL)Page 11


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

}
//whether ip is from remote address
else
{
$ip_address = $_SERVER['REMOTE_ADDR'];
}
echo $ip_address;
?>

(experiment 9)

<?php
$a=1000;
$b=1200;
$c=1400;
echo "<table border=1 cellspacing=0 cellpading=0>
<tr> <td><font color=blue>Salary of Mr. A is</td> <td>$a$</font></td></tr>
<tr> <td><font color=blue>Salary of Mr. B is</td> <td>$b$</font></td></tr>
<tr> <td><font color=blue>Salary of Mr. C is</td> <td>$c$</font></td></tr>
</table>";
?>

Virtual Laboratory (PHP / MySQL)Page 12


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

(experiment 10)

<?php
$all_lines = file('https://www.bitraipur.ac.in/');
foreach ($all_lines as $line_num => $line)
{
echo "Line No.-{$line_num}: " . htmlspecialchars($line) . "\n";
}
?>

Virtual Laboratory (PHP / MySQL)Page 13


Bhilai Institute of Technology, Raipur

Sub Code & Name : B022424(022) Virtual Laboratory (PHP /


MySQL)

Branch: Computer Science & Engineering


Semester: 4th

Virtual Laboratory (PHP / MySQL)Page 14

You might also like