Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Area riservata

  1. #1

    Area riservata

    nel file "index.php"

    <?php include_once 'access.inc.php'; ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Il Network OSI - Opificio Sistemi d'Impresa</title>
    </head>

    <body>


    Sito non protetto</p>
    <?php if (loggedIN()): ?>


    tu sei attualmente loggato!Logout</p>
    <?php endif; ?>
    </body>
    </html>

    nel file "access.inc.php"

    <?php
    require_once 'config.inc.php';

    function loggedIN()

    {

    return isset($_SESSION['authorized']);

    }

    //Processa il tentativo di login
    if(isset($_POST['login'])){
    if($_POST['username'] == ADMIN_USER and
    $_POST['password'] == ADMIN_PASS) {
    $_SESSION['authorized'] = TRUE;
    }
    }

    // Processa il logout
    if(isset($_REQUEST['logout'])){
    unset($_SESSION['authorized']);
    }
    ?>

    nel file "config.inc.php"

    <?php
    define('ADMIN_USER', 'root');
    define('ADMIN_PASS', 'root');
    ?>

    nel file "admin.php"

    <?php require 'secure.inc.php'; ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Sito Amministrazione Area</title>
    </head>

    <body>
    <h1>Administrative Options</h1>
    <ul>[*]HOME[/list]


    Logout</p>
    </body>
    </html>

    nel file "secure.inc.php"

    <?php
    require_once 'access.inc.php';
    if (!loggedIN()) {
    include 'login.inc.php';
    exit;
    }
    ?>

    nel file "login.inc.php"

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Documento senza titolo</title>
    </head>

    <body>
    <h1>Please log in for access</h1>
    <div>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <label>User name:
    <input type="text" name="username" /></label>

    <label>Password:
    <input type="password" name="password" /></label>
    <input type="submit" value="Log in" />
    </form>
    </div>


    </body>
    </html>

    Ho provato ad effettuare il login ma non mi funziona...come mai?? potete correggere per favore?? )

  2. #2
    Utente di HTML.it L'avatar di P4n1c
    Registrato dal
    Feb 2008
    Messaggi
    116
    magari inserendo session_start() in cima a tutte le pagine...
    poi cos'è quell' isset($_POST['login']) ... non c'è nessun input che si chiama login
    Ah ma c'è anche un avatar con forumisti romanisti

  3. #3
    Mi hai salvato

    dovevo mettere 'username' al posto di 'login'!!

    Grazieee e SEMPRE FORZA ROMA!!!

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 © 2024 vBulletin Solutions, Inc. All rights reserved.