Re: Log In
| From: | Hugh Danaher | Date: | Thu, 06 Mar 2003 02:04:49 +0000 |
| Subject: | Re: Log In | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138401@lists.php.net to get a copy of this message | ||
Rob,
create a mysql table containing usernames and passwords then do something
like the following:
Hope this helps,
Hugh
<?php
$db=" ";
$table=" ";
$db_user=" ";
$db_pass=" ";
if (!isset($username) or !isset($password))
{
print "<form action=$PHP_SELF method=post>";
print "log in information<br>";
print "Input your name: <input type=text name=username><br>";
print "Input your password: <input type=text name=password><br>";
print "<input type=submit value=\" Log In \">";
print "</form>";
}
else
{
call_user_func('mysql_log_in',$db, $table, $user, $pass); ///// open
database ///////
$query="select * from $table where username='".addslashes($username)."'
and
password='".addslashes($password)."' ";
$result=mysql_query($query);
$rows=mysql_num_rows($result);
if ($rows==0) header("location: index.htm"); //////// kicks them out
if ($rows==1)
{
your page code goes here
}
}
?>
----- Original Message -----
From: "Van Andel, Robbert" <RVanAndel@chartercom.com>
To: <php-general@lists.php.net>
Sent: Wednesday, March 05, 2003 3:50 PM
Subject: [PHP] Log In
Is there a handy function in PHP that I can use to retrieve the users
Windows Log in? We are creating an application that will allow users to add
comments to a mysql database, and we would like to be able to track who is
putting the comments into the table, preferably with their windows log in.
Robbert van Andel