http://gmtutorials.com/article/advanced/input-textbox/
Let’s say that we have already assigned the user input to the variables password and username. There are several different methods to save the information now but we want to use the registry. There are several advantages with the registry. One example is that it is very, very, fast so it doesn’t matter how many usernames and passwords that you store, the information will always be able to reach within nanoseconds. If you have a file you will have to search through the whole file and that will take more time and it is harder. Another advantage: registry can take two values. Here is how to do:
if (registry_exists(username)) {
show_message("That username is already taken"
;}
else {
registry_write_string(username,password);
}
This code first checks whether there is already a user registered with that name, otherwise it will write it in with the selected password. To get the information (check upon login) you do the reverse:
if (registry_exists(username)) {
rpassword = registry_read_string(username);
}
else {
show_message("That username does not exist"
;exit;
}
if (rpassword == password) {
show_message("Both username and password is correct"
;}
<b>Here is an example:</b> http://gmtutorials.com/files/loginex.gm6
I hope you have a lot of use for this. Do not hesitate to comment on this article, especially not if you wonder anything.
Comments
Loading comments...