📄 delete_all.php
字号:
<?php
function button_backs( )
{
echo "<script>";
echo "alert(\"记录已删除!\");";
echo "</script>";
}
include_once( "inc/auth.php" );
echo "\r\n<html>\r\n<head>\r\n<title></title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n</head>\r\n\r\n<body class=\"bodycolor\" topmargin=\"5\">\r\n\r\n";
$connection = openconnection( );
switch ( $_REQUEST['id'] )
{
case 1 :
$query = $_REQUEST['query'];
$query = str_replace( "\\", " ", $query );
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
$user_id = $row['USER_ID'];
$register_time = $row['REGISTER_TIME'];
$sql = "delete from ATTEND_DUTY where USER_ID='".$user_id."' and REGISTER_TIME='".$register_time."'";
exequery( $connection, $sql );
}
button_backs( );
break;
case 2 :
$query = "select * from ATTEND_OUT ";
if ( $_REQUEST['keywords'] != "" && $where_str == "" )
{
$where_str .= "where OUT_TYPE like '%".$_REQUEST['keywords']."%' ";
}
if ( $_REQUEST['time_start'] != "" )
{
if ( $where_str != "" )
{
$where_str .= "and time_to_sec(OUT_TIME1) >= time_to_sec('".$_REQUEST['time_start']."') ";
}
else
{
$where_str .= "where time_to_sec(OUT_TIME1) >= time_to_sec('".$_REQUEST['time_start']."') ";
}
}
if ( $_REQUEST['time_end'] != "" )
{
if ( $where_str != "" )
{
$where_str .= "and time_to_sec(OUT_TIME2) <= time_to_sec('".$_REQUEST['time_end']."') ";
}
else
{
$where_str .= "where time_to_sec(OUT_TIME2) <= time_to_sec('".$_REQUEST['time_end']."') ";
}
}
if ( $_REQUEST['TO_ID'] != "" )
{
$to_id = ",".$_REQUEST['TO_ID'];
$to_id_str = str_replace( ",", "','", $to_id );
$to_id_str = substr( $to_id_str, 2 );
$to_id_str = substr( $to_id_str, 0, strlen( $to_id_str ) - 2 );
if ( $where_str != "" )
{
$where_str .= "and USER_ID IN (".$to_id_str.")";
}
else
{
$where_str .= "where USER_ID IN (".$to_id_str.")";
}
}
$query .= $where_str;
$query .= "order by OUT_TIME1 desc";
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
$user_id = $row['USER_ID'];
$out_type = $row['OUT_TYPE'];
$out_time1 = $row['OUT_TIME1'];
$out_time2 = $row['OUT_TIME2'];
$sql = "delete from attend_out where USER_ID='".$user_id."' and OUT_TYPE='".$out_type."' and OUT_TIME1='".$out_time1."' and OUT_TIME2='".$out_time2."'";
exequery( $connection, $sql );
}
button_backs( );
break;
case 3 :
$query = "select * from attend_leave ";
if ( $_REQUEST['keywords'] != "" && $where_str == "" )
{
$where_str .= "where LEAVE_TYPE like '%".$_REQUEST['keywords']."%' ";
}
if ( $_REQUEST['date_start'] != NULL )
{
if ( $where_str != "" )
{
$where_str .= "and to_days(date_format(LEAVE_DATE1,'%Y-%m-%d')) >= to_days('".$_REQUEST['date_start']."') ";
}
else
{
$where_str .= "where to_days(date_format(LEAVE_DATE1,'%Y-%m-%d')) >= to_days('".$_REQUEST['date_start']."') ";
}
}
if ( $_REQUEST['date_end'] != NULL )
{
if ( $where_str != "" )
{
$where_str .= "and to_days(date_format(LEAVE_DATE2,'%Y-%m-%d')) <= to_days('".$_REQUEST['date_end']."') ";
}
else
{
$where_str .= "where to_days(date_format(LEAVE_DATE2,'%Y-%m-%d')) <= to_days('".$_REQUEST['date_end']."') ";
}
}
if ( $_REQUEST['TO_ID'] != "" )
{
$to_id = ",".$_REQUEST['TO_ID'];
$to_id_str = str_replace( ",", "','", $to_id );
$to_id_str = substr( $to_id_str, 2 );
$to_id_str = substr( $to_id_str, 0, strlen( $to_id_str ) - 2 );
if ( $where_str != "" )
{
$where_str .= "and USER_ID IN (".$to_id_str.")";
}
else
{
$where_str .= "where USER_ID IN (".$to_id_str.")";
}
}
$query .= $where_str;
$query .= "order by LEAVE_DATE1 desc";
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
$user_id = $row['USER_ID'];
$leave_type = $row['LEAVE_TYPE'];
$leave_date1 = $row['LEAVE_DATE1'];
$leave_date2 = $row['LEAVE_DATE2'];
$sql = "delete from attend_leave where USER_ID='".$user_id."' and LEAVE_TYPE='".$leave_type."' and LEAVE_DATE1='".$leave_date1."' and LEAVE_DATE2='".$leave_date2."'";
exequery( $connection, $sql );
}
button_backs( );
break;
case 4 :
$query = "select * from attend_evection ";
if ( $_REQUEST['city'] != "" && $where_str == "" )
{
$where_str .= "where EVECTION_DEST like '%".$_REQUEST['city']."%' ";
}
if ( $_REQUEST['date_start'] != NULL )
{
if ( $where_str != "" )
{
$where_str .= "and to_days(date_format(EVECTION_DATE1,'%Y-%m-%d')) >= to_days('".$_REQUEST['date_start']."') ";
}
else
{
$where_str .= "where to_days(date_format(EVECTION_DATE1,'%Y-%m-%d')) >= to_days('".$_REQUEST['date_start']."') ";
}
}
if ( $_REQUEST['date_end'] != NULL )
{
if ( $where_str != "" )
{
$where_str .= "and to_days(date_format(EVECTION_DATE2,'%Y-%m-%d')) <= to_days('".$_REQUEST['date_end']."') ";
}
else
{
$where_str .= "where to_days(date_format(EVECTION_DATE2,'%Y-%m-%d')) <= to_days('".$_REQUEST['date_end']."') ";
}
}
if ( $_REQUEST['TO_ID'] != "" )
{
$to_id = ",".$_REQUEST['TO_ID'];
$to_id_str = str_replace( ",", "','", $to_id );
$to_id_str = substr( $to_id_str, 2 );
$to_id_str = substr( $to_id_str, 0, strlen( $to_id_str ) - 2 );
if ( $where_str != "" )
{
$where_str .= "and USER_ID IN (".$to_id_str.")";
}
else
{
$where_str .= "where USER_ID IN (".$to_id_str.")";
}
}
$query .= $where_str;
$query .= "order by EVECTION_DATE1 desc";
$cursor = exequery( $connection, $query );
while ( $row = mysql_fetch_array( $cursor ) )
{
$evection_id = $row['EVECTION_ID'];
$evection_dest = $row['EVECTION_DEST'];
$evection_date1 = $row['EVECTION_DATE1'];
$evection_date2 = $row['EVECTION_DATE2'];
$user_id = $row['USER_ID'];
$sql = "delete from attend_evection where EVECTION_ID='".$evection_id."' and USER_ID='".$user_id."' and EVECTION_DEST='".$evection_dest."' and EVECTION_DATE1='".$evection_date1."' and EVECTION_DATE2='".$evection_date2."'";
exequery( $connection, $sql );
}
button_backs( );
}
echo "<meta http-equiv=\"refresh\" content=\"0; url=search.php?id=";
echo $_REQUEST['id'];
echo "&cur_page=";
echo $_REQUEST['cur_page'];
echo "&number_type=";
echo $_REQUEST['number_type'];
echo "&date_start=";
echo $_REQUEST['date_start'];
echo "&date_end=";
echo $_REQUEST['date_end'];
echo "&time_start=";
echo $_REQUEST['time_start'];
echo "&time_end=";
echo $_REQUEST['time_end'];
echo "&keywords=";
echo $_REQUEST['keywords'];
echo "&TO_ID=";
echo $_REQUEST['TO_ID'];
echo "&city=";
echo $_REQUEST['city'];
echo "\">\r\n</body>\r\n</html>\r\n";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -