Visualizzazione dei risultati da 1 a 8 su 8

Discussione: info

  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    56

    info

    Ciao a tutti!!!
    Volevo chiederVi un'informazione, ho preso uno script in php sull'autenticazione di utenti, però mi dà un errore!!!
    Quando vado a clikkare per prova per inserire un nuovo utente, mi dice: "Parse error: parse error in /membri/anistor/iAdvance/add.php on line 10"
    Cosa vuol dire???
    Se non avete capito, andate all'indirizzo: anistor web site

    P.s. il sito è ancora in costruzione, quindi non fate caso se mancano delle immagini!!!
    Bella!!

  2. #2
    Utente di HTML.it
    Registrato dal
    Mar 2002
    Messaggi
    47
    C'è un errore nello script...

  3. #3
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    56

    info

    Ah! Grazie!! Siccome non ci capisco molto di php, se ti faccio vedere lo script, sapresti dirmi qual'è l'errore??

  4. #4

    Re: info

    Originariamente inviato da Anistor
    Ah! Grazie!! Siccome non ci capisco molto di php, se ti faccio vedere lo script, sapresti dirmi qual'è l'errore??
    posta lo script

  5. #5
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    56

    eccolo.....

    Eccolo:

    ---------------------------------------------------

    <?PHP
    //retrieve al the variables that had been submited by the from
    $username1 = $HTTP_POST_VARS["username"];
    $mailadres1 = $HTTP_POST_VARS["mailadres"];
    $password1 = $HTTP_POST_VARS["password"];
    $confirmpassword1 = $HTTP_POST_VARS["confirmpassword"];
    //generate an random number for the user neede to activate there account
    $actnum = rand( 1,999999999999);
    //make sure that the activation number is positive (YES it can happen that the number is negatief.)
    if ($actnum < 0){$actnum = $actnum + ($actnum*-2)}
    //set the error variable to an empty string.
    $error = "";

    //check it the fields are not empty. if they are, append the error to the error variable ($error)
    if ($username1 == ""){$error = "$error[*]No username given
    \n";}
    if ($password1 == ""){$error = "$error[*]No password given
    \n";}
    if ($mailadres1== ""){$error = "$error[*]No mailadres given
    \n";}
    //check if the passwords match. if they don't append the error to the error variable ($errir)
    if ($password1 <> $confirmpassword1) {$error = "$error[*]Passwords do not match
    \n";}

    // let the config.php file make an database connection
    include("config.php");
    //make an query which checks if the username OR the emailadres ar in the database. if they are append an error.
    $query = "Select * from signup where username='$username1' or mailadres='$mailadres1'";
    $result = mysql_query($query);
    if ($row = mysql_fetch_array($result)){
    if ($row["username"] == $username1){$error = "$error[*]Your username is already used by another member
    \n";}
    if ($row["mailadres"] == $mailadres1){$error = "$error[*]Your e-mail adres is already registrated in our database
    \n";}
    }

    //if ther error variable is still an empty string. The summission was oke and you can start proccesing the submission
    if ($error == ""){
    //first we check wat the date and time is for the signupdate field
    $datetime = date("d-m-Y G:i ");
    //then we submit al this to the database
    $query = "INSERT INTO signup (username, password, mailadres, actnum, userlevel, signupdate ,lastlogin, lastloginfail, numloginfail) VALUES ('$username1','$password1','$mailadres1','$actnum' , '1', '$datetime','0','0','0')";
    $result = mysql_query($query);
    //and we make an (e-mail)message which contains the activation numer
    //also possible is to put a link in that message like :
    //http:// your url /activate.php?username=$username1&actnum=$actnum
    //this would allow the user to direcly submit there activation without having to enter
    //al the data again in the activation form
    $message = "Activation number: $actnum";
    // mail the message to the user
    mail($mailadres1, "Sign up script user activationcode", $message, "From: Sign-up script");
    // and redirect the user to the activation page
    header("Location: activate.php");
    }
    else
    //if $error is no longer a empty stirng there must have been error in the submision.
    //here we echo an nice line which says there are a coulple of errors and we onpen an
    //unorder list (just the <ul> tag) and we prinnt the error. also we include a link back to the
    //sign-upform
    {echo "You could not be added to the database because of the following reasons<ul>
    $error[/list]Please return to <a href=\"signup.php\">signup form</a> and try again.";
    }
    ?>

    ---------------------------------------------------------

    Grazie!!!

  6. #6
    Utente di HTML.it
    Registrato dal
    Mar 2002
    Messaggi
    47
    if ($actnum < 0){$actnum = $actnum + ($actnum*-2)}

    manca un ;

    Versione corretta:

    if ($actnum < 0){$actnum = $actnum + ($actnum*-2);}

  7. #7
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    56
    Vedo se funziona....

  8. #8
    Utente di HTML.it
    Registrato dal
    Jan 2004
    Messaggi
    56

    Funzionaaaaaaaaaaaaaaaaaaaaaaaaa!!!

    Grande, grazie!!! Ti stimo!!!!!

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.