This is my first php script. I actually code in vb.net.. I am making this licensing system for .net applications. This licensing system has a manager which the admin can easily control and view. Also Iam making a class library to login and register for the same. I have succeeded in doing so using only vb.net code but as the credentials need to be stored inside the application there always is a threat. Using php this problem can be overcomed somewhat :tongue: . So I decided to make the login + register system using this kinda php scripts. I am using a only admin read,write text file instead of a mysql database ( Easily maneagable for all hosting services ). So, I have come up with this following piece of code and I need some help in the confirming the login part.
The text file is like this :
username password hwid lastdate membershiptype
All separated by ‘space’ and one account per line.
I hope I have given enough information, If extra information is needed, I will give it.
<?php
$user = addslashes($_GET['username']);
$pass = addslashes($_GET['password']);
$username = "theusername";
$password = "thepassword";
$url = "mywebsite.com/file.txt";
$hostname= "ftp://$username:$password@$url";
$contents = file_get_contents($hostname);
// That gives me the txt file which can only be read and written by the admin
if (strpos($contents,$user) !== false) {
// Need code here to check if the adjacent word and the $pass are same to establish a successfull login
} else {
echo "Username does not exist, please register"
}
?>
Here try this, hope it helps:
file.txt would need tobe in this format, values seperated by
:, spaces are not a good way to seperate values.The PHP bit: