Menu Home

creamgod45 / WTDB_PHP

一、專案說明

專案名稱:無線二維條碼取餐APP (WTDB) Wireless two-dimensional barcode app

專案版本:ver.2.2.0

專案語言:HTML5、CSS3、JavaScript、JSON、PHP、XML、Java

專案軟體:Android Studio、Visual Studio Code

專案套件:PHP QrCode、Font awesome、Bootstrap、Jquery

開源網站:傳送門

檔案下載:傳送門

DEMO 網站:已失效

二、事前須知

  在大多數賣場、美食街會有小吃店或攤販採用無線取餐器,一但要取餐都會開始發出聲音或是震動來提醒客人取餐,雖然方便好用,但維護的成本很高。而如果改用賣場所推出的餐廳服務功能APP來通知,如此可以省下大量的維護成本,也不需要擔心設備被偷走。

  • 專案版本限制
    • PHP Version : 7.0 ↑
    • Android OS Version : 7.0 ↑
    • MySQL Database Version : 無限制 ↑
      • host:localhost
      • username:root
      • password:(null)
      • database_name:appmarket
    • Android Studio Version : 3.5 ↑

三、部屬操作

一、尋找免費網站架設服務

  參考網址:https://www.kocpc.com.tw/archives/5935

二、設定文件

文件位置:/lib/conn.php

<?php 
    class conn {
        
        /**
         * MySQL Connect to DataBase
         * 連接到資料庫
         * @access private
         * @return Array
         */
        public function connent(){
            @$mysqli = mysqli_connect("資料庫位置", "帳號", "密碼", "資料庫名稱");
            if (@$mysqli->connect_error) {
                die("Connection failed: " . $mysqli->connect_error);
                exit;
            }            
            @mysqli_set_charset($mysqli,"utf8");
            return $mysqli;
        }

        /**
         * ### @package: 套件所屬 AUTH 
         * ### Test plugins loading success
         * #### 測試套件載入成功 
         */
        public function test(){
            return true;
        }
    }
?>

文件位置:/mailer.php

使用 google 使用者 發送信件:傳送門

cPanel 電子郵件帳號:

  1. 建立電子郵件帳戶
  2. 點擊 Connect Devices (圖 1)
  3. 檢視 SMTP 服務資訊 (圖 2)
圖 1
圖二
<?php

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;

require 'vendor/autoload.php';

$mail = new PHPMailer(true);

try {
    //Server settings
    $mail->isSMTP();                     // DEBUG INFO
    $mail->SMTPDebug  = SMTP::DEBUG_OFF; // 設置 SMTP DEBUG 訊息
    $mail->Host       = 'SMTP 位置';     // 設置 SMTP 服务器进行发送
    $mail->SMTPAuth   = true;            // 設置 SMTP 授權
    $mail->CharSet    = 'UTF-8';         // 設置 SMTP 轉碼至 UTF8
    $mail->Username   = "帳號";          // 設置 SMTP 帳號
    $mail->Password   = "密碼";          // 設置 SMTP 密碼
    $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; 
                                         // 設置 SMTP 安全協定
    $mail->Port       = 587;             // 設置 SMTP TCP 端口
    
    $mail->setFrom("接收人", $FORM);
    $mail->addAddress($email, $nickname);
    $mail->isHTML(true);
    $mail->Subject = $SUBJECT;
    $mail->Body    = $HTML;
    $mail->AltBody = $ALTHTML;

    $query = $mail->send();
    
    if($query){
        echo 'Message has been sent';
    }
} catch (Exception $e) {
    echo "\nMessage could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
?>

文件位置:/.htaccess (Apache engine)

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php [L]
</IfModule>

文件位置:/.htaccess (Litespeed)

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
</IfModule>

Categories: 開發

Tagged as:

creamgod45

發佈留言