Pagina di registrazione (php4 -> php5)

Levian

Utente Attivo
30 Set 2008
51
0
0
Ho un problema con una delle pagine di registrazione.

Codice:
<? session_start();
include ("variabile.php");
include ("variabile2.php");
#echo "<font color=black>Crash Del Sistema.</font>";
if (($HTTP_SESSION_VARS['OKSesso'] == "")
	|| ($HTTP_SESSION_VARS['OKNome'] == "")
	|| ($HTTP_SESSION_VARS['OKRazza'] == "")
	|| ($HTTP_SESSION_VARS['OKEmail'] == "")) {
    $HTTP_SESSION_VARS['errore'] = "<html><head>
<title>Comunità</title>
<style type='text/css'>
<!--
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.Stile2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>

<body><div align='center'><br><br><br><br><br><br><b>Crash del Sistema, hai compilato il modulo precedente in maniera errata.</b>";
    #header("Location: registrazione1.php", false);
    echo $HTTP_SESSION_VARS['errore']."<br>";
    exit();
}

include("variabile3.php");

$MySql = "Select Nome FROM Personaggio WHERE Nome = '$OKNome' or Email = 'OKEmail'";
$Result = mysql_query($MySql);

if ($rs = mysql_fetch_array($Result)) {$HTTP_SESSION_VARS['errore'] .= "Il nome ".htmlspecialchars($OKNome)." o l'email esistono.<br>";};
$rs->close;

if ($HTTP_SESSION_VARS['errore'] != "") { 
	$RegNome = $HTTP_SESSION_VARS['OKNome'];
    $RegEmail = $HTTP_SESSION_VARS['OKEmail'];
    $RegRazza = $HTTP_SESSION_VARS['OKRazza'];
    $RegSesso = $HTTP_SESSION_VARS['OKSesso'];
    echo $HTTP_SESSION_VARS['errore'];
#header("Location: registrazione1.php", false);
exit();
}

function Lettera() {
	mt_srand((double)microtime()*1000000);
    return(chr(mt_rand(0, 24) + ord("A")));
}

$pass = Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();

$MySql = "SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0 AND IDRazza = '".$OKRazza."'";
$Result = mysql_query($MySql);
if (!$rs = mysql_fetch_array($Result)) {
	echo "<b>Crash Del Sistema.";
	exit();
}
$Forza = $rs["Forza"];
$Destrezza = $rs["Destrezza"];
$Costituzione = $rs["Costituzione"];
$Intelligenza = $rs["Intelligenza"];
$Saggezza = $rs["Saggezza"];
$Carisma = $rs["Carisma"];
$Tempra = $rs["Tempra"];
$Volonta = $rs["Volonta"];
$rs->close;

$MySql = "INSERT INTO Personaggio (Nome, Pass, DataIscrizione, Forza, Destrezza, Costituzione, Intelligenza, Saggezza, Carisma, Tempra, Volonta, IDRazza, Sesso, Email, URLImg, Banca, DataUltimaGilda) ";
$MySql .= "VALUES (";
$MySql .= "'$OKNome'";
$MySql .= ", '$pass'";
$MySql .= ", NOW()";
$MySql .= ", '$forza'";
$MySql .= ", '$destrezza'";
$MySql .= ", '$costituzione'";
$MySql .= ", '$intelligenza'";
$MySql .= ", '$saggezza'";
$MySql .= ", '$carisma'";
$MySql .= ", '$tempra'";
$MySql .= ", '$volonta'";
$MySql .= ", '$OKRazza'";
$MySql .= ", '".strtolower($OKSesso)."'";
$MySql .= ", '".$OKEmail."'";
$MySql .= ", '_altervista_ht/trasparente.gif'";
$MySql .= ", '0'";
$MySql .= ", NOW()";
$MySql .= ")";

	$Result = mysql_query($MySql);

	$StrBody = "Nome: ".$OKNome.chr(10);
	$StrBody .= "Pass: $pass".chr(10).chr(10);
	$StrBody .= "".chr(10).chr(10);
	$StrBody .= "".chr(10).chr(10);
	$StrBody .= "";

	$target=$OKEmail;
	$subject = $par_SiteName.' - '.$OKNome;
	mail($target, $subject, $StrBody, 'From: '.$par_WebmasterEmail); 

// Inizio query per inserire il messaggio di benvenuto 

$MySql1 = "INSERT INTO `Messaggi` (`ID` , `Mittente` , `Destinatario` , `Spedito` , `Letto` , `Testo` )  ";
$MySql1 .= "VALUES (";
$MySql1 .= "''";
$MySql1 .= ", '$par_ModeratorsName'";
$MySql1 .= ", '$OKNome'";
$MySql1 .= ", NOW()";
$MySql1 .= ", '0'";
$MySql1 .= ", 'Lieta permanenza gentile visitatore.}'";
$MySql1 .= ")";

	$Result1 = mysql_query($MySql1);
// Fine 

include ("variabile3.php");    
?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
      <tr>
        <td><div align="center"><?= $OKNome ?><br><?= $OKEmail ?><br>
            <? if ($errore != "") { ?>
            <?= $errore ?>
            <? } else { ?><br>
Registrazione conclusa.
          </div></td></tr>
</table>
<? }
$Errore = ""; ?>
</center></div>
</body>
</html>

Funziona a gonfie vele con php4, ma con php5 rilascia sempre il "Crash del Sistema, hai compilato il modulo precedente in maniera errata.". Questo anche qualora il modulo venga compilato in maniera corretta.

Qualcuno può aiutarmi? Ringrazio in anticipo.

Edit:
Visto e considerato che il problema può riguardare anche la pagina precedente, inserisco anch'essa:

Codice:
<? session_start();
include ('variabile.php');
include ('variabile2.php');
include ("variabile3.php");
$totale = $forza + $destrezza + $costituzione + $intelligenza + $saggezza + $carisma + $tempra + $volonta; 
if ($totale == "70") {
} else {
echo '<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Comunità</title>
<style type="text/css">
<!--
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.Stile2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>
<body><div align="center"><br><br>Il punteggio totale derivante dalla somma delle Statistiche deve essere precisamente 70.<br><br></div>
</body>
</html>';
exit;
}
?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
      <tr>
        <td><div align="center"><span class="style6">
        <?
include("variabile3.php");

function NomeCorretto($car) {
	$TempBool = False;
	$TempBool = ($TempBool || (ord($car) >= ord("A") && ord($car) <= ord("Z")));
	$TempBool = ($TempBool || (ord($car) >= ord("À") && ord($car) <= ord("Â")));
	$TempBool = ($TempBool || (ord($car) >= ord("È") && ord($car) <= ord("Ê")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ì") && ord($car) <= ord("Î")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ò") && ord($car) <= ord("Ô")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ù") && ord($car) <= ord("Û")));
	return($TempBool);
}

$errore = "";
#$Nome = trim(strtoupper($Nome));
for ($i = 0; $i < strlen($Nome); $i++) {
    $c = substr(strtoupper($Nome), $i, 1);
    if (!(NomeCorretto($c))) {
        $errore .= "Carattere non ammesso: &quot;".htmlspecialchars($c)."&quot;<br>";
    }
}

$MySql = "Select Nome FROM Personaggio WHERE Nome = '".pars($Nome)."'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Il Nome ".htmlspecialchars($Nome)." esiste.<br>";};
$rs->close;

If ($razza == "") {$errore .= "Provenienza assente.<br>";};

If ($sesso == "") {$errore .= "Sesso assente.<br>";};

If (($email == "") || ($email == "[email protected]")) {$errore .= "Email assente.<br>";};

if (strpos($email, "@") === false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, ".") === false) { 
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, " ") !== false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, "@") > strrpos($email, ".")-2) {
    $errore .= "Email non corretta.<br>";
}

$MySql = "Select Nome FROM Personaggio WHERE email = '$email'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Email esistente in archivio.<br>";};
$rs->close;

if ($errore != "") {
	$RegNome = trim($Nome);
	$RegEmail = trim($email);
	$RegRazza = trim($razza);
	$RegSesso = trim($sesso);

	echo $errore;
	echo "<br>";
	#header("Location: registrazione1.php", false);
	exit();
}

$OKNome = trim($Nome);
$OKEmail = trim($email);
$OKRazza = trim($razza);
$OKSesso = trim($sesso);

 ?>
        </span>
            Nome:
            <?= htmlspecialchars($OKNome) ?>
            <br>
            Sesso:
                <? if ($OKSesso == "M") { ?>
                Maschio
                <? } else { ?>
                Femmina
                <? } ?>
                <br>
                Email:
          <?= htmlspecialchars($OKEmail) ?>
          <br>
                Provenienza:
                <?
    $MySql = "SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0 AND IDRazza = '".$OKRazza."'";
    $Result = mysql_query($MySql);
    $rs = mysql_fetch_array($Result);
    if ($rs) { ?>
                <?= htmlspecialchars($rs["Razza"]) ?>
<br>
Forza:
<?= htmlspecialchars($forza) ?>
<br>
Destrezza:
<?= htmlspecialchars($destrezza) ?>
<br>
Costituzione:
<?= htmlspecialchars($costituzione) ?>
<br>
Intelligenza:
<?= htmlspecialchars($intelligenza) ?>
<br>
Saggezza:
<?= htmlspecialchars($saggezza) ?>
<br>
Carisma:
<?= htmlspecialchars($carisma) ?>
<br>
Tempra:
<?= htmlspecialchars($tempra) ?>
<br>
Volontà:
<?= htmlspecialchars($volonta) ?>
                <?  } else {
        $errore .= "<b>Crash Del Sistema.</b>";
        $OKRazza = "";
        echo $errore."<br>";
        echo "<br>";
    }
    $rs->close;
    ?>
        </div>
          <div align="center"><br>
        Ok?</div></td></tr><form action="registrazione3.php" target="indexbisinterno" method="POST" id=form1 name=form1>
<tr><td height="100"><div align="center"><br>
      <input name="forza" type="hidden" id="forza" value="<?= htmlspecialchars($forza) ?>">
      <input name="destrezza" type="hidden" id="destrezza" value="<?= htmlspecialchars($destrezza) ?>">
      <input name="costituzione" type="hidden" id="costituzione" value="<?= htmlspecialchars($costituzione) ?>">
      <input name="intelligenza" type="hidden" id="intelligenza" value="<?= htmlspecialchars($intelligenza) ?>">
      <input name="saggezza" type="hidden" id="saggezza" value="<?= htmlspecialchars($saggezza) ?>">
      <input name="carisma" type="hidden" id="carisma" value="<?= htmlspecialchars($carisma) ?>">
      <input name="tempra" type="hidden" id="tempra" value="<?= htmlspecialchars($tempra) ?>">
      <input name="volonta" type="hidden" id="volonta" value="<?= htmlspecialchars($volonta) ?>">
<INPUT TYPE="Submit" Style="font-weight:bold;font-family:Verdana;font-size:8pt" VALUE="Procedi" id=Submit2 name=Submit2>
</div></td></tr></form>
</table>
</div>
</body>
</html>
 
Ultima modifica:

Levian

Utente Attivo
30 Set 2008
51
0
0
Ti ringrazio, in tutta franchezza non ne ero al corrente. Applico le dovute modifiche al codice e faccio una prova, poi farò sapere com'è andata.
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
Ricordati anche di sostituire:
PHP:
<?
con
PHP:
<?php
inoltre evita di utilizzare costrutti tipo:
PHP:
<?= htmlspecialchars($tempra) ?>
è più corretto:
PHP:
<?php echo htmlspecialchars($tempra); ?>
 

Levian

Utente Attivo
30 Set 2008
51
0
0
Ho effettuato le modifiche, ma il risultato non è cambiato.

Registrazione 1

Codice:
<?php session_start();
include('variabile1.php');
include('variabile2.php');
include('variabile3.php');
include ("variabile4.php");
 ?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
<form action="registrazione2.php" target="indexbisinterno" method="POST" id=form1 name=form1><tr>
          <td>
            <div align="center"><br><br><br>Nome:
              <?php if ($_SESSION['RegNome'] == "") {$_SESSION['RegNome'] = "";} ?>
              <input size=10 maxlenght=20 name="Nome" Value="<?php echo htmlspecialchars($_SESSION['RegNome']); ?>"> 
              Sesso:
                  <select name="sesso">
                      <option value="M" selected>Maschio</option>
                      <option value="F">Femmina</option>
                  </select>
                </div></td></tr><tr><td>
                  <table border="0" align="center">
                      <tr>
                        <td>Email:
                    <?php if ($_SESSION['RegEmail'] == "") {$_SESSION['RegEmail'] = "";} ?>
                    <input size=10 maxlenght=50 name="email" Value="<?php echo htmlspecialchars($_SESSION['RegEmail']); ?>"></td>
                        <td> Provenienza:
                                     
                          <select name="razza"><?php
    $MySql = $MySql = 'SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0';
	$Result = mysql_query($MySql);
	
    while ($rs = mysql_fetch_array($Result)) { ?>
    <option value="<?php echo $rs["IDRazza"]; ?>" selected><?php echo htmlspecialchars($rs["Razza"]); ?></option><?php  }
    $rs->close;
    ?>
    </select>

                    </td>
                      </tr>
                  </table>
                    </td></tr><tr><td>
                      <div align="center">Statistiche [70 Punti Distribuibili]:<br>
                        <br>
                      Forza: 
                        <select name="forza">
                      <option id="forza" value=1>1</option>
                      <option value=2>2</option>
                  </select>                                       Destrezza: 
                                       <select name="destrezza">
                      <option id="destrezza" value=1>1</option>
                      <option value=2>2</option>
                  </select>
                                       Costituzione: 
                                       <select name="costituzione">
                      <option id="costituzione" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Intelligenza 
                                       <select name="intelligenza">
                      <option id="intelligenza" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       <br>
                                       Saggezza: 
                                       <select name="saggezza">
                      <option id="saggezza" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Carisma: 
                                       <select name="carisma">
                      <option id="carisma" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Tempra: 
                                       <select name="tempra">
                      <option id="tempra" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Volontà:
                                       <select name="volonta">
                      <option id="volonta" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                        <br><br>
                        Siete pregati, come richiesto nelle pagine precedenti, di consultare attentamente la Guida<br>
                        nell'assegnazione dei punteggi. Qualsiasi Malus di Statistica che deciderete<br>
                        in modo autonomo di imporvi non sarà sistemato, in quanto &egrave; da considerarsi una scelta<br>
                        presa esclusivamente di vostra iniziativa. Fate quindi attenzione alle Statistiche, i valori<br>
                        che vedete impostati sono quelli minimi predefiniti.</div>
                      </td></tr><tr>
<td height="100"><div align="center">
            <INPUT TYPE="Submit" Style="font-weight:bold;font-family:Verdana;font-size:8pt" VALUE="Procedi" id=Submit2 name=Submit2>
          </div></td></form> 
</table>
</div>
</body>
</html>
 

Levian

Utente Attivo
30 Set 2008
51
0
0
Registrazione 2

Codice:
<?php session_start();
include ('variabile1.php');
include ('variabile2.php');
include ("variabile3.php");
$totale = $forza + $destrezza + $costituzione + $intelligenza + $saggezza + $carisma + $tempra + $volonta; 
if ($totale == "70") {
} else {
echo '<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Comunità</title>
<style type="text/css">
<!--
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.Stile2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>
<body><div align="center"><br><br>Il punteggio totale derivante dalla somma delle Statistiche deve essere precisamente 70.<br><br></div>
</body>
</html>';
exit;
}
?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
      <tr>
        <td><div align="center"><span class="style6">
        <?php
include("variabile4.php");

function NomeCorretto($car) {
	$TempBool = False;
	$TempBool = ($TempBool || (ord($car) >= ord("A") && ord($car) <= ord("Z")));
	$TempBool = ($TempBool || (ord($car) >= ord("À") && ord($car) <= ord("Â")));
	$TempBool = ($TempBool || (ord($car) >= ord("È") && ord($car) <= ord("Ê")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ì") && ord($car) <= ord("Î")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ò") && ord($car) <= ord("Ô")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ù") && ord($car) <= ord("Û")));
	return($TempBool);
}

$errore = "";
#$Nome = trim(strtoupper($Nome));
for ($i = 0; $i < strlen($Nome); $i++) {
    $c = substr(strtoupper($Nome), $i, 1);
    if (!(NomeCorretto($c))) {
        $errore .= "Carattere non ammesso: &quot;".htmlspecialchars($c)."&quot;<br>";
    }
}

$MySql = "Select Nome FROM Personaggio WHERE Nome = '".pars($Nome)."'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Il Nome ".htmlspecialchars($Nome)." esiste.<br>";};
$rs->close;

If ($razza == "") {$errore .= "Provenienza assente.<br>";};

If ($sesso == "") {$errore .= "Sesso assente.<br>";};

If (($email == "") || ($email == "[email protected]")) {$errore .= "Email assente.<br>";};

if (strpos($email, "@") === false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, ".") === false) { 
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, " ") !== false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, "@") > strrpos($email, ".")-2) {
    $errore .= "Email non corretta.<br>";
}

$MySql = "Select Nome FROM Personaggio WHERE email = '$email'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Email esistente in archivio.<br>";};
$rs->close;

if ($errore != "") {
	$RegNome = trim($Nome);
	$RegEmail = trim($email);
	$RegRazza = trim($razza);
	$RegSesso = trim($sesso);

	echo $errore;
	echo "<br>";
	#header("Location: registrazione1.php", false);
	exit();
}

$OKNome = trim($Nome);
$OKEmail = trim($email);
$OKRazza = trim($razza);
$OKSesso = trim($sesso);

 ?>
        </span>
            Nome:
            <?php echo htmlspecialchars($OKNome); ?>
            <br>
            Sesso:
                <?php if ($OKSesso == "M") { ?>
                Maschio
                <?php } else { ?>
                Femmina
                <?php } ?>
                <br>
                Email:
          <?php echo htmlspecialchars($OKEmail); ?>
          <br>
                Provenienza:
                <?php
    $MySql = "SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0 AND IDRazza = '".$OKRazza."'";
    $Result = mysql_query($MySql);
    $rs = mysql_fetch_array($Result);
    if ($rs) { ?>
                <?php echo htmlspecialchars($rs["Razza"]); ?>
<br>
Forza:
<?php echo htmlspecialchars($forza); ?>
<br>
Destrezza:
<?php echo htmlspecialchars($destrezza); ?>
<br>
Costituzione:
<?php echo htmlspecialchars($costituzione); ?>
<br>
Intelligenza:
<?php echo htmlspecialchars($intelligenza); ?>
<br>
Saggezza:
<?php echo htmlspecialchars($saggezza); ?>
<br>
Carisma:
<?php echo htmlspecialchars($carisma); ?>
<br>
Tempra:
<?php echo htmlspecialchars($tempra); ?>
<br>
Volontà:
<?php echo htmlspecialchars($volonta); ?>
                <?php  } else {
        $errore .= "<b>Crash Del Sistema.</b>";
        $OKRazza = "";
        echo $errore."<br>";
        echo "<br>";
    }
    $rs->close;
    ?>
        </div>
          <div align="center"><br>
        Ok?</div></td></tr><form action="registrazione3.php" target="indexbisinterno" method="POST" id=form1 name=form1>
<tr><td height="100"><div align="center"><br>
      <input name="forza" type="hidden" id="forza" value="<?= htmlspecialchars($forza) ?>">
      <input name="destrezza" type="hidden" id="destrezza" value="<?= htmlspecialchars($destrezza) ?>">
      <input name="costituzione" type="hidden" id="costituzione" value="<?= htmlspecialchars($costituzione) ?>">
      <input name="intelligenza" type="hidden" id="intelligenza" value="<?= htmlspecialchars($intelligenza) ?>">
      <input name="saggezza" type="hidden" id="saggezza" value="<?= htmlspecialchars($saggezza) ?>">
      <input name="carisma" type="hidden" id="carisma" value="<?= htmlspecialchars($carisma) ?>">
      <input name="tempra" type="hidden" id="tempra" value="<?= htmlspecialchars($tempra) ?>">
      <input name="volonta" type="hidden" id="volonta" value="<?= htmlspecialchars($volonta) ?>">
<INPUT TYPE="Submit" Style="font-weight:bold;font-family:Verdana;font-size:8pt" VALUE="Procedi" id=Submit2 name=Submit2>
</div></td></tr></form>
</table>
</div>
</body>
</html>
 

Levian

Utente Attivo
30 Set 2008
51
0
0
Registrazione 3

Codice:
<?php session_start();
include ("variabile1.php");
include ("variabile2.php");
#echo "<font color=black>Crash Del Sistema.</font>";
if (($_SESSION['OKSesso'] == "")
	|| ($_SESSION['OKNome'] == "")
	|| ($_SESSION['OKRazza'] == "")
	|| ($_SESSION['OKEmail'] == "")) {
    $_SESSION['errore'] = "<html><head>
<title>Comunità</title>
<style type='text/css'>
<!--
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.Stile2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>

<body><div align='center'><br><br><br><br><br><br><b>Crash del Sistema, hai compilato il modulo precedente in maniera errata.</b>";
    #header("Location: registrazione1.php", false);
    echo $_SESSION['errore']."<br>";
    exit();
}

include("variabile3.php");

$MySql = "Select Nome FROM Personaggio WHERE Nome = '$OKNome' or Email = 'OKEmail'";
$Result = mysql_query($MySql);

if ($rs = mysql_fetch_array($Result)) {$_SESSION['errore'] .= "Il nome ".htmlspecialchars($OKNome)." o l'email esistono.<br>";};
$rs->close;

if ($_SESSION['errore'] != "") { 
	$RegNome = $_SESSION['OKNome'];
    $RegEmail = $_SESSION['OKEmail'];
    $RegRazza = $_SESSION['OKRazza'];
    $RegSesso = $_SESSION['OKSesso'];
    echo $_SESSION['errore'];
#header("Location: registrazione1.php", false);
exit();
}

function Lettera() {
	mt_srand((double)microtime()*1000000);
    return(chr(mt_rand(0, 24) + ord("A")));
}

$pass = Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();

$MySql = "SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0 AND IDRazza = '".$OKRazza."'";
$Result = mysql_query($MySql);
if (!$rs = mysql_fetch_array($Result)) {
	echo "<b>Crash Del Sistema.";
	exit();
}
$Forza = $rs["Forza"];
$Destrezza = $rs["Destrezza"];
$Costituzione = $rs["Costituzione"];
$Intelligenza = $rs["Intelligenza"];
$Saggezza = $rs["Saggezza"];
$Carisma = $rs["Carisma"];
$Tempra = $rs["Tempra"];
$Volonta = $rs["Volonta"];
$rs->close;

$MySql = "INSERT INTO Personaggio (Nome, Pass, DataIscrizione, Forza, Destrezza, Costituzione, Intelligenza, Saggezza, Carisma, Tempra, Volonta, IDRazza, Sesso, Email, URLImg, Banca, DataUltimaGilda) ";
$MySql .= "VALUES (";
$MySql .= "'$OKNome'";
$MySql .= ", '$pass'";
$MySql .= ", NOW()";
$MySql .= ", '$forza'";
$MySql .= ", '$destrezza'";
$MySql .= ", '$costituzione'";
$MySql .= ", '$intelligenza'";
$MySql .= ", '$saggezza'";
$MySql .= ", '$carisma'";
$MySql .= ", '$tempra'";
$MySql .= ", '$volonta'";
$MySql .= ", '$OKRazza'";
$MySql .= ", '".strtolower($OKSesso)."'";
$MySql .= ", '".$OKEmail."'";
$MySql .= ", '_altervista_ht/trasparente.gif'";
$MySql .= ", '0'";
$MySql .= ", NOW()";
$MySql .= ")";

	$Result = mysql_query($MySql);

	$StrBody = "Nome: ".$OKNome.chr(10);
	$StrBody .= "Pass: $pass".chr(10).chr(10);
	$StrBody .= "".chr(10).chr(10);
	$StrBody .= "".chr(10).chr(10);
	$StrBody .= "";

	$target=$OKEmail;
	$subject = $par_SiteName.' - '.$OKNome;
	mail($target, $subject, $StrBody, 'From: '.$par_WebmasterEmail); 

// Inizio query per inserire il messaggio di benvenuto 

$MySql1 = "INSERT INTO `Messaggi` (`ID` , `Mittente` , `Destinatario` , `Spedito` , `Letto` , `Testo` )  ";
$MySql1 .= "VALUES (";
$MySql1 .= "''";
$MySql1 .= ", '$par_ModeratorsName'";
$MySql1 .= ", '$OKNome'";
$MySql1 .= ", NOW()";
$MySql1 .= ", '0'";
$MySql1 .= ", 'Lieta permanenza gentile visitatore.}'";
$MySql1 .= ")";

	$Result1 = mysql_query($MySql1);
// Fine 

include ("inc/dati.php");    
?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
      <tr>
        <td><div align="center"><?= $OKNome ?><br><?= $OKEmail ?><br>
            <?php if ($errore != "") { ?>
            <?= $errore ?>
            <?php } else { ?><br>
Registrazione conclusa.
          </div></td></tr>
</table>
<?php }
$Errore = ""; ?>
</center></div>
</body>
</html>

Altre idee?
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
non so cosa ci sia in quei file variabile1.php etc., ma la differenza di funzionamento credo funzioni dalle register globals che su php 5 sono in off di default, controlla nel php.in della tua installazione di php 5 e controlla se il valore della direttiva register_globals è in on o in off
 

Levian

Utente Attivo
30 Set 2008
51
0
0
Nelle variabili non c'è nulla che riguardi direttamente la fase di registrazione.

Il valore della direttiva register_globals è in off.
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
allora il problema dovrebbe stare li (per modo di dire visto che la configurazione ottimale è proprio in off); in pratica non dovrebbe essere:
PHP:
$totale = $forza + $destrezza + $costituzione + $intelligenza + $saggezza + $carisma + $tempra + $volonta;
ma:
PHP:
$totale = $_POST['forza'] + $_POST['destrezza'] + $_POST['costituzione'] +...;
 

Levian

Utente Attivo
30 Set 2008
51
0
0
Fatto, ma ancora una volta il risultato è il medesimo, non me lo so spiegare. In PHP4, ricordo, funziona correttamente sia con le attuali modifiche che con il codice inizialmente esposto.

Codice:
<?php session_start();
include ('variabile1.php');
include ('variabile2.php');
include ("variabile3.php");
$totale = $_POST['forza'] + $_POST['destrezza'] + $_POST['costituzione'] + $_POST['intelligenza'] + $_POST['saggezza'] + $_POST['carisma'] + $_POST['tempra'] + $_POST['volonta'];
if ($totale == "70") {
} else {
echo '<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Comunità</title>
<style type="text/css">
<!--
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.Stile2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>
<body><div align="center"><br><br>Il punteggio totale derivante dalla somma delle Statistiche deve essere precisamente 70.<br><br></div>
</body>
</html>';
exit;
}
?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
      <tr>
        <td><div align="center"><span class="style6">
        <?php
include("variabile4.php");

function NomeCorretto($car) {
	$TempBool = False;
	$TempBool = ($TempBool || (ord($car) >= ord("A") && ord($car) <= ord("Z")));
	$TempBool = ($TempBool || (ord($car) >= ord("À") && ord($car) <= ord("Â")));
	$TempBool = ($TempBool || (ord($car) >= ord("È") && ord($car) <= ord("Ê")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ì") && ord($car) <= ord("Î")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ò") && ord($car) <= ord("Ô")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ù") && ord($car) <= ord("Û")));
	return($TempBool);
}

$errore = "";
#$Nome = trim(strtoupper($Nome));
for ($i = 0; $i < strlen($Nome); $i++) {
    $c = substr(strtoupper($Nome), $i, 1);
    if (!(NomeCorretto($c))) {
        $errore .= "Carattere non ammesso: &quot;".htmlspecialchars($c)."&quot;<br>";
    }
}

$MySql = "Select Nome FROM Personaggio WHERE Nome = '".pars($Nome)."'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Il Nome ".htmlspecialchars($Nome)." esiste.<br>";};
$rs->close;

If ($razza == "") {$errore .= "Provenienza assente.<br>";};

If ($sesso == "") {$errore .= "Sesso assente.<br>";};

If (($email == "") || ($email == "[email protected]")) {$errore .= "Email assente.<br>";};

if (strpos($email, "@") === false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, ".") === false) { 
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, " ") !== false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, "@") > strrpos($email, ".")-2) {
    $errore .= "Email non corretta.<br>";
}

$MySql = "Select Nome FROM Personaggio WHERE email = '$email'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Email esistente in archivio.<br>";};
$rs->close;

if ($errore != "") {
	$RegNome = trim($Nome);
	$RegEmail = trim($email);
	$RegRazza = trim($razza);
	$RegSesso = trim($sesso);

	echo $errore;
	echo "<br>";
	#header("Location: registrazione1.php", false);
	exit();
}

$OKNome = trim($Nome);
$OKEmail = trim($email);
$OKRazza = trim($razza);
$OKSesso = trim($sesso);

 ?>
        </span>
            Nome:
            <?php echo htmlspecialchars($OKNome); ?>
            <br>
            Sesso:
                <?php if ($OKSesso == "M") { ?>
                Maschio
                <?php } else { ?>
                Femmina
                <?php } ?>
                <br>
                Email:
          <?php echo htmlspecialchars($OKEmail); ?>
          <br>
                Provenienza:
                <?php
    $MySql = "SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0 AND IDRazza = '".$OKRazza."'";
    $Result = mysql_query($MySql);
    $rs = mysql_fetch_array($Result);
    if ($rs) { ?>
                <?php echo htmlspecialchars($rs["Razza"]); ?>
<br>
Forza:
<?php echo htmlspecialchars($forza); ?>
<br>
Destrezza:
<?php echo htmlspecialchars($destrezza); ?>
<br>
Costituzione:
<?php echo htmlspecialchars($costituzione); ?>
<br>
Intelligenza:
<?php echo htmlspecialchars($intelligenza); ?>
<br>
Saggezza:
<?php echo htmlspecialchars($saggezza); ?>
<br>
Carisma:
<?php echo htmlspecialchars($carisma); ?>
<br>
Tempra:
<?php echo htmlspecialchars($tempra); ?>
<br>
Volontà:
<?php echo htmlspecialchars($volonta); ?>
                <?php  } else {
        $errore .= "<b>Crash Del Sistema.</b>";
        $OKRazza = "";
        echo $errore."<br>";
        echo "<br>";
    }
    $rs->close;
    ?>
        </div>
          <div align="center"><br>
        Ok?</div></td></tr><form action="registrazione3.php" target="indexbisinterno" method="POST" id=form1 name=form1>
<tr><td height="100"><div align="center"><br>
      <input name="forza" type="hidden" id="forza" value="<?= htmlspecialchars($forza) ?>">
      <input name="destrezza" type="hidden" id="destrezza" value="<?= htmlspecialchars($destrezza) ?>">
      <input name="costituzione" type="hidden" id="costituzione" value="<?= htmlspecialchars($costituzione) ?>">
      <input name="intelligenza" type="hidden" id="intelligenza" value="<?= htmlspecialchars($intelligenza) ?>">
      <input name="saggezza" type="hidden" id="saggezza" value="<?= htmlspecialchars($saggezza) ?>">
      <input name="carisma" type="hidden" id="carisma" value="<?= htmlspecialchars($carisma) ?>">
      <input name="tempra" type="hidden" id="tempra" value="<?= htmlspecialchars($tempra) ?>">
      <input name="volonta" type="hidden" id="volonta" value="<?= htmlspecialchars($volonta) ?>">
<INPUT TYPE="Submit" Style="font-weight:bold;font-family:Verdana;font-size:8pt" VALUE="Procedi" id=Submit2 name=Submit2>
</div></td></tr></form>
</table>
</div>
</body>
</html>
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
le variabili le devi modificare in tutto il codice, per esempio
PHP:
<?php echo htmlspecialchars($forza); ?>
con
PHP:
<?php echo htmlspecialchars($_POST['forza']); ?>
 

Levian

Utente Attivo
30 Set 2008
51
0
0
Applicate le modifiche, ma (e mi spiace continuare ad annunciarlo) la situazione non è mutata. Edit: O meglio, ora invece del precedente problema mi rilascia costantemente come risultato il "Provenienza Assente", devo aver dimenticato qualcosa (o messo qualcosa di troppo) da qualche parte, riguardo alla variabile 'Razza'. Devo dire che sono piuttosto scoraggiato. Ringrazio sinceramente chi mi sta dando una mano per capire cosa sia.

Registrazione 1

Codice:
<?php session_start();
include('variabile1.php');
include('variabile2.php');
include('variabile3.php');
include ("variabile4.php");
 ?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
<form action="registrazione2.php" target="indexbisinterno" method="POST" id=form1 name=form1><tr>
          <td>
            <div align="center"><br><br><br>Nome:
              <?php if ($_SESSION['RegNome'] == "") {$_SESSION['RegNome'] = "";} ?>
              <input size=10 maxlenght=20 name="Nome" Value="<?php echo htmlspecialchars($_SESSION['RegNome']); ?>"> 
              Sesso:
                  <select name="sesso">
                      <option value="M" selected>Maschio</option>
                      <option value="F">Femmina</option>
                  </select>
                </div></td></tr><tr><td>
                  <table border="0" align="center">
                      <tr>
                        <td>Email:
                    <?php if ($_SESSION['RegEmail'] == "") {$_SESSION['RegEmail'] = "";} ?>
                    <input size=10 maxlenght=50 name="email" Value="<?php echo htmlspecialchars($_SESSION['RegEmail']); ?>"></td>
                        <td> Provenienza:
                                     
                          <select name="razza"><?php
    $MySql = $MySql = 'SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0';
	$Result = mysql_query($MySql);
	
    while ($rs = mysql_fetch_array($Result)) { ?>
    <option value="<?php echo $rs["IDRazza"]; ?>" selected><?php echo htmlspecialchars($rs["Razza"]); ?></option><?php  }
    $rs->close;
    ?>
    </select>

                    </td>
                      </tr>
                  </table>
                    </td></tr><tr><td>
                      <div align="center">Statistiche [70 Punti Distribuibili]:<br>
                        <br>
                      Forza: 
                        <select name="forza">
                      <option id="forza" value=1>1</option>
                      <option value=2>2</option>
                  </select>                                       Destrezza: 
                                       <select name="destrezza">
                      <option id="destrezza" value=1>1</option>
                      <option value=2>2</option>
                  </select>
                                       Costituzione: 
                                       <select name="costituzione">
                      <option id="costituzione" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Intelligenza 
                                       <select name="intelligenza">
                      <option id="intelligenza" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       <br>
                                       Saggezza: 
                                       <select name="saggezza">
                      <option id="saggezza" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Carisma: 
                                       <select name="carisma">
                      <option id="carisma" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Tempra: 
                                       <select name="tempra">
                      <option id="tempra" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                                       Volontà:
                                       <select name="volonta">
                      <option id="volonta" value=1 selected>1</option>
                      <option value=2>2</option>
                  </select>
                        <br><br>
                        Siete pregati, come richiesto nelle pagine precedenti, di consultare attentamente la Guida<br>
                        nell'assegnazione dei punteggi. Qualsiasi Malus di Statistica che deciderete<br>
                        in modo autonomo di imporvi non sarà sistemato, in quanto &egrave; da considerarsi una scelta<br>
                        presa esclusivamente di vostra iniziativa. Fate quindi attenzione alle Statistiche, i valori<br>
                        che vedete impostati sono quelli minimi predefiniti.</div>
                      </td></tr><tr>
<td height="100"><div align="center">
            <INPUT TYPE="Submit" Style="font-weight:bold;font-family:Verdana;font-size:8pt" VALUE="Procedi" id=Submit2 name=Submit2>
          </div></td></form> 
</table>
</div>
</body>
</html>
 
Ultima modifica:

Levian

Utente Attivo
30 Set 2008
51
0
0
Registrazione 2

Codice:
<?php session_start();
include ('variabile1.php');
include ('variabile2.php');
include ("variabile3.php");
$totale = $_POST['forza'] + $_POST['destrezza'] + $_POST['costituzione'] + $_POST['intelligenza'] + $_POST['saggezza'] + $_POST['carisma'] + $_POST['tempra'] + $_POST['volonta'];
if ($totale == "70") {
} else {
echo '<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Comunità</title>
<style type="text/css">
<!--
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.Stile2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>
<body><div align="center"><br><br>Il punteggio totale derivante dalla somma delle Statistiche deve essere precisamente 70.<br><br></div>
</body>
</html>';
exit;
}
?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
      <tr>
        <td><div align="center"><span class="style6">
        <?php
include("variabile4.php");

function NomeCorretto($car) {
	$TempBool = False;
	$TempBool = ($TempBool || (ord($car) >= ord("A") && ord($car) <= ord("Z")));
	$TempBool = ($TempBool || (ord($car) >= ord("À") && ord($car) <= ord("Â")));
	$TempBool = ($TempBool || (ord($car) >= ord("È") && ord($car) <= ord("Ê")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ì") && ord($car) <= ord("Î")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ò") && ord($car) <= ord("Ô")));
	$TempBool = ($TempBool || (ord($car) >= ord("Ù") && ord($car) <= ord("Û")));
	return($TempBool);
}

$errore = "";
#$Nome = trim(strtoupper($Nome));
for ($i = 0; $i < strlen($Nome); $i++) {
    $c = substr(strtoupper($Nome), $i, 1);
    if (!(NomeCorretto($c))) {
        $errore .= "Carattere non ammesso: &quot;".htmlspecialchars($_POST['c'])."&quot;<br>";
    }
}

$MySql = "Select Nome FROM Personaggio WHERE Nome = '".pars($Nome)."'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Il Nome ".htmlspecialchars($_POST['Nome'])." esiste.<br>";};
$rs->close;

If ($razza == "") {$errore .= "Provenienza assente.<br>";};

If ($sesso == "") {$errore .= "Sesso assente.<br>";};

If (($email == "") || ($email == "[email protected]")) {$errore .= "Email assente.<br>";};

if (strpos($email, "@") === false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, ".") === false) { 
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, " ") !== false) {
    $errore .= "Email non corretta.<br>";
} elseif (strpos($email, "@") > strrpos($email, ".")-2) {
    $errore .= "Email non corretta.<br>";
}

$MySql = "Select Nome FROM Personaggio WHERE email = '$email'";
$Result = mysql_query($MySql);
$rs = mysql_fetch_array($Result);
if ($rs) {$errore .= "Email esistente in archivio.<br>";};
$rs->close;

if ($errore != "") {
	$RegNome = trim($_POST['Nome']);
	$RegEmail = trim($_POST['email']);
	$RegRazza = trim($_POST['razza']);
	$RegSesso = trim($_POST['sesso']);

	echo $errore;
	echo "<br>";
	#header("Location: registrazione1.php", false);
	exit();
}

$OKNome = trim($_POST['Nome']);
$OKEmail = trim($_POST['email']);
$OKRazza = trim($_POST['razza']);
$OKSesso = trim($_POST['sesso']);

 ?>
        </span>
            Nome:
            <?php echo htmlspecialchars($_POST['OKNome']); ?>
            <br>
            Sesso:
                <?php if ($OKSesso == "M") { ?>
                Maschio
                <?php } else { ?>
                Femmina
                <?php } ?>
                <br>
                Email:
          <?php echo htmlspecialchars($_POST['OKEmail']); ?>
          <br>
                Provenienza:
                <?php
    $MySql = "SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0 AND IDRazza = '".htmlspecialchars($_POST['OKRazza'])."'";
    $Result = mysql_query($MySql);
    $rs = mysql_fetch_array($Result);
    if ($rs) { ?>
                <?php echo htmlspecialchars($_POST["Razza"]); ?>
<br>
Forza:
<?php echo htmlspecialchars($_POST['forza']); ?>
<br>
Destrezza:
<?php echo htmlspecialchars($_POST['destrezza']); ?>
<br>
Costituzione:
<?php echo htmlspecialchars($_POST['costituzione']); ?>
<br>
Intelligenza:
<?php echo htmlspecialchars($_POST['intelligenza']); ?>
<br>
Saggezza:
<?php echo htmlspecialchars($_POST['saggezza']); ?>
<br>
Carisma:
<?php echo htmlspecialchars($_POST['carisma']); ?>
<br>
Tempra:
<?php echo htmlspecialchars($_POST['tempra']); ?>
<br>
Volontà:
<?php echo htmlspecialchars($_POST['volonta']); ?>
                <?php  } else {
        $errore .= "<b>Crash Del Sistema.</b>";
        $OKRazza = "";
        echo $errore."<br>";
        echo "<br>";
    }
    $rs->close;
    ?>
        </div>
          <div align="center"><br>
        Ok?</div></td></tr><form action="registrazione3.php" target="indexbisinterno" method="POST" id=form1 name=form1>
<tr><td height="100"><div align="center"><br>
      <input name="forza" type="hidden" id="forza" value="<?= htmlspecialchars($_POST['forza']); ?>">
      <input name="destrezza" type="hidden" id="destrezza" value="<?= htmlspecialchars($_POST['destrezza']); ?>">
      <input name="costituzione" type="hidden" id="costituzione" value="<?= htmlspecialchars($_POST['costituzione']); ?>">
      <input name="intelligenza" type="hidden" id="intelligenza" value="<?= htmlspecialchars($_POST['intelligenza']); ?>">
      <input name="saggezza" type="hidden" id="saggezza" value="<?= htmlspecialchars($_POST['saggezza']); ?>">
      <input name="carisma" type="hidden" id="carisma" value="<?= htmlspecialchars($_POST['carisma']); ?>">
      <input name="tempra" type="hidden" id="tempra" value="<?= htmlspecialchars($_POST['tempra']); ?>">
      <input name="volonta" type="hidden" id="volonta" value="<?= htmlspecialchars($_POST['volonta']); ?>">
<INPUT TYPE="Submit" Style="font-weight:bold;font-family:Verdana;font-size:8pt" VALUE="Procedi" id=Submit2 name=Submit2>
</div></td></tr></form>
</table>
</div>
</body>
</html>
 
Ultima modifica:

Levian

Utente Attivo
30 Set 2008
51
0
0
Registrazione 3

Codice:
<?php session_start();
include ("variabile1.php");
include ("variabile2.php");
#echo "<font color=black>Crash Del Sistema.</font>";
if (($_SESSION['OKSesso'] == "")
	|| ($_SESSION['OKNome'] == "")
	|| ($_SESSION['OKRazza'] == "")
	|| ($_SESSION['OKEmail'] == "")) {
    $_SESSION['errore'] = "<html><head>
<title>Comunità</title>
<style type='text/css'>
<!--
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
.Stile2 {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
-->
</style>
</head>

<body><div align='center'><br><br><br><br><br><br><b>Crash del Sistema, hai compilato il modulo precedente in maniera errata.</b>";
    #header("Location: registrazione1.php", false);
    echo $_SESSION['errore']."<br>";
    exit();
}

include("variabile3.php");

$MySql = "Select Nome FROM Personaggio WHERE Nome = '$OKNome' or Email = 'OKEmail'";
$Result = mysql_query($MySql);

if ($rs = mysql_fetch_array($Result)) {$_SESSION['errore'] .= "Il nome ".htmlspecialchars($_POST['OKNome'])." o l'email esistono.<br>";};
$rs->close;

if ($_SESSION['errore'] != "") { 
	$RegNome = $_SESSION['OKNome'];
    $RegEmail = $_SESSION['OKEmail'];
    $RegRazza = $_SESSION['OKRazza'];
    $RegSesso = $_SESSION['OKSesso'];
    echo $_SESSION['errore'];
#header("Location: registrazione1.php", false);
exit();
}

function Lettera() {
	mt_srand((double)microtime()*1000000);
    return(chr(mt_rand(0, 24) + ord("A")));
}

$pass = Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();
$pass .= Lettera();

$MySql = "SELECT * FROM Razza where Iscrizione = 1 AND (IDRazza % 1000) = 0 AND IDRazza = '".htmlspecialchars($_POST['OKRazza'])."'";
$Result = mysql_query($MySql);
if (!$rs = mysql_fetch_array($Result)) {
	echo "<b>Crash Del Sistema.";
	exit();
}
$Forza = $_POST['Forza'];
$Destrezza = $_POST['Destrezza'];
$Costituzione = $_POST['Costituzione'];
$Intelligenza = $_POST['Intelligenza'];
$Saggezza = $_POST['Saggezza'];
$Carisma = $_POST['Carisma'];
$Tempra = $_POST['Tempra'];
$Volonta = $_POST['Volonta'];
$rs->close;

$MySql = "INSERT INTO Personaggio (Nome, Pass, DataIscrizione, Forza, Destrezza, Costituzione, Intelligenza, Saggezza, Carisma, Tempra, Volonta, IDRazza, Sesso, Email, URLImg, Banca, DataUltimaGilda) ";
$MySql .= "VALUES (";
$MySql .= "'$OKNome'";
$MySql .= ", '$pass'";
$MySql .= ", NOW()";
$MySql .= ", '$forza'";
$MySql .= ", '$destrezza'";
$MySql .= ", '$costituzione'";
$MySql .= ", '$intelligenza'";
$MySql .= ", '$saggezza'";
$MySql .= ", '$carisma'";
$MySql .= ", '$tempra'";
$MySql .= ", '$volonta'";
$MySql .= ", '$OKRazza'";
$MySql .= ", '".strtolower($OKSesso)."'";
$MySql .= ", '".$OKEmail."'";
$MySql .= ", '_altervista_ht/trasparente.gif'";
$MySql .= ", '0'";
$MySql .= ", NOW()";
$MySql .= ")";

	$Result = mysql_query($MySql);

	$StrBody = "Nome: ".$OKNome.chr(10);
	$StrBody .= "Pass: $pass".chr(10).chr(10);
	$StrBody .= "".chr(10).chr(10);
	$StrBody .= "".chr(10).chr(10);
	$StrBody .= "";

	$target=$OKEmail;
	$subject = $par_SiteName.' - '.$OKNome;
	mail($target, $subject, $StrBody, 'From: '.$par_WebmasterEmail); 

// Inizio query per inserire il messaggio di benvenuto 

$MySql1 = "INSERT INTO `Messaggi` (`ID` , `Mittente` , `Destinatario` , `Spedito` , `Letto` , `Testo` )  ";
$MySql1 .= "VALUES (";
$MySql1 .= "''";
$MySql1 .= ", '$par_ModeratorsName'";
$MySql1 .= ", '$OKNome'";
$MySql1 .= ", NOW()";
$MySql1 .= ", '0'";
$MySql1 .= ", 'Lieta permanenza gentile visitatore.}'";
$MySql1 .= ")";

	$Result1 = mysql_query($MySql1);
// Fine 

include ("inc/dati.php");    
?>
<title>Comunità</title>
<style type="text/css">
<!--
.Stile7 {font-size: 9}
body,td,th {
	color: #000000;
	font-family: Verdana;
	font-size: 9px;
	font-weight: bold;
}
a:link {
	color: #000000;
	text-decoration: none;
}
a:visited {
	text-decoration: none;
	color: #000000;
}
a:hover {
	text-decoration: none;
	color: #000000;
}
a:active {
	text-decoration: none;
	color: #000000;
}
-->
</style>
</head>
<body>
<div style="position: absolute; width: 471px; height: 264px; z-index: 1; left: 97px; top: 68px">
<table align="center" border="0" height="340" width="530">
      <tr>
        <td><div align="center"><?= $OKNome ?><br><?= $OKEmail ?><br>
            <?php if ($errore != "") { ?>
            <?= $errore ?>
            <?php } else { ?><br>
Registrazione conclusa.
          </div></td></tr>
</table>
<?php }
$Errore = ""; ?>
</center></div>
</body>
</html>
 
Ultima modifica:

Levian

Utente Attivo
30 Set 2008
51
0
0
Altervista.
E' un problema? Fino ad oggi non aveva mai creato grane particolari, mi ci sono sempre trovato bene.
 

Eliox

Utente Attivo
25 Feb 2005
4.390
3
0
controlla che vengano inviati tutti i parametri richiesti dal form, ti basta un
PHP:
var_dump($_POST);
all'inizio della pagina che riceve i dati
 

alessandro1997

Utente Attivo
6 Ott 2009
5.302
1
0
26
Roma
alessandro1997.netsons.org
Come immaginavo. AlterVista causa parecchi problemi nel passaggio da PHP 4 a PHP5. Perché non provi a scrivere sul forum? Tra l'altro, sempre sotto lo stesso nickname, ci sono anche io lì! :D
I veterani sanno a memoria che cosa si può fare e cosa no con AlterVista in PHP5, quindi per loro non dovrebbe essere un problema risponderti.
 

Levian

Utente Attivo
30 Set 2008
51
0
0
controlla che vengano inviati tutti i parametri richiesti dal form, ti basta un
PHP:
var_dump($_POST);
all'inizio della pagina che riceve i dati

Al momento, dato il problema della "Provenienza Assente", non mi permette di arrivare alla pagina "Registrazione 3", pertanto ho inserito il var_dump su Registrazione 2, ed ecco il risultato:

array(13) { ["Nome"]=> string(4) "Test" ["sesso"]=> string(1) "M" ["email"]=> string(14) "[email protected]" ["razza"]=> string(0) "" ["forza"]=> string(1) "5" ["destrezza"]=> string(1) "5" ["costituzione"]=> string(1) "5" ["intelligenza"]=> string(1) "5" ["saggezza"]=> string(2) "30" ["carisma"]=> string(2) "10" ["tempra"]=> string(1) "5" ["volonta"]=> string(1) "5" ["Submit2"]=> string(7) "Procedi" }

Come pensavo ora ha problemi con la razza (["razza"]=> string(0) ""), devo aver dimenticato qualche $_POST per strada. Ma dove di preciso?
 
Discussioni simili
Autore Titolo Forum Risposte Data
G Registrazione utente su pagina asp Classic ASP 14
M pagina registrazione con mail contenente link di attivazione profilo PHP 1
M Pagina registrazione errore PHP 14
S Problema nella pagina di registrazione e login PHP 2
M Pagina di registrazione e login in php PHP 4
G pagina registrazione utente Classic ASP 5
M Pagina di Registrazione PHP 2
G Pagina html in stringa PHP 2
L Creare ancore interne alla pagina PHP 1
F Aiuto! cambio immagine di sfondo al cambio pagina HTML e CSS 2
Shyson Regex che trova la parola nella pagina jQuery 6
L Eliminazione di una pagina dalla gallery SEO e Posizionamento 0
D Apre il lightbox fuori pagina Javascript 0
K posizionare variabile da pagina html all'iframe. Javascript 1
R jquery che cambia css di un elemento non mi funziona sulla pagina caricata da ajax Ajax 5
U Link a pagina ed esecuzione file PHP 0
S Passare query o utm alla pagina successiva Domini 1
D [Cerco] Pagina Facebook settore calcio Annunci servizi di Social Media Marketing 0
napuleone div centrato alla pagina posto sopra ai contenuti HTML e CSS 1
G Eliminare l'effetto refresh di una pagina internet PHP 8
L Bing prima pagina prima riga; Google mi ignora SEO e Posizionamento 0
P Pagina modifica record che non funziona PHP 0
T Conferma reload pagina Javascript 4
A Submit senza ricaricare la pagina Ajax 2
L Problemi form Pagina php HTML e CSS 3
L php mysql cerca e visualizza pagina PHP 0
S Variabile in post su altra pagina PHP 2
D Visualizzazione pagina basata sul valore di un campo del database PHP 2
D Pagina non trovata Wordpress WordPress 7
E Pagina Cloudflare e captcha Domini 1
W Anomalia Pagina Facebook Social Media Marketing 9
A Aiuto per pagina php PHP 0
T Risolto Redirect a pagina esterna Javascript 2
M Questa pagina non carica correttamente Google Maps: aiuto!! HTML e CSS 1
T Offuscare link pagina web PHP 2
D Stampa a video in altra pagina html Database 3
Cosina script data aggiornamento pagina Javascript 1
Y cambiare sfondo di una pagina Javascript 1
Y Vorrei selezionare un colore di sfondo per una pagina web Javascript 0
S Apertura in una nuova pagina PHP 6
G creazione menu a tendina e invio a pagina php PHP 1
B Stampare una porzione della pagina PHP 0
D Pubblicità Instagram su pagina da 144 mila follower Vendere e Acquistare pubblicita' online 3
A Dare l'accesso ad una pagina solo ad un utente specifico PHP 0
F pagina dinamica PHP PHP 3
W Invio Dati ad un altra pagina Classic ASP 1
Samuele Ronzani Click e reload della pagina PHP 1
M Compilazione automatica campi in input stessa pagina PHP 0
C Statistiche pagina Facebook aziendale Social Media Marketing 2
L titolo del sito nella pagina di ricerca di google SEO e Posizionamento 2

Discussioni simili