Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7598861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:31:00+00:00 2026-05-30T22:31:00+00:00

This is probably a very basic/introductory thing, but let me paint a scenario: Let’s

  • 0

This is probably a very basic/introductory thing, but let me paint a scenario:

Let’s say I’m using jQuery to do some sort of mini quiz game on my site. The user clicks the correct answer, and then a window pops up with a secret “winner’s code” that they can redeem elsewhere.

How can I generate the winner’s code so that it doesn’t just appear in the HTML and in a way that users cannot reverse-engineer it (at least without considerable effort)?

I mean, if I just generated an encoded string containing their username and some sort of additional information only I know, that would work, right? Or MD5 hash or something, but how do I make it so the winner’s code itself doesn’t appear in the HTML, and only when the correct answer is chosen?

Thank you for any suggested reading/tutorials/assistance/advice you can offer.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:31:01+00:00Added an answer on May 30, 2026 at 10:31 pm

    There are a couple of questions there.

    1) How to generate a secure code:

    if you are implementing a ‘winner code’ you could use an hashed iv + secret + user information, or some signing mechanism. You could also implement a code expiry time on the server so that you could further raise the bar, if necessary.

    2) Getting the code to the winning user:

    If you don’t want the code to appear in the html, then you want to use ajax to get it. Then inject the code into the DOM where you want to display it. Further, you should be using a secure SSL channel to do this so that you guard against sniffing. Even further, consider some kind of ‘one-time’ token so that a man-in-the-middle cannot repost your code request and receive the same win code.

    Hope this gives you something to consider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a very basic question with probably an easy answer. Let's say I
This is probably very basic stuff, but please bear in mind I am completely
This is probably a very basic question, but I could not get my way
This is probably something very basic, but my Erlang installation is doggedly rejecting my
This is probably very basic, but it's giving me a headache, and I'm not
This probably is a very very basic question but i can't seem to find
This is probably a very basic question but I haven't found any detailed information
All, This is probably very basic, but I cannot find an answer that works
I realize that this is probably a very basic question, but I have spent
Probably a very basic solution to this, but I can't seem to figure it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.