Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <meta charset="utf-8">
- </head>
- <?php
- if(isset($_POST['send']))
- {
- $servername = "localhost";
- $username = "root";
- $password = "";
- $dbname = "maturitka";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
- $stmt = $conn->prepare("SELECT id FROM user where login=:login and pass=:pass");
- $stmt->bindParam(':login', $_POST['login']);
- $stmt->bindParam(':pass', $_POST['pass']);
- $stmt->execute();
- if($stmt->rowCount() > 0)
- {
- echo "logged";
- }
- else
- {
- echo "not logged";
- }
- }
- catch(PDOException $e) {
- echo "Error: " . $e->getMessage();
- }
- $conn = null;
- }
- ?>
- <body>
- <form method="post" action>
- <input type="text" name="login" placeholder="login">
- <input type="text" name="pass" placeholder="pass">
- <input type="submit" name="send" value="odeslat">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement