Cyber Tech Help Support Forums

Cyber Tech Help Support Forums (https://www.cybertechhelp.com/index.php)
-   Web Development & Graphic Design (https://www.cybertechhelp.com/forumdisplay.php?f=20)
-   -   search engines and cookies (https://www.cybertechhelp.com/showthread.php?t=170893)

FrEaKmAn December 5th, 2007 11:41 PM

search engines and cookies
 
Hi,

I have a question regarding cookies, does search engine accepts them? Because on my site I have set that cookies have to be set, otherwise it's looping, until cookie is accepted and if SE doesn't want cookies, then I have a problem. I tried validating site with w3.org and I get 302 error, maybe this is problem...

my website: moystudio.com

in case cookies are bad, what about sessions? I think it should be problems with this...

Buzz December 5th, 2007 11:54 PM

1 Attachment(s)
Why are you setting a cookie at all? Why are they needed for that site? I see nothing that should require a cookie. I note that the cookie is for language selection, but there's no such item in the UI.

As far as I know, spiders will not accept cookies but language cookies may be anotehr matter.

Nice looking site.
As for validation.. see attachment.

FrEaKmAn December 6th, 2007 10:06 AM

back then I didn't know how to use sessions so I used cookies. You probably didn't see the whole page, only slovenian version. What I did is that I'm setting language depending on the page you are looking. So like moystudio.com/novice is for slovenian language and moystudio.com/news with set cookie to english and so on. Then, I think I'll need to change this, because main page is loaded depending on the cookies, so it's different content for every language, but same url...

if engines don't like cookies, then this explains why my website isn't indexed :(

about validation, I know, it's a big mess but I'm working on it..

FrEaKmAn December 7th, 2007 07:25 PM

so I changes from cookies to sessions, I used wonderful session_set_save_handler() and after few hours I have already 180 sessions (well inputs in db which are cleaned on every 1000 reloads, I think)

is this normal? is there any script of better article how to create "users online" script and also include all bots etc..

Buzz December 8th, 2007 12:40 AM

I generally don't like linking to webmaster world because of their overly abundant user sign up campaign (it's annoying and prevents content from being shown sometimes.) Byt a Google search turned up these two items related to google and sessions/cookies....

http://www.webmasterworld.com/forum39/423.htm

http://www.webmasterworld.com/forum10003/3595.htm

FrEaKmAn December 8th, 2007 12:56 AM

well sessions inputs went up to 200 but now it's around 15 so it's much better...

FrEaKmAn December 12th, 2007 08:01 PM

I have a question regarding sessions and security. Is it enough to for example add session $_SESSION[admin]='1' after admin has logged in? So just to create a session which is checked if exists on every admin page?

Buzz December 12th, 2007 10:11 PM

Honestly, I'd use a cookie for admin flags. Sessions can be faked, cookies can't.

FrEaKmAn December 12th, 2007 10:15 PM

can I get more info, so you are talking about creating a cookie. But what should I pu inside?

Buzz December 12th, 2007 10:50 PM

You can use the same thing in a cookie..

PHP Code:

setcookie ('user',  'authorized'time()+36000); 

then check for the cookie in the admin areas

PHP Code:

if($_COOKIE['user'] != 'authorized') {
    echo 
'You are not authorized for this area!';
        
header("Location: index.php");
        exit();
   } 

You will need some sort of login script to set the cookie however. I'm uncertain how you were determining when to set the session.

FrEaKmAn December 12th, 2007 11:02 PM

it's possible but I'm not big fan of cookies. I would need to reprogram if I want to use cookies for users, so I'll have to save something else then authorized...

Buzz December 12th, 2007 11:10 PM

You can just set the cookie for admins you know. You don't need to set one for every user. Set the cookie at the same time you set the session variables. Just an if statement for admin users. With no cookie set the above authorization check will fail the same as if the cookie wasn't "authorized".


All times are GMT +1. The time now is 03:24 PM.

Copyright © Cyber Tech Help. All rights reserved. All other trademarks are the property of their respective owners.