Yes,there is no problem using drupal user table, you just need implement you site and connect to data base that Drupal install on it and then just need use user table
,
only one note remain that the password saved with md5
method in user table
.
I thing is not complex, the summery of answer is connect to db
use uid
(or name
) and password
field of users
table .
as sample code :
<?php
$host="localhost"; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name="drupaldb"; // Database name
$tbl_name="users"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = md5(mysql_real_escape_string($mypassword));
$sql="SELECT * FROM $tbl_name WHERE name='$myusername' and pass='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// want to want
echo "congratulation ,you login";
}
else {
echo "Wrong Username or Password";
}
?>