Advertisement
Haezz

hapusgame.php

Jul 25th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.28 KB | None | 0 0
  1. <?php require_once('Connections/connection.php'); ?>
  2. <?php
  3. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  4. {
  5.   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  6.  
  7.   switch ($theType) {
  8.     case "text":
  9.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  10.       break;    
  11.     case "long":
  12.     case "int":
  13.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  14.       break;
  15.     case "double":
  16.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  17.       break;
  18.     case "date":
  19.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  20.       break;
  21.     case "defined":
  22.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  23.       break;
  24.   }
  25.   return $theValue;
  26. }
  27.  
  28. if ((isset($_GET['idpeserta'])) && ($_GET['idpeserta'] != "")) {
  29.   $deleteSQL = sprintf("DELETE FROM daftar_acara WHERE idpeserta=%s",
  30.                        GetSQLValueString($_GET['idpeserta'], "text"));
  31.  
  32.   mysql_select_db($database_connection, $connection);
  33.   $Result1 = mysql_query($deleteSQL, $connection) or die(mysql_error());
  34.  
  35.   $deleteGoTo = "papargame.php";
  36.   if (isset($_SERVER['QUERY_STRING'])) {
  37.     $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
  38.     $deleteGoTo .= $_SERVER['QUERY_STRING'];
  39.   }
  40.   header(sprintf("Location: %s", $deleteGoTo));
  41. }
  42.  
  43. $colname_q_hapusgame = "-1";
  44. if (isset($_GET['idpeserta'])) {
  45.   $colname_q_hapusgame = (get_magic_quotes_gpc()) ? $_GET['idpeserta'] : addslashes($_GET['idpeserta']);
  46. }
  47. mysql_select_db($database_connection, $connection);
  48. $query_q_hapusgame = sprintf("SELECT * FROM daftar_acara WHERE idpeserta = '%s'", $colname_q_hapusgame);
  49. $q_hapusgame = mysql_query($query_q_hapusgame, $connection) or die(mysql_error());
  50. $row_q_hapusgame = mysql_fetch_assoc($q_hapusgame);
  51. $totalRows_q_hapusgame = mysql_num_rows($q_hapusgame);
  52. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  53. <html xmlns="http://www.w3.org/1999/xhtml">
  54. <head>
  55. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  56. <title>Untitled Document</title>
  57. </head>
  58.  
  59. <body>
  60. </body>
  61. </html>
  62. <?php
  63. mysql_free_result($q_hapusgame);
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement