Visualizzazione dei risultati da 1 a 7 su 7
  1. #1

    problema registrazione utenti

    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>

  2. #2
    sembra tutto ok, fai una prova a mettere >0 al posto di !=0 all'if dell'username, aspetto notizie..

  3. #3
    provato a cambiare ma nulla...sempre mi lascia registrare con la solita username e password già da 4 volte...

  4. #4

  5. #5
    Codice PHP:
    $ver "SELECT * FROM messaggi WHERE username= '$username'"
    Codice PHP:
    values (' $username '
    Verifichi che esista «'NOMEUTENTE'» ma poi inserisci «' NOME UTENTE '».

    Togli gli spazi nella query di inserimento (o mettili in quella di selezione).

  6. #6
    ..lo stesso.. ho riprovato e nel db mi inserisce quante volte voglio:


    username password
    a 0cc175b9c0f1b6a831c399e269772661
    a 0cc175b9c0f1b6a831c399e269772661
    .... ......



  7. #7
    ho risolto:

    ($veruser !== 0)
    io avevo messo ($veruser < 0)

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.