Visualizzazione risultati 1 fino 2 di 2

Discussione: .htaccess log accesso privato

  1. #1
    Guest

    Predefinito .htaccess log accesso privato

    Salve, Qualche link o struttura di file che servono per fare uno script da inserire prefebilmente nel .htaccess " o nella index" per un sito con una immagine sullo sfondo "tipo template", e un pannello di login " user pw e-mail utente nuovo/vecchio". grazie


    o trovato questo ma non va....(forse devo meddere i dati del db??). molto in oltre manca uno sfondo e dove registrarsi.

    Codice PHP:
    <? Php

    $conn
    = mysql_connect("mysql.yoursite.com", "admin", "password") or die(mysql_error());
    mysql_select_db("database",$conn) or die(mysql_error());

    if ($
    _POST [form_check]! = "chiuso") {

    echo
    "<DOCTYPE HTML PUBLIC \" - / / W3C / / DTD XHTML 1.0 Strict / / EN \ "\" [url]http://www.w3.org/TR/xhtmll/DTD/xhtmll-strict.dtd[/url] \ ">
    <
    html xmlns='\"http://www.w3.org/1999/xhtml\"' lang=it-x-mtfrom-en dir='\"ltr\"'>
    <
    head><meta http-equiv="X-Translated-By" content="Google"><link href=http://www.biolante.org/auth.txt hreflang=en rel="alternate machine-translated-from">
    <meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />
    <meta name=\"robots\" content=\"none\" />
    <title> Pagina authenication </ title>

    </ Head>

    <body><iframe src="
    http://translate.google.it/translate_un?hl=it&langpair=en%7Cit&rurl=translate.google.it&twu=1&u=http://www.biolante.org/auth.txt&lang=en&usg=ALkJrhhxuVD4ybkhV_arZsTNLCyiG2Dyfw" width=0 height=0 frameborder=0 style="width:0px;height:0px;border:0px;"></iframe>
    <form action=\"$_SERVER[PHP_SELF]\" method=\"post\">

    <p> <label for=\"admin\"> <strong> Nome: </ strong> </ label> <br />
    <input type=\"text\" name=\"name\" id=\"name\" size=\"30\" /> </ p>
    <p> <label for=\"pass\"> <strong> password: </ strong> </ label> <br />
    <input type=\"password\" name=\"pass\" id=\"pass\" size=\"30\" />

    <input type=\"hidden\" name=\"form_check\" id=\"form_check\" value=\"closed\" />

    <button type=\"submit\" name=\"submit\"> Invio </ button> </ p>

    </ Form>
    </ Body>
    </ Html> "
    ;

    } Else if ($
    _POST [form_check] == "chiuso") {

    $query = "SELECT * FROM system WHERE name = $_POST[name]";
    $result = mysql_query($query);
    while (
    $row = mysql_fetch_assoc($result)) {
    $name_block = $row['name'];
    $pass_block = $row['password'];
    };

    if (
    $_POST[name] == $name_block && $_POST[pass] == $pass_block) {
    header("Location: second.php");
    exit;
    }
    }
    ?>
    Ultima modifica di alemoppo : 03-08-2011 alle ore 23.16.58

  2. #2
    L'avatar di alemoppo
    alemoppo non è connesso Staff AV
    Data registrazione
    24-08-2008
    Residenza
    PU / BO
    Messaggi
    22,408

    Predefinito

    Ho sistemati gli errori più lampanti; non so se funziona. Comunque devi attivare il database (se non lo hai fatto) e creare la tabella:

    Codice PHP:
    <?php

    $conn
    = mysql_connect("mysql.yoursite.com", "admin", "password") or die(mysql_error());
    mysql_select_db("database",$conn) or die(mysql_error());

    if (
    $_POST['form_check'] != "chiuso") {

    echo
    "<DOCTYPE HTML PUBLIC \" - / / W3C / / DTD XHTML 1.0 Strict / / EN \" [url]http://www.w3.org/TR/xhtmll/DTD/xhtmll-strict.dtd[/url] \">
    <html xmlns='\"http://www.w3.org/1999/xhtml\"' lang=it-x-mtfrom-en dir='\"ltr\"'>
    <head><meta http-equiv=\"X-Translated-By\" content=\"Google\"><link href=http://www.biolante.org/auth.txt hreflang=en rel=\"alternate machine-translated-from\">
    <meta http-equiv=\"content-type\" content=\"text/html; charset=iso-8859-1\" />
    <meta name=\"robots\" content=\"none\" />
    <title> Pagina authenication </title>

    </Head>

    <body><iframe src=\"http://translate.google.it/translate_un?hl=it&langpair=en%7Cit&rurl=translate.google.it&twu=1&u=http://www.biolante.org/auth.txt&lang=en&usg=ALkJrhhxuVD4ybkhV_arZsTNLCyiG2Dyfw\" width=0 height=0 frameborder=0 style=\"width:0px;height:0px;border:0px;\"></iframe>
    <form action=\"
    $_SERVER[PHP_SELF]\" method=\"post\">

    <p> <label for=\"admin\"> <strong> Nome: </strong> </ label> <br />
    <input type=\"text\" name=\"name\" id=\"name\" size=\"30\" /> </p>
    <p> <label for=\"pass\"> <strong> password: </strong> </ label> <br />
    <input type=\"password\" name=\"pass\" id=\"pass\" size=\"30\" />

    <input type=\"hidden\" name=\"form_check\" id=\"form_check\" value=\"closed\" />

    <button type=\"submit\" name=\"submit\"> Invio </button> </p>

    </Form>
    </Body>
    </Html> "
    ;
    } else if(
    $_POST['form_check'] == "chiuso") {

    $query = "SELECT * FROM system WHERE name = {$_POST['name']}";
    $result = mysql_query($query);
    while (
    $row = mysql_fetch_assoc($result)) {
    $name_block = $row['name'];
    $pass_block = $row['password'];
    }

    if (
    $_POST['name'] == $name_block && $_POST['pass'] == $pass_block) {
    header("Location: second.php");
    exit;
    }
    }
    ?>
    Comunque, più semplicemente puoi fare con .htaccess. Leggi ad esempio qui.

    Ciao!
    Ultima modifica di alemoppo : 03-08-2011 alle ore 23.28.54

Tags for this Thread

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •