İçeriği Paylaş:

PHP login system without using database

Paylaş!
  •  
  •  
  •  
  •  
  •  
  •  

Hello!
Today I will describe a simple entry system with PHP.

1 – Prepare form for login.


<form action="login.php" method="POST">
Username: <input type="text" name="username" required=""><br>
Password: <input type="password" name="password" required=""><br>
<input type="submit" name="login">
</form>

2 – Login.php intra prepare


// First Section

if (isset($_POST['login'])) {

$username = $_POST['username'];
$password = $_POST['password'];

}

// First Section End

3 – It will be datas in .txt file. Create a username.txt. It will be password data in .text file

File Name: username.txt –> Username
Content: 123 –> Password

4 – We will read .text file with php


// Second Section

if (file_exists($username . '.txt')) {
$file = fopen($username . '.txt', 'r');
$content = fread($file, filesize($username . '.txt'));
fclose($file);
}
else{
echo "User not found";
exit;

}

// Second Section End

5 – We will check the information


// Third Section

if (@$content == $password) {
echo "Success";
}
else{
echo "Error password";
exit;
}

// Third Section End

We did login system without using database. I can help hope. Thank you for reading…

İçeriği Paylaş:
İlginizi Çekebilir
Yorum Yapılmamış

Henüz Hiç Yorum Yapılmadı..

Yorum Yaz

PHP login system without using database

PHP,Programlama

25/07/2018 | Yorum Yok | 0 | Önder BAYGIN