Last active
February 13, 2017 19:48
-
-
Save brun0xff/b27f90d21b864b6062f49bfe16245c12 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(isset($_COOKIE["count"])) { | |
$count = $_COOKIE["count"]; | |
$count++; | |
setcookie("count", $count, time() + 600); | |
} else { | |
$count = 0; | |
setcookie("count", $count, time() + 600); | |
} | |
?> <html> | |
<head> | |
<title>Uso de Cookies</title> | |
</head> | |
<body> | |
<h1><?php echo $count; ?></h1> | |
</body> | |
</html> | |
<?php | |
$login = $_POST["login"]; | |
$senha = $_POST["senha"]; | |
try{ | |
$conn = new PDO("mysql:host=localhost;dbname=teste", $login, $senha); | |
$conn-exec("set names utf8"); | |
$stmt = $conn->prepare('SELECT * FROM user WHERE login=:login'); | |
$stmt->bindValue(":login" , $_POST['login']); | |
$stmt->execute(); | |
$stmt = $conn->prepare('SELECT username FROM user WHERE id_curso=1); | |
$stmt->execute(); | |
while($row = #stmt->fetch(PDO::FETCH_OBJ)){ | |
print(row->username . "<br />"); | |
} | |
} catch(PDOException $e){ | |
echo $e->getMessage(); | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment