Show sourcecode
The following files exists in this folder. Click to view.
webbserverprogrammering/projekt/snake_oil_seller/
about_us.php
admin.php
contact.php
create_products
createtable.php
css/
dbconnection.php
deletepost.php
deletetable.php
entry.php
header.php
insertposts.php
js/
leaderboard.php
log_in.php
log_out.php
main.php
my_account.php
php/
question_maker.php
quiz_form.php
quiz_list.php
quiz_maker.php
result.php
selectposts.php
shop.php
shopping_cart.php
sign_in.php
snake_oil.css
style.js
title_card.php
updateposts.php
user_verified.php
verify_page.php
createtable.php
41 lines UTF-8 Windows (CRLF)
<!-- createtable.php -->
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Create table</title>
</head>
<body>
<?php
include ('dbconnection.php');
// Skapar tabell för användare
try {
// sql to create table
$sql = "CREATE TABLE snake_oil_seller (
id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(30) NOT NULL,
email VARCHAR(100),
password VARCHAR(255) NOT NULL,
usertype ENUM('user', 'admin') NOT NULL DEFAULT 'user',
is_verified ENUM('yes', 'no') NOT NULL DEFAULT 'no',
reg_date DATETIME
)";
// use exec() because no results are returned
$dbconn->exec($sql);
echo "Table created successfully";
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
//Rensa kopplingen till databasen
$dbconn = null;
?>
</body>
</html>