Re: Serial Numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



""Daevid Vincent"" <daevid@xxxxxxxxxx> wrote in message 
news:A380A1570D4C4351B38E1CCE2AABEE69@xxxxxxxxxxxxxx
>> -----Original Message-----
>> From: Gary [mailto:gpaul@xxxxxxxxxxxxxxxx]
>> Sent: Monday, July 12, 2010 11:53 AM
>>
>> 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?
>
> Is there a reason you need to increment by 1? I mean, are you going to
> validate the coupon someone brings in to see if it's in the database or is
> used already? Since you say you don't care if the number is skewed, it
> sounds as if you don't care about the code either really.
>
> Point being, why not just use md5(time()) or uniqid() or something and 
> make
> some truly unique code (that you may or may not wish to store in a DB).
> This will be obscure enough the average person won't know that it isn't
> tracked and most likely won't try to make their own. If I saw 123457, I'm
> pretty sure I could make a coupon with 123500 on it. But if I saw
> 6ccd780c-baba-1026-9564-0040f4311e29 then I'm not really going to try and
> fudge one of those. Then I'd use the barcode library to print the code
> (again, doesn't have to actually work if you're not going to do a lookup)
> just to add more "realizm" to it. There are a billion different ways to
> make a unique ID. Even IF you are going to track them, you really 
> shouldn't
> do a sequential code as you originally wanted to do.
>
> http://us.php.net/manual/en/function.uniqid.php
> http://php.net/manual/en/function.com-create-guid.php
> http://us.php.net/manual/en/function.mssql-guid-string.php
> http://us.php.net/manual/en/function.md5.php
> http://us.php.net/manual/en/function.sha1.php
> http://us.php.net/manual/en/function.hash.php
> http://us.php.net/manual/en/function.time.php
> http://dev.mysql.com/doc/refman/5.0/en/miscellaneous-functions.html#functio
> n_uuid
>
> Heck, you could even just use ip2long() on their IP address and then when
> someone "redeems" the coupon code, a simple long2ip() would tell you if
> it's a valid "IP" format rather than some hacked up string.
> http://us.php.net/manual/en/function.ip2long.php
> http://us.php.net/manual/en/function.long2ip.php
>
> Daevid.
> http://daevid.com
>
> "Some people, when confronted with a problem, think 'I know, I'll use
> XML.'"
> Now they have two problems.

Daevid

Thanks for your reply.

The numbers are not for show, we are not trying to make it seem like we have 
thousands of coupons.  We are going to use the numbers to guage how many 
times people see the coupon and to see how many it takes before we have 
someone show up to use it, but dont really care if someone gets a kick out 
of hitting the refresh button 10 or 20 times to watch the number go up.

I was going to start the number at 72010001 (July 2010, 001) and if someone 
figured out what it was, we dont really care. As I mentioned, it is a small 
shop (one man show) that the site gets and average of 350 visits per month 
(which he is very happy with over what he had).

Although I do like the idea of using there ip address...

Thanks for your reply and all the links.

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





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux