Professional Documents
Culture Documents
CSE – 3002
LAB DA - 3
SUBMITTED TO:
PROF. JAYAKUMAR K
SUBMITTED BY:
RISHABH NAGAR
19BCE0722
1|Page
19BCE0722 RISHABH NAGAR
EXP - 8
CODE:
<!DOCTYPE html>
<html>
<body style="background-color:rgb(100, 100, 100);">
<center>
<h1>Workezly (An Online Job Portal.)</h1>
<div class="overflow-hidden bg-gray-800">
<div class="px-4 py-16 mx-auto sm:max-w-xl md:max-w-full lg:max-w-screen-xl
md:px-24 lg:px-8 lg:py-20">
<div class="flex flex-col items-center justify-between xl:flex-row">
<div class="w-full mb-12 xl:pr-16 xl:mb-0 xl:w-7/12">
<h2 class="mb-6 font-sans text-3xl font-bold tracking-tight text-white
sm:text-4xl sm:leading-none">
Find The Best Online Jobs For You. <br class="hidden md:block">
<span class="text-teal-accent-400">Earning simplified</span>
</h2>
<ul class=" mb-4 text-base text-gray-400 md:text-lg">
<li class="flex items-start">
<p class="ml-2">
Work from home and earn without the 9-5 commitment.
</p>
</li>
<li class="flex items-start">
<p class="ml-2">
Choose from a variety of online Jobs such as typing, data entry, content
writing, ad posting, resume writing and
many others.
</p>
2|Page
19BCE0722 RISHABH NAGAR
</li>
<p class="ml-2">
It only takes one job to launch your remote working career.
</p>
</li>
</ul>
</div>
<?php if(isset($_POST["SubmitBtn"])){
$fileName1=$_FILES["resume"]["name"];
$fileSize1=$_FILES["resume"]["size"]/1024;
$fileType1=$_FILES["resume"]["type"];
$fileTmpName1=$_FILES["resume"]["tmp_name"];
$fileName2=$_FILES["image"]["name"];
$fileSize2=$_FILES["image"]["size"]/1024;
$fileType2=$_FILES["image"]["type"];
$fileTmpName2=$_FILES["image"]["tmp_name"];
if($fileType1=="application/msword"||$fileType1=="application/pdf"||$fileType1
=="application/vnd.open
xmlformats-
officedocument.wordprocessingml.document"&&$fileType2=="image/jpeg"){
if($fileSize1<=500&&$fileSize2<=1024){
$uploadPath1="uploaded/".$fileName2;
$uploadPath2="uploaded/".$fileName1;
if(file_exists($uploadPath1)==false&&file_exists($uploadPath2)==false){
if(move_uploaded_file($fileTmpName2,$uploadPath2)&&move_uploaded_file($fileTmp
Name1,$uploadPath1)){
echo "Successful<br>";
echo "<br>File Name :".$fileName2;
echo "<br>File Size :".$fileSize2." kb";
echo "<br>File Type :".$fileType2;
echo "<br>File Name :".$fileName1;
echo "<br>File Size :".$fileSize1." kb";
echo "<br>File Type :".$fileType1;
} }
else{
echo "<h4 style=\"color:red;text-align:center;\">File already exists</h4>";
} }
else{
echo "<h4 style=\"color:red;text-align:center;\">Maximum upload file size
limit is 500 kb</h4>";
} } else{
echo "<h4 style=\"color:red;text-align:center;\">You can only upload a Word
doc file or PDF in
resume and Jpeg in photo.</h4>";
} }
?> <form action="" method="post" enctype="multipart/form-data" name="form1">
<h5> Upload Resume:</h5> <input type="file" name="resume" id="resume">
<br><br>
3|Page
19BCE0722 RISHABH NAGAR
OUTPUT:
FILE FORMAT TYPE:
4|Page
19BCE0722 RISHABH NAGAR
5|Page
19BCE0722 RISHABH NAGAR
FILE EXISTENCE:
6|Page
19BCE0722 RISHABH NAGAR
7|Page
19BCE0722 RISHABH NAGAR
Input:4,5,4,5,2,2,3,3,2,4
Output:2, 4
CODE:
<?php
function getNumbersOccuringOddTimes($arr, $size)
{
$oddOccurencesArray=array();
echo ("<br>No of elements in the array: ".$size);
echo ("<br>");
echo ("OUTPUT: <br>");
}
echo ("\n");
# beow will print numbers occuring odd no of times.
print_r(array_unique($oddOccurencesArray));
}
$count =1;
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
for ($x = 0; $x < 100; $x++)
{
$y = rand(10,100);
fwrite($myfile, $y);
fwrite($myfile,"\n");
8|Page
19BCE0722 RISHABH NAGAR
}
fclose($myfile);
#till here i have generated 100 random numbers starting from 10 to 100.
# and we have written to the file.
$myhandle = fopen("newfile2.txt", "r");
$a=array();
while(! feof($myhandle))
{
array_push($a,fgets($myhandle));
}
print_r($a);
// Till here i have read everything from file to array.
$n = sizeof($a);
// Function calling
getNumbersOccuringOddTimes($a, $n);
?>
OUTPUT 1:
Writing 100 Integers to a text file.
9|Page
19BCE0722 RISHABH NAGAR
OUTPUT 2:
10 | P a g e
19BCE0722 RISHABH NAGAR
11 | P a g e
19BCE0722 RISHABH NAGAR
EXP - 9
A. Create a cookie with a value of username and his email Id. The cookie
should expire in 3 days. Check whether the cookie is present in the
website, when the user enters his username, the emailed should be
given by the cookies.
CODE:
<?php
$cookie_name = "Rishabh";
$cookie_value = "rishabh.nagar2019@vitstudent.ac.in";
setcookie($cookie_name,$cookie_value,time()+3*24*60*60);
?>
<!DOCTYPE HTML>
<html>
<body>
<form action="" method="post">
Name: <input type="text" name="name"><br>
<input type="submit">
</form>
<?php
if(isset($_COOKIE["name"])){
echo "Email id: " .$_COOKIE["Rishabh"];
} else{echo "No cookie set";
}
?>
</body>
</html>
OUTPUT:
12 | P a g e
19BCE0722 RISHABH NAGAR
13 | P a g e
19BCE0722 RISHABH NAGAR
14 | P a g e
19BCE0722 RISHABH NAGAR
CODE:
<!DOCTYPE html>
<?php
$cookie_name = "Rishabh";
$cookie_value = "rishabh.nagar2019@vitstudent.ac.in";
setcookie($cookie_name,$cookie_value,time() + 60*60);
?>
<html>
<body>
<?php
if(count($_COOKIE) > 0) {
echo "Cookie '" .$cookie_name . "' is enabled!<br>";
echo "Value is: " .$_COOKIE[$cookie_name];
} else {
echo "Cookies are disabled.";
}
?>
</body>
</html>
OUTPUT:
15 | P a g e
19BCE0722 RISHABH NAGAR
CODE:
<!DOCTYPE html>
<?php
$cookie_name = "Rishabh";
$cookie_value = "rishabh.nagar2019@vitstudent.ac.in";
setcookie($cookie_name,"",time() - 60*60);
?>
<html>
<body>
<?php
echo "Cookie '" . $cookie_name . "' is deleted!<br>";
if(count($_COOKIE) > 0) {
echo "Cookie '" . $cookie_name . "' is enabled!<br>";
echo "Value is: " . $_COOKIE[$cookie_name];
} else {
echo "Cookie '" . $cookie_name . "' is disabled!<br>";
}
?>
</body>
</html>
OUTPUT:
16 | P a g e
19BCE0722 RISHABH NAGAR
17 | P a g e