forked from ademcan/canSnippet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdetails.php
50 lines (41 loc) · 1.54 KB
/
details.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
/*
@author: Ademcan ([email protected])
@name: details.php
@description: show a single snippet in one page with the related information, helpful for snippet sharing
*/
session_start();
include "config.php";
include 'includes/menu.php';
$mytable ="snippets";
$base=new SQLite3($config["dbname"]);
$query_name = "SELECT * FROM $mytable WHERE ID=".intval($_GET["id"])." ";
$results_name = $base->query($query_name);
$row = $results_name->fetchArray();
$name = $row['name'];
echo '<h1 style="padding-top:50px;"> '.$name;
$private = $row['private'];
if ($private=="on"){
echo '<img src="images/lockFlat.png" style="width:20px; height: 20px;padding-left:10px;" />';
}
echo '</h1>';
$code = $row['code'];
$language = $row['language'];
$date = $row['date'];
$description = $row['description'];
if ($language=="html"){
$languageClass = "language-markup";
}
else if ($language=="text"){
$languageClass = "language-markup";
}
else{
$languageClass = "language-".$language;
}
echo '<font size="1"><i>'.$language.'</i> - '.$date.'</font><br>';
echo '<img src="images/info.png" style="vertical-align: middle;"/>';
echo ' '.nl2br($description);
echo '<section class="'.$languageClass.'"> <pre><code>'.$code.'</code></pre> </section>' ;
echo '<hr style="width:95%; height:5px;background-color:#2ecc71;border-radius:20px;border-color:#2ecc71;border-style:none;">';
echo '</div></body></html>';
?>