0
<?php
// check for minimum PHP version
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
exit('Sorry, this script does not run on a PHP version smaller than 5.3.7 !');
} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {
// if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php
// (this library adds the PHP 5.5 password hashing functions to older versions of PHP)
require_once('libraries/password_compatibility_library.php');
}
// include the config
require_once('config/config.php');
// include the to-be-used language, english by default. feel free to translate your project and include something else
require_once('translations/en.php');
// include the PHPMailer library
require_once('libraries/PHPMailer.php');
// load the login class
require_once('classes/Login.php');
// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process.
$login = new Login();
// ... ask if we are logged in here:
if ($login->isUserLoggedIn() == true) {
// the user is logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are logged in" view.
include("views/index1.php");
} else {
// the user is not logged in. you can do whatever you want here.
// for demonstration purposes, we simply show the "you are not logged in" view.
include("views/not_logged_in.php");
}
我想將這個.php腳本添加到HTML網頁中。我和一個好友設法與我們下載的.php登錄腳本一起獲取數據庫。我們的數據庫與我們的.php一起工作,允許新用戶唱歌和登錄。此外還通過SMTP驗證電子郵件。 Ebery的工作正常,但我們的問題是,當人們去登錄頁面時,它只是一個帶有用戶名和密碼框的白頁。我們希望採用我們的網頁模板,並將其用作我們的後臺登錄(這樣它就可以和網站的其他部分保持一致),我們只需要登錄頁面,註冊和所有其他.php文件匹配我們的網站。我如何將這個php腳本添加到我的.html頁面
它只有一個普通的白色屏幕,1個用戶名框和1個密碼框和一個提交按鈕。謝謝。
我被告知.css會有所幫助。我整個網站都使用style.css文件來爲HTML頁面提供外觀。有沒有什麼辦法可以讓.php頁面的工作呢?再次,謝謝。
所以我可以把.php文件作爲一個.php文件,但是在它的腳本中,只要它不在PHP腳本中,我就可以添加HTML腳本。 – user3335963
正確。你也可以把你的腳本放在一個單獨的文件中,並在HTML中使用'<?php include(「myLoginScript.php」)?>。一些網絡服務器將要求你的PHP文件實際上有.php擴展名。 –
當我添加「include(」myLoginScript.php「)?>」到我的html文件它不起作用,它沒有拉起用戶登錄屏幕。 – user3335963