From: "Gary" on 12 Jul 2010 14:52 I'm sure it is possible, but I am unsure how to do this. I have created a Sale coupon that I was going to put up on a site that I manage, for visitors to print out and bring to the store. The coupon is currently a .png, however I was planning on converting to a pdf. I would like to put on the coupon a serial number that increases by 1 everytime the page is viewed. I dont really care if someone refreshes the page and skews the numbers. Is this possible and could someone give me some help? Thanks Gary __________ Information from ESET Smart Security, version of virus signature database 5273 (20100712) __________ The message was checked by ESET Smart Security. http://www.eset.com
From: Ashley Sheridan on 12 Jul 2010 15:13 On Mon, 2010-07-12 at 14:52 -0400, Gary wrote: > I'm sure it is possible, but I am unsure how to do this. I have created a > Sale coupon that I was going to put up on a site that I manage, for visitors > to print out and bring to the store. The coupon is currently a .png, however > I was planning on converting to a pdf. I would like to put on the coupon a > serial number that increases by 1 everytime the page is viewed. I dont > really care if someone refreshes the page and skews the numbers. > > Is this possible and could someone give me some help? > > Thanks > > Gary > > > > __________ Information from ESET Smart Security, version of virus signature database 5273 (20100712) __________ > > The message was checked by ESET Smart Security. > > http://www.eset.com > > > > > You need some indicator on your server to keep track of the number. To me, the ideal solution would appear to be a MySQL database. You can set up a table with an auto_increment field and use the id generated from that. Two things to maybe note: 1. Don't use MAX(id) in a query to get the next auto value, use something like mysql_insert_id() instead. The MAX() method is just a race condition waiting to happen. 2. If you expect a lot of traffic, then consider setting this table to use the InnoDB engine instead of MyIsam which is usually the default. This allows MySQL to apply row-level locking instead of table-level, which can improve performance when PHP has to wait for MySQL. Thanks, Ash http://www.ashleysheridan.co.uk
From: Floyd Resler on 12 Jul 2010 15:17 On Jul 12, 2010, at 2:52 PM, Gary wrote: > I'm sure it is possible, but I am unsure how to do this. I have created a > Sale coupon that I was going to put up on a site that I manage, for visitors > to print out and bring to the store. The coupon is currently a .png, however > I was planning on converting to a pdf. I would like to put on the coupon a > serial number that increases by 1 everytime the page is viewed. I dont > really care if someone refreshes the page and skews the numbers. > > Is this possible and could someone give me some help? > > Thanks > > Gary > Is there any particular reason you need it to be a PDF? If not and the GD library is installed in your PHP, I would suggest using the GD library to draw your serial number on the coupon. As for keeping track of the counter I would do it either in a database table or save the number to file. Take care, Floyd
From: Ashley Sheridan on 12 Jul 2010 15:22 On Mon, 2010-07-12 at 15:17 -0400, Floyd Resler wrote: > On Jul 12, 2010, at 2:52 PM, Gary wrote: > > > I'm sure it is possible, but I am unsure how to do this. I have created a > > Sale coupon that I was going to put up on a site that I manage, for visitors > > to print out and bring to the store. The coupon is currently a .png, however > > I was planning on converting to a pdf. I would like to put on the coupon a > > serial number that increases by 1 everytime the page is viewed. I dont > > really care if someone refreshes the page and skews the numbers. > > > > Is this possible and could someone give me some help? > > > > Thanks > > > > Gary > > > > Is there any particular reason you need it to be a PDF? If not and the GD library is installed in your PHP, I would suggest using the GD library to draw your serial number on the coupon. As for keeping track of the counter I would do it either in a database table or save the number to file. > > Take care, > Floyd > > I can think of a good reason for making it as a PDF. A PDF is built for printing to scale exactly as you need, whereas a bitmap is very different. Traditionally, GD creates screen images, which are 72dpi, whereas print usually uses 300dpi bitmaps, and they generally don't scale well. Having said that, writing it in GD will be a fair bit easier! Thanks, Ash http://www.ashleysheridan.co.uk
From: Floyd Resler on 12 Jul 2010 15:26 On Jul 12, 2010, at 3:22 PM, Ashley Sheridan wrote: > On Mon, 2010-07-12 at 15:17 -0400, Floyd Resler wrote: >> >> On Jul 12, 2010, at 2:52 PM, Gary wrote: >> >> > I'm sure it is possible, but I am unsure how to do this. I have created a >> > Sale coupon that I was going to put up on a site that I manage, for visitors >> > to print out and bring to the store. The coupon is currently a ..png, however >> > I was planning on converting to a pdf. I would like to put on the coupon a >> > serial number that increases by 1 everytime the page is viewed. I dont >> > really care if someone refreshes the page and skews the numbers. >> > >> > Is this possible and could someone give me some help? >> > >> > Thanks >> > >> > Gary >> > >> >> Is there any particular reason you need it to be a PDF? If not and the GD library is installed in your PHP, I would suggest using the GD library to draw your serial number on the coupon. As for keeping track of the counter I would do it either in a database table or save the number to file. >> >> Take care, >> Floyd >> >> > > I can think of a good reason for making it as a PDF. A PDF is built for printing to scale exactly as you need, whereas a bitmap is very different. Traditionally, GD creates screen images, which are 72dpi, whereas print usually uses 300dpi bitmaps, and they generally don't scale well. > > Having said that, writing it in GD will be a fair bit easier! > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > > "Having said that, writing it in GD will be a fair bit easier!" Yep, that's why I was asking! :) Take care, Floyd
|
Next
|
Last
Pages: 1 2 Prev: Validate if the field of a form is empty Next: Help with template file and email |