/
ajax.php
70 lines (62 loc) · 2.1 KB
/
ajax.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
64
65
66
67
68
69
70
<?php
/**
* Expenia Ziyaretçi Defteri Scripti v2.0
*
* Expenia IT-Solutions tarafından ücretsiz dağıtılmakta olan bir ziyaretçi defteri scriptidir.
* GNU Public License ile korunmakta olup altta olan linki kaldırmak yasaktır.
*
* Bu betik üzerinde değişiklik yaparak veya yapmayarak kullanabilirsiniz.
* Hiçbir şekilde para ile satılamaz. Kodlarda ve sayfaların en altındaki telif yazıları silinemez,
* değiştirilemez, veya bu telif ile çelişen başka bir telif eklenemez.
*
* Yukarıda belirtilen maddelerin değiştirilme hakkı saklıdır.
* Emeğe saygı göstererek bu kurallara uyunuz.
*
* @author Hüseyin Koyun <zd@expenia.com>
* @version 2.0 | 04.02.2013
* @copyright Copyright (c) 2013, Expenia Internet Solutions
* @link http://www.expenia.com
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
include_once "libs/config.inc.php";
// eğer XHR isteği gönderilmişse
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
// mesaj onaylama islemi
if (isset($_GET['onayla'])) {
if (isset($_SESSION['id'])) {
$id = intval($_POST['msg_id']);
if ($zd->db->query("UPDATE messages SET approval = '1' WHERE id = '$id'")) {
echo 1;
} else {
header("location: http://www.google.com");
}
}
}
// delete message
if (isset($_GET['sil'])) {
if (isset($_SESSION['id'])) {
$id = intval($_POST['msg_id']);
if ($zd->db->query("DELETE FROM messages WHERE id = '$id'")) {
echo 1;
$zd->db->query("DELETE FROM messages WHERE parent_id = '$id'");
} else {
header("location: http://www.google.com");
}
}
}
// reply message
if (isset($_GET['cevapla'])) {
if (isset($_SESSION['id'])) {
$id = intval($_POST['m_id']);
$response = nl2br($zd->security($_POST['response']));
if (!empty($response)) {
if ($zd->db->query("INSERT INTO messages (message, parent_id) VALUES ('$response', '$id')")) {
echo 'OK';
}
} else {
echo 'Can\'t be empty!';
}
}
}
}
?>