Auto Login BUG
#1
Posted 06 February 2003 - 07:44 PM
It appeared to be working nicely. However, when I went to this site,
http://www.searchengineworld.com/cgi-bin/s.../sim_spider.cgi
I discovered that with the autologin enabled, the spiders can't see your site, at all.
If anyone out there is useing this contribution, make sure you go there and see if spiders can see YOUR website.
NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.
If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.
#2
Posted 07 February 2003 - 08:13 PM
I noticed the same thing too when I installed it... it is because most spiders (maybe all) do not spider secure pages (HTTPS/SSL) and the autologin routine redirects through HTTPS.
a quick fix is to check if the user has cookies enabled. if they do, then do the autologin routine. if not, then do not do it b/c they are either a bot or have cookies disabled (neither of which can use the autologin anyways).
I just came up with this, installed it, and then tested on the search engine spider sim and my pages can now be spidered... also cookie users can still auto login.
HERE IT IS:
in includes/modules/autologin.php, place this code before the start of the autologin code (at the very top after the comments):
setcookie("TEMPCOOKIE", "CookieOn", time() + 60 * 60);
$cookieinfo = $HTTP_COOKIE_VARS["TEMPCOOKIE"];
if ($cookieinfo == "CookieOn") {
basically sets a temp cookie to determine if cookies are enabled, and if so, then continues with the auto login routine. if not, then it is skipped over (no HTTPS redirect, so we get spidered!)
also, at the end of the autologin.php files, you will need to close the if statement, so put a } right before the closing ?>:
} ?>
Also, what I am thinking of doing, is that since only cookied users can use the autologin, only present the option to them on login.php using the same if statement (or perhaps placing it in application_top.php and setting a variable like $COOKIES_ENABLED = true and then the check for cookies would just become if ($COOKIES_ENABLED == true) to use across different pages to check if the user has enabled cookies.
Also, after the check, it might be a good idea to delete the temp cookie since we create it on every page to check for cookies enabled, but I haven't thought that far ahead.
#3
Posted 07 February 2003 - 09:06 PM
OK, I'll put this in tonight, and I'll look at some of your other suggestions, as well.
I hadn't realized that spiders couldn't spider a site on SSL. In fact, I put almost the entire shop on SSL. In other words, once the customer hits a secure page, he says in secured pages until he leaves. That way there are no warnings that they are "about to leave a sucure page" and what not.
NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.
If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.
#4
Posted 07 February 2003 - 10:14 PM
I changed it some... I moved the cookie test to application_top, so that on a few other pages, I can check if cookies are on alot easier...
so in application_top.php I added:
// 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;
}
I dunno if it matters where it goes, but I put if right after the require configure line (about line 35).
so then in modules/autologon.php, I took out the cookie check since I moved it to app_top, and use this now:
if ($cookies_on == true) {
then in /login.php, the part that was added in from the contrib for users to select if they want to be remembered, I changed from:
if (ALLOW_AUTOLOGON != 'false') {
toif ((ALLOW_AUTOLOGON != 'false') && ($cookies_on == true)) {
this way, if a user has cookies disabled, they don't even see a hint of the autologin feature, since it doesn't work for them...I think we have something now
#5
Posted 18 February 2003 - 07:35 PM
sorry i am a dummy and cant figure out what do you mean by
Quote
if ($cookies_on == true) {could you possibly explain what changes you made in
/catalog/includes/modulesautologon.php
and
/cataloge/login.php
thank you
Hats
#6
Posted 19 February 2003 - 09:21 PM
#7
Posted 20 February 2003 - 10:02 AM
You are not a dummy ... it just sounds more complicated than it is. Add the text in red (I think it is around line 185ish in /catalog/includes/application_top.php):
// define how the session functions will be used
require(DIR_WS_FUNCTIONS . 'sessions.php');
tep_session_name('osCsid');
// 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;
}
// include the database functions
require(DIR_WS_FUNCTIONS . 'database.php');
Edit the very bottom of the same file where it says HMCS:Begin Autologon (Remember the green text is already there ... just add the code in red):
// 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 ******************************************************************
I hope this is useful to you.
#8
Posted 20 February 2003 - 07:26 PM
thanks a lot, i did exactly what you said but it still shows the SID along with my default.php
am i suppose to make any changes in
/catalog/includes/modules/autologon.php
and
/cataloge/login.php
thanks for your help
hats
#9
Posted 22 February 2003 - 02:14 PM
http://www.searchengineworld.com/cgi-bin/s.../sim_spider.cgi
After you type in your domain it will list any links it sees.
Let me know if this helps.
#10
Posted 22 February 2003 - 02:49 PM
i typed in url of my default.php and it spidered all my links but SID was attached with all of the links
when other search engins spiders do they spider it with sid?
thanks
Hats
#11
Posted 23 February 2003 - 02:46 PM
#12
Posted 23 February 2003 - 03:10 PM
i will try to install it again since i have applied your fix to the autologon contibution and let you know
thanks for your help
Hats
#13
Posted 23 February 2003 - 05:16 PM
it is a great idea I think, just needs to be worked on some I think.
#14
Posted 23 February 2003 - 06:03 PM
i tried to install the SID killer again but the same problem it gets stuck at logoff.php in secure server and keeps refrashing blank logoff.php
Joshua,
can you give me idea how did you make it work?
thank you
#15
Posted 23 February 2003 - 07:05 PM
as far as I know, the Sid Killer will not work properly is you have SSL on a different server as you regular domain.
NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.
If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.
#16
Posted 23 February 2003 - 07:24 PM
i checked my site at http://www.searchengineworld.com/cgi-bin/s.../sim_spider.cgi and there is no session ID attached to the links
Quote
is there any known problem i am missing?
thanks
#17
Posted 23 February 2003 - 08:46 PM
NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.
If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.
#18
Posted 24 February 2003 - 03:47 PM
any solutions?
thanks
#19
Posted 15 November 2003 - 06:00 PM
I do have cookies enabled, and am getting them from other sites. I tested it using the code above, and cookies are on...
I actually get a cookie on my machine (the temp test cookie) but I don't get the actual logon cookie.
Guys?
Thanks,
-Chris
Edited by blueline, 15 November 2003 - 06:03 PM.
#20
Posted 20 November 2003 - 10:05 PM
blueline, on Nov 15 2003, 10:00 AM, said:
I do have cookies enabled, and am getting them from other sites. I tested it using the code above, and cookies are on...
I actually get a cookie on my machine (the temp test cookie) but I don't get the actual logon cookie.
Guys?
Thanks,
-Chris
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
Edited by aedmonds, 20 November 2003 - 10:07 PM.









