开发者

Print Out Security (Barcode?) [closed]

开发者 https://www.devze.com 2023-04-06 09:10 出处:网络
It's diffic开发者_JAVA百科ult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
It's diffic开发者_JAVA百科ult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have been pondering this security issue and not exactly sure how to go about this. On my site people will be able to print out flyers and post them somewhere (like a university) and take a picture of themselves next to it. In return they will receive a user upgrade.

These are some of the problems that I have thought of:

  • Users can print one flyer and take pictures in all sorts of places
  • User can take a picture, turn the corner and take another picture
  • Person A posts a flyer, Person B comes up and claims it as their own

Some possible solutions:

  • Write the person's username on the flyer when printing out
  • Have the user hold a piece of paper with their username and date
  • Limit to 1 photo per week
  • Print a barcode, alphanumeric code, or something else on the flyer as well.

My main focus for this question is the last solution. I have been thinking of storing a random salt for each time a flyer is printed.

What are other ways to keep the flyers as secure? (I know it's not possible to fully secure it.)

Programming Question: How should I generate a random code for each flyer? And how do I later verify it versus my system?


Use the username plus the current timestamp, then do a sha1() to the result. That should give you a very unique code.

For example

$code = sha1($username. time());


  1. Generate a random ID with something like base64_encode(uniqid("", TRUE)).
  2. Save it in your DB associated with the user's flyer.
  3. Include the unique ID on the flyer.
  4. When somebody posts a picture, look up in your DB to make sure it was a valid ID.
  5. Mark the DB entry as "redeemed" so nobody uses it again.
  6. Realize that no matter how clever you are, people will come up with ways to cheat your system.
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号