Delete an element in the json_encode array in the cookie


There is a string in the cookie that I converted to json_encode, How can I delete a value within this array?

name3=>null OR name3=>""

Problem best to give us a high level overview of what you are doing and what the real problem is you are trying to solve with this. JSON in the cookie is rather suspect. Please explain why you did that.

previously uploaded image name already exists in cookie
If the new image is loaded, I wanted to delete the old image name in the cookie
I thought wrong, if the new image is uploaded it will already overwrite the cookie

I’m trying to make a website that will generate a quote, I created it works, but I’m trying to make fixes with more correct coding

For unregistered dealers, when they enter their own company information, I also store cookies so that they do not enter company information again to generate a later price offer.

I prefer JSON to keep it in a batch array

Thank you

You should not use cookies for this information. All inputs to your site can be set/altered to any value and cannot be trusted. You must validate all inputs before using them on a web page. By storing this information in cookie(s) you must have validation code on every page that uses the cookie values, not just on the page that the information was originally submitted to. You should accept/pass a minimum amount of information through the browser.

You would store the items that have been picked either in a session or database based shopping cart. For a database based cart, you would use the session id to associate the items in the cart with the current user. A user would register/login to your site at/before the point where the items in the shopping cart are submitted to become a quote. All the specific user, company, cart, quote, order, shipping, invoice, payment, … information would only be stored on the server.

1 Like

Adem, I agree! Never store data in a cookie. Too easy to hack…

1 Like

Cookies contain only the guest visitor’s own company information.
Site is not the login information
For the guest visitor to fill in their company information automatically when they visit the site

Sponsor our Newsletter | Privacy Policy | Terms of Service