Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $xml = simplexml_load_file('users.xml');
- $usr = $_POST['username'];
- $pass = $_POST['pass'];
- if(empty($usr)) {
- die('Please enter an username!');
- } elseif(empty($pass)) {
- die('Please enter a password!');
- }
- $l_usr = null;
- $pass_e = md5($pass);
- foreach($xml->user->username as $username) {
- if($username == $usr) {
- $l_usr = $username;
- }
- }
- if(empty($l_usr)) {
- die('User Not Found!');
- }
- if(!$xml->user->$l_usr->password == $pass_e) {
- die('Wrong Password!!');
- }
- echo 'Hello, '.$l_usr;
- <users>
- <user>
- <username>doruk.ayar</username>
- <password>96b9c62c86f35c209c5b8c302ba34175</password>
- </user>
- <user>
- <username>mina.alpturer</username>
- <password>32250170a0dca92d53ec9624f336ca24</password>
- </user>
- <user>
- <username>efe.gormus</username>
- <password>32250170a0dca92d53ec9624f336ca24</password>
- </user>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement