Visualizzazione risultati 1 fino 5 di 5

Discussione: Problema di php con comportamenti server

  1. #1
    Guest

    Predefinito Problema di php con comportamenti server

    Salve a tutti.
    Io ho creato con dreamweaver delle pagine .php e ci ho messo dei comportamenti server (es.aggiungi record). Però quando le vedo con il browser (explorer) la pagina appare bianca e se faccio "visualizza HTML" il codice è vuoto eccetto per alcuni tag.
    http://shadow95.altervista.org/reg.php è l' indirizzo.
    Però se si accede a quest' altra pagina (sempre.php) http://shadow95.altervista.org/timetest.php questa va. L'unica differenza fra le due è ke la seconda è molto più semplice come codice.
    Qualcuno mi da una mano?

    Questo è il codice di "timetest.php"


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Documento senza titolo</title>
    </head>

    <body>
    <p>This page was created at <b>
    <?php echo date("h:i:s a", time()); ?>
    </b> on the computer running PHP.</p>
    </body>
    </html>
    Ultima modifica di shadow95 : 05-02-2008 alle ore 12.33.28 Motivo: Specificazione codice

  2. #2
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Dovresti scrivere il codice che utilizzi.
    Per vedere se ci sono degli errori prova ad aggiungere all'inizio dello script:
    Codice PHP:
    error_reporting(E_ALL);
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  3. #3
    Guest

    Predefinito

    Grazie. comunque il codice è un po' lungo ed è questo

    Codice PHP:
    <?php require_once('Connections/mysql.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function
    GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $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;
    }
    }

    // *** Redirect if username exists
    $MM_flag="MM_insert";
    if (isset(
    $_POST[$MM_flag])) {
    $MM_dupKeyRedirect="regerror.html";
    $loginUsername = $_POST['Username'];
    $LoginRS__query = sprintf("SELECT Username FROM utenti WHERE Username=%s", GetSQLValueString($loginUsername, "text"));
    mysql_select_db($database_mysql, $mysql);
    $LoginRS=mysql_query($LoginRS__query, $mysql) or die(mysql_error());
    $loginFoundUser = mysql_num_rows($LoginRS);

    //if there is a row in the database, the username was found - can not add the requested username
    if($loginFoundUser){
    $MM_qsChar = "?";
    //append the username to the redirect page
    if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
    $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
    header ("Location: $MM_dupKeyRedirect");
    exit;
    }
    }

    $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 (Username, Password, Nome, Cognome, Eta) VALUES (%s, %s, %s, %s, %s)",
    GetSQLValueString($_POST['Username'], "text"),
    GetSQLValueString($_POST['Password'], "text"),
    GetSQLValueString($_POST['Nome'], "text"),
    GetSQLValueString($_POST['Cognome'], "text"),
    GetSQLValueString($_POST['Eta'], "int"));

    mysql_select_db($database_mysql, $mysql);
    $Result1 = mysql_query($insertSQL, $mysql) or die(mysql_error());

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

    mysql_select_db($database_mysql, $mysql);
    $query_rs = "SELECT * FROM utenti";
    $rs = mysql_query($query_rs, $mysql) or die(mysql_error());
    $row_rs = mysql_fetch_assoc($rs);
    $totalRows_rs = mysql_num_rows($rs);
    ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <!-- saved from url=(0014)about:internet -->
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Registrati</title>
    <style type="text/css">
    <!--
    .Stile1 {font-family: "Comic Sans MS"}
    -->
    </style>
    </head>

    <body>
    <form action="<?php echo $editFormAction; ?>" method="POST" name="form1" id="form1">
    <p class="Stile1">Inserisci i tuoi dati e l' username e la password che vuoi per registrarti</p>
    <table align="center">
    <tr valign="baseline">
    <td nowrap="nowrap" align="right"><span class="Stile1">Username</span>:</td>
    <td><input type="text" name="Username" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right"><span class="Stile1">Password</span>:</td>
    <td><input type="text" name="Password" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right"><span class="Stile1">Nome</span>:</td>
    <td><input type="text" name="Nome" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right"><span class="Stile1">Cognome</span>:</td>
    <td><input type="text" name="Cognome" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right"><span class="Stile1">Eta</span>:</td>
    <td><input type="text" name="Eta" value="" size="32" /></td>
    </tr>
    <tr valign="baseline">
    <td nowrap="nowrap" align="right">&nbsp;</td>
    <td><input type="submit" value="Registrati" /></td>
    </tr>
    </table>

    <input type="hidden" name="MM_insert" value="form1" />
    </form>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    </body>
    </html>
    <?php
    mysql_free_result
    ($rs);
    ?>
    Ultima modifica di debug : 05-02-2008 alle ore 12.41.16

  4. #4
    L'avatar di funcool
    funcool non è connesso Utente storico
    Data registrazione
    05-02-2004
    Residenza
    Qui... Non lì, qui!
    Messaggi
    15,433

    Predefinito

    Il codice che si trova all'interno del file "mysql.php" che a sua volta si trova nella cartella "Connections" qual è?
    Mattia vi manda a FunCool - Matriz - Directory Gogol - Sfondo rosso per la Birmania
    «Tu mi dai fastidio perché ti credi tanto un Dio!» «Bè, dovrò pur prendere un modello a cui ispirarmi, no?» Woody Allen

  5. #5
    Guest

    Predefinito

    Aspettate... Problema risolto!!!!
    è bastato cambiare un impostazione

    EDIT:
    Connections è una cartella che ho caricato

    EDIT2:
    Grazie
    Ultima modifica di seneca : 05-02-2008 alle ore 13.01.13

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •