Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Creazione Di Una Pagina Aggiorna Record In Php e mysql Con Fck Editor integrato

    Ciao a tutti, sto usando Fck editor nell'ambito del php , lo sto usando per la creazione di notizie che finiscono nel database mysql, poi richiamate in output in una pagina. Il problema è che la pagina aggiorna record (aggiorna notizia) mi restituisce un errore, ma la cosa strana che me lo da soltanto alcune volte, a seconda del testo che scrivo, l'errore è il seguente:

    Warning: sprintf() [function.sprintf]: Too few arguments in I:\wamp\www\amministratoridisostegno.net\admin\edi tor_update.php on line 85

    e non riesco a venirne a capo il file incriminato lo ho creato aiutandomi con dreamweaver 8 ed è il seguente:
    <?php require_once('../Connections/connessione.php'); ?>
    <?php
    if (!isset($_SESSION)) {
    session_start();
    }
    $MM_authorizedUsers = "admin";
    $MM_donotCheckaccess = "false";

    // *** Restrict Access To Page: Grant or deny access to this page
    function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
    // For security, start by assuming the visitor is NOT authorized.
    $isValid = False;

    // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
    // Therefore, we know that a user is NOT logged in if that Session variable is blank.
    if (!empty($UserName)) {
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
    // Parse the strings into arrays.
    $arrUsers = Explode(",", $strUsers);
    $arrGroups = Explode(",", $strGroups);
    if (in_array($UserName, $arrUsers)) {
    $isValid = true;
    }
    // Or, you may restrict access to only certain users based on their username.
    if (in_array($UserGroup, $arrGroups)) {
    $isValid = true;
    }
    if (($strUsers == "") && false) {
    $isValid = true;
    }
    }
    return $isValid;
    }

    $MM_restrictGoTo = "../admin-errato.php";
    if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
    $MM_qsChar = "?";
    $MM_referrer = $_SERVER['PHP_SELF'];
    if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
    if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
    $MM_referrer .= "?" . $QUERY_STRING;
    $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
    header("Location: ". $MM_restrictGoTo);
    exit;
    }
    ?>
    <?php
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
    {
    $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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_update"])) && ($_POST["MM_update"] == "form1")) {
    $data = mysql_real_escape_string(trim($_POST['fcktext']));
    $updateSQL = sprintf("UPDATE fck_data SET data = '".$data."' , titolo=%s, autore=%s, numero=%s, data_ins=%s WHERE id=%s",
    GetSQLValueString($_POST['titolo'], "text"),
    GetSQLValueString($_POST['autore'], "text"),
    GetSQLValueString($_POST['numero'], "text"),
    GetSQLValueString($_POST['data_ins'], "text"),
    GetSQLValueString($_POST['id'], "int"));


    mysql_select_db($database_connessione, $connessione);
    $Result1 = mysql_query($updateSQL, $connessione) or die(mysql_error());

    $updateGoTo = "vademecum-modifica.php";
    if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s", $updateGoTo));
    }


    $colname_mod_news = "-1";
    if (isset($_GET['id'])) {
    $colname_mod_news = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
    }
    mysql_select_db($database_connessione, $connessione);
    $query_mod_news = sprintf("SELECT * FROM fck_data WHERE id = %s", $colname_mod_news);
    $mod_news = mysql_query($query_mod_news, $connessione) or die(mysql_error());
    $row_mod_news = mysql_fetch_assoc($mod_news);
    $totalRows_mod_news = mysql_num_rows($mod_news);


    include_once "fckeditor/fckeditor.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" xml:lang="en" lang="en">
    <head>
    <title>Test FCKeditor</title>
    <style type="text/css">
    <!--
    .Stile10 {font-size: 18px; font-weight: bold; }
    -->
    </style>
    </head>
    <body>

    <h1><span class="Stile10">| Amministrazione | Inserisci utenti Area Fiumicino | Modifica utenti Area Fiumicino | Inserisci utenti nell'area privata |

    | Modifica Utenti Area Privata | Gestione Vademecum | Modifica amministratore | Esci dall'amministrazione | </span></h1>
    <h1>Aggiorna pagina del Vademecum </h1>
    <form name="form1" action="<?php echo $editFormAction; ?>" method="POST">
    TITOLO PAGINA

    <input name="titolo" type="text" id="titolo" value="<?php echo $row_mod_news['titolo']; ?>" size="130" />
    <label>
    <input name="id" type="hidden" value="<?php echo $row_mod_news['id']; ?>" size="3" />
    </label>


    AUTORE

    <input name="autore" type="text" id="autore" value="<?php echo $row_mod_news['autore']; ?>" size="40" />




    DATA

    <input name="data_ins" type="text" id="data_ins" value="<?php echo $row_mod_news['data_ins']; ?>" "size="10" />
    </p>


    NUMERO PAGINA NELL'INDICE

    <label>
    <input name="numero" type="text" id="numero" value="<?php echo $row_mod_news['numero']; ?>" size="8" />
    </label>




    <?php
    // Get data from the database
    mysql_select_db($database_connessione, $connessione);
    $query_mod_news = sprintf("SELECT data FROM fck_data WHERE id = %s", $colname_mod_news);
    $mod_news = mysql_query($query_mod_news, $connessione) or die(mysql_error());
    $data = mysql_fetch_array($mod_news);
    $totalRows_mod_news = mysql_num_rows($mod_news);



    // Configure and output editor
    $oFCKeditor = new FCKeditor('fcktext');
    $oFCKeditor->BasePath = "FCKeditor/";
    $oFCKeditor->Value = $data["data"];
    $oFCKeditor->Width = 800;
    $oFCKeditor->Height = 400;
    echo $oFCKeditor->CreateHtml();
    ?>




    <input type="hidden" name="submit_form" value="<?php echo $row_mod_news['data_ins']; ?>" />
    <input type="submit" value="Save Form" />
    <input type="hidden" name="MM_update" value="form1">
    </p>
    </form>

    </body>
    </html>


    <?php
    mysql_free_result($mod_news);

    ?>
    L'errore è in questa if:

    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
    $data = mysql_real_escape_string(trim($_POST['fcktext']));
    $updateSQL = sprintf("UPDATE fck_data SET data = '".$data."' , titolo=%s, autore=%s, numero=%s, data_ins=%s WHERE id=%s",
    GetSQLValueString($_POST['titolo'], "text"),
    GetSQLValueString($_POST['autore'], "text"),
    GetSQLValueString($_POST['numero'], "text"),
    GetSQLValueString($_POST['data_ins'], "text"),
    GetSQLValueString($_POST['id'], "int")); <------Linea 85
    , ma non riesco a trovare soluzioni, per favore datemi una mano, grazie in anticipo!!!!

  2. #2

    errore nella pagina aggiorna record con fck editor

    Ciao a tutti, cortesemente, attendo impaziente risposta, per l'errore suddetto, ma la cosa strana che me lo da soltanto alcune volte, a seconda del testo che scrivo, l'errore è il seguente:

    Warning: sprintf() [function.sprintf]: Too few arguments in I:\wamp\www\amministratoridisostegno.net\admin\edi tor_update.php on line 85


    L'errore è in questa if:

    Citazione:
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
    $data = mysql_real_escape_string(trim($_POST['fcktext']));
    $updateSQL = sprintf("UPDATE fck_data SET data = '".$data."' , titolo=%s, autore=%s, numero=%s, data_ins=%s WHERE id=%s",
    GetSQLValueString($_POST['titolo'], "text"),
    GetSQLValueString($_POST['autore'], "text"),
    GetSQLValueString($_POST['numero'], "text"),
    GetSQLValueString($_POST['data_ins'], "text"),
    GetSQLValueString($_POST['id'], "int")); <------Linea 85


    datemi una mano per favore, non lasciate morire questo post senza darmi una soluzione!!!!grazie ancora

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.