-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicalLink.php
More file actions
26 lines (23 loc) · 747 Bytes
/
icalLink.php
File metadata and controls
26 lines (23 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
try {
require_once('../../config/icalLogin.php');
try {
if (isset($_POST['fragment']) && $_POST['fragment'] != '') {
$conn = new PDO($dbDriver . ':host=' . $dbHost . ';dbname=' . $db . ';charset=ascii', $dbUser, $dbPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$query = $conn->prepare('INSERT INTO shortLinks (url_fragment,last_requested) VALUES (:frag,:dt)');
$query->bindValue('frag', $_POST['fragment']);
$dt = date('Y-m-d H:i:s', time());
$query->bindValue('dt', $dt);
if ($query->execute()) {
$id = $conn->lastInsertId('id');
if ($id > 0) {
echo 'http://thefaceless.be/icalQuery/' . $id . '.ics';
}
}
}
}
catch (PDOException $e) {}
}
catch (Exeption $e) {}
?>