Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost";
- $username = "root";
- $passwd = "";
- $dbname="municipio";
- try {
- $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $passwd);
- $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);}
- catch(PDOException $e)
- {
- echo "Connection failed: " . $e->getMessage();}
- if($_POST['tipoUser']== 'municipe'){
- $stmt = $conn->prepare("SELECT * FROM municipes WHERE user = :user AND password = :pass");
- $stmt->bindParam(':user', $_POST['user'], PDO::PARAM_STR);
- $stmt->bindParam(':pass', $_POST['password'], PDO::PARAM_STR);
- echo '<script type="text/javascript">alert("Nice Inteligente muni");</script>';}
- else{
- $stmt = $conn->prepare("SELECT * FROM funcionarios WHERE user = :user AND password = :pass");
- $stmt->bindParam(':user', $_POST['user'], PDO::PARAM_STR);
- $stmt->bindParam(':pass', $_POST['password'], PDO::PARAM_STR);
- echo '<script type="text/javascript">alert("Nice Inteligente func");</script>';}
- $stmt->execute();
- $obj=$stmt->fetchObject();
- if ($obj){
- echo '<script type="text/javascript">alert("Nice Inteligente");</script>';}
- $conn=null;
- ?>
Add Comment
Please, Sign In to add comment