This commit is contained in:
2025-02-05 04:16:15 +05:30
parent a7b20799ad
commit 7f15dbfc08
6 changed files with 14 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
### Xeorl - The All-In-One, Fully Free to Use Advanced Link Shortener and Management Tool - Powered by [@xodivorce](https://instagram.com/xodivorce) ✨
[![status](https://img.shields.io/badge/status-active-brightgreen.svg?style=flat)](https://github.com/xeorl/xeorl-portfolio/)
[![version](https://img.shields.io/badge/version-v4.2.1-yellow.svg?style=flat)](https://github.com/xeorl/xeorl-portfolio/)
[![version](https://img.shields.io/badge/version-v4.2.2-yellow.svg?style=flat)](https://github.com/xeorl/xeorl-portfolio/)
[![PRs](https://img.shields.io/badge/PRs-welcome-blue.svg?style=flat)](https://github.com/xeorl/xeorl-portfolio/)
<br></br>

View File

@@ -1,6 +1,6 @@
#This is an example of secret environmental variables
#original environmental variable should be created with .env filename
DOMAIN = "Your Domain Name Here"
DOMAIN = "Your Domain Name Here" ### Additionally, you need to set the domain name in the assets/js/home.js file at line 39.
DB_HOST = "Your Database Host Name Her"
DB_USER = "Your Database Username Here"
DB_PASS = "Your Database Password Here"

View File

@@ -36,7 +36,7 @@ shortenBtn.onclick = () => {
let data = xhr.response;
if (data.length <= 5) {
//This is your domain name
const domain = "http://localhost/Php-Projects/xeorl/htdocs/";
const domain = "xeorl.buzz/";
let shortenURL = domain + data;
// Remove the default message if it exists

View File

@@ -15,7 +15,6 @@ $dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../');
$dotenv->load();
// Retrieve environment variables
$domain = $_ENV['DOMAIN'];
$host = $_ENV['DB_HOST'];
$user = $_ENV['DB_USER'];
$pass = $_ENV['DB_PASS'];
@@ -36,7 +35,7 @@ if (isset($_GET)) {
$u = mysqli_real_escape_string($conn, $key);
$new_url = str_replace('/', '', $u);
}
// Query the database for the full URL associated with the shortened URL
$sql = mysqli_query($conn, "SELECT full_url FROM url WHERE shorten_url = '{$new_url}'");
if (mysqli_num_rows($sql) > 0) {
@@ -46,11 +45,13 @@ if (isset($_GET)) {
// Fetch the full URL and store it in the session
$full_url = mysqli_fetch_assoc($sql);
$_SESSION['redirect_url'] = $full_url['full_url'];
// Redirect to unzipper.php
header("Location: unzipper.php");
exit(); // Stop further script execution after redirection
// Instead of header redirect, include the unzipper.php page here
include 'unzipper.php'; // Include the unzipper.php page in this URL
exit(); // Exit to ensure the rest of the script doesn't run
}
} else {
}
}
?>

View File

@@ -91,7 +91,6 @@ ini_set('display_errors', 1); // Include the statistics file
</div>
</section>
</main>
<?php include 'assets/_cookies.php'; ?>
<?php include 'assets/_footer.php'; ?>
<script src="assets/js/_home.js"></script>
<script src="assets/js/developer_tools.js"></script>

View File

@@ -1,13 +1,13 @@
<?php
session_start();
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
// Check if redirect_url is set in session
if (!isset($_SESSION['redirect_url'])) {
http_response_code(400);
die("Invalid request! The page you are looking for may have been deleted or removed from our server.");
}
// Retrieve the redirect URL from session
$redirect_url = $_SESSION['redirect_url'];
?>
<!DOCTYPE html>
@@ -44,12 +44,10 @@ $redirect_url = $_SESSION['redirect_url'];
<?php include "assets/_footer.php"; ?>
<!-- Inject PHP value into JavaScript -->
<script>
const redirectUrl = "<?php echo $redirect_url; ?>"; // PHP injects the redirect_url
const redirectUrl = "<?php echo $redirect_url; ?>";
</script>
<!-- Link to the external JavaScript file -->
<script src="assets/js/_unzipper.js"></script>
</body>