Files
Testing/include/analytics/ask_dr_bate_insert.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

44 lines
1.2 KiB
PHP

<?php header('Content-type: application/json');
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
include(PATHTOINCLUDES."base.php");
date_default_timezone_set('UTC');
$em="";
$thedesc=$_POST['thedesc'];
$thetype=$_POST['thetype'];
$thelink=$_POST['thelink'];
$isactive=$_POST['isactive'];
if($isactive==0){$isactive="N";} else {$isactive="Y";}
$testunique="SELECT count(`ask_dr_bate`.`aid`) FROM `ask_dr_bate` WHERE `ask_dr_bate`.`thecontent` = '".$thedesc."'";
$tquery=$database->database_query($testunique) or $em .= $database->database_error();
$dup = $database->database_result($tquery,0);
if($dup==0){
$sql="INSERT INTO `ask_dr_bate` (`ask_dr_bate`.`thecontent`, `ask_dr_bate`.`thetype`, `ask_dr_bate`.`thelink`, `ask_dr_bate`.`isactive`)
VALUES
(
'".$thedesc."',
'".$thetype."',
'".$thelink."',
'".$isactive."'
)";
$query=$database->database_query($sql) or $em .=$$database->database_error();
}
else{$em = "Duplicate Entry";}
$e='SELECT
`ask_dr_bate`.`aid`,
`ask_dr_bate`.`thecontent`,
`ask_dr_bate`.`thelink`,
`ask_dr_bate`.`theimg`,
`ask_dr_bate`.`isactive`,
`ask_dr_bate`.`thedate`
FROM
`ask_dr_bate`';
$arr = array ('error' => $em);
echo json_encode($arr);
?>