Ben 2 farklı kullanıcı düzeyinde, Yönetici ve ile bir giriş sayfası yapmak istiyorum Personel. Nasıl aşağıdaki d kodu kullanarak bunu yapabilirsiniz.
Thank u.
<?php
$host="localhost";
$username="root";
$password="";
$db_name="profile";
$tbl_name="company";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("Cannot Select Database");
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
if($count==1){
$_SESSION['myusername'] = $myusername;
$_SESSION['mypassword'] = $mypassword;
header("location:Admin_home.php");
}
else {
echo "Wrong Username or Password";
}
?>
Başarı giriniz:
session_start();
if(!session_is_registered(myusername))
{
header("location:Admin_home.php");
}
?>
<html>
<body>
Login Successful
</body>
</html>