Login System

Posts 1–8 of 8 · Page 1 of 1
Login System
Okay i'm making a login system with my website and application on Visual Basic 2008. But, i wanna make it so it can login accounts that are on the website. so ill have a file on my website that will have the username as the title, and the password in the contents, and i wanna log into that using the program. but it will have an encryption system. i was thinking somthing along the lines of it encrypting the username and password that the user gave me in the program, maybe making it a temp txt file or whatever, then seeing if it matches a txt file already up there. i don't know i assumed that's how it works i just need help with the code. By the way, the Encrypt/Decrypt is a function called "EnDeCrypt"(yes it's the one from the tutorials page in this forum, idk if it's a good encryption method or not). Please help me out, Thanks guys

---------- Post added at 10:05 PM ---------- Previous post was at 09:17 PM ----------

Sorry for the double post. but i figured it out. the only problem is it downloads the file from the actual website, so someone could get a hold of them, is there anyway to make it pure ftp so it doesnt download from like www.exmple.com/users/admin.txt
Please use a database for this. Your thoughts of using textfiles with the passwords inside is insecure³.

Either use the database you already use at your website(if you do so) or create a new one. Your host will most likely let you create a database.

So what you should do is create a database and then create a php file to verify the login.

[HTML]CREATE TABLE login(UserID int PRIMARY KEY AUTO_INCREMENT,Username varchar(20),Password varchar(100)) Engine=InnoDB;[/HTML]

Some sample code...

Code:
<php
mysql_connect("server","user","password"); ' db login
mysql_select_db("database");

if(isset($_POST['user'])) {
if(isset($_POST['pw'])) {

$user = mysql_escape_string($_POST['user']);
$pw = md5(mysql_escape_string($_POST['pw']));

$Query = "SELECT * FROM Login WHERE username='$user' AND password='$pw'"; //pw is stored as md5 in this case

$Result = mysql_query($Query) or die(mysql_error());

if(mysql_count_rows($Result) == 0)
{
echo 'false'; // login failed
} else
{
echo 'true'; // login successful
}
}}
?>
Might not be 100% correct(didn't look it up, just wrote it down).

So you can pass the username/id from your .net application to the php file and read what it returns, if it returns true, login was successful, else login failed.

Take a look at WebRequests in .net.
Uhh sorry im very unfamiliar with databases, maybe you can login onto MSN and help me if possible?
@DrunkenGamer: Attachment approved but he doesn't wants to hardcore the usernames and serials into the app. He wants the application to dynamically load the list everytime it runs.
Hassan thanks for the link but im sorry ot say i might need some more help with it. I'm still stuck at how to connect to my database because i don't know what host to use or how to set a host on my cPanel ugh...
Quote Originally Posted by dudezone2 View Post
Hassan thanks for the link but im sorry ot say i might need some more help with it. I'm still stuck at how to connect to my database because i don't know what host to use or how to set a host on my cPanel ugh...
Wrote a tutorial for you:

http://www.mpgh.net/forum/33-visual-...ion-login.html

You can use 'localhost' by default, but if you are unable to do that, email your host provider.
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?