php word file keval zerox
php word file keval zerox
Y- 2024-2025)
<?php
include("connection.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<div id="form">
<h1>Login Form</h1>
<label>Username:</label>
<label>Password</label>
</form>
</div>
<script>
function isvalid(){
return false
else{
if(user.length==""){
alert("Username is empty!!!");
return false
if(pass.length==""){
alert("Password is empty!!!");
return false
} }
</script>
</body>
</html>
Style.css
body{
background-color: blueviolet;
#form{
background-color: white;
width: 25%;
padding: 50px;
#btn{
color: white;
padding: 10px;
font-size: large;
border-radius: 10px;
#form{
width: 65px;
padding: 40;
Connection.php
<?php
$servername = "localhost";
$username="root";
$password="";
$db_name="database1";
$db_name); if($conn->connect_error){
die("connection failed".$conn->connect_error);
echo "";
?>
Login.php
<?php
include("connection.php");
if(isset($_POST['submit'])){
$username = $_POST['user'];
$password = $_POST['pass'];
$count = mysqli_num_rows($result);
if($count==1)
header("Location:welcome.php");
else{
echo '<script>
window.location.href = "index.php";
</script>';
?>
OUTPUT:
2. Write a php code to perform registration page with php and submit data in
mysql. Form.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "registration_db";
// Create connection
// Check connection
if ($conn->connect_error) {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$firstName = $_POST['firstName'];
$lastName = $_POST['lastName'];
$email = $_POST['email'];
$birthDate = $_POST['birthDate'];
$gender = $_POST['gender'];
if ($stmt->execute()) {
} else {
$stmt->close();
$conn->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Registration Form</title>
<style>
body {
serif; background-color:
.container {
max-width: 500px;
margin: 0 auto;
background-color: #fff;
padding: 20px;
border-radius: 10px;
h2 {
text-align: center;
width: 100%;
padding: 10px;
margin: 5px 0;
#ccc; border-radius:
5px;
input[type="submit"] {
background-color:
padding: 10px;
border: none;
border-radius:
5px; cursor:
pointer;
width: 100%;
}
input[type="submit"]:hover {
background-color:
Roll no. Page no.8
SHRINATHJI COLLEGE OF COMPUTER APPLICATION (A.Y- 2024-2025)
#218838;
</style>
</head>
<body>
<div class="container">
<h2>Registration Form</h2>
<label for="email">Email:</label>
<label for="gender">Gender:</label>
</form>
</div>
</body>
</html>
Output:
<html>
<head></head>
<body>
</form>
</body>
</html>
Receive.php
<?php
$name=$_FILES['myfile']['name'];
$tmp_name=$_FILES['myfile']['tmp_name'];
if(move_uploaded_file($tmp_name,$name))
echo"File uploaded";
else
?>
Output:
$number = $_POST['number'];
$address = $_POST['address'];
$sql = "INSERT INTO `reg` VALUES
('$id','$firstname','$lastname','$gmail','$number','$address')";
$data=mysqli_query($con,$sql);
if ($data) {
echo "insert";
}
else
{
echo "sorry";
}
}
?>
Output:
$address = $_GET['address'];
$sql="UPDATE reg SET firstname='$firstname' , lastname='$lastname',
gmail='$gmail' , number='$number', address='$address' WHERE id='$id'";
$data=mysqli_query($con, $sql);
if ($data) {
//echo "record update";
header('location:show.php');
}
else{
echo "not update";
}
}
else
{
echo "click on button to save the change";
}
?>
</body>
</html>
Output:
<td>".$result['firstname']."</td>
<td>".$result['lastname']."</td>
<td>".$result['gmail']."</td>
<td>".$result['number']."</td>
<td>".$result['address']."</td>
<td><a href='update.php?id=$result[id] &
firstname=$result[firstname] & lastname=$result[lastname] & gmail=$result[gmail] &
number=$result[number] &address=$result[address]'> update </a></td>
<td><a href='delete.php?id=$result[id] '>delete </a></td>
</tr>
";
}
}
else
{
echo "no record found";
}
?>
</table>
</body>
</html>
<!--------- echo "<br>".$result['id']." ".$result['firstname']." ".$result['lastname']."
".$result['gmail']." ".$result['number']." ".$result['address']."<br>";_----->
Output:
5. Write a php code with Python Integration (print your name in prompt).
Test.py
import requests
value_to_pass = "Hello, My Name is keval."
php_url = "http://localhost/anaconda/hello.php"
params = {"value": value_to_pass}
response = requests.get(php_url, params=params)
print("Output from PHP script:")
print(response.text)
Output:
overflow: hidden;
}
header {
background:
black; color: #fff;
padding-top: 30px;
min-height: 70px;
border-bottom: #ff6347 3px solid;
}
header h1 {
text-align: center;
text-transform: uppercase;
margin: 0;
font-size: 36px;
letter-spacing:
2px;
}
p{
font-size: 18px;
line-height: 1.6;
color: #333;
}
.content {
background: #fff;
padding: 20px;
margin-top: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<header>
<h1>Shrinathji College</h1>
</header>
<div class="container">
<div class="content">
<p>
Shrinathji College is a renowned institution known for its commitment to
quality education.
The college offers a wide range of programs that cater to the diverse
academic interests of students.
With a strong faculty team and excellent infrastructure, the college creates
an environment conducive to learning.
Students are encouraged to explore their interests and develop critical
thinking skills.
In addition to academics, the college places a strong emphasis
on
extracurricular activities.
This holistic approach ensures that students grow both personally and
professionally.
Shrinathji College fosters an inclusive and collaborative environment for
students from all walks of life.
The institution prides itself on its modern facilities and up-to-date
curriculum.
Graduates from the college are equipped to face the challenges of the
modern world with confidence.
As a hub of innovation, Shrinathji College is constantly evolving to meet
the needs of its students.
</p>
</div>
</div>
</body>
</html>
Output:
9. Write a python flask program to open html and css file from template
folder. index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Website</title>
<style>
{{ styles | safe }}
</style>
</head>
<body>
<h1>This is my website</h1>
<p>Hello, my name is sagar, and I will be running this Python program to open the
html and css file </p>
</body>
</html>
styles.css
body {
font-family: Arial, sans-
serif; background-color:
#f0f0f0; margin: 0;
padding: 20px;
}
h1 {
background-color: orangered;
color: white; /* Optional: change text color for contrast */
padding: 10px; /* Optional: add some padding */
}
p{
color: #555555;
}
app.py
from flask import Flask, render_template
import os
@app.route('/')
def home():
with open(os.path.join(app.template_folder, 'styles.css')) as f:
styles = f.read()
return render_template('index.html', styles=styles)
.about-container {
max-width:
1200px; margin: 0
auto; padding:
20px;
background-color: #fff;
box-shadow: 0 0 10px
rgba(0,0,0,0.1); border-radius: 8px;
}
h1 {
color: #333;
.about-content {
margin: 20px 0;
}
.team-section {
display: flex;
justify-content: space-
around; margin-top: 40px;
}
.team-member {
text-align:
center; margin: 0
20px;
}
.team-member img {
border-radius:
50%; width: 150px;
height: 150px;
}
.team-member h3 {
color: #555;
}
.team-member p {
color: #777;
}
.about-container p
{ line-height:
1.6;
}
</style>
</head>
<body>
<div class="about-container">
<h1>About Us</h1>
<div class="about-content">
<p>Welcome to our company! We are dedicated to providing the best products
and services in the industry. Our team is committed to ensuring customer satisfaction and
delivering quality solutions to our clients.</p>
<p>Founded in 2020, we have quickly grown to become a leader in our field. We
believe in innovation, excellence, and customer-centric approaches.</p>
</div>
<div class="team-member">
<h3>keval</h3>
<p>Chief Marketing Officer</p>
</div>
<div class="team-member">
<h3>keval</h3>
<p>Head of Design</p>
</div>
</div>
</div>
</body>
</html>
Contacts.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Contact Us</title>
<style>
body {
font-family: Arial, sans-
serif; background-color:
#f9f9f9; margin: 0;
padding: 0;
}
.contact-container {
max-width:
800px; margin:
50px auto;
padding: 20px;
background-color:
#fff; border-radius:
10px;
box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
h1 {
text-align: center;
color: #333;
}
form {
display: flex;
flex-direction: column;
}
label {
margin-bottom:
10px; font-weight:
bold;
}
input, textarea {
padding: 10px;
margin-bottom:
20px; border-radius:
5px;
border: 1px solid #ccc;
width: 100%;
}
input[type="submit"] {
background-color:
#28a745; color: #fff;
border: none;
cursor: pointer;
padding: 15px;
input[type="submit"]:hover {
background-color: #218838;
}
.message {
text-align: center;
color: green;
}
.error {
color: red;
}
</style>
</head>
<body>
<div class="contact-container">
<h1>Contact Us</h1>
<label for="email">Email</label>
<input type="text" id="email" name="email" >
<label for="message">Message</label>
<textarea id="message" name="message" rows="5"></textarea>
.login-container {
max-width:
600px; margin:
50px auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 15px rgba(0, 0, 0,
h1 {
text-align: center;
color: #333;
}
form {
display: flex;
flex-direction: column;
}
label {
margin: 10px 0
5px; font-weight:
bold;
}
input[type="email"], input[type="password"] {
padding: 10px;
margin-bottom: 20px;
border-radius: 5px;
border: 1px solid
#ccc;
}
input[type="submit"] {
background-color:
#007bff; color: white;
border: none;
padding: 15px;
cursor: pointer;
input[type="submit"]:hover {
background-color: #0056b3;
}
</style>
</head>
<body>
<div class="login-container">
<h1>Login</h1>
<label for="password">Password</label>
<input type="password" id="password" name="password">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Registration</title>
<style>
body {
font-family: Arial, sans-
serif; background-color:
#f4f4f4;
}
.register-container {
max-width:
600px; margin:
50px auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 0 15px rgba(0, 0, 0,
0.1); border-radius: 10px;
}
h1 {
text-align: center;
color: #333;
}
form {
display: flex;
flex-direction: column;
}
label {
margin: 10px 0
5px; font-weight:
bold;
}
input[type="submit"] {
background-color:
#28a745; color: white;
border: none;
padding: 15px;
cursor: pointer;
}
input[type="submit"]:hover {
background-color: #218838;
}
.error {
color: red;
}
.success-message {
text-align:
center; color:
green;
}
</style>
</head>
<body>
<div class="register-container">
<h1>Register</h1>
<label for="email">Email</label>
<input type="email" id="email" name="email">
<label for="password">Password</label>
<input type="password" id="password" name="password">
</div>
</body>
</html>
Output:
delimiters. app.py
@app.route('/')
def render_template_example():
return render_template('example.html',
variable_name="'keval",
app.run(debug=True)
example.html
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<p>Addition: {{ 10 + 3 }}</p>
{% if 'keval' in variable_name %}
{% else %}
{% endif %}
<ul>
{% endfor %}
</ul>
</body>
</html>
Output: