-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmove_topic.php
More file actions
41 lines (31 loc) · 837 Bytes
/
Copy pathmove_topic.php
File metadata and controls
41 lines (31 loc) · 837 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
@session_start();
date_default_timezone_set('UTC');
if (isset($_SESSION['login_expiration']) && $_SESSION['login_expiration'] != date('Y-m-d'))
{
echo '>> login expired <<';
return;
}
if (!isset($_SESSION['id'])) {
echo '>> user is not logged in <<';
return;
}
// VALIDATION^
if (!isset($_GET['topic_id']) || !isset($_GET['new_cat_id'])) {
echo 'error2343';
return;
}
$topic_id = intval($_GET['topic_id']);
$new_cat_id = intval($_GET['new_cat_id']);
if ($topic_id == 0 || $new_cat_id ==0) {
echo 'error345';
return;
}
require_once('general.php');
$db = new dbase();
$db->connect_sqlite();
$res = $db->executeSQL('update topics set category_id=? where topic_id=?', array($new_cat_id, $topic_id));
if ($res)
header("Location: view_topic.php?id={$topic_id}");
else
echo "No SQL transaction done.";