I just installed a script for logins with all the bells and whistles but I can't get past this error when on the login.php page:
PHP Parse error: syntax error, unexpected T_STRING in D:\webs\website\login\settings.php on line 70
I'll supply the code for both login.php and settings.php
login.php
<?php
require_once ( 'settings.php' );
if ( array_key_exists ( '_submit_check', $_POST ) )
{
if ( $_POST['username'] != '' && $_POST['password'] != '' )
{
$query = 'SELECT ID, Username, Active, Password FROM ' . DBPREFIX . 'users WHERE Username = ' . $db->qstr ( $_POST['username'] ) . ' AND Password = ' . $db->qstr ( md5 ( $_POST['password'] ) );
if ( $db->RecordCount ( $query ) == 1 )
{
$row = $db->getRow ( $query );
if ( $row->Active == 1 )
{
set_login_sessions ( $row->ID, $row->Password, ( $_POST['remember'] ) ? TRUE : FALSE );
header ( "Location: " . REDIRECT_AFTER_LOGIN );
}
elseif ( $row->Active == 0 ) {
$error = 'Your membership was not activated. Please open the email that we sent and click on the activation link.';
}
elseif ( $row->Active == 2 ) {
$error = 'You are suspended!';
}
}
else {
$error = 'Login failed!';
}
}
else {
$error = 'Please use both your username and password to access your account';
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>roScripts.com - PHP Login System With Admin Features</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="log">
<?php if ( isset( $error ) ) { echo ' <p class="error">' . $error . '</p>' . "\n";}?>
</div>
<div id="container" style="width:230px;">
<form class="form" action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="hidden" name="_submit_check" value="1"/>
<div style="margin-top:12px; margin-bottom:10px">
<img src="images/username.gif" alt="username" border="0" />
<input class="input" type="text" name="username" id="username" size="25" maxlength="40" value="" />
</div>
<div style="margin-bottom:6px">
<img src="images/password.gif" alt="password" border="0" />
<input class="input" type="password" name="password" id="password" size="25" maxlength="32" />
</div>
<?php if ( ALLOW_REMEMBER_ME ):?>
<div style="margin-bottom:6px">
<input type="checkbox" name="remember" id="remember" />
<label for="remember">Remember me</label>
</div>
<?php endif;?>
<input type="image" name="Login" value="Login" class="submit-btn" src="images/btn.gif" alt="submit" title="submit" />
<br class="clear" />
<a href="register.php">Register</a> / <a href="forgot_password.php">Password recovery?</a>
</form>
<!--
Keeping the link below not only gives respect to the large amount of time given freely by me
but also helps build interest, traffic and use of this script. It's not required but
recommended since it also might affect my support priorities on the forums.
Thank you, Mihalcea Romeo - roScripts.com
// -->
<?=powered_by ()?>
</div>
</body>
</html>
settings.php
<?php
require ( 'lib/connection.php' ); // - the connection class needed to operate with mysql
require ( 'functions.php' ); // - the functions
/*
|---------------------------------------------------------------
| SYSTEM VARIABLES
|---------------------------------------------------------------
|
| System variables needed by the application
|
*/
define ( "HOSTNAME", "host" ); // - hostname - nedded to access the database
define ( "DATABASE", "userdatabase" ); // - database name - the name of your mysql database
define ( "DBUSER", "useruser" ); // - database user - what user should we use to access the database
define ( "DBPASS", "omgpassword" ); // - database password - what password should we use to access the database
define ( "DBPREFIX", "logintest_" ); // - db prefix - would you like to use a prefix for your table?
define ( "APPLICATION_URL", "http://www.website.com/login/" );// - app. url - the url that points to our application ( ! with trailing slash )
define ( "APPLICATION_FOLDER", "login" ); // - do we have a folder where we store our scripts? ( ! no slashes )
define ( "REDIRECT_TO_LOGIN", "http://www.website.com" ); // - where should we redirect visitors if the access is restricted?
define ( "REDIRECT_AFTER_LOGIN", "http://www.website.com" ); // - where should we redirect members after logging in?
define ( "REDIRECT_ON_LOGOUT", "http://www.website.com" ); // - where should we redirect on logout?
define ( "ADMIN_EMAIL", "email@hotmail.com" ); // - what email should we use to contact our members?
define ( "KEEP_LOGGED_IN_FOR", 60*60*24*100 ); // - if they chose to be remembered, how long should the cookies remain active ( default is 100 days )
define ( "COOKIE_PATH", "/" ); // - where should the cookies be active ( '/' means the whole domain. )
define ( "DOMAIN_NAME", "WebSite" ); // - the domain name that we use
define ( "RUN_ON_DEVELOPMENT", FALSE ); // - TRUE if you wish to see the nasty errors for debugging, FALSE to hide them
define ( "REDIRECT_AFTER_CONFIRMATION", TRUE ); // - TRUE if you want to redirect your users to the members page after they confirm their membership
define ( "ALLOW_USERNAME_CHANGE", FALSE ); // - do we let our members update their usernames as well? ( FALSE stands for no )
define ( "ALLOW_REMEMBER_ME", TRUE ); // - do we let our members use the "remember me" feature
/*
|---------------------------------------------------------------
| EMAILING VARIABLES
|---------------------------------------------------------------
|
| Emailing variables needed by phpmailer
|
*/
define ( "USE_SMTP", FALSE ); // - do you want to use SMTP to send out emails? TRUE or FALSE ( mail() will be used )
define ( "SMTP_PORT", "" ); // - what port should we use for smtp ( only needed if SMTP is set to TRUE )
define ( "SMTP_HOST", "" ); // - what host should we use for smtp ( only needed if SMTP is set to TRUE )
define ( "SMTP_USER", "" ); // - what user should we use for smtp ( only needed if SMTP is set to TRUE )
define ( "SMTP_PASS", "" ); // - what password should we use for smtp (only needed if SMTP is set to TRUE)
define ( "MAIL_IS_HTML", TRUE ); // - send emails as html or text? ( TRUE for html and FALSE for text )
############################################################# DON'T EDIT BELOW THIS LINE ########################################
/*
|---------------------------------------------------------------
| SET THE SERVER PATH
|---------------------------------------------------------------
|
| Let's attempt to determine the full-server path to the "system"
| folder in order to reduce the possibility of path problems.
|
*/
if ( function_exists ( 'realpath' ) AND @realpath ( dirname (__FILE__) ) !== FALSE )
{
define ( "BASE_PATH", str_replace ( "\", "/", realpath ( dirname(__FILE__) ) ) . '/' );
}
//how do we handle errors
error_reporting ( ( RUN_ON_DEVELOPMENT ) ? E_ALL : E_WARNING );
if ( file_exists ( BASE_PATH . 'install.php' ) )
{
die ( "Please delete install.php from your server before continuing!" );
}
$db = new db ( DBUSER, DBPASS, DATABASE, HOSTNAME ); // - and away we go
?>
It seems that something in here goes wrong in settings.php:
{
define ( "BASE_PATH", str_replace ( "\", "/", realpath ( dirname(__FILE__) ) ) . '/' );
}