12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?php
- include 'config.php';
- $sql = "CREATE TABLE Images (
- Link TEXT NOT NULL,
- Unlocked TINYINT(1) NOT NULL,
- Uploader INT(11) NOT NULL,
- License TEXT NOT NULL DEFAULT 'CC BY SA 4.0',
- Alt TEXT NOT NULL,
- ID INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY
- )";
- if ($conn->query($sql) === TRUE) {
- echo "Success!";
- } else {
- echo "Error creating table: " . $conn->error;
- }
- $sql = "CREATE TABLE Log (
- User TEXT NOT NULL,
- IP TEXT NOT NULL,
- Input LONGTEXT NOT NULL,
- Date INT(11) NOT NULL,
- ID INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY
- )";
- if ($conn->query($sql) === TRUE) {
- echo "Success! 2";
- } else {
- echo "Error creating table: " . $conn->error;
- }
- $sql = "CREATE TABLE stor (
- Name TEXT NOT NULL,
- Text LONGTEXT NOT NULL,
- Options TEXT NOT NULL,
- Description TEXT NOT NULL,
- Image INT(11) NOT NULL,
- Owner INT(11) NOT NULL,
- Open INT(11) NOT NULL,
- RefID BIGINT NOT NULL,
- OpenAddLinks TINYINT(4) NOT NULL,
- OpenRemoveLinks TINYINT(4) NOT NULL,
- OpenImage TINYINT(4) NOT NULL,
- ID INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY
- )";
- if ($conn->query($sql) === TRUE) {
- echo "Success! 3";
- } else {
- echo "Error creating table: " . $conn->error;
- }
- $sql = "CREATE TABLE Stories (
- ID INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY,
- Title TEXT NOT NULL,
- Opener BIGINT NOT NULL,
- Description TEXT NOT NULL,
- Owner INT(11) NOT NULL
- )";
- if ($conn->query($sql) === TRUE) {
- echo "Success! 4";
- } else {
- echo "Error creating table: " . $conn->error;
- }
- $sql = "CREATE TABLE Users (
- Name TEXT NOT NULL,
- Password TEXT NOT NULL,
- Level INT(11) NOT NULL,
- ID INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY
- )";
- if ($conn->query($sql) === TRUE) {
- echo "Success! 2";
- } else {
- echo "Error creating table: " . $conn->error;
- }
- $sql = "INSERT INTO Users (Name, Password, Level) VALUES (?, ?, ?)";
- $stmt = $conn->prepare($sql);
- $in1="root";
- $PW=bin2hex(openssl_random_pseudo_bytes(4));
- $in2=password_hash($PW, PASSWORD_DEFAULT);
- $in3='3';
- $stmt->bind_param("ssi", $in1, $in2, $in3);
- $stmt->execute();
- echo "<br><br> Admin account created: Name: root, PW: " . $PW;
- ?>
|