Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How can I make a javascript that requires a username in a form

    I want my javascript to connect to a cookie called username and check to see if that word is included in a form (file).

    So if my username is XTGeminiman and the file I'm uploading is xtgeminimanbluepic.jpg it will pass but if the usernames not at the beginning of the string it doesn't submit

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    You should not be using JavaScript for this since i is not secure.

    If you want to do this, you will have to include this user list on the page in a format that JavaScript can understand. (Most likely an array) You then would have to compare that info. Again the names woulf be in plain text so anyone could use any of tha names listed.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    Feb 2005
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    damn, i thought javascript could request cookies. I guess I'll just use a server side language instead.

  • #4
    Registered User
    Join Date
    Oct 2004
    Posts
    592
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by XTGeminiman
    damn, i thought javascript could request cookies. I guess I'll just use a server side language instead.
    Server side cookie calling is more secure.
    Gmail knows if you open different gmail accounts at the same time.
    That's what cookie thing.

  • #5
    Registered User
    Join Date
    Oct 2004
    Posts
    592
    Thanks
    0
    Thanked 1 Time in 1 Post
    Quote Originally Posted by XTGeminiman
    damn, i thought javascript could request cookies. I guess I'll just use a server side language instead.
    yeah but the visitors delete cookies in browsers, then what'll you do ?


  •  

    Posting Permissions

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