Tema: ayuda !!!!!
Ver Mensaje Individual
  #6 (permalink)  
Antiguo 27/04/2010, 14:15
xrizaly
 
Fecha de Ingreso: abril-2010
Mensajes: 69
Antigüedad: 14 años
Puntos: 0
Respuesta: ayuda !!!!!

Código PHP:
Ver original
  1. <?php require_once('../Connections/ficha1.php'); ?>
  2. <?php
  3. if (!isset($_SESSION)) {
  4. }
  5. $MM_authorizedUsers = "0";
  6. $MM_donotCheckaccess = false;
  7.  
  8. // *** Restrict Access To Page: Grant or deny access to this page
  9. function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  10.   // For security, start by assuming the visitor is NOT authorized.
  11.   $isValid = false;
  12.  
  13.   // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
  14.   // Therefore, we know that a user is NOT logged in if that Session variable is blank.
  15.   if (!empty($UserName)) {
  16.     // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
  17.     // Parse the strings into arrays.
  18.     $arrUsers = Explode(",", $strUsers);
  19.     $arrGroups = Explode(",", $strGroups);
  20.     if (in_array($UserName, $arrUsers)) {
  21.       $isValid = true;
  22.     }
  23.     // Or, you may restrict access to only certain users based on their username.
  24.     if (in_array($UserGroup, $arrGroups)) {
  25.       $isValid = true;
  26.     }
  27.     if (($strUsers == "") && false) {
  28.       $isValid = true;
  29.     }
  30.   }
  31.   return $isValid;
  32. }
  33.  
  34. $MM_restrictGoTo = "muestra.php";
  35. if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {  
  36.   $MM_qsChar = "?";
  37.   $MM_referrer = $_SERVER['PHP_SELF'];
  38.   if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  39.   if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  40.   $MM_referrer .= "?" . $QUERY_STRING;
  41.   $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  42.   header("Location: ". $MM_restrictGoTo);
  43.   exit;
  44. }
  45. ?>
  46. <?php
  47. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") {
  48.   $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
  49.   switch ($theType) {
  50.     case "text":
  51.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  52.       break;    
  53.     case "long":
  54.     case "int":
  55.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  56.       break;
  57.     case "double":
  58.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  59.       break;
  60.     case "date":
  61.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  62.       break;
  63.     case "defined":
  64.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  65.       break;
  66.   }
  67.   return $theValue;
  68. }
  69.  
  70. $editFormAction = $_SERVER['PHP_SELF'];
  71. if (isset($_SERVER['QUERY_STRING'])) {
  72.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  73. }
  74.  
  75. if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
  76.   $insertSQL = sprintf("INSERT INTO respuestas (SN1, SN2, SN3, SN4, SN5, SN6, SN7, SN8, SN9, SN10, SN11, SN12, SN13, SN14, SN15, SN16, SN17, SN18, SN19, SN20, SN21, SN22, SN23, SN24, SN25, SN26, SN27, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, cont1, cont2, cont3, cont4, cont5, cont6, cont7, cont8, cont9, cont10, cont11, cont12, cont13, idi0, idi1, idi2, idi3) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NOW())",
  77.                        GetSQLValueString($_POST['SN1'], "int"),
  78.                        GetSQLValueString($_POST['SN2'], "int"),
  79.                        GetSQLValueString($_POST['SN3'], "int"),
  80.                        GetSQLValueString($_POST['SN4'], "int"),
  81.                        GetSQLValueString($_POST['SN5'], "int"),
  82.                        GetSQLValueString($_POST['SN6'], "int"),
  83.                        GetSQLValueString($_POST['SN7'], "int"),
  84.                        GetSQLValueString($_POST['SN8'], "int"),
  85.                        GetSQLValueString($_POST['SN9'], "int"),
  86.                        GetSQLValueString($_POST['SN10'], "int"),
  87.                        GetSQLValueString($_POST['SN11'], "int"),
  88.                        GetSQLValueString($_POST['SN12'], "int"),
  89.                        GetSQLValueString($_POST['SN13'], "int"),
  90.                        GetSQLValueString($_POST['SN14'], "int"),
  91.                        GetSQLValueString($_POST['SN15'], "int"),
  92.                        GetSQLValueString($_POST['SN16'], "int"),
  93.                        GetSQLValueString($_POST['SN17'], "int"),
  94.                        GetSQLValueString($_POST['SN18'], "int"),
  95.                        GetSQLValueString($_POST['SN19'], "int"),
  96.                        GetSQLValueString($_POST['SN20'], "int"),
  97.                        GetSQLValueString($_POST['SN21'], "int"),
  98.                        GetSQLValueString($_POST['SN22'], "int"),
  99.                        GetSQLValueString($_POST['SN23'], "int"),
  100.                        GetSQLValueString($_POST['SN24'], "int"),
  101.                        GetSQLValueString($_POST['SN25'], "int"),
  102.                        GetSQLValueString($_POST['SN26'], "int"),
  103.                        GetSQLValueString($_POST['SN27'], "int"),
  104.                        GetSQLValueString($_POST['t1'], "text"),
  105.                        GetSQLValueString($_POST['t2'], "text"),
  106.                        GetSQLValueString($_POST['t3'], "text"),
  107.                        GetSQLValueString($_POST['t4'], "text"),
  108.                        GetSQLValueString($_POST['t5'], "text"),
  109.                        GetSQLValueString($_POST['t6'], "text"),
  110.                        GetSQLValueString($_POST['t7'], "text"),
  111.                        GetSQLValueString($_POST['t8'], "text"),
  112.                        GetSQLValueString($_POST['t9'], "text"),
  113.                        GetSQLValueString($_POST['t10'], "text"),
  114.                        GetSQLValueString($_POST['t11'], "text"),
  115.                        GetSQLValueString($_POST['t12'], "text"),
  116.                        GetSQLValueString($_POST['t13'], "text"),
  117.                        GetSQLValueString($_POST['cont1'], "text"),
  118.                        GetSQLValueString($_POST['cont2'], "text"),
  119.                        GetSQLValueString($_POST['cont3'], "text"),
  120.                        GetSQLValueString($_POST['cont4'], "text"),
  121.                        GetSQLValueString($_POST['cont5'], "text"),
  122.                        GetSQLValueString($_POST['cont6'], "text"),
  123.                        GetSQLValueString($_POST['cont7'], "text"),
  124.                        GetSQLValueString($_POST['cont8'], "text"),
  125.                        GetSQLValueString($_POST['cont9'], "text"),
  126.                        GetSQLValueString($_POST['cont10'], "text"),
  127.                        GetSQLValueString($_POST['cont11'], "text"),
  128.                        GetSQLValueString($_POST['cont12'], "text"),
  129.                        GetSQLValueString($_POST['cont13'], "text"),
  130.                        GetSQLValueString($_POST['idi0'], "text"),
  131.                        GetSQLValueString($_POST['idi1'], "text"),
  132.                        GetSQLValueString($_POST['idi2'], "text"),
  133.                        GetSQLValueString($_POST['idi3'], "text"));
  134.   mysql_select_db($database_ficha1, $ficha1);
  135.   $Result1 = mysql_query($insertSQL, $ficha1) or die(mysql_error());
  136.   $insertGoTo = "final.php";
  137.   if (isset($_SERVER['QUERY_STRING'])) {
  138.     $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
  139.     $insertGoTo .= $_SERVER['QUERY_STRING'];
  140.   }
  141.   header(sprintf("Location: %s", $insertGoTo));
  142. }
  143. ?>