Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Grave_sts · Feb 21, 2012 at 10:22 PM · databaselogin

Login - var compare to database?

Hey all I've made a very simple login system, and have a registration screen which saves the required data to a Microsoft access database.

What I'm struggling/curious about is how to compare what the user inputs to what exists in the database

Here is my current login code (at the moment I just have a var that can be defined in the code for the users name & surname):

 var mySkin : GUISkin;
 
 var GeneralWidth = 73; // Width for most bottons should be the same. Use GeneralWidth. Use there custom Width if needed.
 
 var LoaderHeight = 10;
 var LoaderWidth = 10;
 
 var LogHeight = 101;
 var LogWidth = 163;
 
 var PlayerUsername = "Test1";        //var for user name
 var PlayerPassword = "12345";        //var for user password
 
 var UserHeight = 35;
 var UserWidth = 1;
 
 var PassHeight = 65;
 var PassWidth = 1;
 
 var GameOwner = "";                //shows current user input for name
 var GameOwnerPassword = "";        //shows current user input for password
 
 var UsernameCORRECT = false;
 var PasswordCORRECT = false;
 
 function Update (){
     // Updates each frames and checks if the TextArea is equal to the username we want
     if (PlayerUsername == GameOwner){
             UsernameCORRECT = true;
     }
         
     else {
             UsernameCORRECT = false;
     }
         
     // Updates each frames and checks if the TextArea is equal to the password we want    
     if (PlayerPassword == GameOwnerPassword){
             PasswordCORRECT = true;
     }
     
     else {
             PasswordCORRECT = false;
     }
 }
 
 function OnGUI () {
     // Assign a skin to you menu
     GUI.skin = mySkin;
     
     // Background box
     GUI.Box (Rect (LoaderHeight,LoaderWidth,220,120), "Log-in");
     
     //Text area for the username
     PlayerUsername = GUI.TextArea (Rect(GeneralWidth,UserHeight,100,20),PlayerUsername);
 
         
     //Text area for the password
     PlayerPassword = GUI.TextArea (Rect(GeneralWidth,PassHeight,100,20),PlayerPassword);
     
     
     // Loads level (0) - customize in build settings
     if (GUI.Button (Rect (LogWidth,LogHeight,60,25), "Log-In")) {
         
         if(UsernameCORRECT == true){
         
             if(PasswordCORRECT == true){
             
         Application.LoadLevel (2);
         
             }
             
         }
     }
     else
         {
         Debug.Log("Username or Password was Incorrect");        
         }
 }
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Compiler Errors on client server login database 1 Answer

Security issues with Multi-player User Database? 2 Answers

need unity to connect with online admin panel and view credits,login system etc 0 Answers

mmo/server question.. 2 Answers

yield return WWW.text not downloading??? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges