CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 Logged user not displayed in header anymore

Print topic Send  topic

Author Message
timlauer

Posts: 12
Posted: 10/10/2007, 3:23 PM

Hi there,


I had the scripts working for 3 years,
after upgrading from CCS 2.3.81 to CCS 3.2 none of my old files are working anymore.
I created all new. The only function left is to show the logged user. The code below shows the manual section I
did copy over.
My development system is IIS5 mit PHP5.21 and Mysql 5.0.37
My Production system is Apache auf Linux mit PHP 5.22 and Mysql 5.0.37

I get the following error message.
Parse error: syntax error, unexpected $end in C:\Inetpub\wwwroot\header_events.php on line 39
This is the line after the end of the script.
I am not a PHP developer so any way just to display the logged user is fine.


Section from the header.php

// -------------------------
global $header;
if(CCGetSession("user_id")<>""){
$header->loggeduser->SetValue("You are logged in as ".CCGetSession("user_id"));
$header->login->Visible=false;
}else {
$header->loggeduser->SetValue("You are not logged in");
$header->login->Visible = true;
$header->Logout->Visible = false;
}
// -------------------------



Section from the header_events

// -------------------------
global $header;
if(CCGetSession("user_id")<>""){
$header->loggeduser->SetValue("You are logged in as ".CCGetSession("user_id"));
$header->login->Visible=false;
}else {
$header->loggeduser->SetValue("You are not logged in");
$header->login->Visible = true;
$header->Logout->Visible = false;
}
// -------------------------

View profile  Send private message
DonP
Posted: 10/10/2007, 3:50 PM

It looks to be a Before Show event for the grid or form, correct?
header_events.php should be the only place you add custom code. The newer
versions of CCS do not need the global because it is created automatically
when adding an event. I don't see anything obviously wrong except for the
missing closing bracket, although it can possibly be simplified slightly:

// -------------------------
if (CCGetUserID()){
$header->loggeduser->SetValue("You are logged in as ".CCGetUserID());
$header->login->Visible = False;
}else {
$header->loggeduser->SetValue("You are not logged in");
$header->login->Visible = True;
$header->Logout->Visible = False;
}
// -------------------------

It looks that you are going to be showing only the user's ID so you'll need
a lookup to get their name.

Be sure that the case matches all your labels as it IS case sensitive. For
Booleans, I always use 0 and 1 so I am not sure of the False and True are
case sensitive or not. They might be.

DonP

"timlauer" <timlauer@forum.codecharge> wrote in message
news:5470d50deee19a@news.codecharge.com...
>
> Hi there,
>
>
> I had the scripts working for 3 years,
> after upgrading from CCS 2.3.81 to CCS 3.2 none of my old files are
> working
> anymore.
> I created all new. The only function left is to show the logged user. The
> code
> below shows the manual section I
> did copy over.
> My development system is IIS5 mit PHP5.21 and Mysql 5.0.37
> My Production system is Apache auf Linux mit PHP 5.22 and Mysql 5.0.37
>
> I get the following error message.
> Parse error: syntax error, unexpected $end in
> C:\Inetpub\wwwroot\header_events.php on line 39
> This is the line after the end of the script.
> I am not a PHP developer so I any way just to display the logged user is
> fine.
>
>
>
> Section from the header.php
>
> // -------------------------
> global $header;
> if(CCGetSession("user_id")<>""){
> $header->loggeduser->SetValue("You are logged in as
> ".CCGetSession("user_id"));
> $header->login->Visible=false;
> }else {
> $header->loggeduser->SetValue("You are not logged in");
> $header->login->Visible = true;
> $header->Logout->Visible = false;
> // -------------------------
>
>
>
> Section from the header_events
>
> // -------------------------
> global $header;
> if(CCGetSession("user_id")<>""){
> $header->loggeduser->SetValue("You are logged in as
> ".CCGetSession("user_id"));
> $header->login->Visible=false;
> }else {
> $header->loggeduser->SetValue("You are not logged in");
> $header->login->Visible = true;
> $header->Logout->Visible = false;
> // -------------------------
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>

mamboBROWN


Posts: 1713
Posted: 10/10/2007, 6:31 PM

timlauer
In both sets of code you appear to be missing the ending bracket } for the else portion of the if statement.
View profile  Send private message
timlauer

Posts: 12
Posted: 10/11/2007, 1:01 AM

Quote mamboBROWN:
timlauer
In both sets of code you appear to be missing the ending bracket } for the else portion of the if statement.

I have not copied everything. The brackets are in the original files. I will correct it in the forum
thanks
View profile  Send private message
datadoit
Posted: 10/11/2007, 6:50 AM

This has been inexplicably happening to me also, but didn't know why nor
spent a whole lot of time trying to figure it out. Just reverted to
previous version and moved on.

'Unexpected $end' usually means an improperly closed function (missing
bracket). It appears it was reported and fixed in the latest patch 3.2.0.4.
timlauer

Posts: 12
Posted: 10/29/2007, 5:22 AM

Quote datadoit:
This has been inexplicably happening to me also, but didn't know why nor
spent a whole lot of time trying to figure it out. Just reverted to
previous version and moved on.

'Unexpected $end' usually means an improperly closed function (missing
bracket). It appears it was reported and fixed in the latest patch 3.2.0.4.

Thanks for your reply. The error remains and the bracket is in the code and I have 3.2.0.4 installed. This is the only exception I try to get some advice from the forum. In general I fix it sooner or later. I have no possibility to roll back as the old technology is not available anymore and I have to cope with this situation. But I agree in general with what you are saying.

Cheers,

Timlauer
View profile  Send private message
timlauer

Posts: 12
Posted: 10/29/2007, 5:25 AM

Quote DonP:
It looks to be a Before Show event for the grid or form, correct?
header_events.php should be the only place you add custom code. The newer
versions of CCS do not need the global because it is created automatically
when adding an event. I don't see anything obviously wrong except for the
missing closing bracket, although it can possibly be simplified slightly:

// -------------------------
if (CCGetUserID()){
$header->loggeduser->SetValue("You are logged in as ".CCGetUserID());
$header->login->Visible = False;
}else {
$header->loggeduser->SetValue("You are not logged in");
$header->login->Visible = True;
$header->Logout->Visible = False;
}
// -------------------------

It looks that you are going to be showing only the user's ID so you'll need
a lookup to get their name.

Be sure that the case matches all your labels as it IS case sensitive. For
Booleans, I always use 0 and 1 so I am not sure of the False and True are
case sensitive or not. They might be.

DonP

"timlauer" <timlauer@forum.codecharge> wrote in message
news:5470d50deee19a@news.codecharge.com...
>
> Hi there,
>
>
> I had the scripts working for 3 years,
> after upgrading from CCS 2.3.81 to CCS 3.2 none of my old files are
> working
> anymore.
> I created all new. The only function left is to show the logged user. The
> code
> below shows the manual section I
> did copy over.
> My development system is IIS5 mit PHP5.21 and Mysql 5.0.37
> My Production system is Apache auf Linux mit PHP 5.22 and Mysql 5.0.37
>
> I get the following error message.
> Parse error: syntax error, unexpected $end in
> C:\Inetpub\wwwroot\header_events.php on line 39
> This is the line after the end of the script.
> I am not a PHP developer so I any way just to display the logged user is
> fine.
>
>
>
> Section from the header.php
>
> // -------------------------
> global $header;
> if(CCGetSession("user_id")<>""){
> $header->loggeduser->SetValue("You are logged in as
> ".CCGetSession("user_id"));
> $header->login->Visible=false;
> }else {
> $header->loggeduser->SetValue("You are not logged in");
> $header->login->Visible = true;
> $header->Logout->Visible = false;
> // -------------------------
>
>
>
> Section from the header_events
>
> // -------------------------
> global $header;
> if(CCGetSession("user_id")<>""){
> $header->loggeduser->SetValue("You are logged in as
> ".CCGetSession("user_id"));
> $header->login->Visible=false;
> }else {
> $header->loggeduser->SetValue("You are not logged in");
> $header->login->Visible = true;
> $header->Logout->Visible = false;
> // -------------------------
>
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>



Thanks DonP. I will give it a try and let you know.

Cheers,

Timlauer
View profile  Send private message
timlauer

Posts: 12
Posted: 11/03/2007, 5:49 PM

Hi all,

the code change was not fully successful. I did only add the following code as custom code into the header_event:

<?php
// //Events @1-F81417CB

//header_BeforeShow @1-FBDD2738
function header_BeforeShow(& $sender)
{
$header_BeforeShow = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $header; //Compatibility
//End header_BeforeShow

// global $Header;
if(CCGetSession("UserLogin")){
$header->loggeduser->SetValue("You are logged in as ".CCGetSession("UserLogin"));
}else {
$header->loggeduser->SetValue("You are not logged in");
$header->Logout->Visible = false;
}

//Close header_BeforeShow @1-C6915AF4
return $header_BeforeShow;
}
//End Close header_BeforeShow


?>


Next I did add in header.php the following under components

$this->loggeduser = new clsControl(ccsLabel, "loggeduser", "loggeduser", ccsText, "", CCGetRequestParam("loggeduser", ccsGet));

And under Show Method:

$this->loggeduser->Show();


It displays now "You are logged in as 1"

The error messages are the following:


Warning: Missing argument 7 for clsControl::clsControl(), called in /websites/LinuxPackage02/im/la/ue/imlauer.co.uk/header.php on line 75 and defined in /websites/LinuxPackage02/im/la/ue/imlauer.co.uk/Classes.php on line 613

Warning: Cannot modify header information - headers already sent by (output started at /websites/LinuxPackage02/im/la/ue/imlauer.co.uk/Classes.php:613) in /websites/LinuxPackage02/im/la/ue/imlauer.co.uk/clients.php on line 88

In classes. php it is this line:
function clsControl($ControlType, $Name, $Caption, $DataType, $Format, $InitValue = "", & $Parent)

In clients.php, that is where the header appears after logging in:

$Charset = $Charset ? $Charset : "iso-8859-1";
if ($Charset)
header("Content-Type: text/html; charset=" . $Charset); <- this line.

In header.php the line:

$this->loggeduser = new clsControl(ccsLabel, "loggeduser", "loggeduser", ccsText, "", CCGetRequestParam("loggeduser", ccsGet));


There must be a syntax error but I cannot figure it out. Changing the parameters in header_events.php from CCGetUserID to CCGetUserLogin does display the User login correct but the problem (error messages)" remain.

Cheers,

timlauer



View profile  Send private message
timlauer

Posts: 12
Posted: 11/04/2007, 10:38 AM

Problem is fixed. the syntax has changed. Nobody is telling this, so it was a wild guess.

$this->loggeduser = new clsControl(ccsLabel, "loggeduser", "loggeduser", ccsText, "", CCGetRequestParam("loggeduser", ccsGet));

It has to be:

$this->loggeduser = new clsControl(ccsLabel, "loggeduser", "loggeduser", ccsText, "", CCGetRequestParam("loggeduser", ccsGet, NULL), $this);

Thank you for all your help,

timlauer
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.