SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist borna's Avatar
    Join Date
    Jun 2006
    Location
    Iran, Tehran
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Generate Random code

    How may I generate a 'code for security' section at my web-page for new users to register.

    It randomly generate a code and ask them to enter unless no enterance.
    -1/2=999?

  2. #2
    SitePoint Evangelist vikrantkorde's Avatar
    Join Date
    Jun 2004
    Location
    Mumbai, India
    Posts
    541
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I f you want it for the security reasons then only javascript will not help you, as whole code will be available at the client side and hacker can easily crack it.
    In this case you should take help form server side also.
    Vikrant Korde
    S Y S T I M E, Mhape,
    Mumbai, Maharashtra, India.

  3. #3
    SitePoint Evangelist borna's Avatar
    Join Date
    Jun 2006
    Location
    Iran, Tehran
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What if I put the code at a simple function.js file and refer to it at my html.

    I don't know if it is risky or not.

    What about the code, as if i just need to check weather the applicant is human, A CAPTCHA (an acronym for "Completely Automated Public Turing test to tell Computers and Humans Apart"

    So it is not that much security sensitive. Just generate some random combination of letters and digits is the aim either server side or client side.
    -1/2=999?

  4. #4
    malloc
    Join Date
    Nov 2006
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is usually done by generating an image with the code, so that bots can't read it but humans can. It depends what server-side language you are using, but PHP with the GD library makes this very easy.

  5. #5
    SitePoint Evangelist borna's Avatar
    Join Date
    Jun 2006
    Location
    Iran, Tehran
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Java, I use java as a server side language. But could you pls say how come you asked of that.
    -1/2=999?

  6. #6
    ********* user
    Join Date
    Mar 2006
    Location
    Malta
    Posts
    312
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You should use a server script to generate the code as it is much more secure.

    However here is the javascript method for generating random numbers.

    http://www.webdevelopersnotes.com/tu...avascript.php3

  7. #7
    malloc
    Join Date
    Nov 2006
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    borna: I asked, so I could be more specific. PHP uses the GD library for generating images.

    You can apparently generate dynamic images from java servlets too:
    http://www.javaworld.com/javaworld/j...-servlets.html

    The idea is to create an image canvas, draw the code onto it, and output the image to the browser.

    Hope this helps

  8. #8
    SitePoint Evangelist borna's Avatar
    Join Date
    Jun 2006
    Location
    Iran, Tehran
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JonSiddle
    The idea is to create an image canvas, draw the code onto it, and output the image to the browser.
    makes perfect sense, I'll give it a try! Tnks very much.
    -1/2=999?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •