effettuo la registrazione con un username già esistente e mi registra nuovamente...
<?php
session_start();
?>
<?
include "config.php";
// inizializza sempre le variabili che usi in uno script
$username="";
$psw="";
$repsw="";
// assegna i valori POSTati a queste variabili hashando la password
$username=$_POST['username'];
$psw=md5($_POST['password']);
$repsw=md5($_POST['repassword']);
$ver = "SELECT * FROM messaggi WHERE username= '$username'";
$tabver = @mysql_query ($ver) or die (mysql_error());
$veruser = mysql_num_rows ($tabver);
if ($username=='' || $psw=='' || $repsw=='')
{
echo '
Compila correttamente tutti i campi';
}
else if ($psw !== $repsw)
{
echo "
Controllare la password digitata.";
}
else if ($veruser !== 0)
{
echo "
L'username richiesto risulta già registrato";
}
else if (eregi("[:,;èéçòà °@#ù§*+^ì'<>?!£$%&/=()]", $username))
{
echo "
Il nick contiene caratteri non validi.";
}
else
{
$inserimento=mysql_query( "insert into messaggi (username,password,user,gender,date_of_birth,count ry,test_arousal_photo1,test_valence_photo1 ,test_arousal_photo2,test_valence_photo2,test_arou sal_photo3,test_valence_photo3,test_arousal_photo4 ,test_valence_photo4,test_arousal_photo5,test_vale nce_photo5,test_arousal_photo6,test_valence_photo6 ,test_arousal_photo7,test_valence_photo7,test_arou sal_photo8,test_valence_photo8,test_arousal_photo9 ,test_valence_photo9,test_arousal_photo10,test_val ence_photo10,date)
values (' $username ',' $psw ',
'" . $_SESSION['user']. "','" . $_SESSION['gender'] . "','" . $_SESSION['year'] . "-" . $_SESSION['month'] . "-" . $_SESSION['day'] . "','" . $_SESSION['country'] . "','" . $_SESSION['test_arousal_photo1'] . "','" . $_SESSION['test_valence_photo1'] . "','" . $_SESSION['test_arousal_photo2'] . "','" . $_SESSION['test_valence_photo2'] . "','" . $_SESSION['test_arousal_photo3'] . "','" . $_SESSION['test_valence_photo3'] . "','" . $_SESSION['test_arousal_photo4'] . "','" . $_SESSION['test_valence_photo4'] . "','" . $_SESSION['test_arousal_photo5'] . "','" . $_SESSION['test_valence_photo5'] . "','" . $_SESSION['test_arousal_photo6'] . "','" . $_SESSION['test_valence_photo6'] . "','" . $_SESSION['test_arousal_photo7'] . "','" . $_SESSION['test_valence_photo7'] . "','" . $_SESSION['test_arousal_photo8'] . "','" . $_SESSION['test_valence_photo8'] . "','" . $_SESSION['test_arousal_photo9'] . "','" . $_SESSION['test_valence_photo9'] . "','" . $_SESSION['test_arousal_photo10'] . "','" . $_SESSION['test_valence_photo10'] . "', now())" ) or die (mysql_error());
echo " hai effettuato la registrazione con successo
can see the final statistics <a href=\"finalstat.php\">stat</a>.";
}
@mysql_close($connection);
?>
</body>
</html>