Registrato: May 03, 2004 Messaggi: 120
Località: Gioiosa Jonica
Oggetto: EASYUP-NUKE
Fatal error: Call to a member function on a non-object in /usr/local/psa/home/vhosts/medambiente.it/httpdocs /html75/modules/Easyup/index.php on line 145
Dove sbaglio
Codice:
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
//* Copyright (c) 2002 by Francisco Burzi (fbc@mandrakesoft.com) */
/* http://phpnuke.org */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
// EASYUP-NUKE
// module created by HI-Lab based on EasyUp of Amine Ouelhadj *
// Copyright (c) 2002 by cooperativa sociale l'Utopia a r.l.
// released under GPL licence
// www.hi-lab.net
//***************************************************************************/
// upload html form
if (!eregi("modules.php", $PHP_SELF)) {
die ("Non puoi accedere a questo file direttamente...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._TITLEASYUP."";
global $user, $cookie, $prefix, $dbi, $user_prefix;
include ("header.php");
title("<img src='modules/Easyup/EASYUP-NUKE.jpg' width='248' height='123' alt='logo EASYUP-NUKE'>");
echo "<center><font class=\"content\"><b>"._TITLEASYUP."</b></font></center>";
OpenTable();
echo "<i>"._INSTRUCTIONEASYUP."</i><br>"
."<form ENCTYPE=\"multipart/form-data\" action=\"modules.php?mop=modload&name=Easyup&file=index\" method=\"post\">"
._FILETYPE.":<br><SELECT name=\"percorso\" title=\"Tipo di file\">\n"
."<OPTION value=\"1\">"._FILETODISPLAY."</OPTION>\n"
."<OPTION value=\"2\">"._FILETODOWN."</OPTION></SELECT><br><br>\n"
._CATEGORY.":<br><input name=\"Categoria\" type=\"text\" size=\60\" maxlength=\"100\"><br><br>\n"
._DESCRIPTION.":<br><input name=\"Descrizione\" type=\"text\" size=\60\" maxlength=\"200\"><br><br>\n"
._FILEPOSITION.":<br><input name=\"nomfichier\" type=\"file\" size=\"30\"><br><br>\n"
._ALTTAG.":<br><input name=\"alt\" type=\"text\" size=\"30\" maxlength=\"40\"><br><br>\n"
._BGCOLORSWF.":<br># <input name=\"bgcolorswf\" type=\"text\" size=\"6\" maxlength=\"6\"><br><br>\n"
."<input type=\"submit\" name=\"Submit\" value=\""._SEND."\">\n"
."</form><br>\n";
//----------------------------------------------------------------
// upload engine
//----------------------------------------------------------------
// parameters
//$uploaddir = is_dir($this->conf['path'])?$this->conf['path']:$TYPO3_CONF_VARS['BE']['fileadminDir'];
// choose directory of upload files
$GrandezzaFile=filesize($nomfichier);
$Tag="";
$imagesdir="images/uploadmedambiente";
$downloaddir="images/materialimedambiente";
// Allow or not executable files adding an extension - yes="si" no="no"
$execution = "no";
// Allow or not upload of index files - yes="si" no="no"
$index_autorisation = "no";
$alertdimension=array(
// Alert dimension for images files in Kb integer
img=>150,
// Alert dimension for swf files in Kb integer
swf=>150,
// Alert dimension for other files in Kb integer
other=>500
);
checkperms($imagesdir);
checkperms($downloaddir);
switch ($percorso)
{
case "1":
$chemin=$imagesdir;
break;
case "2":
$chemin=$downloaddir;
break;
}
$testotoobig=array(_TOOBIG,_TOOBIG1,_TOOBIG2,_TOOBIG3,_TOOBIG4,_TOOBIG5);
$nom_fichier_name = strtolower($nomfichier_name);
if ($nomfichier!="")
{
if ($index_autorisation == "no")
{
if (verif_index($nomfichier_name)) {
echo "<hr>";
echo ""._ERROR." 02: "._YOURFILE." "$nomfichier_name" "._REFUSE."<br>";
echo "<hr>";
exit;
}
}
if ($execution == "no"){
if(check_extension($nomfichier_name)){
$nomfichier_name = "$nomfichier_name.txt";
}
}
if (presence_file($nomfichier_name) == "true") {
echo "<hr>";
echo ""._ERROR." 01: "._YOURFILE." $nomfichier_name "._EXIST."<br>";
echo "<hr>";
exit;
}
if (copy($nomfichier, "$chemin/$nomfichier_name"))
{
echo ""._YOURFILE." $nomfichier_name "._SUCCESS."<br><p>\n";
// check file type
$imgextension = end(explode(".", $nomfichier_name));
switch ($imgextension)
{
case ("swf"):
$Tag=swftag($chemin,$nomfichier_name,$alt,$bgcolorswf);
break;
case ("gif"):
$Tag=imagetag($chemin,$nomfichier_name,$alt);
break;
case ("jpg"):
$Tag=imagetag($chemin,$nomfichier_name,$alt);
break;
case ("png"):
$Tag=imagetag($chemin,$nomfichier_name,$alt);
break;
default:
$Tag=otherfiles($chemin,$nomfichier_name);
}
chmod_no_execution($nomfichier_name);
}
else
{
//echo ""._ERRORPERM."<br>";
//echo ""._PERMISSION."<p>";
//exit;
}
}
// aqggiunta codice di Giorgio
$data=date("Y-m-d");
$boo=false;
//ok Path $chemin;
//OK file $nomfichier_name;
//OK Dimensione File $GrandezzaFile;
// OK data $data;
//ok $imgextension;
//OK TAG $Tag;
$varFile="$chemin/$nomfichier_name";
$querystr="insert into ".$prefix."_easyup ((easydescription,easypath,easysize,easydate,easycategory,easyext,easytag) VALUES('$Descrizione','$varFile',$GrandezzaFile,'$data','$Categoria','$imgextension','$Tag'))";
if($nomfichier_name!="")
$db->sql_query($querystr) or die("ci sono problemi con la query1 in modulo easyup");
//$resultpersons = sql_query($querystr, $dbi);
// Verifie si le nom ne se nomme pas index.extension
function verif_index($nomfichier_name)
{
$pointeur = strrpos($nomfichier_name, ".");
$nom = substr($nomfichier_name, 0, $pointeur);
if (ereg ("^index$", $nom)) return true;
}
// Verifie si le fichier existe sur le serveur.
function presence_file($nomfichier_name)
{
global $chemin;
if (file_exists("$chemin/$nomfichier_name")) return true;
}
// Calculate dimensions of image and print related html tag
function imagetag($chemin,$nomfichier_name,$alt)
{
global $testotoobig,$alertdimension;
$misura=getimagesize("$chemin/$nomfichier_name");
$htmlimgstring="<img src=\"$chemin/$nomfichier_name\" alt=\"$alt\" ".$misura[3].">";
echo "<center><h2>"._TITLETAG."</h2>\n".
"<i>"._INSTRUCTIONTAG." "._IMAGE.". "._INSTRUCTIONTAG2."</i><br>\n";
echo "<font color=\"#000066\"><h2><blockquote><img src=\"$chemin/$nomfichier_name\" alt=\"$alt\" ".$misura[3]."></h2></font></center><br><br>";
echo "<center><h2>"._TITLEDIMENSION."</h2></center><br>\n";
dimensionefiles($chemin,$nomfichier_name,$testotoobig[0],$testotoobig[1],$alertdimension[img]);
echo "<center><h2><br>"._PREVIEW."</h2>\n".
"<i>"._SUBPREVIEW." "._IMAGE." "._SUBPREVIEW2."</i>:<br><br>\n";
echo "".$htmlimgstring."</center>";
return $htmlimgstring;
}
// Calculate dimensions of swf file and print related html tag
function swftag ($chemin,$nomfichier_name,$alt,$bgcolorswf)
{
global $testotoobig,$alertdimension;
$misura=getimagesize("$chemin/$nomfichier_name");
$htmlswfstring="<embed ALT=\"$alt\" src=\"$chemin/$nomfichier_name\" quality=high bgcolor=\"#$bgcolorswf\" ".$misura[3]." type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">";
echo "<center><h2>"._TITLETAG."</h2>\n".
"<i>"._INSTRUCTIONTAG." "._MOVIE.". "._INSTRUCTIONTAG2."</i><br>\n";
echo "<font color=\"#000066\"><h2><blockquote><embed ALT=\"$alt\" src=\"$chemin/$nomfichier_name\" quality=high bgcolor=\"#$bgcolorswf\" ".$misura[3]." type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\"></h2></font></center><br><br>";
echo "<center><h2>"._TITLEDIMENSION."</h2></center><br>\n";
dimensionefiles($chemin,$nomfichier_name,$testotoobig[2],$testotoobig[3],$alertdimension[swf]);
echo "<center><h2><br>"._PREVIEW."</h2>\n".
"<i>"._SUBPREVIEW." "._MOVIE." "._SUBPREVIEW2."</i>:<br><br>\n";
echo "".$htmlswfstring."</center>";
return $htmlswfstring;
}
// Check dimension of file and print alert message
function otherfiles ($chemin,$nomfichier_name)
{
global $testotoobig,$alertdimension,$nukeurl,$Tag;
echo "<center><h2>"._TITLEDIMENSION."</h2></center><br>\n";
dimensionefiles($chemin,$nomfichier_name,$testotoobig[4],$testotoobig[5],$alertdimension[other]);
echo "<center><h2>"._TITLEDOWNLOAD."</h2></center><br>\n";
echo "<center>"._INSTRUCTIONDOWN."</center><br>".
_FILEURL.": <font color=\"#000066\">$nukeurl/$chemin/$nomfichier_name</font><br>\n";
$dimensione=filesize("$chemin/$nomfichier_name");
echo ""._FILESIZE.": <font color=\"#000066\">$dimensione</font> "._BYTES."<br>\n";
echo ""._HOMEPAGE.": <font color=\"#000066\">$nukeurl</font><br>";
return "";
}
// Chmod le fichier pour en 644 pour le rendre non executable.
function chmod_no_execution($nomfichier_name)
{
global $chemin;
chmod ("$chemin/$nomfichier_name", 0644);
}
echo "<p align=\"right\"><A href=\"http://www.hi-lab.net\"><img src='modules/Easyup/hilab.gif' width='70' height='30' alt='HI-Lab - The Social Technology'></A><p>";
include ("footer.php");
Diciamo che messo giù così non serve a molto, ad sempio quando ti da quel messaggio di errore??
Hai uppato i file nelle relative directory come specificato nel file install???
Hai assegnato i giusti permessi alla directory images/upload ????
Da come lo hai inserito alla riga 145 viene evidenziato un errore nel collegamento al database, ma non è detto che il problema sia quello.
Poi hai apportato modifiche al modulo originale??? controllando le riga 145 dello script che hai postato c'è una collegamento al database mentre il modulo originale quella riga è diversa.
_________________ Non inviatemi pm con richieste di aiuto grazie.
Su questo forum solo gli utenti registrati possono vedere i links! Registrati o fai il login
Inviato:
Lun Dic 20, 2004 7:02 pm
tonin Moderatore
Registrato: May 03, 2004 Messaggi: 120
Località: Gioiosa Jonica
Oggetto:
vedo ma mi sembra di no......
Inviato:
Lun Dic 20, 2004 8:20 pm
tonin Moderatore
Registrato: May 03, 2004 Messaggi: 120
Località: Gioiosa Jonica
Oggetto:
Risolto.....
1) era scritta male la sintasi di mysql...
2) non era $db ma $dbi per la 5.5
Non puoi inserire nuovi Topic in questo forum Non puoi rispondere ai Topic in questo forum Non puoi modificare i tuoi messaggi in questo forum Non puoi cancellare i tuoi messaggi in questo forum Non puoi votare nei sondaggi in questo forum