Auto Login BUG
#21
Posted 21 November 2003 - 12:54 AM
#22
Posted 21 November 2003 - 01:17 AM
blueline, on Nov 20 2003, 04:54 PM, said:
Another thing I did was I changed all of the:
$cookie_url_array = parse_url((ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . substr(DIR_WS_CATALOG, 0, -1)); $cookie_path = $cookie_url_array['path'];to the following:
if (function_exists('session_set_cookie_params')) {
session_set_cookie_params(0, $cookie_path, $cookie_domain);
} elseif (function_exists('ini_set')) {
ini_set('session.cookie_lifetime', '0');
ini_set('session.cookie_path', $cookie_path);
ini_set('session.cookie_domain', $cookie_domain);
}
Not sure if that has any effect either...guess we'll find out now, won't we....
Can somebody tell me if that will effect OSC in any negative way?
Thanks
-Aaron
#23
Posted 21 November 2003 - 02:38 PM
The other cookie which is being called by the tep_setcookie function is not working.
I have included the code below so that you can see.
The "test" cookie
// Determine if cookies are enabled
setcookie("TEMPCOOKIE", "CookieOn", time() + 60 * 60);
$cookieinfo = $HTTP_COOKIE_VARS["TEMPCOOKIE"];
if ($cookieinfo == "CookieOn") {
global $cookies_on;
$cookies_on = true;
}
The "autologin" cookie
// HMCS: Begin Autologon ******************************************************************
if ($cookies_on == true) {
if (ALLOW_AUTOLOGON == 'true') { // Is Autologon enabled?
if (basename($PHP_SELF) != FILENAME_LOGIN) { // yes
if (!tep_session_is_registered('customer_id')) {
include('includes/modules/autologon.php');
}
}
} else {
setcookie("email_address", "", time() - 3600, $cookie_path); //no, delete email_address cookie
setcookie("password", "", time() - 3600, $cookie_path); //no, delete password cookie
}
}
// HMCS: End Autologon ******************************************************************
Thanks a bunch guys.
-Chris
#24
Posted 21 November 2003 - 05:32 PM
Lets see what is in your autologon.php code...
#25
Posted 21 November 2003 - 07:21 PM
<?php
/*
$Id: autologon.php,v 1.11 2003/01/18 20:00:00 Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Copyright (c) 2003 HMCservices
Released under the GNU General Public License
*/
if ($cookies_on == true) {
$cookie_url_array = parse_url((ENABLE_SSL == true ? HTTPS_SERVER : HTTP_SERVER) . substr(DIR_WS_CATALOG, 0, -1));
$cookie_path = $cookie_url_array['path'];
if (($email_address != "") && ($password != "")) {
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_lastname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
if (tep_db_num_rows($check_customer_query)) {
$check_customer = tep_db_fetch_array($check_customer_query);
if (tep_validate_password($password, $check_customer['customers_password'])) {
if (SESSION_RECREATE == 'True') {
tep_session_recreate();
}
$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . $check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");
$check_country = tep_db_fetch_array($check_country_query);
$customer_id = $check_customer['customers_id'];
$customer_default_address_id = $check_customer['customers_default_address_id'];
$customer_first_name = $check_customer['customers_firstname'];
$customer_country_id = $check_country['entry_country_id'];
$customer_zone_id = $check_country['entry_zone_id'];
if(!tep_session_is_registered('customer_id'))
tep_session_register('customer_id');
if(!tep_session_is_registered('customer_default_address_id'))
tep_session_register('customer_default_address_id');
if(!tep_session_is_registered('customer_first_name'))
tep_session_register('customer_first_name');
if(!tep_session_is_registered('customer_country_id'))
tep_session_register('customer_country_id');
if(!tep_session_is_registered('customer_zone_id'))
tep_session_register('customer_zone_id');
setcookie('email_address', $email_address, time()+ (365 * 24 * 3600), $cookie_path, '', ((getenv('HTTPS') == 'on') ? 1 : 0));
setcookie('password', $check_customer['customers_password'], time()+ (365 * 24 * 3600), $cookie_path, '', ((getenv('HTTPS') == 'on') ? 1 : 0));
$date_now = date('Y-m-d');
$qr = "update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . $customer_id . "'";
tep_db_query($qr);
$cart->restore_contents(); // restore cart contents
}
}
} else {
if($autologon_executed != 'true'){
$autologon_page = '<html><head><meta http-equiv="Refresh" content="0;URL=' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '"></head><body></body></html>';
$autologon_link = ((getenv('HTTPS') == 'on') ? 'https://' : 'http://') . $SERVER_NAME . $REQUEST_URI . (strpos($REQUEST_URI, "?") ? '&' : '?') . SID;
$autologon_executed = 'true';
if(!tep_session_is_registered('autologon_link'))
tep_session_register('autologon_link');
if(!tep_session_is_registered('autologon_executed'))
tep_session_register('autologon_executed');
tep_session_close();
exit($autologon_page);
}
}
if (tep_session_is_registered('autologon_link')) {
$x = $autologon_link;
tep_session_unregister('autologon_link');
tep_redirect($x);
}
}
?>
Thanks again/
#26
Posted 21 November 2003 - 09:59 PM
-Aaron
#27
Posted 22 November 2003 - 01:07 AM
#28
Posted 06 October 2006 - 12:37 AM
Would get blank screen, changed, Filename_Logoff to Filename_Default in autologon.php and still got blank screen when I would logoff and when I would close the browser and open it and get a blank screen again, pressing F5 would then make the site appear.
In autologon.php I made the change
// $autologon_page = '<html><head><meta http-equiv="Refresh" content="0;URL=' . tep_href_link(FILENAME_DEFAULT, '', 'SSL') . '"></head><body></body></html>';
to
$autologon_page = header("Location: index.php");
May well have speeded things up but it didn't solve any of my problems.
I took a little poetic license with an earlier post, bit of a variation on a theme and it is WORKING
In autologon.php, I made a change to an earlier suggested change at the top of autologon.php, I changed:
setcookie("TEMPCOOKIE", "CookieOn", time() + 60 * 60);
$cookieinfo = $HTTP_COOKIE_VARS["TEMPCOOKIE"];
if ($cookieinfo == "CookieOn")
tosetcookie("TEMPCOOKIE", "CookieOn", time() + 60 * 60);
$cookieinfo = $HTTP_COOKIE_VARS["TEMPCOOKIE"];
$cookieinfo2 = "";
$cookieinfo2 = $HTTP_COOKIE_VARS["email_address"];
if ($cookieinfo == "CookieOn" && $cookieinfo2 != "" )
{
Have tested and retested and I am not getting blank screens, I can log off and be redirected to the home page, things look good.
Spent hrs on this, well, on and off for days now, will test it some more, retest it tomorrow, and then get some users to test the whole new checkout experience.
Will post back if things are still good. Looks good so far
#29
Posted 07 October 2006 - 12:29 AM
allymacneil, on Oct 6 2006, 01:37 AM, said:
Ok everyone, everything is still going good,
There's a test site at
http://test.naturalfigure.co.uk
I'm happy with it all now, have seriously bug tested it and its holding water.
Hope this Helps, getting this working dragged out way longer than I wanted but am now happy with my FEC and autologon working together so roll on all them extra conversions :-)
ally
#30
Posted 07 October 2006 - 01:00 AM
allymacneil, on Oct 7 2006, 01:29 AM, said:
Famous last words, was just wanting to not show the remember me checkbox if cookies arent enabled, and found a wee bug, so I think I'll call it a night and leave something to do for over the weekend / early next week.
#31
Posted 09 October 2006 - 08:05 PM
allymacneil, on Oct 6 2006, 01:37 AM, said:
setcookie("TEMPCOOKIE", "CookieOn", time() + 60 * 60);
$cookieinfo = $HTTP_COOKIE_VARS["TEMPCOOKIE"];
$cookieinfo2 = "";
$cookieinfo2 = $HTTP_COOKIE_VARS["email_address"];
if ($cookieinfo == "CookieOn" && $cookieinfo2 != "" )
{Ok, so a little bit of bug hunting reveled as plain as day as the code above shows (for anyone who knows about cookies as I do now a little more)
That my cookie was expiring after an hour. Have changed this to be
setcookie("TEMPCOOKIE", "CookieOn", time() + 60 * 60 * 24 * 365 * 3);
So as it will remember me for up to 3 yrs :-)
The all important code in my application_top.php now looks like this:
// HMCS: Begin Autologon ******************************************************************
setcookie("TEMPCOOKIE", "CookieOn", time() + 60 * 60 * 24 * 365 * 3); //Remember this cookie for 3yrs
$cookieinfo = $HTTP_COOKIE_VARS["TEMPCOOKIE"];
//Only do autologon if there is an email set in cookie - avoids nasty logoff mishap
$cookieinfo2 = "";
$cookieinfo2 = $HTTP_COOKIE_VARS["email_address"];
if (ALLOW_AUTOLOGON == 'true' && $cookieinfo == "CookieOn" && $cookieinfo2 != "" ) // Is Autologon enabled and cookies permissable
{
if (basename($PHP_SELF) != FILENAME_LOGIN)
{ // yes
// if (!tep_session_is_registered('customer_id')) {
if ( ($session_started) && (!tep_session_is_registered('customer_id')) )
{
include('includes/modules/autologon.php');
}
}
}
else
{
setcookie("email_address", "", time() - 60 * 60 * 24 * 365 * 3, $cookie_path); //no, delete email_address cookie
setcookie("password", "", time() - 60 * 60 * 24 * 365 * 3, $cookie_path); //no, delete password cookie
}
// HMCS: End Autologon ******************************************************************
#32
Posted 28 February 2007 - 11:51 PM
#33
Posted 01 March 2007 - 09:26 AM
danil0, on Mar 1 2007, 10:51 AM, said:
The Coopco Underwear Shop
If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.
#34
Posted 18 April 2007 - 06:38 PM
nothing but bad things about it. I attempted to install it on my test cart and wound up undoing
the install because it caused errors beyond my current programming expertise.
Can someone fix up the instructions and re-release the VERY IMPORTANT and VITAL mod?
#35
Posted 01 May 2007 - 06:02 PM
find
if(ALLOW_AUTOLOGON != 'false') {
and above it add
if ($cookies_on == true) {
find
// HMCS: End Autologon **********************************************************
and right above it add
}
I cant seem to find the directory catalog/includes/boxes/meberlogin.php or anything close. What file should I be looking for, to make this fix work?
Thanks!
#36
Posted 02 May 2007 - 09:01 PM
<?php // HMCS: Begin Autologon **********************************************************
if(ALLOW_AUTOLOGON != 'false') && ($cookies_on == true)) {
?>
If anyone could help me with any of this, I would really appreciate it.
#37
Posted 03 May 2007 - 02:48 PM
pulp2, on May 3 2007, 07:01 AM, said:
<?php // HMCS: Begin Autologon **********************************************************
if(ALLOW_AUTOLOGON != 'false') && ($cookies_on == true)) {
?>
If anyone could help me with any of this, I would really appreciate it.The Coopco Underwear Shop
If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.
#38
Posted 04 May 2007 - 09:27 PM
aedmonds, on Nov 20 2003, 11:05 PM, said:
I had the same problem...I've been working on getting this implemented on my site but have been very frustrated. What I found was the problem for me was that I was using the "Use Search -Engine Safe URLs" option but contribution works off of a PHP get path which pulled up "action" for my path. Try sorting your cookies by when they were last modified and play around with it. My cookies were coming up with the domain "action." You need to go into the code if you are having this problem...
Hope that helps...
Although I'm having a problem of my own. The Autologon feature works great on my computer, but whenever I use my brother's computer, login, close the browser, and open up the site again, I get automatically sent to a secured logoff page. So maybe someone can help me with that one?
Maybe the wizards might return and give some help...
Thanks
-Aaron
Same here. When I check the autologin box and leave the site and come back, it goes straight to the log off page (logoff.php)
It's exactly the same for firefox and IE. Any ideas anyone?
#39
Posted 19 June 2007 - 12:01 PM
I'm still getting redirected to logoff.php when I revisit my site. Also, when returning to the site root, I'm faced with the 'please log in' message.
I think catalog/includes/modules/autologon.php is to blame.
The end of the file is as follows:
} else {
if($autologon_executed != 'true'){
$autologon_page = '<html><head><meta http-equiv="Refresh" content="0;URL=' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '"></head><body></body></html>';
$autologon_link = ((getenv('HTTPS') == 'on') ? 'https://' : 'http://') . $SERVER_NAME . $REQUEST_URI . (strpos($REQUEST_URI, "?") ? '&' : '?') . SID;
$autologon_executed = 'true';
if(!tep_session_is_registered('autologon_link'))
tep_session_register('autologon_link');
if(!tep_session_is_registered('autologon_executed'))
tep_session_register('autologon_executed');
tep_session_close();
exit($autologon_page);
}
}
if (tep_session_is_registered('autologon_link')) {
$x = $autologon_link;
tep_session_unregister('autologon_link');
tep_redirect($x);
}
?>
Should the else condition be fired when returning to the site? The if condition is this:
if (($email_address != "") && ($password != "")) {
Should that be returning false?
Any help greatly appreciated.
#40
Posted 06 November 2007 - 09:29 PM









