Hi,
I'm new to PHP, and learning some tutorial to create a login feature which includes 4 pages:
1/ login --> this is a form <form action="login_check.php" method="post">
2/ config.php --> with info of host, username, password, connect to mysql
3/ login_check.php --> to process the form:
4/ member.php--> after successful loginCode:<?php
session_start();
include 'config_pc.php';
$username=$_POST["username"];
$password=$_POST["password"];
if(!empty($username)&&!empty($password)){
$query="SELECT*FROM member WHERE username='$username' and password='$password'";
$result=mysql_query($query,$connection) or die("Can't execute!");
$count=mysql_num_rows($result);
if($count==1){
$_SESSION['user_logged']=$username;
$_SESSION['user_password']=$password;
Header('Location:member.php');
} else {
echo "You've entered wrong username/password. Please enter again!";}
} else {
echo "You forgot to enter something!";}
?>
what should I put in the member.php so that it can only accessed after logging in. Right now if e.g. I type http://localhost/member.php, I can go directly to the member.php page. I know it has something to do with SESSION but don't know how.
Also, right now it seems that my username and password fields are not casesensitive, how to make them become case sensitive?
Thanks!!!!!!
