Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function mute(){
- echo "<!--";
- }
- function unmute() {
- echo "-->";
- }
- ?>
- <?php
- $file = fopen('pass.csv', 'r');
- while (!feof($file)) {
- $data[] = fgetcsv($file);
- }
- //echo (array_search('qwer', array($data)));
- $success = array_filter($data, 'filter_name_pass', ARRAY_FILTER_USE_BOTH);
- //print_r($data);
- fclose($file);
- ?>
- <?php
- function filter_name_pass($val)
- {
- return $val[0] == $_POST['username'] &&
- $val[1] == $_POST['password'];
- }
- ?>
- <?php // Not Logged in
- if ($success) mute();
- ?>
- <form method="POST", action="index.php">
- <label for="username">Username:</label>
- <input type="text" name="username">
- <br/>
- <label for="password">Password:</label>
- <input type="text" name="password">
- <br/>
- <input type="submit" name="submit">
- </form>
- <?php
- if ($success) unmute();
- ?>
- <?php // Logged in
- if (!$success) mute();
- ?>
- <h1>Login sukses!</h1>
- <h2>Halo, <? echo $_POST['username']; ?></h2>
- <?php
- if (!$success) unmute();
- ?>
Add Comment
Please, Sign In to add comment