Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2001
    Messaggi
    309

    script loginn che non funziona...

    ciao ragazzi, ho scaricato dalla raccolta di script il file file_3350.zip nella sezione protezione e password, ma in una pagina mi da errore, esattamente dice questo:

    Parse error: parse error, unexpected '}' in C:\wamp\www\5\add.php on line 10

    ma io nel file add.php non vedo nessun errore, qualcuno di voi sa dirmi dove sbaglio? grazie!
    di seguito posto tutto il file add.php

    Codice PHP:
    <?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 rand1,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.";
    }
    ?>

  2. #2
    ciao,

    in questa riga (la 10 per l'appunto):
    if ($actnum < 0){$actnum = $actnum + ($actnum*-2); }

    manca il ; dopo -2)

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.