Portal Home > Knowledgebase > Articles Database > PHP License Frontend
PHP License Frontend
Posted by Danny159, 12-15-2007, 12:37 PM |
Hey
I am making a small script so i can license my script out...
I have made a database with the following:
Table Name: billing
id int(8) auto
license text
ip varchar(250)
host varchar(250)
expire varchar(50)
Here is my end that will be in the panel:
the file in the file_get_contents:
However its not working, can anyone help me all i want is for the script to check and if there is no licance in my database it will say invalid or if its expired echo expired.. but if it works it will just carry on.
I am planning on putting this on my congid file above my database connect in the script so if it is invalid it will exit; and the user will not be able to continue.
Can anyone help me make a new script like this or fix mine
Dan
|
Posted by BrettB, 12-15-2007, 12:55 PM |
Your
Line will only get the text on that page after it has been processed by the PHP server on that domain. Since you're calling the file by it's entire URL, it will not just include the variables from that included page.
|
Posted by Danny159, 12-15-2007, 12:57 PM |
I dont understand
so you mean i need to echo something then get the script on the users server to read it and ect there?
Dan
|
Posted by Mr. Obvious, 12-15-2007, 01:47 PM |
When you use get_file_contents, it's exactly as you're reading it on the web. For example, visit http://www.masterhostuk.com/v7/licens/config.php in your brower, you get a blank page, and if you view source you get a blank page there also, because the code has already been processed into the html static page
|
Posted by Danny159, 12-15-2007, 01:52 PM |
So i need to do all the checks my end then echo like echo "1"; then on the script process the 1?
|
Posted by Hastings, 12-15-2007, 02:04 PM |
Correct
|
Posted by Tom-Brown, 12-15-2007, 02:33 PM |
You'll have to allow your server to allow any connection but make sure the user connection can only select the rows from your license database or you'll have problems ;]
|
Posted by Danny159, 12-15-2007, 02:34 PM |
ok
Can anyone help with the ecpire
in the database the format is like d/m/y (15/12/07) so how do i make it so if the date in the database is today then it would comeup with error... and keep doing it will a date is put in that hasnt gone
Hope this makes sence
Dan
|
Posted by Steve_Arm, 12-15-2007, 03:00 PM |
Get config
$get_con = file_get_contents("http://www.masterhostuk.com/v7/licens/config.php");
// Check Begin
$get_lic = mysql_query("SELECT * FROM billing");
shouldn't $get_lic be $get_con?
Anyway, I can't understand the logic behind this system?
Will the code be encrypted?
|
Posted by Danny159, 12-15-2007, 03:08 PM |
Yes it will
Can you help?
|
Posted by Steve_Arm, 12-15-2007, 03:16 PM |
From what I can make out, you are getting variables from your server, to login
to a database on the "client" server and check the license date?
I would suggest the expire field to make it date. Then you can check
if current date is greater than the one on the database:
if (date("Y-m-d") > $date_from_db)
|
Posted by Danny159, 12-15-2007, 03:20 PM |
Thats wat im looking for i think i can do it all now, can i PM you if i get any issues?
Dan
|
Posted by whmcsguru, 12-15-2007, 03:49 PM |
why even bother using date() , use time() , it is so much better off than date, and you can tell it to check expire time (2 months, one month, etc) easily enough
|
Posted by Steve_Arm, 12-15-2007, 03:52 PM |
Yes, you can PM me.... but take it easy.
Let's keep it simple for now.
|
Posted by whmcsguru, 12-15-2007, 03:56 PM |
Yeah, let's do so
your format:
$date = date("Y,M,D");
proper format?
$date=time();
can it GET any more simpler?
|
Posted by Danny159, 12-15-2007, 04:58 PM |
Need some help
This is my server end:
And I have a license set-up in my script and database and when i go to it it comes back 1 but the license exists and is a valid date so it sould be 3 but it stays as 1... why is is?
Dan
|
Posted by Steve_Arm, 12-16-2007, 11:52 AM |
date() is more proper as Dan is not using int timestamps in his database.
Actually he is using strings but anyway.
|
Add to Favourites Print this Article
Also Read