Tuesday, 9 June 2020

how to convert some text to some encryption usnng md5 and orint that

md5 encryotion
lesson 39
encryption means some type of convertion
how to convert some text to some encryption usnng md5 and orint that
<?php
$password = 'pass123';
it will converts to some unknow format
echo md5($password);
fsfdfjdsfdfdajjfasjdjfdkjfgdaa1a22535f5dfdfdf

$key = ' fsfdfjdsfdfdajjfasjdjfdkjfgdaa1a22535f5dfdfdf ';
how to compare the entered and store
if (md5($password) == $key){
echo 'ok';
} else {
echo 'wrong';
}
?>
how to chcek the entered password by user is write or wrong
index.php
<?php
If(isset($_post['userpassword'])){
how to check form is submitted or not

ist checck form is submittedm athen get the data using name, check anything entered or not , user entered some password, convert to encryption, read the file a, that data loads to some variable, converted key and file key check , both are ok,it is ok otherwise enter write paassword
$userpassword = $_post['userpassword'];
write the entered matter to some variable
if (!empty ($userpassword)){
check that is empty or not
$userpassword = md5($userpassword);
convert to some encryption
$fname ='filepass.text';
get the file name
$filesize = filesize($fname);
if file is created already, get the file size
$file = fopen ($fname, 'r');
ready to read the file
$key = fread($file, $fsize);
alredy some key is there in text , we write previously using manual
if ($userpassword == $key) {
compare both entered by user and saved in text file
echo 'password ok';
} else {
echo 'wrong password';
}
} else {
echo 'please enter a password '; }
<form action="index.php"method="post">
password: <input type="text" name ="userpassword">
<input type="submit" value="login">
</form>
?>

isset
$_post
!empty
md55
filesize
fopen
fread
compare
ifelse else
post
tyoe=text"
type="password"

how to convert some text to some encryption usnng md5 and orint that 
how to compare the entered and store
how to chcek the entered password by user is write or wrong
how to chcek the form is submit or not
how to save the entered matter from custoemr
how to chcek is itireally enters
how to convert to some encryption
how to get the size
how to open the file and ready to read
how to read the file
how to chck the key and entered password both are ok




No comments:

Post a Comment