mirror of
https://github.com/xodivorce/xeorl.git
synced 2025-12-20 00:29:34 +05:30
v4.2.3
This commit is contained in:
@@ -3,6 +3,7 @@ session_start();
|
||||
include "config.php";
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
|
||||
$full_url = mysqli_real_escape_string($conn, $_POST['full_url']);
|
||||
|
||||
if (!empty($full_url) && filter_var($full_url, FILTER_VALIDATE_URL)) {
|
||||
@@ -12,14 +13,22 @@ if (!empty($full_url) && filter_var($full_url, FILTER_VALIDATE_URL)) {
|
||||
if (mysqli_num_rows($sql) > 0) {
|
||||
echo "Something went wrong. Please generate again!";
|
||||
} else {
|
||||
$sql2 = mysqli_query($conn, "INSERT INTO url (full_url, shorten_url, clicks)
|
||||
VALUES ('{$full_url}', '{$ran_url}', '0')");
|
||||
$user_email = isset($_SESSION['user_email']) ? $_SESSION['user_email'] : NULL;
|
||||
|
||||
if ($user_email !== NULL) {
|
||||
$sql2 = mysqli_query($conn, "INSERT INTO url (full_url, shorten_url, clicks, user_email)
|
||||
VALUES ('{$full_url}', '{$ran_url}', '0', '{$user_email}')");
|
||||
} else {
|
||||
$sql2 = mysqli_query($conn, "INSERT INTO url (full_url, shorten_url, clicks)
|
||||
VALUES ('{$full_url}', '{$ran_url}', '0')");
|
||||
}
|
||||
|
||||
if ($sql2) {
|
||||
$link_id = mysqli_insert_id($conn); // Get the ID of the newly inserted row
|
||||
$link_id = mysqli_insert_id($conn);
|
||||
if (!isset($_SESSION['shortened_links'])) {
|
||||
$_SESSION['shortened_links'] = array();
|
||||
}
|
||||
$_SESSION['shortened_links'][] = $link_id; // Store the link ID in session
|
||||
$_SESSION['shortened_links'][] = $link_id;
|
||||
|
||||
$shorten_url = $ran_url;
|
||||
echo $shorten_url;
|
||||
|
||||
Reference in New Issue
Block a user