Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/projekt/quiz/
createtable.php
dbconnection.php
deletepost.php
deletetable.php
insertdefaultposts.php
insertposts.php
leaderboard.php
log_in.php
log_out.php
main.php
question_maker.php
quiz_form.php
quiz_list.php
quiz_maker.php
result.php
selectposts.php
sign_in.php
style.js
updateposts.php
dbconnection.php
19 lines ASCII Windows (CRLF)
<!-- dbconnection.php -->
<?php
$dbname = 'mindatabas';
$hostname = 'localhost';
$/* DB_USER, is removed and hidden for security reasons */ ;
$/* DB_PASSWORD, is removed and hidden for security reasons */ ;
$options = array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'");
try {
$dbconn = new PDO("mysql:host=$hostname;dbname=$dbname", $/* DB_USER, is removed and hidden for security reasons */ ;
$dbconn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/*** echo a message saying we have connected ***/
} catch(PDOException $e){
// For debug purpose, shows all connection details
echo 'Connection failed: '.$e->getMessage()."<br />";
// Hide connection details.
//echo 'Could not connect to database.<br />');
}
?>