> Nope it won't ... use .htaccess files for whatever you want to achieve.
>.htaccess requires telnet or ssh access to run the htpasswd command

If u are on a remote connect and don't have either telnet or ssh but have
MySql and PhP
there is an alternative
------------------------login.php file------------------------------
<?

if (!isset($PHP_AUTH_USER)) {

 header('WWW-Authenticate: Basic realm="Restricted Zone"');
 header('HTTP/1.0 401 Unauthorized');
 echo 'Authorization Required.';
 exit;

} else {

 $connection = mysql_connect("localhost", "db_user", "db_password")
    or die ("Couldn't connect to server.");

 $db = mysql_select_db("db_name", $connection)
  or die ("Couldn't select database.");

 $sql = "SELECT id
  FROM login
  WHERE user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'";

 $result = mysql_query($sql)
  or die("Couldn't execute query.");

 $num = mysql_numrows($result);

 if ($num == 1) {

                echo "<TITLE>Login</TITLE>";
  echo "<center>";
  echo "<font face=verdana color=#000050 size=2>";
  echo "<P>Authorised as ";
  echo " $PHP_AUTH_USER<br>";
  echo "Click <a href=http://www.your.dom/yourfile.html>HERE</a> to
proceed";

 } else if ($num == 0)  {

                echo "<TITLE>Login</TITLE>";
  echo "<center>";
  echo "<font face=verdana color=#000050 size=2>";
  echo "Your username and password could not be authenticated!<br>";
  echo "Close the browser window to attempt a re-login";



 }

}

?>
-------------------------end login.php
file ---------------------------------
Requires table login in your db with the following fields (minimum)
id (int not null auto increment)
user (char not null)
pass (char not null binary)
Set the fields width to suit your requirement ( 6/8 depending upon what u
wish the max length of the username and password)
The username myself=MySelf=MYSELF
but password is case sensitive
-------------------enjoy--------------------------
DaX


_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to