0
0
This repository has been archived on 2020-11-15. You can view files and clone it, but cannot push or open issues or pull requests.
OpenShorte.old/lib/php/manage.php

39 lines
1.5 KiB
PHP
Raw Normal View History

<?php
if ( ! isset ( $_SESSION [ 'user_id' ] ) ) {
header ( "Location: " . $GLOBALS [ 'config' ] [ 'installation_path' ] . "/login" );
}
$database = new Database ( $GLOBALS [ 'config' ] [ 'db' ] );
$database->connect ( );
$database->prepare ( "SELECT links.ID, links.URL FROM links WHERE links.created_by = " . $_SESSION [ 'user_id' ] );
$database->execute ( );
$result = $database->get_result ( );
$row = $result->fetch_assoc ( );
?>
<!DOCTYPE html>
<html>
<head>
2019-05-29 19:05:33 +02:00
<title>Management Panel | <?=$GLOBALS['config']['website_name']?></title>
<link href="<?=$GLOBALS['config']['installation_path']?>/favicon.ico" rel="icon" type="image/x-icon">
</head>
<body>
<button onclick="logout()">Logout</button>
<div id="urllist">
<?php
if ( ! $row ) {
echo ( "You have not created any URL yet.<br>" );
}
else {
do {
echo ( "\t\t\t" . '<div>' . $row [ 'ID' ] . " | " . $row [ 'URL' ] . "</div>\n" );
} while ( $row = $result->fetch_assoc ( ) );
}
?>
</div>
<input type="text" id="form-url" placeholder="URL:">
<button onclick="urlinsert()">Insert new URL</button><br>
<div id="responsetext"></div>
2019-05-29 19:05:33 +02:00
<script src="<?=$GLOBALS['config']['installation_path']?>/lib/js/insertnew.js"></script>
<script>var script_name = "<?=$GLOBALS['config']['installation_path']?>";</script>
</body>
</html>