Ho ancora qualche dubbio , prendete il codice che posto come un aprova che ho fatto per vedere se fungeva il tutto (sono in fase sperimentale).
codice della pagina registrazione.php
codice:
<body>
<?php include ("register.php"); ?>
<form action="cerebro\register.php" method="post">
<table id="registra" name="registra">
<thead>
<tr>
<td>
Registrati
</td>
</tr>
<thead>
<tr>
<td>NOME :</td>
<td><input name="nome" id="nome" type="text" value=""/></td>
</tr>
<tr>
<td>USER :</td>
<td><input name="user" id="user" type="text" value=""/></td>
</tr>
<tr>
<td>E-MAIL :</td>
<td><input name="mail" id="mail" type="text" value=""/></td>
</tr>
<tr>
<td>PASSWORD :</td>
<td><input name="password" id="password" type="password" value=""/></td> <?php ?>
</tr>
<tr>
<td>REPASSWORD :</td>
<td><input name="repassword" id="repassword" type="password" value=""/></td>
</tr>
<tr>
<td><input name="invio" id="invio" type="submit" value="INVIA INFO"/></td>
<td><input name="reset" id="reset" type="reset" value="RESET"/></td>
</tr>
</table>
</form>
</body>
Nella sezione in rosso vorrei mettere il primo controllo ossia una scritta che mi dice 'errore ...' se non ce l'errore non succdede nulla.
codice della pagina register.php
codice:
<?php
$name = $_POST['nome'];
$user = $_POST['user'];
$mail = $_POST['mail'];
$pass = $_POST['password'];
$repass = $_POST['repassword'];
session_start();
$_SESSION['pass1'] = $pass1;
$_SESSION['pass2'] = $repass2;
if (($pass != "") && ($repass != "")){
$lenpass = strlen($pass);
$lenrepass = strlen($repass);
if (($lenpass <= 7) || ($lenrepass <= 7)){
$errorepass ="la password deve essere maggiore o uguale di 8 caratteri \n" ;
}else{
$criptpass = sha1($pass);
$criptrepass = sha1($repass);
if ($criptpass === $criptrepass){
$errorepass ="password corrette";
}else{
$errorepass = "Le passwsord inserite non sono uguali\n";
}
}
}else{
$errorepass = "inserire il valore delle password" ;
}
header("location:http://testiamo/registrazione.php");
?>
Qui invece eseguo tutti i calcoli , prendo le 2 stringhe e le confronto , le trasformo , le cripto etc..
ora voi mi state dicendo ceh dovrei inserire quell'avviso di errorepass in un quary:string da inviare alla pagina registrazione.php, a me non sembra un bel modo, immagina se avessi 2001 caratteri da inviare IE esploderebbe visto che tiene al max 2000 carfatteri o no?!
devo per ogni errore fare header
scusate l'insistenza ma non riesco a concepirlo