2014-02-22 34 views
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页面的工作呢?再次,谢谢。

回答

1

您可以在<?php?>标签之外包含HTML。使用HTML根据自己的喜好设置页面的样式。

+0

所以我可以把.php文件作为一个.php文件,但是在它的脚本中,只要它不在PHP脚本中,我就可以添加HTML脚本。 – user3335963

+0

正确。你也可以把你的脚本放在一个单独的文件中,并在HTML中使用'<?php include(“myLoginScript.php”)?>。一些网络服务器将要求你的PHP文件实际上有.php扩展名。 –

+0

当我添加“include(”myLoginScript.php“)?>”到我的html文件它不起作用,它没有拉起用户登录屏幕。 – user3335963

相关问题