We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,106 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Parse error: syntax error, unexpected T_STRING

Hi

I am really struggling here and cant see the syntax error.

It is probably a " but could really do with a hand as to why I get the error:

unsxpected T_STRING on line 14

My php code is as follows:

<?php
 
include_once("php/library/lib.php");
include_once("php/library/template.php");
include_once("php/library/database.php");
 
 
//
//$database = new database();//$security = new security();//$security->allowed_get("PHPSESSID");//$security->check_vars(false);//
$page = new template( "index.html" );
//$page->lockToLoggedIn = false;
//$security->set_counters(page);//$page->setRegionVisable("lines",true);// Build the actual page contents display
//$pageDtls = '<table cellpadding=0 cellspacing=0 border=0>';//$pageDtls .= '<tr><td>';//$pageDtls .= '<?region-start id="lines" type="repeat" ?>';//$pageDtls .= '<center>';//$pageDtls .= '<table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1">';//$pageDtls .= '<tr>';
//$pageDtls = '<table cellpadding=0 cellspacing=0 border=0><tr><td><?region-start id="lines" type="repeat" ?><center><table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1"><tr>';
//
//$img_width = 85;//$img_height = 30;
// Build a grid of ALL cells
//for ( $cat_set = 1 ; $cat_set < (MAX_CATS + 1); $cat_set ++ )//{// $categories = array();// $cat_hdrs = array();//
//// // Find all Categories for the current set//// $sqlQry = "SELECT *// FROM categories// WHERE cat_set_no = " . $cat_set . "// ORDER BY cat_pos_no";//
// $result = $database->runQuery( $sqlQry );// $rows = $database->numRows();//
// for ($a = 0 ; $a < $rows ; $a ++ )// {// $catObj = $database->getObject();//// $categories[$catObj->cat_pos_no -1] = $catObj->cat_id;// $cat_hdrs[$catObj->cat_pos_no -1] = $catObj->cat_name;// }////
// // Set the category headers//// for ( $cat_no = 0 ; $cat_no < 10; $cat_no ++ )// {// $pageDtls .= '<td id="hdrCell" valign="top">' . $cat_hdrs[$cat_no] . '</td>';// $pageDtls .= '<td id="spaceCell">&nbsp;</td>';// }////// $pageDtls .= '</tr>';// $pageDtls .= '<?repeat-line-start?>';//
// // Set Cell Details//
// for ( $line_no = 1 ; $line_no < (MAX_ROWS + 1); $line_no ++ )// {// $pageDtls .= '<tr>';//
// for ( $cat_no = 0 ; $cat_no < 10; $cat_no ++ )// {// $pageDtls .= '<td id="singleCell" valign="top">';//// $cellObj = $database->getSingleObject("SELECT *// FROM cells// WHERE cell_category = '" . $categories[$cat_no] . "'// AND cell_no = " . $line_no);//// if ($cellObj != null)// {// if ($cellObj->cell_status === "R")// {// $pageDtls .= '<a href="#">';// $pageDtls .= '<img src="/pages/images/img_reserved.png" width=' . $img_width . ' height=' . $img_height . ' border="1">';// }//
// if ($cellObj->cell_status === "S")// {// $pageDtls .= '<a href="' . $cellObj->cell_url . '">';// $pageDtls .= '<img src="/pages/sold/' . $cellObj->cell_image . '" width=' . $img_width . ' height=' . $img_height . ' border="1">';// }// }// else// {// $pageDtls .= '<a href="' . STORE_PATH . 'buy.php?category='. $categories[$cat_no] . '&cell=' . $line_no . '">';// $pageDtls .= '<img src="/pages/images/img_available.png" width=' . $img_width . ' height=' . $img_height . ' border="1">';// }//// $pageDtls .= '</a>';// $pageDtls .= '</td>';// $pageDtls .= '<td id="spaceCell">&nbsp;</td>';// }//// $pageDtls .= '</tr>';// }//}//
//unset($database);//
//$pageDtls .= '<?repeat-line-end?>';//$pageDtls .= '</table>';//$pageDtls .= '</center>';//$pageDtls .= '<?region-end?>';//$pageDtls .= '</td></tr>';//$pageDtls .= '</table>';//$page->setItem( "page-details" , $pageDtls );
 
// Display the page
 
echo $page->process();
 
?>

I am desperate for some help as I have been staring at this for a day or so.

all the best

Pete

14
Contributors
23
Replies
5 Years
Discussion Span
11 Months Ago
Last Updated
32
Views
pete harby
Newbie Poster
2 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

First off please put your code inside of the php code tags

[php] Code here [/php]

The error is on line 14 but I can't really tell where line 14 starts in your code. Please either clean the code up a little or just give use lines 12-17 or something like that. Thanks

big_k105
PFO Founder
Team Colleague
361 posts since May 2003
Reputation Points: 36
Solved Threads: 2
Skill Endorsements: 0
//$security->set_counters(page);//$page->setRegionVisable("lines",true);// Build the actual page contents display
//$pageDtls  = '<table cellpadding=0 cellspacing=0 border=0>';//$pageDtls .= '<tr><td>';//$pageDtls .= '<?region-start id="lines"  type="repeat" ?>';//$pageDtls .= '<center>';//$pageDtls .= '<table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1">';//$pageDtls .= '<tr>';
//$pageDtls  = '<table cellpadding=0 cellspacing=0 border=0><tr><td><?region-start id="lines"  type="repeat" ?><center><table class="browseContents" width="100%" border="0" cellspacing="0" cellpadding="1"><tr>';
//
//$img_width  = 85;//$img_height = 30;
// Build a grid of ALL cells

lines 12 - 17 as requested thanks for your help
Pete

pete harby
Newbie Poster
2 posts since Aug 2006
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Well the error isn't in those lines because they are all commented out. The only thing I could see is that maybe the error is in one of the included files.

big_k105
PFO Founder
Team Colleague
361 posts since May 2003
Reputation Points: 36
Solved Threads: 2
Skill Endorsements: 0

I can tell you that my personal experiences not T_STRING, as in your case, but T_INC came from not putting the "$" sign in front of a variable in a for loop. Check your syntax on your strings and your problem may be hidden somewhere in one of them...

It took me a lot of searching on the internet one day for something so simple. Then, after a some sleep, i woke up and saw the obvious mistake, corrected it, and the program worked perfectly.

Woobag
Light Poster
33 posts since Jun 2006
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

do you notice the de color of the code chanched after

<?region-start id="lines" type="repeat" ?>

the ?> tag closes the php sesion despate it being commened out by //

use of /* */ comment will solve this

pzuurveen
Posting Whiz in Training
277 posts since Sep 2006
Reputation Points: 46
Solved Threads: 59
Skill Endorsements: 0

I just got Deja vu reading this thread. Twice I thought "I wrote that" and saw someone elses name. Am I having that much of an effect here? :-)

Puckdropper
Posting Pro
500 posts since Jul 2004
Reputation Points: 23
Solved Threads: 23
Skill Endorsements: 0

I had this problem in Joomla! with my php code that I was including in an article through the plugin sourcerer. Well, needless to say, my web hosting changed to php 4 without me knowing why, I changed it to php 5 as the compiling engine and it worked like a charm.

bugmenot
Posting Whiz in Training
225 posts since Nov 2006
Reputation Points: 53
Solved Threads: 34
Skill Endorsements: 0

I had this problem in Joomla! with my php code that I was including in an article through the plugin sourcerer. Well, needless to say, my web hosting changed to php 4 without me knowing why, I changed it to php 5 as the compiling engine and it worked like a charm.

I'm pretty sure you just bumped a thread that was over 2 years old, that has to fit into the Daniweb drinking game if it exists.

ShawnCplus
Code Monkey
Team Colleague
1,583 posts since Apr 2005
Reputation Points: 526
Solved Threads: 269
Skill Endorsements: 26

Drink up buddy!!! funny

buddylee17
Practically a Master Poster
699 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
Skill Endorsements: 1

I desperately need and answer the error code:
i got this error when i try to log in using administrator on our joomla website . your help is much appreciated.

<?php
/**
* @version $Id: index.php 8078 2007-07-19 06:45:54Z robs $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Set flag that this is a parent file
define( '_VALID_MOS', 1 );

if (!file_exists( '../configuration.php' )) {
    header( 'Location: ../installation/index.php' );
    exit();
}

require( '../globals.php' );
require_once( '../configuration.php' );

// SSL check - $http_host returns <live site url>:<port number if it is 443>
$http_host = explode(':', $_SERVER['HTTP_HOST'] );
if( (!empty( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) != 'off' || isset( $http_host[1] ) && $http_host[1] == 443) && substr( $mosConfig_live_site, 0, 8 ) != 'https://' ) {
    $mosConfig_live_site = 'https://'.substr( $mosConfig_live_site, 7 );
}

require_once( '../includes/joomla.php' );
include_once ( $mosConfig_absolute_path . '/language/'. $mosConfig_lang .'.php' );

//Installation sub folder check, removed for work with SVN
if (file_exists( '../installation/index.php' ) && $_VERSION->SVN == 0) {
    define( '_INSTALL_CHECK', 1 );
    include ($mosConfig_absolute_path .'/offline.php');
    exit();
}

$option = strtolower( strval( mosGetParam( $_REQUEST, 'option', NULL ) ) );

// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame( $database, $option, '..', true );

if (isset( $_POST['submit'] )) {
    $usrname    = stripslashes( mosGetParam( $_POST, 'usrname', NULL ) );
    $pass       = stripslashes( mosGetParam( $_POST, 'pass', NULL ) );

    if($pass == NULL) {
        echo "<script>alert('Please enter a password'); document.location.href='index.php?mosmsg=Please enter a password'</script>\n";
        exit();
    }

    $query = "SELECT COUNT(*)"
    . "\n FROM #__users"
    . "\n WHERE ("
    // Administrators
    . "\n gid = 24"
    // Super Administrators
    . "\n OR gid = 25"
    . "\n )"
    ;
    $database->setQuery( $query );
    $count = intval( $database->loadResult() );
    if ($count < 1) {
        mosErrorAlert( _LOGIN_NOADMINS );
    }

    $my = null;
    $query = "SELECT u.*, m.*"
    . "\n FROM #__users AS u"
    . "\n LEFT JOIN #__messages_cfg AS m ON u.id = m.user_id AND m.cfg_name = 'auto_purge'"
    . "\n WHERE u.username = " . $database->Quote( $usrname )
    . "\n AND u.block = 0"
    ;
    $database->setQuery( $query );
    $database->loadObject( $my );

    /** find the user group (or groups in the future) */
    if (@$my->id) {
        $grp            = $acl->getAroGroup( $my->id );
        $my->gid        = $grp->group_id;
        $my->usertype   = $grp->name;

        // Conversion to new type
        if ((strpos($my->password, ':') === false) && $my->password == md5($pass)) {
            // Old password hash storage but authentic ... lets convert it
            $salt = mosMakePassword(16);
            $crypt = md5($pass.$salt);
            $my->password = $crypt.':'.$salt;

            // Now lets store it in the database
            $query = 'UPDATE #__users ' .
                    'SET password = '.$database->Quote($my->password) .
                    'WHERE id = '.(int)$my->id;
            $database->setQuery($query);
            if (!$database->query()) {
                // This is an error but not sure what to do with it ... we'll still work for now
            }
        }

        list($hash, $salt) = explode(':', $my->password);
        $cryptpass = md5($pass.$salt);

        if ( strcmp( $hash, $cryptpass ) || !$acl->acl_check( 'administration', 'login', 'users', $my->usertype ) ) {
            mosErrorAlert("Incorrect Username, Password, or Access Level.  Please try again", "document.location.href='index.php'");
        }

        session_name( md5( $mosConfig_live_site ) );
        session_start();

        // construct Session ID
        $logintime  = time();
        $session_id = md5( $my->id . $my->username . $my->usertype . $logintime );


        // add Session ID entry to DB
        $query = "INSERT INTO #__session"
        . "\n SET time = " . $database->Quote( $logintime ) . ", session_id = " . $database->Quote( $session_id ) . ", userid = " . (int) $my->id . ", usertype = " . $database->Quote( $my->usertype) . ", username = " . $database->Quote( $my->username )
        ;
        $database->setQuery( $query );
        if (!$database->query()) {
            echo $database->stderr();
        }

        // check if site designated as a production site
        // for a demo site allow multiple logins with same user account
        if ( $_VERSION->SITE == 1 ) {
            // delete other open admin sessions for same account
            $query = "DELETE FROM #__session"
            . "\n WHERE userid = " . (int) $my->id
            . "\n AND username = " . $database->Quote( $my->username )
            . "\n AND usertype = " . $database->Quote( $my->usertype )
            . "\n AND session_id != " . $database->Quote( $session_id )
            // this ensures that frontend sessions are not purged
            . "\n AND guest = 1"
            . "\n AND gid = 0"
            ;
            $database->setQuery( $query );
            if (!$database->query()) {
                echo $database->stderr();
            }
        }

        $_SESSION['session_id']             = $session_id;
        $_SESSION['session_user_id']        = $my->id;
        $_SESSION['session_username']       = $my->username;
        $_SESSION['session_usertype']       = $my->usertype;
        $_SESSION['session_gid']            = $my->gid;
        $_SESSION['session_logintime']      = $logintime;
        $_SESSION['session_user_params']    = $my->params;
        $_SESSION['session_userstate']      = array();

        session_write_close();

        $expired = 'index2.php';

        // check if site designated as a production site
        // for a demo site disallow expired page functionality
        if ( $_VERSION->SITE == 1 && @$mosConfig_admin_expired === '1' ) {
            $file   = $mainframe->getPath( 'com_xml', 'com_users' );
            $params =& new mosParameters( $my->params, $file, 'component' );

            $now    = time();

            // expired page functionality handling
            $expired        = $params->def( 'expired', '' );
            $expired_time   = $params->def( 'expired_time', '' );

            // if now expired link set or expired time is more than half the admin session life set, simply load normal admin homepage
            $checktime = ( $mosConfig_session_life_admin ? $mosConfig_session_life_admin : 1800 ) / 2;
            if (!$expired || ( ( $now - $expired_time ) > $checktime ) ) {
                $expired = 'index2.php';
            }
            // link must also be a Joomla link to stop malicious redirection
            if ( strpos( $expired, 'index2.php?option=com_' ) !== 0 ) {
                $expired = 'index2.php';
            }

            // clear any existing expired page data
            $params->set( 'expired', '' );
            $params->set( 'expired_time', '' );

            // param handling
            if (is_array( $params->toArray() )) {
                $txt = array();
                foreach ( $params->toArray() as $k=>$v) {
                    $txt[] = "$k=$v";
                }
                $saveparams = implode( "\n", $txt );
            }

            // save cleared expired page info to user data
            $query = "UPDATE #__users"
            . "\n SET params = " . $database->Quote( $saveparams )
            . "\n WHERE id = " . (int) $my->id
            . "\n AND username = " . $database->Quote( $my->username )
            . "\n AND usertype = " . $database->Quote( $my->usertype )
            ;
            $database->setQuery( $query );
            $database->query();
        }

        // check if auto_purge value set
        if ( $my->cfg_name == 'auto_purge' ) {
            $purge  = $my->cfg_value;
        } else {
        // if no value set, default is 7 days
            $purge  = 7;
        }
        // calculation of past date
        $past = date( 'Y-m-d H:i:s', time() - $purge * 60 * 60 * 24 );

        // if purge value is not 0, then allow purging of old messages
        if ($purge != 0) {
        // purge old messages at day set in message configuration
            $query = "DELETE FROM #__messages"
            . "\n WHERE date_time < " . $database->Quote( $past )
            . "\n AND user_id_to = " . (int) $my->id
            ;
            $database->setQuery( $query );
            if (!$database->query()) {
                echo $database->stderr();
            }
        } 
        /** cannot using mosredirect as this stuffs up the cookie in IIS */
        // redirects page to admin homepage by default or expired page
        echo }
?>
ryohio
Newbie Poster
6 posts since Apr 2009
Reputation Points: 4
Solved Threads: 0
Skill Endorsements: 0

I desperately need and answer the error code:
i got this error when i try to log in using administrator on our joomla website . your help is much appreciated.

<?php
/**
* @version $Id: index.php 8078 2007-07-19 06:45:54Z robs $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Set flag that this is a parent file
define( '_VALID_MOS', 1 );

if (!file_exists( '../configuration.php' )) {
    header( 'Location: ../installation/index.php' );
    exit();
}

require( '../globals.php' );
require_once( '../configuration.php' );

// SSL check - $http_host returns <live site url>:<port number if it is 443>
$http_host = explode(':', $_SERVER['HTTP_HOST'] );
if( (!empty( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) != 'off' || isset( $http_host[1] ) && $http_host[1] == 443) && substr( $mosConfig_live_site, 0, 8 ) != 'https://' ) {
    $mosConfig_live_site = 'https://'.substr( $mosConfig_live_site, 7 );
}

require_once( '../includes/joomla.php' );
include_once ( $mosConfig_absolute_path . '/language/'. $mosConfig_lang .'.php' );

//Installation sub folder check, removed for work with SVN
if (file_exists( '../installation/index.php' ) && $_VERSION->SVN == 0) {
    define( '_INSTALL_CHECK', 1 );
    include ($mosConfig_absolute_path .'/offline.php');
    exit();
}

$option = strtolower( strval( mosGetParam( $_REQUEST, 'option', NULL ) ) );

// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame( $database, $option, '..', true );

if (isset( $_POST['submit'] )) {
    $usrname    = stripslashes( mosGetParam( $_POST, 'usrname', NULL ) );
    $pass       = stripslashes( mosGetParam( $_POST, 'pass', NULL ) );

    if($pass == NULL) {
        echo "<script>alert('Please enter a password'); document.location.href='index.php?mosmsg=Please enter a password'</script>\n";
        exit();
    }

    $query = "SELECT COUNT(*)"
    . "\n FROM #__users"
    . "\n WHERE ("
    // Administrators
    . "\n gid = 24"
    // Super Administrators
    . "\n OR gid = 25"
    . "\n )"
    ;
    $database->setQuery( $query );
    $count = intval( $database->loadResult() );
    if ($count < 1) {
        mosErrorAlert( _LOGIN_NOADMINS );
    }

    $my = null;
    $query = "SELECT u.*, m.*"
    . "\n FROM #__users AS u"
    . "\n LEFT JOIN #__messages_cfg AS m ON u.id = m.user_id AND m.cfg_name = 'auto_purge'"
    . "\n WHERE u.username = " . $database->Quote( $usrname )
    . "\n AND u.block = 0"
    ;
    $database->setQuery( $query );
    $database->loadObject( $my );

    /** find the user group (or groups in the future) */
    if (@$my->id) {
        $grp            = $acl->getAroGroup( $my->id );
        $my->gid        = $grp->group_id;
        $my->usertype   = $grp->name;

        // Conversion to new type
        if ((strpos($my->password, ':') === false) && $my->password == md5($pass)) {
            // Old password hash storage but authentic ... lets convert it
            $salt = mosMakePassword(16);
            $crypt = md5($pass.$salt);
            $my->password = $crypt.':'.$salt;

            // Now lets store it in the database
            $query = 'UPDATE #__users ' .
                    'SET password = '.$database->Quote($my->password) .
                    'WHERE id = '.(int)$my->id;
            $database->setQuery($query);
            if (!$database->query()) {
                // This is an error but not sure what to do with it ... we'll still work for now
            }
        }

        list($hash, $salt) = explode(':', $my->password);
        $cryptpass = md5($pass.$salt);

        if ( strcmp( $hash, $cryptpass ) || !$acl->acl_check( 'administration', 'login', 'users', $my->usertype ) ) {
            mosErrorAlert("Incorrect Username, Password, or Access Level.  Please try again", "document.location.href='index.php'");
        }

        session_name( md5( $mosConfig_live_site ) );
        session_start();

        // construct Session ID
        $logintime  = time();
        $session_id = md5( $my->id . $my->username . $my->usertype . $logintime );


        // add Session ID entry to DB
        $query = "INSERT INTO #__session"
        . "\n SET time = " . $database->Quote( $logintime ) . ", session_id = " . $database->Quote( $session_id ) . ", userid = " . (int) $my->id . ", usertype = " . $database->Quote( $my->usertype) . ", username = " . $database->Quote( $my->username )
        ;
        $database->setQuery( $query );
        if (!$database->query()) {
            echo $database->stderr();
        }

        // check if site designated as a production site
        // for a demo site allow multiple logins with same user account
        if ( $_VERSION->SITE == 1 ) {
            // delete other open admin sessions for same account
            $query = "DELETE FROM #__session"
            . "\n WHERE userid = " . (int) $my->id
            . "\n AND username = " . $database->Quote( $my->username )
            . "\n AND usertype = " . $database->Quote( $my->usertype )
            . "\n AND session_id != " . $database->Quote( $session_id )
            // this ensures that frontend sessions are not purged
            . "\n AND guest = 1"
            . "\n AND gid = 0"
            ;
            $database->setQuery( $query );
            if (!$database->query()) {
                echo $database->stderr();
            }
        }

        $_SESSION['session_id']             = $session_id;
        $_SESSION['session_user_id']        = $my->id;
        $_SESSION['session_username']       = $my->username;
        $_SESSION['session_usertype']       = $my->usertype;
        $_SESSION['session_gid']            = $my->gid;
        $_SESSION['session_logintime']      = $logintime;
        $_SESSION['session_user_params']    = $my->params;
        $_SESSION['session_userstate']      = array();

        session_write_close();

        $expired = 'index2.php';

        // check if site designated as a production site
        // for a demo site disallow expired page functionality
        if ( $_VERSION->SITE == 1 && @$mosConfig_admin_expired === '1' ) {
            $file   = $mainframe->getPath( 'com_xml', 'com_users' );
            $params =& new mosParameters( $my->params, $file, 'component' );

            $now    = time();

            // expired page functionality handling
            $expired        = $params->def( 'expired', '' );
            $expired_time   = $params->def( 'expired_time', '' );

            // if now expired link set or expired time is more than half the admin session life set, simply load normal admin homepage
            $checktime = ( $mosConfig_session_life_admin ? $mosConfig_session_life_admin : 1800 ) / 2;
            if (!$expired || ( ( $now - $expired_time ) > $checktime ) ) {
                $expired = 'index2.php';
            }
            // link must also be a Joomla link to stop malicious redirection
            if ( strpos( $expired, 'index2.php?option=com_' ) !== 0 ) {
                $expired = 'index2.php';
            }

            // clear any existing expired page data
            $params->set( 'expired', '' );
            $params->set( 'expired_time', '' );

            // param handling
            if (is_array( $params->toArray() )) {
                $txt = array();
                foreach ( $params->toArray() as $k=>$v) {
                    $txt[] = "$k=$v";
                }
                $saveparams = implode( "\n", $txt );
            }

            // save cleared expired page info to user data
            $query = "UPDATE #__users"
            . "\n SET params = " . $database->Quote( $saveparams )
            . "\n WHERE id = " . (int) $my->id
            . "\n AND username = " . $database->Quote( $my->username )
            . "\n AND usertype = " . $database->Quote( $my->usertype )
            ;
            $database->setQuery( $query );
            $database->query();
        }

        // check if auto_purge value set
        if ( $my->cfg_name == 'auto_purge' ) {
            $purge  = $my->cfg_value;
        } else {
        // if no value set, default is 7 days
            $purge  = 7;
        }
        // calculation of past date
        $past = date( 'Y-m-d H:i:s', time() - $purge * 60 * 60 * 24 );

        // if purge value is not 0, then allow purging of old messages
        if ($purge != 0) {
        // purge old messages at day set in message configuration
            $query = "DELETE FROM #__messages"
            . "\n WHERE date_time < " . $database->Quote( $past )
            . "\n AND user_id_to = " . (int) $my->id
            ;
            $database->setQuery( $query );
            if (!$database->query()) {
                echo $database->stderr();
            }
        } 
        /** cannot using mosredirect as this stuffs up the cookie in IIS */
        // redirects page to admin homepage by default or expired page
        echo }
?>
ryohio
Newbie Poster
6 posts since Apr 2009
Reputation Points: 4
Solved Threads: 0
Skill Endorsements: 0

Well what was the error? Did the computer explode or did the page just not load. If any error messages popped up please post them.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 260
Skill Endorsements: 13

Well what was the error? Did the computer explode or did the page just not load. If any error messages popped up please post them.

Hi sir,

here's the error:

Parse error: syntax error, unexpected $end in /hermes/web05/b1461/pow.walterng/htdocs/esprintsolutions/administrator/index.php on line 230


that's the code i indicated previously on my index.php

according to other forums : something to do with the syntax:

" <?php "

im not a techie on programming stuff , hope you could advise . thanks so much.

ryohio
Newbie Poster
6 posts since Apr 2009
Reputation Points: 4
Solved Threads: 0
Skill Endorsements: 0

Well that error normally refers to not enough ending brackets } or even too many before the end of the script. I just checked your script and there is a bug on the second last line. It looks like you are trying to echo a bracket and when counting the brackets there aren't enough closing brackets before the script ends. So try making the last two lines the following:

} }
?>
cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 260
Skill Endorsements: 13

Well that error normally refers to not enough ending brackets } or even too many before the end of the script. I just checked your script and there is a bug on the second last line. It looks like you are trying to echo a bracket and when counting the brackets there aren't enough closing brackets before the script ends. So try making the last two lines the following:

} }
?>

i tried what you have suggested sir bu still i get same error. would appreciate your patience and help sir.

thanks

ryohio
Newbie Poster
6 posts since Apr 2009
Reputation Points: 4
Solved Threads: 0
Skill Endorsements: 0

Well I would suggest placing the code into a live syntax highlighter such as notepad++ and check each bracket associated with each if statement to see which if statements need to have a closing bracket added. That is where the problem is as I can see it but am not sure where you would like those closing brackets and exactly how many closing brackets do need adding. An example in your code is the if statement if (isset( $_POST['submit'] )) is does not have a closing bracket.

cwarn23
Occupation: Genius
Team Colleague
3,033 posts since Sep 2007
Reputation Points: 413
Solved Threads: 260
Skill Endorsements: 13

Well I would suggest placing the code into a live syntax highlighter such as notepad++ and check each bracket associated with each if statement to see which if statements need to have a closing bracket added. That is where the problem is as I can see it but am not sure where you would like those closing brackets and exactly how many closing brackets do need adding. An example in your code is the if statement if (isset( $_POST['submit'] )) is does not have a closing bracket.

thanks,

now i got different problem. the password button keeps popping up. added 2 braces and this is the new code: derately needs help.

you can check my web: esprint.org/administrator

<?php
/**
* @version $Id: index.php 8078 2007-07-19 06:45:54Z robs $
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license [url]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Set flag that this is a parent file
define( '_VALID_MOS', 1 );

if (!file_exists( '../configuration.php' )) {
    header( 'Location: ../installation/index.php' );
    exit();
}

require( '../globals.php' );
require_once( '../configuration.php' );

// SSL check - $http_host returns <live site url>:<port number if it is 443>
$http_host = explode(':', $_SERVER['HTTP_HOST'] );
if( (!empty( $_SERVER['HTTPS'] ) && strtolower( $_SERVER['HTTPS'] ) != 'off' || isset( $http_host[1] ) && $http_host[1] == 443) && substr( $mosConfig_live_site, 0, 8 ) != 'https://' ) {
    $mosConfig_live_site = 'https://'.substr( $mosConfig_live_site, 7 );
}

require_once( '../includes/joomla.php' );
include_once ( $mosConfig_absolute_path . '/language/'. $mosConfig_lang .'.php' );

//Installation sub folder check, removed for work with SVN
if (file_exists( '../installation/index.php' ) && $_VERSION->SVN == 0) {
    define( '_INSTALL_CHECK', 1 );
    include ($mosConfig_absolute_path .'/offline.php');
    exit();
}

$option = strtolower( strval( mosGetParam( $_REQUEST, 'option', NULL ) ) );

// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame( $database, $option, '..', true );

if (isset( $_POST['submit'] )) {
    $usrname    = stripslashes( mosGetParam( $_POST, 'usrname', NULL ) );
    $pass       = stripslashes( mosGetParam( $_POST, 'pass', NULL ) );
}
    if($pass == NULL) {
        echo "<script>alert('Please enter a password'); document.location.href='index.php?mosmsg=Please enter a password'</script>\n";{
        exit();
    }


    $query = "SELECT COUNT(*)"
    . "\n FROM #__users"
    . "\n WHERE ("
    // Administrators
    . "\n gid = 24"
    // Super Administrators
    . "\n OR gid = 25"
    . "\n )"
    ;
    $database->setQuery( $query );
    $count = intval( $database->loadResult() );
    if ($count < 1) {
        mosErrorAlert( _LOGIN_NOADMINS );
    }

    $my = null;
    $query = "SELECT u.*, m.*"
    . "\n FROM #__users AS u"
    . "\n LEFT JOIN #__messages_cfg AS m ON u.id = m.user_id AND m.cfg_name = 'auto_purge'"
    . "\n WHERE u.username = " . $database->Quote( $usrname )
    . "\n AND u.block = 0"
    ;
    $database->setQuery( $query );
    $database->loadObject( $my );

    /** find the user group (or groups in the future) */
    if (@$my->id) {
        $grp            = $acl->getAroGroup( $my->id );
        $my->gid        = $grp->group_id;
        $my->usertype   = $grp->name;

        // Conversion to new type
        if ((strpos($my->password, ':') === false) && $my->password == md5($pass)) {
            // Old password hash storage but authentic ... lets convert it
            $salt = mosMakePassword(16);
            $crypt = md5($pass.$salt);
            $my->password = $crypt.':'.$salt;

            // Now lets store it in the database
            $query = 'UPDATE #__users ' .
                    'SET password = '.$database->Quote($my->password) .
                    'WHERE id = '.(int)$my->id;
            $database->setQuery($query);
            if (!$database->query()) {
                // This is an error but not sure what to do with it ... we'll still work for now
            }
        }

        list($hash, $salt) = explode(':', $my->password);
        $cryptpass = md5($pass.$salt);

        if ( strcmp( $hash, $cryptpass ) || !$acl->acl_check( 'administration', 'login', 'users', $my->usertype ) ) {
            mosErrorAlert("Incorrect Username, Password, or Access Level.  Please try again", "document.location.href='index.php'");
        }

        session_name( md5( $mosConfig_live_site ) );
        session_start();

        // construct Session ID
        $logintime  = time();
        $session_id = md5( $my->id . $my->username . $my->usertype . $logintime );


        // add Session ID entry to DB
        $query = "INSERT INTO #__session"
        . "\n SET time = " . $database->Quote( $logintime ) . ", session_id = " . $database->Quote( $session_id ) . ", userid = " . (int) $my->id . ", usertype = " . $database->Quote( $my->usertype) . ", username = " . $database->Quote( $my->username )
        ;
        $database->setQuery( $query );
        if (!$database->query()) {
            echo $database->stderr();
        }

        // check if site designated as a production site
        // for a demo site allow multiple logins with same user account
        if ( $_VERSION->SITE == 1 ) {
            // delete other open admin sessions for same account
            $query = "DELETE FROM #__session"
            . "\n WHERE userid = " . (int) $my->id
            . "\n AND username = " . $database->Quote( $my->username )
            . "\n AND usertype = " . $database->Quote( $my->usertype )
            . "\n AND session_id != " . $database->Quote( $session_id )
            // this ensures that frontend sessions are not purged
            . "\n AND guest = 1"
            . "\n AND gid = 0"
            ;
            $database->setQuery( $query );
            if (!$database->query()) {
                echo $database->stderr();
            }
        }

        $_SESSION['session_id']             = $session_id;
        $_SESSION['session_user_id']        = $my->id;
        $_SESSION['session_username']       = $my->username;
        $_SESSION['session_usertype']       = $my->usertype;
        $_SESSION['session_gid']            = $my->gid;
        $_SESSION['session_logintime']      = $logintime;
        $_SESSION['session_user_params']    = $my->params;
        $_SESSION['session_userstate']      = array();

        session_write_close();

        $expired = 'index2.php';

        // check if site designated as a production site
        // for a demo site disallow expired page functionality
        if ( $_VERSION->SITE == 1 && @$mosConfig_admin_expired === '1' ) {
            $file   = $mainframe->getPath( 'com_xml', 'com_users' );
            $params =& new mosParameters( $my->params, $file, 'component' );

            $now    = time();

            // expired page functionality handling
            $expired        = $params->def( 'expired', '' );
            $expired_time   = $params->def( 'expired_time', '' );

            // if now expired link set or expired time is more than half the admin session life set, simply load normal admin homepage
            $checktime = ( $mosConfig_session_life_admin ? $mosConfig_session_life_admin : 1800 ) / 2;
            if (!$expired || ( ( $now - $expired_time ) > $checktime ) ) {
                $expired = 'index2.php';
            }
            // link must also be a Joomla link to stop malicious redirection
            if ( strpos( $expired, 'index2.php?option=com_' ) !== 0 ) {
                $expired = 'index2.php';
            }

            // clear any existing expired page data
            $params->set( 'expired', '' );
            $params->set( 'expired_time', '' );

            // param handling
            if (is_array( $params->toArray() )) {
                $txt = array();
                foreach ( $params->toArray() as $k=>$v) {
                    $txt[] = "$k=$v";
                }
                $saveparams = implode( "\n", $txt );
            }
            // save cleared expired page info to user data
            $query = "UPDATE #__users"
            . "\n SET params = " . $database->Quote( $saveparams )
            . "\n WHERE id = " . (int) $my->id
            . "\n AND username = " . $database->Quote( $my->username )
            . "\n AND usertype = " . $database->Quote( $my->usertype )
            ;
            $database->setQuery( $query );
            $database->query();
        }

        // check if auto_purge value set
        if ( $my->cfg_name == 'auto_purge' ) {
            $purge  = $my->cfg_value;
        } else {
        // if no value set, default is 7 days
            $purge  = 7;
        }
        // calculation of past date
        $past = date( 'Y-m-d H:i:s', time() - $purge * 60 * 60 * 24 );

        // if purge value is not 0, then allow purging of old messages
        if ($purge != 0) {
        // purge old messages at day set in message configuration
            $query = "DELETE FROM #__messages"
            . "\n WHERE date_time < " . $database->Quote( $past )
            . "\n AND user_id_to = " . (int) $my->id
            ;
            $database->setQuery( $query );
            if (!$database->query()) {
                echo $database->stderr();
            }
        }
        }
        }


        /** cannot using mosredirect as this stuffs up the cookie in IIS
        * redirects page to admin homepage by default or expired page echo "
        */
?>
ryohio
Newbie Poster
6 posts since Apr 2009
Reputation Points: 4
Solved Threads: 0
Skill Endorsements: 0

Well that error normally refers to not enough ending brackets } or even too many before the end of the script. I just checked your script and there is a bug on the second last line. It looks like you are trying to echo a bracket and when counting the brackets there aren't enough closing brackets before the script ends. So try making the last two lines the following:

} }
?>

got the solution already. thanks sir.

ryohio
Newbie Poster
6 posts since Apr 2009
Reputation Points: 4
Solved Threads: 0
Skill Endorsements: 0

I think the problem is here
'<?region-start id="lines" type="repeat" ?>';

You need to have
'<?php region-start id="lines" type="repeat" ?>';

pin8marian
Newbie Poster
5 posts since Apr 2009
Reputation Points: 10
Solved Threads: 1
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
 
© 2013 DaniWeb® LLC
Page rendered in 0.1423 seconds using 2.96MB