Membership is FREE – with unlimited access to all features, tools, and discussions. Premium accounts get benefits like banner ads and newsletter exposure. ✅ Signature links are now free for all. 🚫 No AI-generated (LLM) posts allowed. Share your own thoughts and experience — accounts may be terminated for violations.

Do your sites rely on javascript and/or cookies to work right?

Status
Not open for further replies.

Bob

Jedi Master
Joined
Apr 8, 2002
Messages
3,102
Reaction score
29
I use cookies extensively, especially on sites where you have to "Log In". it is a lot easier (for me at least) to do it this way rather than passing variables in the hyperlink or hidden form fields.

I do not abuse cookies. Typically, I will only store the userid so it can be read and then looked up in a database to get any info I need about the user. All of my cookies are destroyed when the user shuts down the browser.

-Bob
 

AhmedF

DNF Member
Legacy Exclusive Member
Joined
Jul 18, 2003
Messages
222
Reaction score
0
Cookies a lot .. if you look around on php.net, you can find the header file so that IE6 [on default settings] will accept your cookie.

I stay away from javascript ... and use it only for imageovers.
 

Bob

Jedi Master
Joined
Apr 8, 2002
Messages
3,102
Reaction score
29
Originally posted by AhmedF
I stay away from javascript ... and use it only for imageovers.

I use JavaScript only for Form Validation. I also do form validation on the PERL / PH level too. Yes, this is double kill, but JavaScript validation is a LOT quicker. But if for some reason the user does not allow JavaScript on their browser, the PERL / PHP script will do the validation as well.

-Bob
 

NameGuy

Level 8
Legacy Exclusive Member
Joined
Apr 19, 2003
Messages
1,827
Reaction score
2
Originally posted by Bob
I also do form validation on the PERL / PH level too.

I always do this because someone can get the source for your page, modify it by taking out the clientside javascript validation, and then submit crap into your database to corrupt it.

I also commonly use this function when adding stuff to database fields because users may embed script that will be executed when you display the values in a web page.

PHP:
function safehtml($str) {
      //nuke script and header tags and anything inbetween
       $str = preg_replace("'<script[^>]*?>.*?</script>'si", "", $str);
       $str = preg_replace("'<head[^>]*?>.*?</head>'si", "", $str);
       
       //listed of tags that will not be striped but whose attributes will be
       $allowed = "br|b|i|p|u|a|block|pre|center|hr";
       //start nuking those suckers. don you just love MS Word's HTML?
       $str = preg_replace("/<((?!\/?($allowed)\b)[^>]*>)/xis", "", $str);
       $str = preg_replace("/<($allowed).*?>/i", "<\\1>", $str);

       return $str;
}

More handy "safe" functions are here:
http://us4.php.net/strip_tags
 

.com.net.org

Level 8
Legacy Platinum Member
Joined
Oct 20, 2002
Messages
1,951
Reaction score
0
from your title, I don't think it's wise to rely on JavaScript / Cookie for your site to work right.
 

darrenl

Level 8
Legacy Platinum Member
Joined
Sep 22, 2003
Messages
1,856
Reaction score
4
I use sessions because then it doesn't store a cookie.
 

sponk

Level 4
Legacy Platinum Member
Joined
Dec 7, 2002
Messages
196
Reaction score
0
Originally posted by Darren06
I use sessions because then it doesn't store a cookie.

same here :cool:
But I'm thinking of using cookies in the near future as I want to implement an affiliate program into my site.
 
Status
Not open for further replies.

Who has viewed this thread (Total: 1) View details

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members Online

Premium Members

Upcoming events

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators

Top Bottom