项目作者: 7ife

项目描述 :
:: ChatBox :: pure php, SQLite database and without javascript
高级语言: PHP
项目地址: git://github.com/7ife/chat-box.git
创建时间: 2021-03-20T10:04:34Z
项目社区:https://github.com/7ife/chat-box

开源协议:GNU General Public License v3.0

下载


General Information:

This project is like a hobby for me. All knowledge from the Internet, do not judge strictly.

ChatBox

here is the list advantages:

  • Does not use Java scripts
  • Uses the SQLite database
  • You can use message approval
  • BBCode, Emojis and avatars
  • Beautiful adaptive design

Installation Instructions:

ChatBox can work on almost any hosting with php 5.5+. It will immediately start working when you upload it to your hosting.

You need to make changes, for chat management:

For correct operation, scripts it must be located in the chat-box directory.

For the folder admin_similar-to-password leave chmod 777, for all others recommend chmod 755


Change the name of the folder admin_similar-to-password to you own, so that no one guesses, this will be your admin panel, for additional protection, you can use HTTP Basic Authentication, also change the name in the files: index.php, /include/Display-ChatBox.php


in index.php: line 62
```php

if ( $_SERVER[‘REQUEST_METHOD’] == ‘POST’ && !$missing ) :
// No missing fields, update database
try {
// Open db connection
$db = new PDO(‘sqlite:admin_similar-to-password/ChatBox.sqlite’);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

  1. $datetime = date('Y-m-d h:i:s');
  1. in **Display-ChatBox.php**: line 6
  2. ```php
  3. <ul>
  4. <?php
  5. // Display ChatBox entries
  6. try {
  7. // Open db connection / create db and table if first time here
  8. $db = new PDO('sqlite:admin_similar-to-password/ChatBox.sqlite');
  9. // *************************************
  10. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

Do not close the file Display-ChatBox.php, edit the line 182 with the password for Admin:

  1. // Come up with a password(up to 18 characters) that is difficult to pick up; you will respond as an administrator by entering this password instead of your nickname
  2. $name = str_replace("pass-for-Admin","<span style=\"color:#800000;\">Admin <span class=\"glyphicon glyphicon-check\"></span></span>",$name);
  3. // **************************************
  4. // Uncomment the line and you will have the user Chess King
  5. // $name = str_replace("pass-for-ChessKing","<span style=\"color:#550066;\">Chess King <span class=\"glyphicon glyphicon-king\"></span></span>",$name);
  6. // **************************************
  7. // Uncomment the line and you will have the user Chess Queen
  8. // $name = str_replace("pass-for-Queen","<span style=\"color:#870044;\">Chess Queen <span class=\"glyphicon glyphicon-queen\"></span></span>",$name);

ibid in file Display-ChatBox.php line 160 Change the code to your own, for an interesting gif image:

  1. // ************* good site *************
  2. $message = str_replace("yoursite.com"," This is a good site, checked! <img src=\"./images/emoji/fs/halo.png\" height=\"23\"> ",$message);
  3. // *************************************
  4. // change this code to your liking, write it in Message
  5. $message = str_replace("CheatCode-for-f*ckOf"," <center><img src=\"./images/anonflay2.gif\" height=\"150\"></center> ",$message);
  6. // ************* BBCode *************
  7. $message = str_replace("[B]","<b>",$message); $message = str_replace("[/B]","</b>",$message);
  8. $message = str_replace("[I]","<i>",$message); $message = str_replace("[/I]","</i>",$message);

Starting with v2.4 Function Pagination has been added Demo

ibid in file Display-ChatBox.php line 17 Change the code to your own, number of chat messages per page:

  1. } else {
  2. $pg = 1;
  3. }
  4. $limit = 5; // number of chat messages per page
  5. $starting_limit = ($pg-1) * $limit;
  6. $previous_page = $pg - 1;
  7. $next_page = $pg + 1;
  8. $adjacents = "2";

That’s it, your ChatBox is ready, upload to your hosting.


How it should all look

Default version, watch: Demo

in the chat, there are several backgrounds:

  1. // Open db connection
  2. $db = new PDO('sqlite:admin_similar-to-password/ChatBox.sqlite');
  3. $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  4. $datetime = date('Y-m-d h:i:s');
  5. $time = date('h:i:s');
  6. $approved = 1; // set to 0 if prior approval required

```



Visits Badge

Top