Joywork/admin/ajax/block_meta_save.php

28 lines
834 B
PHP
Raw Permalink Normal View History

2026-05-22 20:21:54 +02:00
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/config.php");
if (!isset($_SESSION['superadmin'])) {
echo json_encode(['No data', 403]); exit;
}
$post = clearInputData($_POST);
$sql = "SELECT id FROM block_meta WHERE block_id = " . $post['block_meta_id'];
$q = mysql_query($sql);
if(mysql_num_rows($q) == 0){
$sql_up = "INSERT INTO block_meta SET block_id = " . $post['block_meta_id'] . ", title = '" . $post['title'] ."', description = '" . $post['description'] ."', keywords = '" . $post['keywords'] ."'";
} else {
$sql_up = "UPDATE block_meta SET title = '" . $post['title'] ."', description = '" . $post['description'] ."', keywords = '" . $post['keywords'] ."' WHERE block_id = " . $post['block_meta_id'];
}
try {
mysql_query($sql_up);
}
catch (Exception $e) {
echo $e->getMessage();
}
echo 1;
?>