简体   繁体   English

更改购物车价格的安全方法

[英]Safe way of altering prices in shopping cart

I am trying to create quite simple project. 我正在尝试创建一个非常简单的项目。 I will explain it on an example. 我将在一个示例中对其进行解释。

Description on what i am trying to do using simply example: 仅使用示例说明我要执行的操作:
Let say you can upload two images to my site, select size (1000x500 or 2000x1000), and write some text. 假设您可以将两张图片上传到我的网站,选择尺寸(1000x500或2000x1000),并写一些文字。 My site would merge these 2 images into one, of course resizing it properly, and write some text on top of the images. 我的站点将把这2张图像合并为一张,当然会适当地调整其大小,并在这些图像的上方写一些文本。 That's quite simple. 那很简单。 After generating such image, it sends you to a page where you can preview the image and there is a Paypal button with 1$ price. 生成此类图像后,它将带您到一个页面,您可以在其中预览图像,并且有一个价格为1美元的Paypal按钮。 Everything in $_POST[] when it comes to PHP and GD so it should be safe. $_POST[]涉及PHP和GD的所有内容,因此应该是安全的。

I want to allow user push "next image" saving the one he already made, and make another one. 我想允许用户按“下一张图片”保存自己已经制作的一张,再制作一张。 Same process, he finishes at a site with 2 image previews, and a button saying 2$. 同样的过程,他在一个包含2张图片预览和一个显示2 $的按钮的站点上完成。 Again shouldn't be that hard. 再次不应该那么难。

Problem and the question: 问题与疑问:
But here comes my question. 但是我的问题来了。 User created 2 images, both 1000x500, and he see both previews. 用户创建了2张图像(均为1000x500),并且看到了两个预览。 And i want to let him change ON THIS SCREEN one image to 2000x1000, but that also means change of the price. 我想让他在此屏幕上将一张图像更改为2000x1000,但这也意味着价格的改变。 So is that possible without reloading the page, to change SAFELY quantity or some properties of images , also altering price on paypal button? 那么是否可以在不重新加载页面的情况下更改安全数量或图像的某些属性 ,也可以更改Paypal按钮上的价格? I am sure javascript isnt the best idea here. 我敢肯定javascript不是这里的最好主意。 I saw paypal lets me use "Add drop-down menu with price/option" but i cant rly use it determine which photo gonna be big one, and which one small one. 我看到贝宝让我使用“添加具有价格/选项的下拉菜单”,但我无法使用它来确定哪张照片将是大照片,哪张照片将是小照片。 Cuz with 3 photos there are already quite some possibilities (all small, 1st big, second big, two big etc)... Cuz拥有3张照片,已经有很多选择(全部较小,第一较大,第二较大,两个较大等)...

Solution i wish not to use, but didn't find any other so far: 我不希望使用的解决方案,但到目前为止没有找到其他解决方案:
Or i have to let him change these properties/values in a form (disabling buy button somehow), and then pass everything using $_POST[] which would redirect him to page, with proper button? 或者我必须让他以某种形式更改这些属性/值(以某种方式禁用“购买”按钮),然后使用$_POST[]传递所有内容,并使用适当的按钮将其重定向到页面?



I know its kinda messy, but i tried to explain it best i was able too. 我知道它有点混乱,但是我也尽力解释了一下。 My english isn't the best. 我的英语不是最好的。 Hope you guys understand what i am trying to do. 希望你们了解我正在尝试做的事情。

it's not messy and many website does it, example: 它并不messy ,很多网站都这样做,例如:
On many Buy-Pages, when you choose US as a country the page submits itself to the server and a new state dropdown appears. 在许多“购买页面”上,当您选择“美国”作为country ,页面会将自己提交给服务器,并显示一个新的state下拉列表。
You can certainly do that, or use AJAX. 您当然可以做到这一点,或使用AJAX。 But, if there are only a few options I WOULD use JS/jQuery to change the prices (especially since it's such low prices and since the prices are static). 但是,如果只有几个选项,我将使用JS / jQuery来更改价格(尤其是因为它的价格如此之低且价格是静态的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM