Web page is not loaded after activation

studyhood
Posts: 11
Joined: 2013-12-06 14:43

Web page is not loaded after activation

Post by studyhood » 2013-12-06 15:10

If users use the registration form to register, on my web site (http://www.studyhood.com/english/register.php), then they receive an e-mail with an activation link, and when they click on it, the index page of the logged-in section is loaded. This works fine.

When users, from a non-logged-in page, click on a link to a page in the logged-in area, they are also transferred to the registration page, they register and submit the registration form, and they receive an e-mail with an activation link. However, when they click on the link, they are not transferred to the corresponding logged-in page. Here is an example:

A user is at http://studyhood.com/english/translation_quote.php
The user completes the quote form and clicks OK, for one of the three available options. Because the user is not in the logged-in section, the system will take the user to the registration page. The url is http://studyhood.com/english/register.php?info=DENIED
The user submits the registration and receives an e-mail with the activation link http://studyhood.com/english/activate.p ... 5931f0df7b
When the user clicks on the link, the url is not provided correctly to the browser and so a "Not Found" page appears. Here is the url appearing on the browser: http://studyhood.com/http:/studyhood.co ... pe=Regular

The mistake is in that "http://studyhood.com/" appears twice.
How can I correct this? Please note that I used MX Collection a long time ago, so I prefer to make the corrections directly on the html/php code.

Thank you,

studyhood
Posts: 11
Joined: 2013-12-06 14:43

Re: Web page is not loaded after activation

Post by studyhood » 2013-12-08 00:22

Anyone, please?

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Web page is not loaded after activation

Post by Fred » 2013-12-08 13:00

Ok so it looks like it is trying to activate the account AND send the user back to where he/she was coming from. i.e. the restricted page.

My solution would be to either split the login and registration pages or clear the cookies after the redirection to the login/registration page.
Splitting the login and registration pages would be the easier option as messing with the redirection cookies might just break something else.

Having both functionalities on the same page after a redirection is a bad idea. Even facebook have a button to take you to a dedicated registration page.

studyhood
Posts: 11
Joined: 2013-12-06 14:43

Re: Web page is not loaded after activation

Post by studyhood » 2013-12-14 15:37

Hi Fred,

I am sorry I was late to respond here, but, as you know, I was trying to fix the other problem with sending e-mails.

Now, regarding the problem in this post, in the case where the user goes directly to the registration page http://www.studyhood.com/english/register.php and completes the registration form, the {kt_activation page} http://www.studyhood.com/english/activa ... 2f7fc168bc redirects to http://www.studyhood.com/english/indexglogin.php and works. But in the case where the non-registered user goes to the registration page through a restricted page (translation_second.php), the {kt_activation_page} http://www.studyhood.com/english/activa ... 2f7fc168bc redirects redirects to http://www.studyhood.com/http:/www.stud ... pe=Regular. Why that extra piece http://www.studyhood.com is added? If it was not added, then everything would work fine.
I deleted the cookies from the browser, before clicking the activation link (in the latter case), and it works, but it takes me again to http://www.studyhood.com/english/indexglogin.php not to translation_second.php (because cookies are deleted as I understand).

Can you please check it again and let me know what you think?

Thank you,

Marinos

studyhood
Posts: 11
Joined: 2013-12-06 14:43

Re: Web page is not loaded after activation

Post by studyhood » 2013-12-16 12:56

Hi,

I created a separate registration page, but if the user firstly clicks on the link to be taken to the restricted page, that is for example, http://studyhood.com/english/translatio ... pe=Regular, these parameter values stay in the browser memory and when the user clicks on the email activation link, the system tries to redirect her to translation_second.php with all those parameters. However, this is not successful because an additional www.studyhood.com is inserted in front of the URL.
If the user goes directly to the registration page (without clicking on the link to the non-restricted page), then the email activation link sends the user to studyhood.com/indexlogin without any problem.
Also if the user logs in (not registers) after clicking on the link to the restricted page, everything is again fine, since she is taken to translation_second.php without any problem.

Some help please!

Thank you,

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Web page is not loaded after activation

Post by Fred » 2013-12-19 11:33

Take a look at line 643 - 646 in tNG_defTrigg.inc.php, that is where {kt_activation_page} is constructed.

Try a simple hack. If the user lands on a restricted page and choose to register, set a cookie or something to some value.
After registration and before sending the email, check for the value and construct the {kt_activation_page} variable as required.

studyhood
Posts: 11
Joined: 2013-12-06 14:43

Re: Web page is not loaded after activation

Post by studyhood » 2013-12-20 00:58

Hi Fred,

thank you for your continuous assistance. However, I am afraid that my programming skills are not so advanced :).

What if I clear my web site cookies once the user clicks on the Register button of the registration form? What do you think, and how can I do this?

In any case, here are also the three lines you mentioned, if they could be of any assistance:

$tmpPath = KT_makeIncludedURL("");
$activation_page = KT_getUriFolder().$tmpPath.'activate.php?'. $args;
$tNG->addColumn("kt_activation_page", "STRING_TYPE", "VALUE", $activation_page);

Thank you,

Marinos

studyhood
Posts: 11
Joined: 2013-12-06 14:43

Re: Web page is not loaded after activation

Post by studyhood » 2013-12-20 13:10

I made it work! Here is what I did, and please let me know if it is a good solution.
When someone submits the registration form of the registration page, the browser returns automatically a confirmation page. I have used the following php code, in the confirmation page, to delete the cookies from my domain:

<?php
// unset cookies
if (isset($_SERVER['HTTP_COOKIE'])) {
$cookies = explode(';', $_SERVER['HTTP_COOKIE']);
foreach($cookies as $cookie) {
$parts = explode('=', $cookie);
$name = trim($parts[0]);
setcookie($name, '', time()-1000);
setcookie($name, '', time()-1000, '/');
}
}
?>

I tried it both in Firefox and Chrome, and it works.
I took the above code from the page http://phpmysql-code.blogspot.com/2010/ ... omain.html . They also mention
"
If cookie names are in Array notation, eg: user[username]
Then PHP will automatically create a corresponding array in $_COOKIE. Instead use $_SERVER['HTTP_COOKIE'] as it mirrors the actual HTTP Request header.
"
Should I take anything else into account?

Thank you,

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Web page is not loaded after activation

Post by Fred » 2013-12-20 19:50

Ahh you got it sorted.
Make the changes and test and then test some more. No other way.
Make sure to login and see if there is any way you can get to the registration page.
If so you might get issues with cookies being deleted. You shouldn't be able to get to the registration page in any way after you logged on.

I was going to refer you to a posting on http://stackoverflow.com/
It is a good place to find solutions to general php problems.

Post Reply