-
Notifications
You must be signed in to change notification settings - Fork 9
/
delete-link.php
63 lines (38 loc) · 1.79 KB
/
delete-link.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
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
require 'class.base.php';
require 'class.html.php';
$base_instance=new base();
$html_instance=new html();
$userid=$base_instance->get_userid();
$link_id=isset($_REQUEST['link_id']) ? (int)$_REQUEST['link_id'] : exit;
if (isset($_POST['save'])) {
$base_instance->query("DELETE FROM {$base_instance->entity['LINK']['MAIN']} WHERE ID='$link_id' AND user='$userid'");
header('Location: close-me.php'); exit;
}
$data=$base_instance->get_data("SELECT * FROM {$base_instance->entity['LINK']['MAIN']} WHERE ID='$link_id' AND user='$userid'");
if (!$data) { $base_instance->show_message('Link not found'); exit; }
$datetime=$data[1]->datetime;
$url=$data[1]->url;
$title=$data[1]->title;
$category=$data[1]->category;
//
$data2=$base_instance->get_data("SELECT title FROM {$base_instance->entity['LINK']['CATEGORY']} WHERE user='$userid' AND ID='$category'");
if (!empty($data2)) {
$title_category=$data2[1]->title;
} else { $title_category='(not found)'; }
//
if (preg_match('/:\/\//',$url)) {} else { $url='http://'.$url; }
$url=substr($url,0,60);
$datetime_converted=$base_instance->convert_date($datetime);
$html_instance->add_parameter(
array('ACTION'=>'show_form',
'HEADER'=>'<font color="#ff0000">Delete this Link?</font>',
'FORM_ACTION'=>$_SERVER['PHP_SELF'],
'INNER_TABLE_WIDTH'=>'80%',
'BUTTON_TEXT'=>'Delete Link'
));
$html_instance->add_form_field(array('TYPE'=>'hidden','NAME'=>'link_id','VALUE'=>"$link_id"));
$html_instance->add_form_field(array('TYPE'=>'label','TEXT'=>"
<div align=\"center\"><table><tr><td><strong>Added:</strong></td><td>$datetime_converted</td></tr><tr><td><strong>URL:</strong></td><td>$url</td></tr><tr><td><strong>Title:</strong></td><td>$title</td></tr><tr><td><strong>Category:</strong></td><td>$title_category</td></tr></table></div>"));
$html_instance->process();
?>