Backup Commit
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
session_start();
|
||||
|
||||
function uniqidReal($lenght = 13) {
|
||||
// uniqid gives 13 chars, but you could adjust it to your needs.
|
||||
if (function_exists("random_bytes")) {
|
||||
$bytes = random_bytes(ceil($lenght / 2));
|
||||
} elseif (function_exists("openssl_random_pseudo_bytes")) {
|
||||
$bytes = openssl_random_pseudo_bytes(ceil($lenght / 2));
|
||||
} else {
|
||||
throw new Exception("no cryptographically secure random function available");
|
||||
}
|
||||
return substr(bin2hex($bytes), 0, $lenght);
|
||||
}
|
||||
|
||||
function getNewUUID() {
|
||||
return uniqidReal() . "-" . uniqidReal() . "-" . uniqidReal();
|
||||
}
|
||||
|
||||
|
||||
$servername = "localhost";
|
||||
$username = "database_access";
|
||||
$password = "DataAccess1.";
|
||||
$dbname = "avali_shop";
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
|
||||
if (!isset($_SESSION["uuid"])) {
|
||||
|
||||
$exists = true;
|
||||
|
||||
$NEWuuid;
|
||||
|
||||
while($exists) {
|
||||
$NEWuuid = getNewUUID();
|
||||
|
||||
$sql = "SELECT * FROM wishlist_uuid WHERE uuid=\"" . $NEWuuid . "\"";
|
||||
//$sql = "SELECT * FROM wishlist_uuid WHERE uuid=\"" . $_GET["uuid"] . "\"";
|
||||
$result = $conn->query($sql);
|
||||
$row = $result->fetch_assoc();
|
||||
|
||||
if ($result->num_rows > 0) {
|
||||
$exists = true;
|
||||
} else {
|
||||
$exists = false;
|
||||
}
|
||||
}
|
||||
|
||||
$sql_create = "INSERT INTO `wishlist_uuid`(`uuid`, `last_use`, `array`) VALUES ('" . $NEWuuid . "','" . date("Y-m-d H:i:s") . "', '')";
|
||||
$result_create = $conn->query($sql_create);
|
||||
|
||||
|
||||
$_SESSION["uuid"] = $NEWuuid;
|
||||
}
|
||||
|
||||
header("Location: https://mfgames.net/#acc");
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user