Ben basit bir giriş sistemi oluşturmak için çalışıyorum. Ben (doğru kullanıcı adı ve şifre ile) giriş formunu çalıştırdığınızda bu php çalıştırmak için görünmüyor. Herhangi bir öneriniz?
<?php
$host="linuxserver"; // Host name
$username="jparry2"; // Mysql username
$password=""; // Mysql password
$db_name="jparry2"; // Database name
$tbl_name="customer"; // Table name
// Connect to server and select databse.
mysqli_connect("$host", "$username", "$password")or die("cannot connect");
mysqli_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
$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=mysqli_query($sql);
// Mysql_num_row is counting table row
$count=mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file “login_success.php”
session_register("myusername");
session_register("mypassword");
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
}
?>
<html>
<body>
</body>
</html>
edit giriş formu kodu eklendi
<html>
<head><title>Login</title></head>
<body>
<form action='checklogin.php'
method='POST' style='margin: .5in'>
<p><label for='user_name' style='font-weight: bold;
padding-bottom: 1em'>USER ID: </label>
<input type='text' name='myusername' id='myusername'
value='' /></p>
<p><label for='password' style= 'font-weight: bold'>Password: </label>
<input type='password' name='mypassword' id='mypassword'
value='' /></p>
<p><input type='submit' value='Login'> </p>
<input type='hidden' name='sent' value='yes'/>
<a href= "/home/jparry2/public_html/register.php">Register</a>
</form>
</body>
</html>