Location: PHPKode > projects > WorkOrder TS > workorder-ts/include/upload_img_del.php
<html><head> <title>Image Uploader</title> </head> <body> <?PHP if( isset($_POST['TicketID']) ) { $TicketID=addslashes($_POST['TicketID']);} else { die("This script can not be called directly");} if( isset($_POST['SSID']) ) { $SSID=addslashes($_POST['SSID']);} else { die("This script can not be called directly");} if( isset($_POST['Step']) ) { $Step=addslashes($_POST['Step']);} if( isset($_POST['ImageCount']) ) { $_jLC1o=addslashes($_POST['ImageCount']);} if( isset($_POST['ImageName']) ) { $_jL0i6=addslashes($_POST['ImageName']);} else { $_jL0i6="Unnamed";} $_IljlI=0;$_jLi1j=0;$_jLiJQ=0;for( $x=0;$_jLC1o >=$x;$x++) { if( isset($_POST['ID'.$x]) ) { $_jLitJ[$_IljlI]=addslashes($_POST['ID'.$x]);$_IljlI++;} if( isset($_POST['FileName'.$x]) ) { $_jLL8l[$_jLi1j]=addslashes($_POST['FileName'.$x]);$_jLiJQ=1;} if( isset($_POST['FileNameID'.$x]) ) { $_jLlI0[$_jLi1j]=addslashes($_POST['FileNameID'.$x]);$_jLiJQ=1;} if( $_jLiJQ==1 ) { $_jLi1j++;$_jLiJQ=0;} } $inc_dir="./";$_Il6fL=NULL;require $inc_dir.'workorder_function_general.inc.php';require $inc_dir.'workorder_function_upload.php';$CONF=_OFB10($inc_dir);$TableTicketImages=$CONF['TableNameTicketImages'];require_once $inc_dir.'workorder_function_isuserauthenticated.inc.php';if( _L00CR($SSID,$inc_dir,$_Il6fL,$CONF)=="FAILED" ) { die('Not Authenticated, please login first');} require $inc_dir.'config-user.inc.php';require $inc_dir.'conn-string-user.inc.php';if( isset($_jLitJ)==True ) { $_jLltI=count($_jLitJ);for( $_jl0fO=0;$_jl0fO < $_jLltI;$_jl0fO++) { $_jL1tf="../".stripslashes($CONF['UploadTargetPath'])."/";$_jLQ0o=stripslashes($CONF['ImageTicketFilesPerDir']);$_jLQ10=$CONF['ImageTicketSubDir'];$_jLIl6=explode(',',$CONF['ImageTicketEXT']);_L0LB1($_jL1tf);_L0LB1($_jL1tf.$_jLQ10."/");$sql="SELECT * FROM $TableTicketImages WHERE ID = \"$_jLitJ[$_jl0fO]\"";$res=mysql_query($sql,$conn) or die("Unable to get total count Error:xc4dg4v4<br /> $sql");$row=mysql_fetch_array($res);$_jLQ10=$row['SubDir'];$FileName=$row['FileName'];$_jL1tf=$_jL1tf.$_jLQ10."/";$_jLOQL=$_jL1tf.$FileName;if( @unlink($_jLOQL)==False ) { if( file_exists($_jLOQL)==False ) { $sql="delete from $TableTicketImages WHERE ID = \"$_jLitJ[$_jl0fO]\"";$res=mysql_query($sql,$conn) or die("Unable to delete the file from the database to fix the database. The file on the filesystem is already gone. Problems! Error 4535dgd<br /> $sql");echo('<a href="javascript:window.close();">The Database should be consistent now</a>');} die("<br /><p>Unable to Delete File: $_jLOQL</p>");} else { $sql="delete from $TableTicketImages WHERE ID = \"$_jLitJ[$_jl0fO]\"";$res=mysql_query($sql,$conn) or die("Unable to delete the file from the database after the file system delete was OK: Error:GFTdg4v4<br /> $sql");} } } if( isset($_jLL8l)==True ) { $_jl1oC=count($_jLL8l);for( $_jlQ1L=0;$_jlQ1L < $_jl1oC;$_jlQ1L++) { $sql="UPDATE $TableTicketImages SET FileDesc = \"$_jLL8l[$_jlQ1L]\" WHERE ID = \"$_jLlI0[$_jlQ1L]\" && FileName != \"$_jLL8l[$_jlQ1L]\"";$res=mysql_query($sql,$conn) or die("Unable to rename the files Error: 45adg<br /> $sql");} } echo('<a href="javascript:window.close();">All Done</a>');?> </body></html>
Return current item: WorkOrder TS