deletrec.php

来自「火花留言本」· PHP 代码 · 共 71 行

PHP
71
字号
<?php
// *** Restrict Access To Page: Grant or deny access to this page
$FF_authorizedUsers=" ";
$FF_authFailedURL="sparkLog.php";
$FF_grantAccess=0;
session_start();
if (isset($HTTP_SESSION_VARS["MM_Username"])) {
  if (true || !(isset($HTTP_SESSION_VARS["MM_UserAuthorization"])) || $HTTP_SESSION_VARS["MM_UserAuthorization"]=="" || strpos($FF_authorizedUsers, $HTTP_SESSION_VARS["MM_UserAuthorization"])) {
    $FF_grantAccess = 1;
  }
}
if (!$FF_grantAccess) {
  $FF_qsChar = "?";
  if (strpos($FF_authFailedURL, "?")) $FF_qsChar = "&";
  $FF_referrer = $HTTP_SERVER_VARS['PHP_SELF'];
  if (isset($HTTP_SERVER_VARS['QUERY_STRING']) && strlen($HTTP_SERVER_VARS['QUERY_STRING']) > 0) $FF_referrer .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
  $FF_authFailedURL = $FF_authFailedURL . $FF_qsChar . "accessdenied=" . urlencode($FF_referrer);
  header("Location: $FF_authFailedURL");
  exit;
}

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

if ((isset($_GET['digiB_id'])) && ($_GET['digiB_id'] != "") && (isset($_GET['delsure']))) {
  $deleteSQL = sprintf("DELETE FROM board WHERE digiB_id=%s",
                       GetSQLValueString($_GET['digiB_id'], "int"));

  mysql_select_db($database_connBoard, $connBoard);
  $Result1 = mysql_query($deleteSQL, $connBoard) or die(mysql_error());

  $deleteGoTo = "spark_ed.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
    $deleteGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $deleteGoTo));
}

$colname_RecBoard = "1";
if (isset($_GET['digiB_id'])) {
  $colname_RecBoard = (get_magic_quotes_gpc()) ? $_GET['digiB_id'] : addslashes($_GET['digiB_id']);
}
mysql_select_db($database_connBoard, $connBoard);
$query_RecBoard = sprintf("SELECT * FROM board WHERE digiB_id = %s", $colname_RecBoard);
$RecBoard = mysql_query($query_RecBoard, $connBoard) or die(mysql_error());
$row_RecBoard = mysql_fetch_assoc($RecBoard);
$totalRows_RecBoard = mysql_num_rows($RecBoard);
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?