Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- echo 'Bem vindo, '.$_SESSION['username'];
- ?>
- <br /><a href='logout.php'>Logout</a>
- <?php
- if(isset($_POST["button"])){
- $hostname='localhost';
- $username='root';
- $password='';
- try {
- $dbh = new PDO("mysql:host=$hostname;dbname=projeto",$username,$password);
- $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // <== add this line
- $del = "DELETE FROM tbl_users WHERE id =".$_SESSION['id'];
- if ($dbh->query($sql)) {
- echo "<script type= 'text/javascript'>alert('Conta deletada com sucesso'); </script>";
- }
- else{
- echo "<script type= 'text/javascript'>alert('Falha');</script>";
- }
- $dbh = null;
- }
- catch(PDOException $e)
- {
- echo $e->getMessage();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement