0% found this document useful (0 votes)
57 views16 pages

URL Shortener Project Report in PHP

The document outlines a micro-project report for a URL Shortener Site developed by students of Bharati Vidyapeeth’s College of Engineering as part of their Diploma in Computer Engineering. It includes details on the project's aims, methodology, course outcomes, and evaluation criteria, along with a certificate of completion. The project focuses on using PHP and MySQL to create a functional web application that shortens URLs and tracks their performance.

Uploaded by

xjarveco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views16 pages

URL Shortener Project Report in PHP

The document outlines a micro-project report for a URL Shortener Site developed by students of Bharati Vidyapeeth’s College of Engineering as part of their Diploma in Computer Engineering. It includes details on the project's aims, methodology, course outcomes, and evaluation criteria, along with a certificate of completion. The project focuses on using PHP and MySQL to create a functional web application that shortens URLs and tracks their performance.

Uploaded by

xjarveco
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 16

BHARATI VIDYAPEETH’S

COLLEGE OF ENGINEERING (DIPLOMA), KOLHAPUR.


DEPARTMENT OF COMPUTER ENGINEERING
ACADEMIC YEAR 2024-25

MICRO-PROJECT REPORT
PART - A and PART - B

Name of Program: Diploma in Computer Engineering

Semester: CO6I

Name of Course and Code: Web based application using PHP (22619)

Title of the Micro-Project: URL Shortener Site

1. Nayak Chaitanya Prakash


Name Of Team Members: 2. Patil Shantanu Ashok
3. Patil Harshad Shivaji

Mrs. Yadav P. V.
Name and Sign of the Project Guide
Maharashtra State
Board of Technical Education, Mumbai
Year 2024-25

CERTIFICATE

This is to certify that: -


1. Nayak Chaitanya Prakash
2. Patil Shantanu Ashok
3. Patil Harshad Shivaji

Diploma in Computer Engineering of Bharati Vidyapeeth’s college of Engineering


(Diploma), Kolhapur (Code: 0540) has completed Micro project on URL Shortener
Site of the course Web based application using PHP (22619) entitled as prescribed in
the curriculum for the academic year 2024-25.

Place: Kolhapur Group No: 15


Date: - - 2025

Course In charge Head of Department


Mrs. Yadav P. V. Mr. Sutar K. G.

Seal of Institute
Micro project Evaluation Sheet

Name of Student: Mr. Nayak Chaitanya Prakash Enrollment No: 2205400144


Name of Programme: Computer Engineering Semester: Sixth
Course Title: Web based application using PHP Code: 22619
Title of the Micro-Project: URL Shortener Site.

Course Outcomes Achieved:


1. Develop program using control statement.
2. Use form controls with validation to collect user’s input.
3. Perform database operations in PHP.
Sr Characteristic to be Poor Average Good Excellent Sub
No assessed (Marks 1-3) (Marks 4-5) (Marks 6-8) (Marks 9-10) Total

(A) Process and Product Assessment (Convert above total marks out of 6 marks)
1 Relevance to the course
2 Literature Survey /
Information Collection
3 Completion of the Target
as per project proposal
4 Analysis of Data and
representation
5 Quality of
Prototype/Model
6 Report Preparation
(B) Individual Presentation / Viva (Convert above total marks out of 4 marks)
8 Presentation
9 Viva
Evaluation as per Suggested Rubric for Assessment of Micro Project
(A) (B) Total
Process and Product Assessment Individual Presentation/Viva Marks 10
(6 Marks) ( 4 Marks )

Comments/Suggestions about team work/leadership/inter-personal communication


________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Name and designation of the Faculty Member: Mrs. Yadav P. V.

Dated Signature:
Micro project Evaluation Sheet
Name of Student: Mr. Patil Shantanu Ashok Enrollment No: 2205400152
Name of Programme: Computer Engineering Semester: Sixth
Course Title: Web based application using PHP Code: 22619
Title of the Micro-Project: URL Shortener Site.

Course Outcomes Achieved:


1. Develop program using control statement.
2. Use form controls with validation to collect user’s input.
3. Perform database operations in PHP.
Sr Characteristic to be Poor Average Good Excellent Sub
No assessed (Marks 1-3) (Marks 4-5) (Marks 6-8) (Marks 9-10) Total

(C) Process and Product Assessment (Convert above total marks out of 6 marks)
1 Relevance to the course
2 Literature Survey /
Information Collection
3 Completion of the Target
as per project proposal
4 Analysis of Data and
representation
5 Quality of
Prototype/Model
6 Report Preparation
(D) Individual Presentation / Viva (Convert above total marks out of 4 marks)
8 Presentation
9 Viva
Evaluation as per Suggested Rubric for Assessment of Micro Project
(A) (B) Total
Process and Product Assessment Individual Presentation/Viva Marks 10
(6 Marks) ( 4 Marks )

Comments/Suggestions about team work/leadership/inter-personal communication


________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Name and designation of the Faculty Member: Mrs. Yadav P. V.

Dated Signature:
Micro project Evaluation Sheet

Name of Student: Mr. Patil Harshad Shivaji Enrollment No: 2205400148


Name of Programme: Computer Engineering Semester: Sixth
Course Title: Web based application using PHP Code: 22619
Title of the Micro-Project: URL Shortener Site.

Course Outcomes Achieved:


1. Develop program using control statement.
2. Use form controls with validation to collect user’s input.
3. Perform database operations in PHP.
Sr Characteristic to be Poor Average Good Excellent Sub
No assessed (Marks 1-3) (Marks 4-5) (Marks 6-8) (Marks 9-10) Total

(E) Process and Product Assessment (Convert above total marks out of 6 marks)
1 Relevance to the course
2 Literature Survey /
Information Collection
3 Completion of the Target
as per project proposal
4 Analysis of Data and
representation
5 Quality of
Prototype/Model
6 Report Preparation
(F) Individual Presentation / Viva (Convert above total marks out of 4 marks)
8 Presentation
9 Viva
Evaluation as per Suggested Rubric for Assessment of Micro Project
(A) (B) Total
Process and Product Assessment Individual Presentation/Viva Marks 10
(6 Marks) ( 4 Marks )

Comments/Suggestions about team work/leadership/inter-personal communication


________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
Name and designation of the Faculty Member: Mrs. Yadav P. V.

Dated Signature:
PART A – MICRO PROJECT PROPOSAL
URL Shortener Site

1.0 Aims of Micro Project:


1. Develop a URL Shortener Site using PHP.
2. Implement smooth URL shortening using XAMPP MySQL.
3. Allow user input for enter their URL.
4. Shows stats of URL performance.

2.0 Course Outcomes Addressed:


1. Develop program using control statement.
2. Perform operations based on arrays and graphics.
3. Develop programs by applying various object-oriented concepts.
4. Use form controls with validation to collect user’s input.
5. Perform database operations in PHP.

3.0 Proposed Methodology:


Algorithm:
Input:
 User provides an Original URL
 (Optional) Custom short code
 (For redirection) Shortened URL accessed
 (For statistics) User requests URL stats
Output:
 Shortened URL if a new URL is entered
 Redirection if a short URL is accessed
 URL statistics if requested

Steps:
1. Start
2. User chooses an action:
o (A) Shorten a URL
o (B) Redirect from a short URL
o (C) View statistics
Shorten a URL
3. Accept input:
o original_url (Mandatory)
o custom_code (Optional)
4. Validate URL format of original_url
5. If custom_code is provided:
o Check if custom_code exists in the database
o If exists, reject and ask for a new one
o If not exists, assign custom_code
6. If no custom_code is provided:
o Generate a random 6-character short code
o Ensure it is unique by checking in the database
7. Store (original_url, short_code, click_count=0, created_at) in the database
8. Display shortened URL to the user
9. End

Redirect from a Shortened URL


10. User enters a shortened URL
11. Extract short_code from the URL
12. Search in database for short_code
13. If short_code exists:
 Fetch the original_url
 Increment click_count by 1
 Redirect user to original_url
14. If short_code does not exist:
 Show "Invalid short URL" error
15. End

View URL Statistics


16. User requests stats
17. Fetch all records from urls table, sorted by created_at
18. Display each entry with:
 Shortened URL
 Original URL
 Click count
 Creation date
19. End

End Algorithm
4.0 Action Plan:

Sr. No Details of activity Planned Planned Name of


start Finish Date Responsible
Date Team Members

Topics given by Subject


1. Teacher and discussed on given 01/01/2025 08/01/2025
topic with all members
Collected information
2. 08/01/2025 15/01/2025
of the Topic
3. Planning of project 15/01/2025 22/01/2025
Analyze the collected data and
4. 22/01/2025 29/01/2025
finalize structure of project
Distribution of task and
5. discussion of roles and 29/01/2025 05/02/2025
responsibilities of each member

6. Design of micro-project 05/02/2025 14/02/2025

7. Design of micro -project 14/02/2025 19/02/2025


Mr. Nayak Chaitanya,
8. Implementation 19/02/2025 21/02/2025 Mr. Patil Shantanu,
Mr. Patil Harshad.
9. Implementation 21/02/2025 2/02/2025

10. Implementation 26/02/2025 05/03/2025

11. Implementation 05/03/2025 12/03/2025

12. Report Preparation 12/03/2025 20/03/2025

13. Report Submission 19/03/2025 26/03/2025

14. PPT Presentation 26/03/2025 02/04/2025

15. Presentation 26/03/2025 02/04/2025

16. Submission of Micro Project 02/04/2024 02/04/2025


5.0 Resources required:

Sr. No Name of Resource Specification Quantity Remark

Computer/Laptop (i3-i5
preferable), RAM Minimum 4 GB
1. Computer System
and onward, Minimum 512
1 -
HDD/256 SDD Storage

2. Operating System Windows 7 or onward 1 -

3. Software XAMPP, Code Editor 1 -

wikipedia, geeksforgeeks,
4. Websites
w3schools, etc.
1 -

6.0 Name of Team Members with Roll Numbers:

Sr. No. Roll No Name

1. 3035 Nayak Chaitanya Prakash

2. 3042 Patil Shantanu Ashok

3. 3039 Patil Harshad Shivaji

Name of Course Teacher: Mrs. Yadav P. V.

Sign: __________
PART B – MICROPROJECT REPORT
URL Shortener Site
1. Rationale:
PHP is a widely used server-side scripting language, known for its simplicity and
efficiency in web development. It is commonly used to build dynamic websites and
applications. This micro-project focuses on developing a simple URL Shortener Site,
helping students understand key programming concepts such as server-side scripting,
database management, user input handling, and link redirection. Through this project,
students will enhance their problem-solving skills and gain hands-on experience in web
development using PHP and MySQL.

2. Aims of Micro Project:


1. Develop a URL Shortener Site using PHP.
2. Implement smooth URL shortening using XAMPP MySQL.
3. Allow user input for enter their URL.
4. Shows stats of URL performance.

3. Course Outcomes Achieved:


1. Develop program using control statement.
2. Use form controls with validation to collect user’s input.
3. Perform database operations in PHP.

4. Literature Review:
Web development has evolved significantly with the rise of server-side scripting
languages like PHP. PHP, combined with MySQL, provides a powerful yet easy-to-use
framework for creating dynamic web applications. Several studies and projects highlight
PHP’s efficiency in handling server requests, database interactions, and user
authentication.

Previous research on URL shortening services emphasizes the importance of efficient


database storage, fast redirection, and security measures to prevent abuse. Many
beginner-friendly URL shorteners focus on generating unique short links, tracking usage
statistics, and ensuring seamless redirection to enhance user experience. This project
builds upon these principles to create a simple yet effective URL Shortener Site, helping
students understand web development fundamentals while applying essential
programming concepts.
5. Actual Methodology Followed:
PHP code:
index.php
<?php
// Database configuration
$host = 'localhost';
$dbname = 'srt';
$username = 'root';
$password = '';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Database connection failed: " . $e->getMessage());
}
// Function to generate a unique short code
function generateShortCode($pdo, $length = 6) {
$characters =
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
do {
$shortCode = '';
for ($i = 0; $i < $length; $i++) {
$shortCode .= $characters[rand(0, strlen($characters) - 1)];
}
// Check if the code already exists
$stmt = $pdo->prepare("SELECT COUNT(*) FROM urls WHERE short_code = ?");
$stmt->execute([$shortCode]);
} while ($stmt->fetchColumn() > 0); // Keep generating until unique
return $shortCode;
}
// Handle form submission
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$originalUrl = $_POST['original_url'];
$customCode = trim($_POST['custom_code']); // Custom short code (optional)
// Validate URL format
if (!filter_var($originalUrl, FILTER_VALIDATE_URL)) {
die("Invalid URL format.");
}
// Check if custom code is provided
if (!empty($customCode)) {
$stmt = $pdo->prepare("SELECT COUNT(*) FROM urls WHERE short_code = ?");
$stmt->execute([$customCode]);
if ($stmt->fetchColumn() > 0) {
die("Custom short code already exists. Choose another.");
}
$shortCode = $customCode;
} else {
$shortCode = generateShortCode($pdo);
}
// Insert into database
$stmt = $pdo->prepare("INSERT INTO urls (original_url, short_code) VALUES (?, ?)");
$stmt->execute([$originalUrl, $shortCode]);
// Display the shortened URL
$shortenedUrl = "http://localhost/srt/$shortCode";
echo "Original URL: <a href='$originalUrl'>$originalUrl</a><br>";
echo "Shortened URL: <a href='$shortenedUrl'>$shortenedUrl</a>";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Improved URL Shortener</title>
</head>
<body>
<h1>URL Shortener</h1>
<form method="POST">
<label for="original_url">Enter URL:</label>
<input type="url" id="original_url" name="original_url" required>

<label for="custom_code">Custom Short Code (optional):</label>


<input type="text" id="custom_code" name="custom_code" maxlength="10">

<button type="submit">Shorten</button>
</form>
</body>
</html>

redirect.php
<?php
// Database configuration
$host = 'localhost';
$dbname = 'srt';
$username = 'root';
$password = '';
try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Database connection failed: " . $e->getMessage());
}
// Get the short code from the URL
$shortCode = $_GET['code'] ?? '';
if (empty($shortCode)) {
die("Invalid short URL.");
}
// Find the original URL
$stmt = $pdo->prepare("SELECT original_url FROM urls WHERE short_code = ?");
$stmt->execute([$shortCode]);
$url = $stmt->fetch(PDO::FETCH_ASSOC);
// Redirect if found, otherwise show an error
if ($url) {
// Update click count
$updateStmt = $pdo->prepare("UPDATE urls SET click_count = click_count + 1 WHERE
short_code = ?");
$updateStmt->execute([$shortCode]);

header("Location: " . $url['original_url']);


exit();
} else {
die("Short URL not found.");
}
?>

stats.php
<?php
// Database configuration
$host = 'localhost';
$dbname = 'srt';
$username = 'root';
$password = '';

try {
$pdo = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die("Database connection failed: " . $e->getMessage());
}
// Fetch all shortened URLs
$stmt = $pdo->query("SELECT * FROM urls ORDER BY created_at DESC");
$urls = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>URL Stats</title>
</head>
<body>
<h1>URL Shortener Statistics</h1>
<table border="1">
<tr>
<th>Short URL</th>
<th>Original URL</th>
<th>Click Count</th>
<th>Created At</th>
</tr>
<?php foreach ($urls as $url): ?>
<tr>
<td><a href="http://localhost/srt/<?php echo $url['short_code']; ?>"
target="_blank"><?php echo $url['short_code']; ?></a></td>
<td><?php echo $url['original_url']; ?></td>
<td><?php echo $url['click_count']; ?></td>
<td><?php echo $url['created_at']; ?></td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>

6. Resources Used:

Sr.
Name of Resource Specification Quantity Remark
No.
1. Computer System Asus vivobook 15, i3-1220P, 1 -
8 GB RAM, 512 GB Storage
2. Operating System Windows 11 1 -
3. Software VS Code 1 -
4. Books Programming PHP: Rasmus 1 -
Lerdorf, Kevin T. and Peter M.
7. Output of the Micro-Projects:

Main Page

After Entering URL Welcome Screen

Opening Shortener URL

Shorten Link Opened


8. Skill Developed:
1. Programming: We'll develop proficiency in Python, focusing on implementing
functions, loops, and event handling for interactive game development.

2. Game Development: By creating a URL Shortener Site, you'll enhance your ability to
build engaging and interactive applications using Python and Pygame.

3. Problem-Solving: We'll strengthen your problem-solving abilities by tackling challenges


such as obstacle placement, collision detection, and game mechanics.

4. UI/UX Design: Designing an intuitive game interface, including menus, score display,
and animations, will help you understand the principles of user interface (UI) and user
experience (UX) design.

5. Event Handling: We'll gain expertise in handling user interactions, such as car
movement and game controls, using keyboard events in Python.

6. Debugging and Testing: You'll improve your debugging and testing skills by ensuring
smooth gameplay, accurate collision detection, and optimized game performance.

9. Applications of this Micro-Project:


1. Learning Web Development: Helps understand the basics of web programming using
PHP, HTML, CSS, and MySQL.

2. Improving Coding Skills: Enhances logical thinking and problem-solving through URL
shortening algorithms and database management.

3. Efficiency & Convenience: Provides a quick and effective way to manage and share
long URLs, improving user experience.

4. Educational Tool: Serves as a beginner-friendly project for students learning web


development, backend scripting, and database interactions.

5. UI/UX Understanding: Teaches how to design simple and user-friendly web interfaces
for seamless interaction.

6. Project Showcase: Useful for academic projects and portfolio building, demonstrating
knowledge of PHP and web technologies.

You might also like