Visualizzazione dei risultati da 1 a 7 su 7

Discussione: errore di login

  1. #1
    Utente di HTML.it
    Registrato dal
    Dec 2009
    Messaggi
    115

    errore di login

    Scusate, i dareste una mano a trovare l'errore?
    sone tre paginette che non riesco a far andare.

    prima:
    <?php
    session_start();
    $_SESSION['username'] = $_POST['user'];
    $_SESSION['userpass'] = $_POST['pass'];
    $_SESSION['authuser'] = 0;

    //verifica le informazioni relative a password e username
    if (($_SESSION['username'] == 'Joe') and
    ($_SESSION['userpass'] == '12345')) {
    $_SESSION['authuser'] = 1;
    } else {
    echo 'Sorry, but you don\'t have permission to view this page!';
    exit();
    {
    ?>
    <html>
    <head>
    <title>Find my Favorite Movie!</title>
    </head>

    <body>
    <?php
    $myfavmovie = urlencode('Life of Brian');
    echo "<a href=\"moviesite.php?favmovie=$myfavmovie\">";
    echo "Click here to see information about my favorite movie!";
    echo "</a>";
    ?>
    </body>

    </html>

    seconda
    <?php
    session_start();

    //verifica se l'utente ha fatto log-in con una password valida
    if ($_SESSION['authuser'] != 1) {
    echo 'Sorry, but you don\'t have permission to view this page!';
    exit();
    }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>My Movie Site</title>
    </head>

    <body>
    <?php
    echo 'Wellcame to our site, ';
    echo $_SESSION['username'];
    echo '!
    ';
    echo 'My favorite movie is ';
    echo $_GET['favmovie'];
    echo '
    ';
    $movierate = 5;
    echo 'My movie rating for this movie is: ';
    echo $movierate;
    ?>
    </body>
    </html>

    terza
    <?php
    session_unset();
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Please Log In</title>
    </head>

    <body>
    <form method="post" action="movie1.php">


    Enter your username:
    <input type="text" name="user"/>
    </p>


    Enter your password:
    <input type="password" name="pass"/>
    </p>



    <input type="submit" name="submit" value="Submit"/>
    </p>
    </form>
    </body>
    </html>

    Vi ringrazio.

  2. #2
    Utente di HTML.it L'avatar di Andy_87
    Registrato dal
    Jun 2010
    Messaggi
    323
    Ma che errore ti da?
    "Se non riuscirò a piegare gli dei del cielo, smuoverò le potenze dell'inferno"
    S. Freud

  3. #3
    Utente di HTML.it
    Registrato dal
    Dec 2009
    Messaggi
    115
    Giusto, scusa hai ragione.
    l'errore è il seguente: Parse error: syntax error, unexpected $end in C:\htdocs\nationalEx\MovieSite\movie1.php on line 31.

    La linea 31 è dopo il tag di chiusura. </html>
    del primo file.
    grazie

  4. #4
    Utente di HTML.it L'avatar di Andy_87
    Registrato dal
    Jun 2010
    Messaggi
    323
    L'errore è qui, la parentesi di chiusura dell'else, anzichè chiuderla l'hai riaperta
    Codice PHP:
    else

    echo 
    "Sorry, but you don't have permission to view this page!"//EDIT: corretto!
    exit();
    // }
    ?> 
    "Se non riuscirò a piegare gli dei del cielo, smuoverò le potenze dell'inferno"
    S. Freud

  5. #5
    Utente di HTML.it
    Registrato dal
    Dec 2009
    Messaggi
    115
    Grazie.
    Errore da principiante imbranato!!!
    Ti saluto.

  6. #6
    mi chiedo come faccia funzionare l'echo in questione XD
    sostituiscilo (assieme a quello più in basso nel codice) con
    Codice PHP:
    echo "Sorry, but you don't have permission to view this page!"

  7. #7
    Utente di HTML.it L'avatar di Andy_87
    Registrato dal
    Jun 2010
    Messaggi
    323
    Ah si infatti ahaha..non me ne sono nemmeno accorto!
    "Se non riuscirò a piegare gli dei del cielo, smuoverò le potenze dell'inferno"
    S. Freud

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.