Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('connection.php');
- $username = $_POST['user'];
- $password = $_POST['pass'];
- $id = '';
- try{
- $parancs = $dbh->prepare("select * from users where username = :username and password = :password and id = :id");
- $parancs->bindParam(':username', $username, PDO::PARAM_STR,strlen($username));
- $parancs->bindParam(':password', $password, PDO::PARAM_STR,strlen($password));
- $parancs->bindParam(':id', $id, PDO::PARAM_STR,strlen($id));
- $parancs->execute();
- }
- catch (PDOException $e){
- echo 'Hiba' . $e->getMessage();
- }
- $row = $parancs->fetch(PDO::FETCH_ASSOC);
- if ($row['username'] == $username && $row['password'] == $password ){
- echo "Login success!! Welcome ".$row['username'];
- header("Location: home.php");
- } else {
- echo "Failed to login!";
- }
- $parancs=null;
- $dbh=null;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement