Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2007
    Messaggi
    35

    Problemi con redirect in dreamweaver

    Salve a tutti =)
    Dopo svariate ricerche e tentativi, pur vedendo che il tema è già stato trattato abbondantemente, ho deciso di chiedere aiuto perchè dopo averne provate un po', ancora non mi funziona :/

    Partendo dalla pagina http://localhost/fiammetta/utenti_nuovo.php una volta inserito l'utente vorrei che mi rimandasse a http://localhost/fiammetta/utenti.php.
    Inserendo la forma canonica di dreamweaver ho ottentuto il seguente codice:

    codice:
    $insertGoTo = "../fiammetta/utenti.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    in questa maniera (e non capisco perchè) mi rimanda a http://localhost/fiammetta/utenti_nuovo.php? (stesso indirizzo ma con ? alla fine)
    mentre se aggiungo

    codice:
    exit;
    alla fine, mi dice che La connessione a localhost è stata interrotta. ma mica mi rimanda dove voglio io.
    Qualcuno mi può suggerire qualcosa che funzioni? Grazie =)

    codice completo (se può servire)

    codice:
    <?php virtual('/fiammetta/Connections/fiammetta.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 utenti (Nome, Cognome, Indirizzo, Telefono, Email, Nome_Utente, Pass_Utente, Livello_Utente) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['Nome'], "text"),
                           GetSQLValueString($_POST['Cognome'], "text"),
                           GetSQLValueString($_POST['Indirizzo'], "text"),
                           GetSQLValueString($_POST['Telefono'], "text"),
                           GetSQLValueString($_POST['Email'], "text"),
                           GetSQLValueString($_POST['Nome_Utente'], "text"),
                           GetSQLValueString($_POST['Pass_Utente'], "text"),
                           GetSQLValueString($_POST['Livello_Utente'], "int"));
      mysql_select_db($database_fiammetta, $fiammetta);
      $Result1 = mysql_query($insertSQL, $fiammetta) or die(mysql_error());
    
    
      $insertGoTo = "../fiammetta/utenti.php";
      if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
      }
      header(sprintf("Location: %s", $insertGoTo));
    }
    ?>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <meta name="author" content="Francesco Bettoni" />
    
    <title>Albero Musicale - Fiammetta 2.0</title>
    <link href="css/fiammetta.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
    <form method="post" name="form1" action="<?php echo $editFormAction; ?>">
      <table align="center">
        <tr valign="baseline">
          <td nowrap align="right">Nome:</td>
          <td><input type="text" name="Nome" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Cognome:</td>
          <td><input type="text" name="Cognome" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Indirizzo:</td>
          <td><input type="text" name="Indirizzo" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Telefono:</td>
          <td><input type="text" name="Telefono" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Email:</td>
          <td><input type="text" name="Email" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Nome_Utente:</td>
          <td><input type="text" name="Nome_Utente" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Pass_Utente:</td>
          <td><input type="text" name="Pass_Utente" value="" size="32"></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right">Livello_Utente:</td>
          <td><select name="Livello_Utente">
            <option value="2" <?php if (!(strcmp(2, ""))) {echo "SELECTED";} ?>>Utente base</option>
            <option value="1" <?php if (!(strcmp(1, ""))) {echo "SELECTED";} ?>>Super Admin</option>
          </select></td>
        </tr>
        <tr valign="baseline">
          <td nowrap align="right"></td>
          <td><input type="submit" value="Insert record"></td>
        </tr>
      </table>
      <input type="hidden" name="MM_insert" value="form1">
    </form>
    </body>
    </html>

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2007
    Messaggi
    35
    nient.. in remoto funziona, in locale no 8/

    Non avevo ancora provato a caricare i files.
    Pardon

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.