Oilchange web software – panel/alarm – bootstrap5

طرح اولیه صفحه آلارم در پنل مدیریت نرم افزار خدمات تعویض روغن

https://www.oilchange.ir

HTML Source code:


<!doctype html>
<html lang="ar" dir="rtl" data-bs-theme="auto">
<head><script src="<?php echo base_url(); ?>adon/js/color-modes.js"></script>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="javid ahmadi - oilchange software">
    <meta name="generator" content="jeyoo">
    <title>مدیریت آلارم</title>
    <link href="<?php echo base_url(); ?>adon/css/bootstrap.rtl.min.css" rel="stylesheet" integrity="sha384-PJsj/BTMqILvmcej7ulplguok8ag4xFTPryRq8xevL7eBYSmpXKcbNVuy+P0RMgq" crossorigin="anonymous">
    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>adon/css/main.css">
    <!-- Favicons -->

    <meta name="theme-color" content="#fbd336">
    <!-- Custom styles for this template -->
    <link href="<?php echo base_url(); ?>adon/icon/font/bootstrap-icons.css" rel="stylesheet">
    <!-- Custom styles for this template -->
</head>
<body>
<main>
    <nav class="navbar">
        <div class="container-fluid">
            <a class="navbar-brand" href="<?php echo base_url();?>panel/alarm">مدیریت آلارم </a>
            <ul class="navbar-nav ms-auto">
                <li class="nav-item">
                    <a class="nav-link active" aria-current="page" href="<?php echo base_url();?>main/dashboard">
                        <i class="bi bi-arrow-return-right"></i>
                        بازگشت به داشبورد</a>
                </li>

            </ul>
        </div>

    </nav>

    <ul class="nav nav-tabs" id="myTab" role="tablist" style="margin-top: 20px;">
        <li class="nav-item" role="presentation">
            <button class="nav-link active" id="home-tab" data-bs-toggle="tab" data-bs-target="#home" type="button" role="tab" aria-controls="home" aria-selected="true">آلارم های فعال</button>
        </li>
        <li class="nav-item" role="presentation">
            <button class="nav-link" id="profile-tab" data-bs-toggle="tab" data-bs-target="#profile" type="button" role="tab" aria-controls="profile" aria-selected="false">نمودار ارسال</button>
        </li>
        <li class="nav-item" role="presentation">
            <button class="nav-link" id="contact-tab" data-bs-toggle="tab" data-bs-target="#contact" type="button" role="tab" aria-controls="contact" aria-selected="false">بازگشت مشتری</button>
        </li>
        <li class="nav-item" role="presentation">
            <button class="nav-link" id="archive-tab" data-bs-toggle="tab" data-bs-target="#archive" type="button" role="tab" aria-controls="archive" aria-selected="false">آرشیو</button>
        </li>
    </ul>
    <div class="tab-content" id="myTabContent">
        <div class="tab-pane fade show active" id="home" role="tabpanel" aria-labelledby="home-tab">
            <div class="table-responsive">
                <table class="table">
                    <thead>
                    <tr>
                        <th scope="col">کدآلارم</th>
                        <th scope="col">نام مشتری</th>
                        <th scope="col">خودرو</th>
                        <th scope="col">تاریخ آلارم</th>
                        <th scope="col">وضعیت</th>
                        <th scope="col"></th>
                    </tr>
                    </thead>
                    <tbody class="table-group-divider">
                    <tr>
                        <th scope="row">1000</th>
                        <td>صادق محمدی</td>
                        <td>۲۰۶ سفید</td>
                        <td>۱۴۰۲/۰۶/۲۰</td>

                        <td>
                            <span class="badge rounded-pill bg-success">در انتظار...</span>
                        </td>
                        <td>
                            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
                                Open
                            </button>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">2000</th>
                        <td>فرهادشایان</td>
                        <td>سمند</td>
                        <td>۱۴۰۲/۰۶/۳۰</td>

                        <td>
                            <span class="badge rounded-pill bg-success">پیامک ارسال شد.</span>
                        </td>
                        <td>
                            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
                                Open
                            </button>
                        </td>
                    </tr>
                    <tr>
                        <th scope="row">3000</th>
                        <td>سیماسیمین</td>
                        <td>@ریو</td>
                        <td>۱۴۰۲/۰۶/۳۰</td>

                        <td>
                            <span class="badge rounded-pill bg-success">خطا / </span>
                        </td>
                        <td>
                            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#myModal">
                                Open
                            </button>
                        </td>
                    </tr>
                    </tbody>
                </table>

            </div>

        </div>
        <div class="tab-pane fade" id="profile" role="tabpanel" aria-labelledby="profile-tab">...</div>
        <div class="tab-pane fade" id="contact" role="tabpanel" aria-labelledby="contact-tab">...</div>
        <div class="tab-pane fade" id="archive" role="tabpanel" aria-labelledby="archive-tab">...</div>
    </div>

    <div>
        <ul>
            <li>
                پیامک تحویل داده شد.
            </li>
            <li>
                خطا / پیامک به دست گیرنده نرسید.
            </li>
            <li>
                 امکان تماس و یا پیامک از گوشی سرویس کار
            </li>
            <li>
                امکان ارسال پیام از طریق واتساپ و تلگرام
            </li>
            <li>
                امکان کپی پیام / امکان تماس صوتی اعتبارسنجی
            </li>
        </ul>
    </div>
</main>



<!-- The Modal -->
<div class="modal" id="myModal">
    <div class="modal-dialog modal-fullscreen">
        <div class="modal-content">

            <!-- Modal Header -->
            <div class="modal-header">
                <h4 class="modal-title">لاگ</h4>
                <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
            </div>

            <!-- Modal body -->
            <div class="modal-body">
                <ul>
                    <li>
                        <span class="badge rounded-pill bg-primary">Primary</span>
                    </li>
                    <li>
                        <span class="badge rounded-pill bg-secondary">Secondary</span>
                    </li>
                </ul>


                <span class="badge rounded-pill bg-success">Success</span>
                <span class="badge rounded-pill bg-danger">Danger</span>
                <span class="badge rounded-pill bg-warning">Warning</span>
                <span class="badge rounded-pill bg-info">Info</span>
                <span class="badge rounded-pill bg-light">Light</span>
                <span class="badge rounded-pill bg-dark">Dark</span>
            </div>

            <!-- Modal footer -->
            <div class="modal-footer">
                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">بستن</button>
            </div>

        </div>
    </div>
</div>

<script src="<?php echo base_url(); ?>asset/jquery-3.5.1.min.js"></script>
<script src="<?php echo base_url(); ?>adon/js/bootstrap.bundle.min.js"></script>
<script src="<?php echo base_url(); ?>adon/js/chart.umd.min.js"></script>
</body>
</html>

MongoDB 5 on Ubuntu 20.04

Installing MongoDB on Ubuntu
01. Open the terminal and add the repository key of MongoDB to the apt keyring. We can do this by following commands. It will ask for a password:

wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add - 
02. Now, we will add the MangoDB repository to our repository list by editing in the system’s list of sources. To access the editor of the system’s list we open the source list:

sudo nano /etc/apt/sources.list.d/mongodb.list 
Add the following line in the file as shown in the image:

deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse

03. Update the apt repository and then install the Mongodb server packages.


sudo apt update 
sudo apt install mongodb-org 
This will install the MongoDB server on your system along with the required dependencies.

04. Now, start the MongoDB daemon using the systemctl utility. Also, enable the service to auto-start on system reboot.


sudo systemctl enable mongod 
sudo systemctl start mongod 
05. Once the service started successfully, check the service status by typing the following command.

sudo systemctl status mongod 
06. Type “mongo” command on terminal and run to connect to the mongo shell:

mongo 
That’s it, the MongoDB server is up and running on your system.

Enable Authorization in MongoDB
By default, anyone can access MongoDB and can make changes to it. To secure it we will enable user authentication on the MongoDB server. This will prevent anonymous access to the database server.

Login to the Mongo shell:

mongo 
We will type “use admin” in the mongo shell so now we are in its administration section.

use admin
Next, create a user account with admin privileges in MongoDB.

db.createUser(
  {
    user: "tecadmin",
    pwd: "Pa$$w0rd",
    roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
  }
)
Create Admin Account in MongoDB
Create Admin Account in MongoDB
Now exit the editor by pressing CTRL + C.

Next we need to enable security in MongoDB configuration file. Edit the mongo configuration file by using:

sudo nano /etc/mongod.conf 
The setting will be open and go to the “#security” section. Remove the “ # ” and type “authorization: enabled”.

MongoDB Enable Authorization
MongoDB Enable Authorization
Now exit by pressing CTRL + x, type “ y ” and press ENTER to exit by saving the file. Now restart the MongoDb and then check its status:

sudo systemctl restart mongod 
Now the database is secured, only admin users can access it by entering the set password. Use the following command to connect to the MongoDB server.

mongo -u tecadmin -p 
Output:

MongoDB shell version v5.0.2
Enter password:
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("0876c195-18dc-4e6c-a0c8-368364f10d03") }
MongoDB server version: 5.0.2
================
Warning: the "mongo" shell has been superseded by "mongosh",
which delivers improved usability and compatibility.The "mongo" shell has been deprecated and will be removed in
an upcoming release.
We recommend you begin using "mongosh".
For installation instructions, see
https://docs.mongodb.com/mongodb-shell/install/
================
>
Conclusion
If we are doing a startup project and you know you have to make a lot of changes then MongoDB is the best database to work with as compared to conventional databases. In this article, we learned about MongoDB and how we can install and secure MongoDB on Ubuntu 20.04.

How To Install Node.js on Ubuntu 20.04

sudo apt update

Option 3 — Installing Node Using the Node Version Manager
Another way of installing Node.js that is particularly flexible is to use nvm, the Node Version Manager. This piece of software allows you to install and maintain many different independent versions of Node.js, and their associated Node packages, at the same time.

To install NVM on your Ubuntu 20.04 machine, visit the project’s GitHub page. Copy the curl command from the README file that displays on the main page. This will get you the most recent version of the installation script.

Before piping the command through to bash, it is always a good idea to audit the script to make sure it isn’t doing anything you don’t agree with. You can do that by removing the | bash segment at the end of the curl command:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh
Review the script and make sure you are comfortable with the changes it is making. When you are satisfied, run the command again with | bash appended at the end. The URL you use will change depending on the latest version of nvm, but as of right now, the script can be downloaded and executed with the following:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
This will install the nvm script to your user account. To use it, you must first source your .bashrc file:

source ~/.bashrc
Now, you can ask NVM which versions of Node are available:

nvm list-remote
Output
. . .
        v18.0.0
        v18.1.0
        v18.2.0
        v18.3.0
        v18.4.0
        v18.5.0
        v18.6.0
        v18.7.0
        v18.8.0
        v18.9.0
        v18.9.1
       v18.10.0
       v18.11.0
       v18.12.0   (LTS: Hydrogen)
       v18.12.1   (LTS: Hydrogen)
       v18.13.0   (Latest LTS: Hydrogen)
        v19.0.0
        v19.0.1
        v19.1.0
        v19.2.0
        v19.3.0
        v19.4.0
It’s a very long list. You can install a version of Node by writing in any of the release versions listed. For instance, to get version v14.10.0, you can run:

nvm install v14.10.0
You can view the different versions you have installed by listing them:

nvm list
Output
->     v14.10.0
       v14.21.2
default -> v14.10.0
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v14.21.2) (default)
stable -> 14.21 (-> v14.21.2) (default)
. . .
This shows the currently active version on the first line (-> v14.10.0), followed by some named aliases and the versions that those aliases point to.

Note: if you also have a version of Node.js installed through apt, you may receive a system entry here. You can always activate the system-installed version of Node using nvm use system.

Additionally, there are aliases for the various long-term support (or LTS) releases of Node:

Output
lts/* -> lts/hydrogen (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.24.1 (-> N/A)
lts/erbium -> v12.22.12 (-> N/A)
lts/fermium -> v14.21.2
lts/gallium -> v16.19.0 (-> N/A)
lts/hydrogen -> v18.13.0 (-> N/A)
You can install a release based on these aliases as well. For instance, to install the latest long-term support version, hydrogen, run the following:

nvm install lts/hydrogen
Output
Downloading and installing node v18.13.0...
. . .
Now using node v18.13.0 (npm v8.19.3)
You can switch between installed versions with nvm use:

nvm use v14.10.0
Output
Now using node v14.10.0 (npm v6.14.8)
```

You can verify that the install was successful using the same technique from the other sections:

```command
node -v
Output
v14.10.0
The correct version of Node is installed on your machine as expected. A compatible version of npm is also available.

Removing Node.js
You can uninstall Node.js using apt or nvm, depending on how it was installed. To remove the version from the system repositories, use apt remove:

sudo apt remove nodejs
By default, apt remove retains any local configuration files that were created since installation. If you don’t want to save the configuration files for later use, use apt purge:

sudo apt purge nodejs
To uninstall a version of Node.js that you installed using nvm, first determine whether it is the current active version:

nvm current
If the version you are targeting is not the current active version, you can run:

nvm uninstall node_version
Output
Uninstalled node node_version
This command will uninstall the selected version of Node.js.

If the version you would like to remove is the current active version, you first need to deactivate nvm to enable your changes:

nvm deactivate
Now you can uninstall the current version using the uninstall command used previously. This removes all files associated with the targeted version of Node.js.

How to Auto-Update WordPress Without FTP

In some cases, you are not able to update/upgrade your WordPress and plugins to a newer version without providing your FTP connection information. This is a common issue whereby the WordPress system can’t write to your /wp-content folder directly.

To solve this issue you need to define the FTP details in your wp-config.php file so WordPress will remember it. Alternatively, you may also provide WordPress with write access to your /wp-content folder by accessing the FTP root file and changing the folder file permission (CHMOD) to 775 rather than the default 755 and 644.

There is however an easier way to deal with this; by defining constantFS_METHOD in your wp-config.php file. This bypasses WordPress’s recurring prompts, and allows auto-updates of your files to happen. And it takes only 1 line of code to do this.

1. Open /wp-config.php

Now the first thing you need to do is to open the wp-config.php file from your WordPress root folder (you may access this file from your WordPress installer folder). From the installation folder, the file is located at wordpress/wp-config.php

2. Insert FS_METHOD

Paste the following code to your wp-config.php file, preferably just below every other line of code.

define('FS_METHOD','direct');

3. Save and upload

When you have already pasted the one-line code, you can proceed to upload the file to your WordPress root folder on your server, and it should work right away. Uploading can be done directly from your host control panel.

Conclusion

The FTP issue normally happens when you are on shared hosting and when WordPress is having a conflict with permissions and ownerships. With this ‘direct’ method implemented, you will be able to update or upgrade your WordPress and plugins installations to newer versions without having to provide any FTP details.

Nginx server block port 80

server {

	listen 80;
	listen [::]:80;
	root /var/www/slimsink.com/html;
	index index.html index.htm index.php;
	server_name slimsink.com www.slimsink.com;
	location / {
        	try_files $uri $uri/ /index.php$is_args$args;
	}
}

NGINX UBUNTU TERMINAL

NGINX:
$ sudo nginx -t
$ sudo systemctl restart Nginx
$ sudo systemctl status Nginx
$ sudo systemctl stop nginx
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
4. To check the version of Nginx, run:
$ sudo dpkg -l nginx
14. To automatically start Nginx on boot or a reboot run:
$ sudo systemctl enable nginx
15. If you want to restart the webserver especially after making changes to the configuration files, run:
$ sudo systemctl restart nginx
16. Alternatively, you can reload to avoid dropping connections as shown.
$ sudo systemctl reload nginx
FIREWALL:
$ sudo ufw enable
$ sudo ufw allow 'Nginx HTTP'
$ sudo ufw reload
$ sudo ufw status
$ sudo ufw app list

@moshkel session php dar nginx
chmod -R 777 /var/lib/php/session