• Home
  • Forum
  • Fare Web
  • PHP

Migrazione da PHP4 a PHP5

  • Creatore Discussione Creatore Discussione Levian
  • Data di inizio Data di inizio 30 Set 2008
Prec.
  • 1
  • 2
  • 3
Primo Prec. 3 di 3

Trogo

Utente Attivo
11 Gen 2008
370
0
0
44
Sanremo
  • 14 Ott 2008
  • #41
Spero ti sia divertito, magari con la mente fresca è più facile trovare i problemi.
Allora intanto c'è da cambiare questo:
PHP:
If ($IDMsg == '') {
        #----- nuovo messaggio! -----
        $MySql = 'INSERT INTO MessaggioAraldo (IDAraldo, IDMessaggioPadre, Tag, Titolo, Messaggio, Autore, IDGilda, Img, Corporazione, IDRazza, DataMessaggio)';
        $MySql .=" VALUES (".addslashes(pars($IDAraldo))."',";
        $MySql .=" '".addslashes(pars($IDMsgPadre))."',";
        $MySql .=" '".addslashes(pars($Tag))."',";
        $MySql .=" '".addslashes(pars($Titolo))."',";
        $MySql .=" '".addslashes(pars($Messaggio))."',";
        $MySql .=" '".addslashes(pars($Login))."',";
        $MySql .=" '".addslashes(pars($IDGilda_S))."',";
        $MySql .=" '".addslashes(pars($ImgGilda_S))."',";
        $MySql .=" '".addslashes(pars($DescGilda_S))."',";
        $MySql .=" '".addslashes(pars($IDRazza_S))."',";
        $MySql .=" NOW())";
        echo "<p>" . $MySql . "</p>";

Non c'era la parentesi dopo "VALUES". Eppoi quel testo del messaggio non mi piace proprio. La funzione pars(...) cosa fa?
 
L

Levian

Utente Attivo
30 Set 2008
51
0
0
  • 18 Ott 2008
  • #42
Ho sistemato la parentesi dopo il Values e rimosso la funzione pars a tutto il file, perchè superflua.

PHP:
If ($IDMsg == '') {
        #----- nuovo messaggio! -----
        $MySql = 'INSERT INTO MessaggioAraldo (IDAraldo, IDMessaggioPadre, Tag, Titolo, Messaggio, Autore, IDGilda, Img, Corporazione, IDRazza, DataMessaggio)';
        $MySql .=" VALUES (".addslashes($IDAraldo)."',";
        $MySql .=" '".addslashes($IDMsgPadre)."',";
		$MySql .=" '".addslashes($Tag)."',";
        $MySql .=" '".addslashes($Titolo)."',";
        $MySql .=" '".addslashes($Messaggio)."',";
        $MySql .=" '".addslashes($Login)."',";
        $MySql .=" '".addslashes($IDGilda_S)."',";
        $MySql .=" '".addslashes($ImgGilda_S)."',";
        $MySql .=" '".addslashes($DescGilda_S)."',";
        $MySql .=" '".addslashes($IDRazza_S)."',";
        $MySql .=" NOW())";
        echo "<p>" . $MySql . "</p>";
		$Result = mysql_query($MySql);
 

Trogo

Utente Attivo
11 Gen 2008
370
0
0
44
Sanremo
  • 20 Ott 2008
  • #43
E adesso come va? Che query ti tira fuori?
 
L

Levian

Utente Attivo
30 Set 2008
51
0
0
  • 21 Ott 2008
  • #44
INSERT INTO MessaggioAraldo (IDAraldo, IDMessaggioPadre, Tag, Titolo, Messaggio, Autore, IDGilda, Img, Corporazione, IDRazza, DataMessaggio) VALUES (3', '0', '[Off Game]', 'Test', 'Testo di prova. \'\"/\'\'è° Testo di Prova.', 'Hisoka', '8', 'gestore.gif', 'Genei Ryodan', '8000', NOW())

Continua a darmi lo stesso problema. Fintanto che non si usano apici come ' e/o " nessun problema. Nel momento in cui si usano il thread non viene inserito. Ma possibile che il php5 sia così rognoso? Sarò scemo io. T_T
 
L

Levian

Utente Attivo
30 Set 2008
51
0
0
  • 28 Ott 2008
  • #45
Uppo il Messaggio.
 

Trogo

Utente Attivo
11 Gen 2008
370
0
0
44
Sanremo
  • 28 Ott 2008
  • #46
Nel senso che adesso almeno questa parte funziona? Ora la query mi sembra a posto, a parte che manca un apice all'inizio:
........................................................|
.............................+------------------+
.............................|
INSERT [...] VALUES (3', '0', [...]
 
Ultima modifica: 28 Ott 2008
L

Levian

Utente Attivo
30 Set 2008
51
0
0
  • 28 Ott 2008
  • #47
Che urto di nervi, il problema era proprio quel cavolo di apice mancante.

E noi che ci scervellavamo pensando a che caspio potesse essere. >_<

In pratica questa parte:

PHP:
If ($IDMsg == '') { 
        #----- nuovo messaggio! ----- 
        $MySql = 'INSERT INTO MessaggioAraldo (IDAraldo, IDMessaggioPadre, Tag, Titolo, Messaggio, Autore, IDGilda, Img, Corporazione, IDRazza, DataMessaggio)'; 
        $MySql .=" VALUES (".addslashes($IDAraldo)."',"; 
        $MySql .=" '".addslashes($IDMsgPadre)."',"; 
        $MySql .=" '".addslashes($Tag)."',"; 
        $MySql .=" '".addslashes($Titolo)."',"; 
        $MySql .=" '".addslashes($Messaggio)."',"; 
        $MySql .=" '".addslashes($Login)."',"; 
        $MySql .=" '".addslashes($IDGilda_S)."',"; 
        $MySql .=" '".addslashes($ImgGilda_S)."',"; 
        $MySql .=" '".addslashes($DescGilda_S)."',"; 
        $MySql .=" '".addslashes($IDRazza_S)."',"; 
        $MySql .=" NOW())"; 
        echo "<p>" . $MySql . "</p>"; 
        $Result = mysql_query($MySql);

Bastava sistemarla così:

PHP:
If ($IDMsg == '') {
        #----- nuovo messaggio! -----
        $MySql = 'INSERT INTO MessaggioAraldo (IDAraldo, IDMessaggioPadre, Tag, Titolo, Messaggio, Autore, IDGilda, Img, Corporazione, IDRazza, DataMessaggio)';
        $MySql .=" VALUES ('".addslashes($IDAraldo)."',";
        $MySql .=" '".addslashes($IDMsgPadre)."',";
		$MySql .=" '".addslashes($Tag)."',";
        $MySql .=" '".addslashes($Titolo)."',";
        $MySql .=" '".addslashes($Messaggio)."',";
        $MySql .=" '".addslashes($Login)."',";
        $MySql .=" '".addslashes($IDGilda_S)."',";
        $MySql .=" '".addslashes($ImgGilda_S)."',";
        $MySql .=" '".addslashes($DescGilda_S)."',";
        $MySql .=" '".addslashes($IDRazza_S)."',";
        $MySql .=" NOW())";
		echo "<p>" . $MySql . "</p>"; 
#echo $MySql;
		$Result = mysql_query($MySql);

Ora funziona correttamente sia in PHP4 che in PHP5. Adesso mi dedico alla terza ed ultima pagina. Ringraziandoti come al solito per l'aiuto, senza di te non avrei potuto fare nulla. ^^
 

Trogo

Utente Attivo
11 Gen 2008
370
0
0
44
Sanremo
  • 28 Ott 2008
  • #48
Alla fine tutto si risolve. Come spesso accade le soluzioni sono sotto gli occhi, ma si guarda troppo lontano...
 
L

Levian

Utente Attivo
30 Set 2008
51
0
0
  • 28 Ott 2008
  • #49
Già. 2 scogli su 3 sono tolti di mezzo. Che liberazione psicologica. xD

Per comodità riporto qui l'ultimo file, nella speranza di individuare in tempi brevi il problema, che è simile a quello dei file precedenti: quando si invia un Messaggio Privato con apostrofi e/o apici da il "Crash del Sistema" ed il messaggio non arriva a destinazione.

PHP:
<? session_start();
include ('inc/variabile1.php');
include ('inc/variabile2.php');
include ('inc/variabile3.php');
include ('inc/variabile4.php');

if ($_GET['cancella'] != '') {
	$IDCanc = 0 + $_POST['IDCanc'];
	if ($IDCanc >0) {
	    $MySql = "INSERT INTO BakMessaggi SELECT * FROM Messaggi WHERE ID = $IDCanc AND Destinatario = '".pars($Login)."'";
	    mysql_query($MySql);
		$MySql = "DELETE FROM Messaggi WHERE ID = $IDCanc AND Destinatario = '".pars($Login)."'";
		mysql_query($MySql);
		header("Location: comunicazionel.php?p=$p&Ord=$Ord&Max=$Max", false);
	}
}
include ('inc/variabile5.php');
?>
<title>Comunity</title>
</head>
<body bgcolor="fbf4e4">
<div align="center">
  <table border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td></td>
      <td></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td><div align="center">
  <font face="Verdana" color="#800000"><strong><?= strtoupper(htmlspecialchars($par_MessaggiName)) ?></strong></font></div></td>
      <td></td>
    </tr>
    <tr>
      <td></td>
      <td></td>
      <td></td>
    </tr>
  </table><br><br>
  <?
function formattadata($tim)
{
	return(strftime("%d/%m/%Y %H:%M", strtotime($tim)));
}

if ($_POST['Destinatario'] != '') {

	$Testo = htmlspecialchars($Testo);
	$Testo = str_replace("\n", "<br>", $Testo);

	$IDAllegato = 0 + $_POST['IDAllegato'];

	if ($IDAllegato > 0) {
			
			$MySql = "Select * From Messaggi";
			$MySql .= " Where ID = '$IDAllegato'";
			$MySql .= " AND Destinatario = '".pars($Login)."'";

			$Result = mysql_query($MySql);
			if ($rs = mysql_fetch_array($Result)) {
				$TestoAllegato = htmlspecialchars($par_MessaggiNameSing).' inoltrato da <b>'.htmlspecialchars($rs['Mittente']).'</b>';
				$TestoAllegato .=' il '.formattadata($rs['Spedito']).':<br>';
				$TestoAllegato .= addslashes($rs['Testo']);
				$TestoAllegato = str_replace('', '', $TestoAllegato);
				$TestoAllegato = str_replace('', '', $TestoAllegato);
			} else {
				$TestoAllegato = '<b>Allegato non presente.</b>';
			}
			$rs->close;
			mysql_free_result($Result);
			$Testo .= '<br><br>'.$TestoAllegato.'';
	}
	
	
	if (($_SESSION['IDGilda_S']%100 == 0) && (0 + $_SESSION['IDGilda_S'] > 0)) {
		$Dest = explode(',', $_POST['Destinatario']);
	} else {
		$Dest[0] = $_POST['Destinatario'];
	}
	for ($i = 0; $i <= count($Dest)-1; $i++) {
		$Destinatario = trim($Dest[$i]);
		$MySql = "SELECT Nome FROM Personaggio WHERE Nome = '$Destinatario'";
		$Result = mysql_query($MySql);
		$rs = mysql_fetch_array($Result);
		$Esiste = (!(!$rs));
		$rs->close;
		mysql_free_result($Result);
		$Certified = 0;
		if ($Esiste) {

			$MySql = "INSERT Into Messaggi (Mittente, Destinatario, Testo, Spedito) VALUES ('$Login', '$Destinatario', '$Testo', NOW())";
			mysql_query($MySql);

			$Certified = mysql_affected_rows();
			
			$IDCanc = 0 + $IDCanc;
			if (($IDCanc != "") && ($i==count($Dest)-1)) {
				$MySql = "INSERT INTO BakMessaggi SELECT * FROM Messaggi WHERE ID = $IDCanc AND Destinatario = '".pars($Login)."'";
				mysql_query($MySql);
				$MySql = "DELETE From Messaggi WHERE ID = $IDCanc AND Destinatario = '".pars($Login)."'";
				mysql_query($MySql);
	    	}
?>
  <table border=0 width="400">
    <? if($Certified == 1) { ?>
    <tr><td><div align="center"><?= htmlspecialchars($par_MessaggiNameSing) ?>:<br>
<?= stripslashes($Testo) ?><br><br>
<strong>Spedito Correttamente.</strong></div></td></tr>
    <? } else { ?>
    <tr><td><div align="center">Crash Del Sistema: 
          <?= strtoupper(htmlspecialchars($par_MessaggiNameSing)) ?> 
             
          <?= htmlspecialchars(stripslashes($Destinatario)) ?>
    </div></td></tr>
    <tr><td><?= strftime("%d/%m/%Y %H:%M:%S") ?>
    <div align="center"></div></td></tr>
    <tr><td><?= $Testo ?>
    <div align="center"></div></td></tr>
    <? } ?>
  </table>
  <br>
  <?		} else { ?>
  Destinatario 
  '<?= htmlspecialchars($Destinatario) ?>' 
  non presente.<br>
  <?
		}
	}
} else { ?>
</div>
<form action="comunicazioneavviatal.php" method="post">
  <table width="558" height="353" border="0" align="center">
    <tr>
      <td width="418"><div align="center">Destinatario
            <?
if (($_SESSION['IDGilda_S']%100 == 0) && (0 + $_SESSION['IDGilda_S'] > 0)) {
	echo '[Power]';
}
?><br>
            <input type="text" size="20" name="Destinatario" value="<?= $Dest ?>">
            <br><br>Comunicazione<br>
            <textarea name="Testo" rows="3" cols="35"></textarea>    
          <br>
              
      </div></td>
      <td width="130">
        <div align="left">
          <input type="submit" value="Spedisci" Style="font-weight:bold;font-family:Verdana;font-size:8pt"> 
      </div></td></tr>
      <?
if ($_POST['allega'] != '') {
	
	$MySql = "Select * From Messaggi";
	$MySql .= " Where ID = '".$_POST['IDCanc']."'";
	$MySql .= " AND Destinatario = '".pars($Login)."'";

	$Result = mysql_query($MySql);
	if($rs = mysql_fetch_array($Result)) {
	?>	<input type=hidden name=IDAllegato value="<?= $_POST['IDCanc'] ?>">
          <td><div align="center"></div></td>
          </tr> <?
	}
	$rs->close;
	mysql_free_result($Result);
}
?>
    </table>
    <? if (($_GET['cancella'] != '') || ($_GET['cancellaerispondi'] != '')) { ?>
    <input type=hidden name="IDCanc" value="<?= $_POST['IDCanc'] ?>">
    <? } ?>
    <input type=hidden name="p" value="<?= $_POST['p'] ?>">
    <input type=hidden name="Ord" value="<?= $_POST['Ord'] ?>">
    <input type=hidden name="Max" value="<?= $_POST['Max'] ?>">
  </div>
</form>
  <div align="center">
  <? } ?>
  </div>
  </div>
</body>
</html>
 
Ultima modifica: 28 Ott 2008

Trogo

Utente Attivo
11 Gen 2008
370
0
0
44
Sanremo
  • 4 Nov 2008
  • #50
Anche in questo pezzo direi che una addslashes potrebbe risultare utile...

PHP:
        $Certified = 0;
        if ($Esiste) {

            $MySql = "INSERT Into Messaggi (Mittente, Destinatario, Testo, Spedito) VALUES ('$Login', '$Destinatario', '".addslashes($Testo)."', NOW())";
            mysql_query($MySql);
 
L

Levian

Utente Attivo
30 Set 2008
51
0
0
  • 5 Nov 2008
  • #51
Sì, era quello il problema. Ora va tutto a gonfie vele. Non mi sembra vero, Grazie Trogo. ^^
 
Prec.
  • 1
  • 2
  • 3
Primo Prec. 3 di 3
Devi accedere o registrarti per poter rispondere.

Discussioni simili

G
migrazione Joomla 3.10 a 4.x
  • gbag
  • 18 Mag 2023
  • Joomla
Risposte
2
Visite
12K
Joomla 19 Mag 2023
gbag
G
J
migrazione da php 5.3 a 7.0
  • jeeve73
  • 13 Mar 2019
  • PHP
Risposte
1
Visite
1K
PHP 13 Mar 2019
Max 1
[PHP] Gestionale Migrazione DB
  • bubino8
  • 19 Mar 2018
  • PHP
Risposte
0
Visite
1K
PHP 19 Mar 2018
bubino8
P
Migrazione sito da http a https per rispettare linee guida google
  • PaloAlto
  • 17 Mar 2017
  • SEO e Posizionamento
Risposte
12
Visite
5K
SEO e Posizionamento 31 Mar 2018
colomber
C
Migrazione da Hosting Condiviso a Cloud
  • booklisa
  • 10 Feb 2017
  • CMS (Content Management System)
Risposte
0
Visite
1K
CMS (Content Management System) 10 Feb 2017
booklisa
M
windows 7 - Errore in migrazione a windows 10
  • misonsan
  • 25 Ott 2015
  • Windows e Software
Risposte
1
Visite
2K
Windows e Software 7 Nov 2015
filomeni
P
Problemi migrazione da Apache 2.2.9 ad Apache2
  • peopleinside
  • 2 Lug 2015
  • Apache
Risposte
0
Visite
1K
Apache 2 Lug 2015
peopleinside
P
[Cerco / Retribuito] Virtuemart: migrazione da 1.x a 3
  • felino
  • 10 Mar 2015
  • Offerte e Richieste di Lavoro e/o Collaborazione
Risposte
1
Visite
2K
Offerte e Richieste di Lavoro e/o Collaborazione 14 Apr 2015
felino
G
Migrazione dominio e cambiamento DNS
  • giulio46moto
  • 16 Gen 2015
  • Domini
Risposte
1
Visite
2K
Domini 3 Feb 2015
filomeni
T
Consigli migrazione da Phpbb a VBulletin
  • Topastro
  • 6 Apr 2014
  • CMS (Content Management System)
Risposte
0
Visite
3K
CMS (Content Management System) 6 Apr 2014
Topastro
T
F
problema migrazione sito joomla ad altro provider - non parte configurazione
  • Fabio_TO
  • 13 Mar 2014
  • Joomla
Risposte
3
Visite
2K
Joomla 20 Mar 2014
Fabio_TO
F
F
migrazione commenti jcomment 1.5 alla 2.5
  • Fabio90
  • 26 Ago 2013
  • Joomla
Risposte
0
Visite
2K
Joomla 26 Ago 2013
Fabio90
F
B
Creazione Forum e migrazione di quello vecchio.
  • Bizantino
  • 10 Set 2010
  • PHP
Risposte
1
Visite
1K
PHP 10 Set 2010
Eliox
P
joomla: potrei riscontrare problemi migrazione dalla versione 1x alla 1.5
  • pc001
  • 17 Dic 2009
  • Joomla
Risposte
13
Visite
4K
Joomla 4 Gen 2010
pc001
P
T
Migrazione blog
  • tanogabo
  • 3 Ott 2009
  • Hosting
Risposte
0
Visite
2K
Hosting 3 Ott 2009
tanogabo
T
S
AIUTOOOOOOOOOOOO!!!!!!!Migrazione da ASP a PHP
  • sslazio85
  • 7 Gen 2008
  • PHP
Risposte
1
Visite
2K
PHP 7 Gen 2008
Eliox
E
problemi migrazione script php su vers 4.1
  • excalibur
  • 26 Giu 2007
  • PHP
Risposte
0
Visite
1K
PHP 26 Giu 2007
excalibur
E
S
[MsSQL > MySQL] Migrazione struttura e dati e' possibile?
  • schizzechea
  • 18 Gen 2007
  • MySQL
Risposte
0
Visite
2K
MySQL 18 Gen 2007
schizzechea
S
Z
Migrazione da MySQL 3.23.58 a MySQL 4.0.18
  • zag
  • 12 Nov 2004
  • Database
Risposte
0
Visite
2K
Database 12 Nov 2004
zag
Z
Z
PHP4 e PHP5
  • z.cristiano
  • 31 Mar 2010
  • PHP
Risposte
18
Visite
5K
PHP 13 Apr 2010
MarcoGrazia
Condividi:
Facebook X (Twitter) LinkedIn WhatsApp e-mail Condividi Link
  • Home
  • Forum
  • Fare Web
  • PHP
  • Italiano
  • Termini e condizioni d'uso del sito
  • Policy Privacy
  • Aiuto
  • Home
Community platform by XenForo® © 2010-2024 XenForo Ltd. | Traduzione a cura di XenForo Italia
Menu
Accedi

Registrati

  • Home
  • Forum
    • Nuovi Messaggi
    • Cerca...
  • Novità
    • Featured content
    • Nuovi Messaggi
    • Ultime Attività
X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?

X

Privacy & Transparency

We use cookies and similar technologies for the following purposes:

  • Personalized ads and content
  • Content measurement and audience insights

Do you accept cookies and these technologies?