NOKIA

pages of blog

Tuesday 24 June 2014

cour 3 : what is the action of our login form ? (PHP)

hello .
in cour 1 and 2 , we create a login form by HTML and CSS 
in this cour we ask this question :

what is the action of our login form ? what is the Interest ? 

ok , in this point , we need a edia befour starting . 
1-the user enter a username and password 
2-i say that only if user enter (username="admin" and password="admin")  . he can sees "hello" at Level of our page exemple.php . else he sees "error".

ok , its simple , What do you think that we are testing
  
open your file (exemple.php) and add this code PHP : 
  




you can learn about PHP from all of PHP
we define 2 variables , $username and $password  
$username give its value from $_POST['name'] ( value of input of name='name') by the method POST . 
the $_POST is Matrix help us to give the values of different  input as last input and the input of password .
$password , The same thing ,but it give his value from $_POST['password'] (the second input) 

ok , if the value of $username='admin' and $password='admin' then show (in php echo "") hello
else show error.

so , i say that we need a data base , no only (admin)  can see "hello" 
all users can see this , but if they are registered at data base . 

in the next cour , we use to create a data base , and we know what is SQL , and how to use it . 

i hope that the cour is simple and easy , try to get the correct result .

reminder : 
Do not forget, that you move your 2 files (exemple.php and style.css )  to directory    (c:\appserv\www\) 
if you want to try your page at Browser , write at adress ( localhost/exemple.php) 

ok . that's all 







thank you . 
yassine  
 

No comments:

Post a Comment