What risks do I have to consider when encrypting server side as opposed to client-side?

Shopping cart coding - Client or server side?

  • Is it acceptable - with the ubiquity of modern browser  usage - to code a website's shopping cart in Js as opposed the aite's framework language (php, ASP, etc)? What are the cons of going that route?

  • Answer:

    Depends on requirements. Your answer spans a range of possibilities from, at one extreme, a client based shopping with no persistence at all, to a cart which uses sessions to persist, to a cart which persists explicitly in your own database (implying an account system). All of these could be implemented either in JavaScript/AJAX or traditionally using form submits and page requests. It really comes down to the kind of user experience you want to offer. AJAX can give you a more streamlined flow without page reloads. A key point of course is whether you need to support browsers with JavaScript disabled, or blocked. If so, you can fall back to a non-JS version of the flow.

Toby Thain at Quora Visit the source

Was this solution helpful to you?

Other answers

The main con is simple - if the input to the site is incorrect, and you aren’t checking it both in the browser and the server, you’re getting bad input. That can lead to SQL injection, a blown server or any other of many problems.Some things should be done in the client (checking the length of phone numbers and zip codes, formatting phone numbers, Capitalizing the first letters of names, etc.) and some things have to be done on the server (checking things in a server-side database. (Even using AJAX to get the data to the browser means getting it from the server first.)So the answer to your question - “Shopping cart coding - client or server?” is “both”. Some parts have to be on one or the other, some parts should be on one or the other and some parts should be on both. (Never send unchecked data to the server, never let the server accept data without checking it - even if it was checked in the client.)And that’s only one example of the simplest problem with putting code on only one or the other.

Al Klein

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.