キケッツ掲示板のリポジトリです. https://bbs.kekec.wiki
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

make_thread.php 1.8 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require "${_SERVER['DOCUMENT_ROOT']}/database.php";
  3. if (!(empty ($_POST['thread-name'])))
  4. {
  5. $explain = '<p>' . $_POST['thread-explain'] . '</p>';
  6. $explain = str_replace ("\n", '</p><p>', $explain);
  7. $mysqli = set_mysql ('miteruzo_bbs');
  8. $mysqli -> set_charset ('utf8');
  9. $result = $mysqli -> query ('SELECT COUNT(*) FROM threads');
  10. $row = $result -> fetch_assoc ();
  11. $current = $row['COUNT(*)'];
  12. $result -> close ();
  13. $sql = "INSERT INTO threads (id, title, `explain`, latest, length) VALUES ($current, '{$_POST['thread-name']}', '$explain', '" . date ('Y-m-d H:i:s') . "', 0)";
  14. $mysqli -> query ($sql);
  15. /* $sql = "CREATE TABLE `miteruzo_bbs`.`thread_$current` (
  16. `id` INT( 11 ) NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'レス番',
  17. `name` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '名なしさん' COMMENT '名前',
  18. `message` MEDIUMTEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'レス',
  19. `date` DATETIME NOT NULL COMMENT '投稿日時',
  20. `image` VARCHAR( 31 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '画像 URL',
  21. `held` TINYINT( 1 ) NOT NULL DEFAULT '0' COMMENT '保留',
  22. `deleted` TINYINT( 1 ) NOT NULL DEFAULT '0' COMMENT '削除済',
  23. `pass` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '削除用パスワード',
  24. `good` INT( 11 ) NOT NULL DEFAULT '0' COMMENT '高評価数',
  25. `bad` INT( 11 ) NOT NULL DEFAULT '0' COMMENT '低評価数',
  26. INDEX ( `date` )
  27. ) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_general_ci"; */
  28. $mysqli -> query ($sql);
  29. $mysqli -> close ();
  30. }
  31. header ("location: ./?thread=$current");