CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Page redirection

Print topic Send  topic

Author Message
rado

Posts: 221
Posted: 10/22/2008, 4:35 PM

I know that this or similar topic was posted here before, however I'm newbe with codecharge and need simple (beginers) explanation for the following:

I have Page1 and Page 2. On Page 1 I have link to Page 2 which requires login. However if the user is not registered, it has to go trough registration process. My question is how can I make user to be automatically logged in after registration and redirected to Page2.

Please help me.

Rado
View profile  Send private message
Gena

Posts: 591
Posted: 10/22/2008, 4:55 PM

After reg process you can auto login user using function CCLoginUser(login, password) and after use code like

global $Redirect;
$Redirect = "page2.php";
_________________
Gena
View profile  Send private message
rado

Posts: 221
Posted: 10/22/2008, 5:08 PM

Thanks for fast replay. One of the problem is that registration process is sometimes just standalone process and doesn't require any redirection, however in case that I described above I need to do redirection. Would you like to explain where to put the function and additional code (again, I'm newbie).
Thanks again for help.

Rado
View profile  Send private message
melvyn


Posts: 333
Posted: 10/22/2008, 7:28 PM

I guess you finish the form in the page 1.

Click in the border of that form. Go to properties (right side, below) and click on events tab, A list of events will be shown, select "AfterInsert", click it, then click on + sign and select "Custom Code";

In the custom code section in the text editor something will be shown as

//Custom Code @98-2A29BDB7  
 // -------------------------  
 // Write your own code here.  
// -------------------------  
//End Custom Code

Yo will replace by:

//Custom Code @98-2A29BDB7  
 // -------------------------  
global $Redirect;  
$Redirect = "page2.php";  
// -------------------------  
//End Custom Code


_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
rado

Posts: 221
Posted: 10/22/2008, 8:12 PM

Thank you very much. An what about function "CCLoginUser". Is it also properties of the form? Which even to use?
View profile  Send private message
melvyn


Posts: 333
Posted: 10/22/2008, 9:05 PM

Well, my fault.
In my last answer, the user is not being logged in, only redirected. If you want to log him/her before redirecting, then try this:

In the same event (AfterInsert).

Let's assume that you catch the two fields in the form, login_field and password_field.

  
//Custom Code @98-2A29BDB7  
// -------------------------   
global $Redirect;   
$Redirect = "page2.php";   
  
$login = $Component->login_field->GetValue();  
$password = $Component->password_field->GetValue();  
  
CCLoginUser($login,$password);  
// -------------------------   
//End Custom Code  

That's the try to learn version, you can also do:
CCLoginUser($Component->login_field->GetValue(),$Component->password_field->GetValue());

So, the user will be logged after being registered and before being redirected.

CCLoginUser is not a property of the form, it's a method in the common, available to any form , page or componen in the project (well, it's a property of the form).

You can see it's code in Common.php, please don't edit the gray area, if you need to modify use an afterlogin event in the login form.

By the way, this post must be located in the PHP Forum.

Enjoy.



_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
rado

Posts: 221
Posted: 10/22/2008, 9:09 PM

You are the MAAAN. Everything is clear.
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.