184 lines
2.0 KiB
PHP
184 lines
2.0 KiB
PHP
|
|
<?php header('Content-type: application/json');
|
||
|
|
|
||
|
|
$em="";
|
||
|
|
|
||
|
|
if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/cmeter/');
|
||
|
|
|
||
|
|
include(PATHTOINCLUDES."base.php");
|
||
|
|
|
||
|
|
|
||
|
|
$fieldname=$_POST["fieldname"];
|
||
|
|
|
||
|
|
$fieldvalue=$_POST["fieldvalue"];
|
||
|
|
|
||
|
|
$orig_value=$_POST["origvalue"];
|
||
|
|
|
||
|
|
$table_name=$_POST["thetable"];
|
||
|
|
|
||
|
|
$dtype = $_POST["dtype"];
|
||
|
|
|
||
|
|
$req = $_POST["req"];
|
||
|
|
|
||
|
|
$themin=$_POST["themin"];
|
||
|
|
|
||
|
|
$themax=$_POST["themax"];
|
||
|
|
|
||
|
|
$ncrypt=$_POST["ncrypt"];
|
||
|
|
|
||
|
|
$therowid=$_POST["rowid"];
|
||
|
|
|
||
|
|
date_default_timezone_set('UTC');
|
||
|
|
|
||
|
|
$thedate=date("Y-m-d H:i:s");
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
if(stripos($fieldname, 'vid_id_') !== false)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$fieldname="vid_id";
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if(stripos($fieldname, 'imgurl_') !== false)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$fieldname="imgurl";
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if(stripos($fieldname, 'thesort_') !== false)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$fieldname="thesort";
|
||
|
|
|
||
|
|
$dtype="int";
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
if(stripos($fieldname, 'vid_active_') !== false)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$fieldname="vid_active";
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$ps=5;
|
||
|
|
|
||
|
|
if($ncrypt==1){$ps=1;} else {$ps=0;}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
if($dtype=="date")
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
if(is_date($fieldvalue))
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$fieldvalue=strtotime($fieldvalue);
|
||
|
|
|
||
|
|
$fieldvalue=date('Y-m-d H:i:s',$fieldvalue);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
else
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$ps=6;
|
||
|
|
|
||
|
|
$em="Please enter a valid date (mm/dd/yyyy)!";
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
if($ps==0){
|
||
|
|
|
||
|
|
$sql="UPDATE ".$table_name." SET ".$fieldname."=".GetSQLValueString($fieldvalue, $dtype)."
|
||
|
|
|
||
|
|
WHERE id = ".$therowid;
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$query=$database->database_query($sql) or $em=$em.$database->database_error();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
elseif($ps==1)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
$sql="UPDATE ".$table_name." SET ".$fieldname." = AES_ENCRYPT(".GetSQLValueString($fieldvalue, $dtype).",'".$wordgames."')
|
||
|
|
|
||
|
|
WHERE id = ".$therowid;
|
||
|
|
|
||
|
|
$query=$database->database_query($sql) or $em=$em.$database->database_error();
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
elseif($ps==2)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
elseif($ps==3)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
elseif($ps==4)
|
||
|
|
|
||
|
|
{
|
||
|
|
|
||
|
|
if($fieldvalue==1){$fieldvalue="Y";}else{$fieldvalue="N";}
|
||
|
|
|
||
|
|
$sql="UPDATE ".$table_name." SET ".$fieldname."=".GetSQLValueString($fieldvalue, $dtype)."
|
||
|
|
|
||
|
|
WHERE id = ".$therowid;
|
||
|
|
|
||
|
|
$query=$database->database_query($sql) or $em=$em.$database->database_error();
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
$arr = array ('error'=>$em);
|
||
|
|
|
||
|
|
echo json_encode($arr);
|
||
|
|
|
||
|
|
//Philip Poremba 05/02/2012
|
||
|
|
|
||
|
|
?>
|