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

    problema inserire le foto e slideshow dinamica

    Salve.
    Devo inserire le foto e descrizioni dal php a mysql. ho creato la pagina ma mi dice che parse error on line 171.. cioe connecssione datbase. Incollo tutto codice.. se qualcuno sa dove sbaglio...
    un altra domando.. si puo' creare un slideshow come lightbox di ajax dinamica?


    <?php require_once('../Connections/connCucina.php'); ?>
    <?php
    session_start();
    $MM_authorizedUsers = "";
    $MM_donotCheckaccess = "true";

    // *** 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 log in.
    // 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 == "") && true) {
    $isValid = true;
    }
    }
    return $isValid;
    }

    $MM_restrictGoTo = "fail.php";
    if (!((isset($HTTP_SESSION_VARS['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $HTTP_SESSION_VARS['MM_Username'], $HTTP_SESSION_VARS['MM_UserGroup'])))) {
    $MM_qsChar = "?";
    $MM_referrer = $HTTP_SERVER_VARS['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 != "") ? "'" . date("Y-d-m",strtotime($theValue)) . "'" : "NULL";
    break;
    case "time":
    $theValue = ($theValue != "") ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
    break;
    case "datetime":
    $theValue = ($theValue != "") ? "'" . date("Y-d-m H:i:s",strtotime($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"] == "form2")) {
    //user defined variables
    $abpath = "images/cucine"; //Absolute path to where images are uploaded. No trailing slash
    $sizelim = "no"; //Do you want size limit, yes or no
    $size = "2500000"; //What do you want size limited to be if there is one

    //all image types to upload
    $cert1 = "image/pjpeg"; //Jpeg type 1
    $cert2 = "image/jpeg"; //Jpeg type 2
    $cert3 = "image/gif"; //Gif type
    $cert4 = "image/ief"; //Ief type
    $cert5 = "image/png"; //Png type
    $cert6 = "image/tiff"; //Tiff type
    $cert7 = "image/bmp"; //Bmp Type
    $cert8 = "image/vnd.wap.wbmp"; //Wbmp type
    $cert9 = "image/x-cmu-raster"; //Ras type
    $cert10 = "image/x-x-portable-anymap"; //Pnm type
    $cert11 = "image/x-portable-bitmap"; //Pbm type
    $cert12 = "image/x-portable-graymap"; //Pgm type
    $cert13 = "image/x-portable-pixmap"; //Ppm type
    $cert14 = "image/x-rgb"; //Rgb type
    $cert15 = "image/x-xbitmap"; //Xbm type
    $cert16 = "image/x-xpixmap"; //Xpm type
    $cert17 = "image/x-xwindowdump"; //Xwd type

    $log = "";

    //begin upload 1
    $nomeimg = $img1_name;
    $nomeimg1 = $img2_name;

    //checks if file exists
    if ($img1_name == "") {
    $log .= "Nessun file selezionato per il caricamento dell'immagine piccola
    ";
    } else {

    //checks if files to big
    if ($sizelim == "yes") {
    if ($img1_size > $size) {
    $log .= "L'immagine piccola è troppo grande
    ";
    }
    }

    //Checks if file is an image
    if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3) or ($img1_type == $cert4) or ($img1_type == $cert5) or ($img1_type == $cert6) or ($img1_type == $cert7) or ($img1_type == $cert8) or ($img1_type == $cert9) or ($img1_type == $cert10) or ($img1_type == $cert11) or ($img1_type == $cert12) or ($img1_type == $cert13) or ($img1_type == $cert14) or ($img1_type == $cert15) or ($img1_type == $cert16) or ($img1_type == $cert17)) {
    @copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server
    ";
    if (file_exists("$abpath/$img1_name")) {
    $log .= "L'immagine piccola è stata caricata con successo
    ";
    $fotopiccola = "images/cucine".$img1_name;
    }
    } else {
    $log .= "L'immagine piccola non è un file immagine(jpg o gif)
    ";
    }
    }
    //checks if file exists
    if ($img2_name == "") {
    $log .= "Nessun file selezionato per il caricamento dell'immagine grande
    ";
    } else {

    //checks if files to big
    if ($sizelim == "yes") {
    if ($img2_size > $size) {
    $log .= "L'immagine grande è troppo grande
    ";
    }
    }

    //Checks if file is an image
    if (($img2_type == $cert1) or ($img2_type == $cert2) or ($img2_type == $cert3) or ($img2_type == $cert4) or ($img2_type == $cert5) or ($img2_type == $cert6) or ($img2_type == $cert7) or ($img2_type == $cert8) or ($img2_type == $cert9) or ($img2_type == $cert10) or ($img2_type == $cert11) or ($img2_type == $cert12) or ($img2_type == $cert13) or ($img2_type == $cert14) or ($img2_type == $cert15) or ($img2_type == $cert16) or ($img2_type == $cert17)) {
    @copy($img2, "$abpath/$img2_name") or $log .= "Couldn't copy image 2 to server
    ";
    if (file_exists("$abpath/$img2_name")) {
    $log .= "L'immagine grande è stata caricata con successo
    ";
    $fotogrande = "images/cucine".$img2_name;

    }
    } else {
    $log .= "L'immagine piccola non è un file immagine(jpg o gif)
    ";
    }
    }

    $insertSQL = sprintf("INSERT INTO tbfoto(ID, nome, testofoto, nomefotopiccola, nomefotogrande, categoria, visualizza) VALUES (%s, %s, %s, %s, %s, %s, %s)",
    GetSQLValueString($_POST['ID'], "int"),
    GetSQLValueString($_POST['categoria'], "text"),
    GetSQLValueString($_POST['visualizza'], "text"),
    GetSQLValueString($_POST['nome'], "text"),
    GetSQLValueString($fotopiccola, "text"),
    GetSQLValueString($fotogrande, "text"),
    GetSQLValueString($_POST['descrizione'], "text"),


    mysql_select_db($database_connCucina, $connCucina);
    $Result1 = mysql_query($insertSQL, $connCucina) or die(mysql_error());

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


    $colname_rsCucine = "1";
    if (isset($_GET['ID'])) {
    $colname_rsCucine = (get_magic_quotes_gpc()) ? $_GET['ID'] : addslashes($_GET['ID']);
    }
    mysql_select_db($database_connCucina, $connCucina);
    $query_rsCucine = sprintf("SELECT * FROM tbfoto WHERE ID = %s", $colname_rsCucine);
    $rsCucine = mysql_query($query_rsCucine, $connCucina) or die(mysql_error());
    $row_rsCucine = mysql_fetch_assoc($rsCucine);
    $totalRows_rsCucine = mysql_num_rows($rsCucine);
    ?>

    grazie.. tante...
    shakila
    shakila

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2002
    Messaggi
    443
    prova a sostituire riga 168 con

    Codice PHP:
    GetSQLValueString($_POST['descrizione'], "text"); 

  3. #3
    Salve
    mi da lo stesso errore adesso mi dice che parse error on line 172.. prima on line 171..
    shakila

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.