Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/exercises/mysqlintro/kryptering/
admin.php
dbconnection.php
deletepost.php
hemlig.php
index.php
insertpost.php
lås.php
selectposts.php
updatepost.php
selectposts.php
49 lines UTF-8 Windows (CRLF)
<?php
session_start();
?>
<!-- selectposts.php -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Select</title>
</head>
<body>
<?php
include('dbconnection.php');
include('lås.php');
try {
//The SQL SELECT statement
$sql = "SELECT * FROM anvandareKrypt";
$stmt = $dbconn->prepare($sql);
$data = array();
$stmt->execute($data);
$output = "<table><caption>Registrerade användare:</caption>";
while ($res = $stmt->fetch(PDO::FETCH_ASSOC)) {
$output .= "<tr>".
"<td>".htmlentities($res['id'])."</td>".
"<td>".htmlentities($res['firstname'])."</td>".
"<td>".htmlentities($res['lastname'])."</td>".
"<td>".htmlentities($res['username'])."</td>".
"<td>".htmlentities($res['password'])."</td>".
"<td>".htmlentities($res['admin'])."</td>".
"<td>".htmlentities($res['reg_date'])."</td>".
"</tr>";
}
$output .= "</table>";
echo "$output";
}
catch(PDOException $e)
{
echo $sql . "<br />" . $e->getMessage();
}
$dbconn = null;
?>
<button onclick="window.location.href='admin.php'">Meny</button>
</body>
</html>