add tan generation

This commit is contained in:
Marcel Schwarz 2018-05-26 14:33:15 +02:00
parent d035aa16c4
commit 5886d48a7f
4 changed files with 44 additions and 0 deletions

12
entry.php Normal file
View File

@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<body>
Deine Tan ist:
<?php echo $_GET["tan"]; ?>
</body>
</html>

View File

@ -8,6 +8,7 @@
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
</head>
@ -148,5 +149,8 @@
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
<!-- import contentloader-->
<script src="js/contentloader.js"></script>
</body>
</html>

View File

@ -0,0 +1,17 @@
window.addEventListener('load', async () => {
console.log("Seite geladen");
getNewUniqueLink();
})
async function getNewUniqueLink() {
try {
var firstFetch = await fetch('php/generateLink.php');
var jsonFirstFetch = await firstFetch.json();
var content = document.getElementById('content');
content.innerHTML = `${jsonFirstFetch.html}`;
} catch (e) {
console.log("Server nicht erreichbar.");
}
}

11
php/generateLink.php Normal file
View File

@ -0,0 +1,11 @@
<?php
$uniqueID = uniqid();
$resultStr = "Neuer eintrag über: http://localhost/github/ipr-projekt/entry.php?tan=";
$resultStr = $resultStr . uniqid();
$HTMLJSON = array('html' => $resultStr);
echo json_encode($HTMLJSON);
?>