Untitled
unknown
plain_text
2 years ago
556 B
3
Indexable
<?php session_start(); $userName = $_POST["username"]; $userPass = $_POST["pass"]; $file = file_get_contents("users.json"); $users = json_decode($file, true); $loging = false; for ($i = 0; $i < count($users); $i++) { if ($users[$i]["username"] == $userName && $users[$i]['password'] == $userPass) { $_SESSION['user_id'] = $users[$i]["id"]; $loging = true; header("location:../destination"); } } if (!$loging) // echo "Username or password is invalid"; header("location:../login.php?log=false");
Editor is loading...