<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=iso-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Cristiano Verondini ha scritto:
<blockquote cite="mid:01cf01c7efc0$46d5e250$6301a8c0@IdeaFutura.local"
type="cite">
<pre wrap="">1euro al giorno e questo spazio e' tuo. <a class="moz-txt-link-abbreviated" href="mailto:info@ziobudda.net">info@ziobudda.net</a>
___________FINE_____SPONSOR_______________________________
</pre>
<blockquote type="cite">
<pre wrap="">Ho creato uno script che crea i file .htaccess e .htpasswd e mentre su
Aruba (linux) Apache 2.0.59 mi funzia benissimo e mi accesso alla
cartella dopo aver verificato l'user e la pass... in locale su windows
le cose sono diverse.... in locale sulla macchina di sviluppo ho
sempre
Apache 2.0.59 versione windows e non accetta l'user e pass inserire e
di
conseguenza mi nega l'accesso alla cartella... perchè su aruba va ed
in
locale non va?
</pre>
</blockquote>
<pre wrap=""><!---->
Non è che Win si aspetta le righe del file terminate da CR+LF?
</pre>
</blockquote>
Ecco il file modificato ma anche così non funge ;-(<br>
<pre><?php
if (($_POST['username']) && ($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xhtml1/DTD/strict.dtd">"http://www.w3.org/TR/xhtml1/DTD/strict.dtd"</a>>
<html <a class="moz-txt-link-freetext" href="xml:lang=">xml:lang=</a>"it" xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/1999/xhtml">"http://www.w3.org/1999/xhtml"</a> dir="ltr">
<head>
<title>Questo script genera i file .htaccess e .htpasswd</title>
</head>
<body>
<?php
if ((substr($_SERVER['DOCUMENT_ROOT'],-1,1) == "/") && (substr($_SERVER['PHP_SELF'],0,1) =="/")) {
$path = $_SERVER['DOCUMENT_ROOT'] . substr(dirname($_SERVER['PHP_SELF']),1) . "/.htpasswd";
} else {
$path = $_SERVER['DOCUMENT_ROOT'] . dirname($_SERVER['PHP_SELF']) . "/.htpasswd";}
if (strtoupper(substr(PHP_OS,0,3) == 'WIN')) {
$eol = "\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3) == 'MAC')) {
$eol = "\r";
} else {
$eol = "\n";
}
$tmp1 = fopen(".htaccess", "w+");
$tmp2 .= "AuthType Basic" . $eol;
$tmp2 .= "AuthName \"Area Protetta\"" . $eol;
$tmp2 .= "AuthUserFile $path" . $eol;
$tmp2 .= "Require valid-user" . $eol;
fwrite($tmp1, $tmp2);
fclose($tmp1);
unset($tmp1);
unset($tmp2);
$tmp1 = fopen(".htpasswd", "w+");
$tmp2 = "$username:" . crypt($password,CRYPT_STD_DES) . $eol;
fwrite($tmp1, $tmp2);
fclose($tmp1);
unset($tmp1);
unset($tmp2);
die ("<h2>.htaccess e .htpasswd generati correttamente!</h2>\n</body>\n</html>");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" <a class="moz-txt-link-rfc2396E" href="http://www.w3.org/TR/xhtml1/DTD/strict.dtd">"http://www.w3.org/TR/xhtml1/DTD/strict.dtd"</a>>
<html <a class="moz-txt-link-freetext" href="xml:lang=">xml:lang=</a>"it" xmlns=<a class="moz-txt-link-rfc2396E" href="http://www.w3.org/1999/xhtml">"http://www.w3.org/1999/xhtml"</a> dir="ltr">
<head>
<title>Questo script genera i file .htaccess e .htpasswd</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><label for="username">Username</label>: <input type="text" id="username" name="username" /></p>
<p><label for="password">Password</label>: <input type="text" id="password" name="password" /></p>
<p><input type="submit" value="Genera i file" /></p>
</form>
</body>
</html>
</pre>
Qualche altro suggerimento?<br>
<pre class="moz-signature" cols="76">--
Alessandro Marinuzzi
--------------------
<a class="moz-txt-link-freetext" href="http://www.alecos.it">http://www.alecos.it</a>
--------------------</pre>
</body>
</html>