Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/09/2013, 08:41
manolilorenzo
 
Fecha de Ingreso: agosto-2013
Ubicación: cadiz
Mensajes: 35
Antigüedad: 10 años, 8 meses
Puntos: 0
error al insertar registro

Hola tengo un problema que no logro resolver tengo este formulario

Código PHP:
<form action="<?php echo $editFormAction?>" method="post" name="form1" id="form1" accept-charset="ISO-8859-1" enctype="multipart/form-data">
      <span id="id">
          <label for="idaudiolibro"></label>
          <input type="text" name="idaudiolibro" id="idaudiolibro" />
          <span class="textfieldRequiredMsg">La Id no puede estar vacio.</span><span class="textfieldInvalidFormatMsg">Esto no es una Id.</span><span class="textfieldMaxCharsMsg">Esta Id es demasiada larga .</span></span>
<span id="url">
          <label for="enlace"></label>
          <input type="text" name="enlace" id="enlace" />
          <span class="textfieldRequiredMsg">Escribe el enlace de descarga.</span><span class="textfieldMinCharsMsg">Este enlace es demasiado corto.</span><span class="textfieldMaxCharsMsg">Este enlace es demasiado largo.</span></span><span id="name">
          <label for="usuario"></label>
          <input type="text" name="usuario" id="usuario" />
          <span class="textfieldRequiredMsg">Escribe un Apodo o Usuario.</span><span class="textfieldMinCharsMsg">Minimo 3 caracteres.</span><span class="textfieldMaxCharsMsg">Se ha superado el n&uacute;mero m&aacute;ximo de caracteres.</span></span>
        <span id="sprytextarea1">
            <label for="valoracion"></label>
            <textarea name="valoracion" id="valoracion" cols="45" rows="5">  </textarea>
            <span class="textareaRequiredMsg">no puede estar vacio.</span></span>
       <select name="fallo" class="campodetext" >
    <option value="images/1fichier.jpg">1fichier.com</option>
    <option value="images/4shared.jpg">4shared</option>
    <option value="images/bayfiles.jpg">Bayfiles</option>
    <option value="images/bitshare.jpg">Bitshare</option>
    <option value="images/cloudzer.jpg">Cloudzer</option>
    <option value="images/crocko.jpg">Crocko</option>
    <option value="images/cyberlocker.jpg">Cyberlocker</option>
    <option value="images/depositfiles.jpg">Depositfiles</option>
    <option value="images/filerio.jpg">Filerio</option>
    <option value="images/fileswap.jpg">Fileswap</option>
    <option value="images/freakshare.jpg">Freakshare</option>
    <option value="images/gamefront.jpg">Gamefront</option>
    <option value="images/hipfile.jpg">Hipfile</option>
    <option value="images/hotfile.jpg">hotfile</option>
    <option value="images/mediafire.jpg">Mediafire</option>
    <option value="images/mega.jpg">Mega</option>
    <option value="images/megashares.jpg">Megashares</option>
    <option value="images/multiupload.jpg">Multiupload</option>
    <option value="images/putlocker.jpg">Putlocker</option>
    <option value="images/rapidgator.jpg">Rapidgator</option>
    <option value="images/rapidshare.jpg">Rapidshare</option>
    <option value="images/rghost.jpg">Rghost</option>
    <option value="images/sockshare.jpg">Sockshare</option>
    <option value="images/solidfiles.jpg">Solidfiles</option>
    <option value="images/turbobit.jpg">Turbobit</option>
    <option value="images/uppit.jpg">Uppit</option>    <option value="images/uptobox.jpg">Uptobox</option>
    <option value="images/Otro.jpg">Otro</option>
     </select>
          <input type="submit" value="Enviar enlace" />
      <input type="hidden" name="MM_insert" value="form1" />
    </form>
y este codigo

Código PHP:
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  if (
PHP_VERSION 6) {
    
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}

$editFormAction $_SERVER['PHP_SELF'];
if (isset(
$_SERVER['QUERY_STRING'])) {
  
$editFormAction .= "?" htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset(
$_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  
$insertSQL sprintf("INSERT INTO descargas (idaudiolibro, enlace, usuario, valoracion, fallo) VALUES (%s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['idaudiolibro'], "text"),
                       
GetSQLValueString($_POST['enlace'], "text"),
                       
GetSQLValueString($_POST['usuario'], "text"),
                       
GetSQLValueString($_POST['valoracion'], "text"),
                       
GetSQLValueString($_POST['fallo'], "text"));

  
mysql_select_db($database_audiolibro$audiolibro);
  
$Result1 mysql_query($insertSQL$audiolibro) or die(mysql_error());

  
$insertGoTo "nuevo-enlace.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
header(sprintf("Location: %s"$insertGoTo));
}
?>
es muy simple, es para agregar enlaces funciona perfecto pero al insertar enlaces de "mediafire y megashare" y me da el error
Forbidden

You don't have permission to access /ejemplo on this server.
el error esta en la url pero lo raro es que si agrego un espacio en blanco al principio de la url funciona perfectamente
porque al agregar ese espacio se arregla ?
y con los otros servidores funciona perfectamente ?

espero haber me explicado bien un saludo !!