internetprogrammierung/php/generateLink.php
the_kellner 43dbaf126c Revert "Merge branch 'master' of https://github.com/iCaotix/ipr-projekt"
This reverts commit ebb6e4eed752d33cb4b2f2eb70750cf1487b5787, reversing
changes made to 40398a69392f63fef161a5725cc1122625958dae.
2018-06-11 17:41:01 +02:00

30 lines
716 B
PHP

<?php
$uniqueID = uniqid();
$resultStr = "Neuer eintrag über: http://localhost/github/ipr-projekt/entry.php?tan=";
//Final link
//$resultStr = "Neuer eintrag über: http://localhost/friendsbook/entry.php?tan=";
$resultStr = $resultStr . $uniqueID;
insertTan($uniqueID);
$HTMLJSON = array('html' => $resultStr);
echo json_encode($HTMLJSON);
function insertTan($tan) {
require('../dbConnect.php'); //Erstellt variable mit dem namen $database
$stmt = $database->prepare("INSERT INTO tans (tan, used) VALUES (?, ?)");
$false = false;
$stmt->bind_param("si", $tan, $false);
try {
$stmt->execute();
} catch (PDOException $e) {
$e->getMessage();
}
}
?>