Salta al contenuto
  • CATEGORIES
  • La Community Connect.gt
  • Presentati alla Community
  • News Ufficiali da Connect.gt
  • Internet News
  • A Scuola Di
  • Digital Marketing
  • Intelligenza Artificiale
  • SEO & GEO
  • Web Marketing e Content
  • Google Analytics e Web Analytics
  • Google Ads & Advertising
  • YouTube
  • TikTok, Instagram e altri Social
  • Google Adsense, Affiliazioni e Guadagno
  • E-Commerce
  • Coding e Sistemistica
  • Help Center: consigli per il tuo progetto
  • Hosting e Cloud
  • Coding
  • CMS & Piattaforme Self-Hosted
  • Annunci e Collaborazioni
  • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
  • Collaborazioni WEB e Lavoro: offro e cerco
  • Impresa, Fisco e Leggi
  • Consulenza Legale e Professioni Web
  • Consulenza Fiscale, Imprese, Startup e P.Iva
  • Gli Off Topic
  • PC, Smartphone e altri Hardware
  • Tutti i Software
  • GT Fetish Cafè
  • Discussioni
  • 0 Non letti 0
  • Recenti
  • Hashtag
  • Popolare
  • Utenti
  • Privacy
  • Termini e condizioni
  • © 2026 Search On Media Group S.r.l.
Collassa
Connect.gt
Il network Search On
Connect.gt WMF AI Festival Accademia Advanced SEO Tool AgentCy Social Media Strategies Search Tech
Registrati Accedi
Connect.gt
Stream Interest Categorie Hashtag
  1. La community italiana di SEO, marketing digitale e AI
  2. Categorie
  3. Coding e Sistemistica
  4. Coding
  5. Script per login che non effettua il login

Script per login che non effettua il login

Pianificato Fissato Bloccato Spostato Coding
2 Post 1 Autori 1.6k Visualizzazioni 1 Seguito
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • T
    T
    tracy
    scritto su ultima modifica di
    User 0
    #1
    Script per login che non effettua il login

    Salve a tutti,
    ho un problema con uno script php che protegge attraverso il login una sezione del sito.
    Lo script è composto di 8 file più il css: il problema è che lo script non effettua il login, ossia quando provo a registrarmi, mi dice che l'iscrizione è avvenuta, e reindizza alla pagina di login, metto username e password ma non accede, mi dice che i dati sono incorretti.

    questa è la pagina di login, la index.php

    <?php
    session_start(); // Maintain session state
    header("Cache-control: private");    // Fixes IE6's back button problem.
    
    // Are we logged in, or logging in?
    if(@$_SESSION['user']) header("location: login.php");
    else{
    ?>
    <html>
    <head>
    
    <link rel = "stylesheet" type = "text/css" href = "style.css">
    <title>members area: mike holloway</title>
    </head>
    <body onload = "document.getElementById('user').focus();">
    
    <form method = "post" action = "login.php">
    <table border = "0" cellspacing = "0" cellpadding = "10" width = "50%" align = "center" style = "height: 100%;">
        <tr>
            <td colspan = "3" valign = "bottom">
                <span class = "bold">members area, v: 3.0</span>    <br>
                <?php
                // Get user count
                $file = file("users.php");
                $userCount = 0;
    
                for($line = 0; $line < sizeof($file); $line++){
                    if("//" != substr($file[$line], 0, 2)) $userCount++;
                }
                ?>
                <span class = "hilight">we have</span> <span class = "bold hilight"><?php print $userCount; ?></span> <span class = "hilight">members and growing!</span>
            </td>
        </tr>
        <tr>
            <td colspan = "3" height = "5%">
                <a href = "addUser.php">signup</a> 
                <?php
                // Check if we need to add a message
                if(@$_GET["fail"]) echo "| <span class = 'alert'>Incorrect username or password</span>";
                elseif(@$_GET["logout"]) echo "| <span class = 'alert'>Successfully logged out</span>";
                elseif(@$_GET["new"]) echo "| <span class = 'alert'>Successfully registered</span>";
                ?>
            </td>
        </tr>
        <tr>
            <td width = "30%" height = "10" valign = "bottom">
                username:
            </td>
            <td width = "70%" height = "10" valign = "bottom">
                <input type = "text" id = "user" name = "user" style = "width: 80%" class = "text" tabindex = "1">
            </td>
            <td rowspan = "2" width = "16" height = "16" align = "right" valign = "bottom">
                <input type = "image" src = "next.gif" width  = "16" height = "16" name = "submit" alt = "arrow pointing right: next" tabindex = "3">
            </td>
        </tr>
        <tr>
            <td width = "30%" height = "10" valign = "bottom">
                password:
            </td>
            <td width = "70%" height = "10" valign = "bottom">
                <input type = "password" name = "pass" style = "width: 80%" class = "text" tabindex = "2">
            </td>
        </tr>
        <tr>
            <td colspan = "3" valign = "top" style = "color: #cccccc;">
                freeware by: <a href = "mikeholloway.co.uk" target = "_blank">mike holloway<a/>, 2003.
            </td>
        </tr>
    </table>
    </form>
    </body>
    </html>
    <?php
    }
    ?>
    

    questa la pagina che richiama, la login.php

    <?php
    session_start(); // Maintain session state
    header("Cache-control: private");    // Fixes IE6's back button problem.
    
    // Redirect if not logging in
    if(!@$_POST['user'] && !@$_SESSION['user']) header("location: index.php");
    else{
        if(@$_SESSION['user']){
            @include("userarea.php");
        }
        else{
            // Get the posted username and password
            $user = strtolower($_POST['user']);
            $pass = $_POST['pass'];
    
            // Include the flat-file
            $file = file("users.php") or die("Problem getting the user details flat-file [users.php]");
    
            // Get the size of file
            $totalLines = sizeof($file);
    
            // Get the users details line by line
            $line = 0;
            $match = 0;
            do{
                // Check the line isn't a comment
                if("//" != substr($file[$line], 0, 2)){
                    // Break our records up
                    @list($username, $password, $permission, $email, $url, $dob, $location, $joined) = explode("<del>", $file[$line]);
    
                    // Check the username and passwords match
                    if((strtolower($user) == strtolower($username)) && (md5($pass) == $password)) $match = 1;
                    else $match = 0;
                }
    
                // Exit loop if match found
                if($match) break;
                
                // Increment line count
                $line++;
            } while($line < $totalLines);
    
            // Include the file or send them back
            if($match){
                $_SESSION["user"] = $user;
                $_SESSION["pass"] = $pass;
                $_SESSION["permission"] = $permission;
                $_SESSION["email"] = $email;
                $_SESSION["url"] = $url;
                $_SESSION["dob"] = $dob;
                $_SESSION["location"] = $location;
                $_SESSION["joined"] = $joined;
                
                // Refresh page
                header("location: ". $_SERVER['PHP_SELF']);
            }
            else header("location: index.php?fail=1");
        }
    }
    ?>
    

    mi aiutate perfavore?
    grazie fin d'ora

    1 Risposta Ultima Risposta
    Miglior risposta 0
    0
    • T
      T
      tracy
      scritto su ultima modifica di
      User 0
      #2

      up
      c'è qualcuno che può darmi una mano?

      1 Risposta Ultima Risposta
      Miglior risposta 0
      0

      Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

      Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

      Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

      Registrati Accedi
      Rispondi
      • Risposta alla discussione
      Effettua l'accesso per rispondere
      • Da Vecchi a Nuovi
      • Da Nuovi a Vecchi
      • Più Voti


      • Accedi

      • Non hai un account? Registrati

      • Accedi o registrati per effettuare la ricerca.
      • Primo post
        Ultimo post
      Home Accedi Registrati
      Menu
      • CATEGORIES
      • La Community Connect.gt
      • Presentati alla Community
      • News Ufficiali da Connect.gt
      • Internet News
      • A Scuola Di
      • Digital Marketing
      • Intelligenza Artificiale
      • SEO & GEO
      • Web Marketing e Content
      • Google Analytics e Web Analytics
      • Google Ads & Advertising
      • YouTube
      • TikTok, Instagram e altri Social
      • Google Adsense, Affiliazioni e Guadagno
      • E-Commerce
      • Coding e Sistemistica
      • Help Center: consigli per il tuo progetto
      • Hosting e Cloud
      • Coding
      • CMS & Piattaforme Self-Hosted
      • Annunci e Collaborazioni
      • Annunci Vendita e Acquisto: Pubblicità, Domini, Link e altro
      • Collaborazioni WEB e Lavoro: offro e cerco
      • Impresa, Fisco e Leggi
      • Consulenza Legale e Professioni Web
      • Consulenza Fiscale, Imprese, Startup e P.Iva
      • Gli Off Topic
      • PC, Smartphone e altri Hardware
      • Tutti i Software
      • GT Fetish Cafè
      • Discussioni
      • Non letti 0
      • Recenti
      • Hashtag
      • Popolare
      • Utenti
      • Privacy
      • Termini e condizioni
      • © 2026 Search On Media Group S.r.l.