Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    script php "strano probelma" (per me)

    perche questo script (per gestire mail list) non mi fa accedere ad un pannello di controllo ma mi chiede il login?
    devo inserirlo in una pagina protetta da psw?
    se si come faccio? ciao grazie

    l'ho trovato sul sito html.it ma non ricordo qual'e

    <?
    if (!$PHP_AUTH_USER || !$PHP_AUTH_PW)
    {
    // If empty, send header causing dialog box to appear
    header('WWW-Authenticate: Basic realm="Mailing List admin"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Authorization Required.';
    exit;
    }
    else
    {
    $tu = strtolower($PHP_AUTH_USER);
    $pu = strtolower($PHP_AUTH_PW);
    include("config.php");
    if ($tu == strtolower($adminusername) && $pu == strtolower($adminpassword))
    {
    $fd = fopen ($listfile, "r");
    $contents = fread ($fd, filesize ($listfile));
    fclose ($fd);
    $entries = explode(",",$contents);
    for($i=0;$i<count($entries);$i++)
    {
    if ($entries[$i] != "")
    $choices .= "<OPTION VALUE=\"$entries[$i]\"> ".$entries[$i]."\n";
    }

    if ($cmd != "send")
    {
    $output = "
    <form action=\"?cmd=send\" method=\"post\">
    <table align=\"left\">
    <tr>
    <td>
    <SELECT MULTIPLE SIZE=5 NAME=sendto[]>
    <OPTION VALUE=\"All\" selected>Send to All
    $choices
    </select>
    </td>
    </tr>
    </table>
    <table align=\"center\">
    <tr>
    <td nowrap>Msg Subject</td><td><input type=\"text\" size=\"30\" name=\"subject\"></td>
    </tr>
    <tr>
    <td nowrap valign=\"top\">Msg Body</td><td><textarea name=\"body\" rows=\"8\" cols=\"50\"></textarea></td>
    </tr>
    <tr>
    <td></td>
    <td><input type=\"checkbox\" name=\"useheader\" value=\"yes\"> Include Header <input type=\"checkbox\" name=\"usefooter\" value=\"yes\"> Include Footer</td>
    </tr>
    <tr>
    <td></td>
    <td><input type=\"submit\" value=\"Send Mail\"></td>
    </tr>
    <tr>
    <td></td>
    <td>Please keep in mind that it may take a while to send the messages depending how many people are on your list, let it finish sending</td>
    </tr>
    </table>
    ";
    }else
    {
    for ($i=0;$i<count($sendto);$i++)
    {
    echo "".$sendto[$i]."
    ";
    }

    $footerd = fopen ($footerfile, "r");
    $thefooter = fread ($footerd, filesize ($footerfile));
    fclose ($footerd);

    $headerd = fopen ($headerfile, "r");
    $theheader = fread ($headerd, filesize ($headerfile));
    fclose ($headerd);

    if ($useheader == "yes")
    $message .= "".$theheader."\n\n";

    $message .= "".$body."\n\n";

    if ($usefooter == "yes")
    $message .= "".$thefooter."";

    if ($sendto[0] == "All")
    {
    for($i=0;$i<count($entries);$i++)
    {
    mail($entries[$i], $subject, $message,
    "From: ".$fromemail."");
    }
    }
    else
    {
    for($i=0;$i<count($sendto);$i++)
    {
    mail($sendto[$i], $subject, $message,
    "From: ".$fromemail."");
    }
    }
    $output = "sent";
    }
    echo $output;


    }
    else
    {
    echo " <html><body>Login/Password errati</body></html> ";
    }
    }
    www.zukimania.org

  2. #2
    Si, devi metterlo in una directory protetta da password

    codice:
    if (!$PHP_AUTH_USER || !$PHP_AUTH_PW)
    {
    // If empty, send header causing dialog box to appear
    header('WWW-Authenticate: Basic realm="Mailing List admin"');
    header('HTTP/1.0 401 Unauthorized');
    echo 'Authorization Required.';
    exit;
    }
    Questo non funziona con IIS e dovresti verificare che php venga usato come modulo di apache e non nella versione CGI. Per scoprirlo puoi provare a fare una pagina vuota con

    <? echo php_sapi_name(); ?>

    Se ti dice "apache" sei a posto.

    Ciao!

    StefaX
    BluePine Technology
    Virtual hosting - Server Dedicati - Sviluppo applicazioni

  3. #3
    bene

    mi da questo...

    cgi-fcgi

    come procedo? posso scaricare un altro script che mi protegge la cartella con psw o sono a piedi?
    ciao grazie
    www.zukimania.org

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.