Log in

View Full Version : PHP Help



Luno1599
17-11-2007, 04:44 PM
Hey,

How would you make a script that if the scipt on the users server cant find anything (Eg Licence Key) it will lock the domain or script (like a license system)

Danny

Scania
17-11-2007, 04:46 PM
Hey,

How would you make a script that if the scipt on the users server cant find anything (Eg Licence Key) it will lock the domain or script (like a licence system)

Danny

I think someone on here is like in the process of building one of those.

Luno1599
17-11-2007, 04:47 PM
Yeah i know i was just wondering so i can try myself XD not to relece or anything im lerning php

Im just looking for the locking site of thins as help

Dentafrice,
17-11-2007, 04:48 PM
You could do a *simple* script with file_get_contents to get a file on your server that checks the server, ip, and or folder and returns something.



<?php

$server = "bob.com";

$get_l = file_get_contents("http://www.myserver.com/license/check.php?server=$server");
if ($get_l == "expired")
{
echo "Your licence has expired.";
exit;
}
if ($get_l == "none")
{
echo "Thats no license!";
exit;
}
?>

Luno1599
17-11-2007, 04:53 PM
Yeah i see that that will echo it but i dont think it will stop the user from doing anything =S

Dentafrice,
17-11-2007, 04:55 PM
If you take and make that into a script, and include it into the configuration file.. then Zend Encode it, it will stop the script from ever running using exit; ;)

Luno1599
17-11-2007, 04:57 PM
Oh, one last think what would the server end look like :S (as in my end)

Luno1599
18-11-2007, 12:09 PM
Soz for dubble post cant edit other 1

Can anyone help me wid this?

Dentafrice,
18-11-2007, 02:20 PM
Server end, do you know how to use MySQL?

Luno1599
18-11-2007, 02:22 PM
Yes i do =D i just need some guidance

Dentafrice,
18-11-2007, 02:25 PM
Make a new table that has,

license, domain

and then on the server end just check that the license and domain is right.

I will write a script later, I am on my laptop. No phpDesigner.

Blob
18-11-2007, 02:26 PM
Make a new table that has,

license, domain

and then on the server end just check that the license and domain is right.

I will write a script later, I am on my laptop. No phpDesigner.

You use PHP Designer aswell? Wow.

Btw, i would make your own. If someone makes one here and isnt trusted and its encoded, got know what could happen to your server

Dentafrice,
18-11-2007, 02:28 PM
I am not going to encode it :P Just showing him how its done.

Yeah I use phpDesigner 2008 Professional and Zend Studio for SVN.

Blob
18-11-2007, 02:29 PM
I am not going to encode it :P Just showing him how its done.

Yeah I use phpDesigner 2008 Professional and Zend Studio for SVN.

I use PHP Designer 2007. 2008 any better?

Luno1599
18-11-2007, 02:31 PM
ok, i know how to make it check but i dont know the bit where my server replys to the other server :S like the true and false thing =S

also is there any programs that encode php?

Blob
18-11-2007, 02:31 PM
ok, i know how to make it check but i dont know the bit where my server replys to the other server :S like the true and false thing =S

also is there any programs that encode php?

Zend.

MAKING IT LONGER FGS JAVASCRIPT ALERT THINGY

Luno1599
18-11-2007, 02:33 PM
Zend.

MAKING IT LONGER FGS JAVASCRIPT ALERT THINGY

You didnt answer my first thing XD

Blob
18-11-2007, 02:36 PM
You didnt answer my first thing XD

On the checking file, i think you would do



return $license;

$license = the status of the license

then on the client, you would do



if($license == "blaa blaa")
{
}


I would wait for kevins

Luno1599
18-11-2007, 02:38 PM
Thanks, Yeah i think i will wait for some more guidance when hes on his PC :D

Blob
18-11-2007, 02:39 PM
I would write you one, but im trying to find someone to code the new dePanel layout & im finishing dePanel off

Luno1599
19-11-2007, 05:46 PM
Bump this post as still need help XD

VistaBoy
19-11-2007, 09:24 PM
okay well i think your still needing the server bit this is only to show to it will or may not work.


$server = $_GET[server];
$license = mysql_query("SELECT * FROM license WHERE server= '$server'");
$license = mysql_fetch_array($license);
if($license == "0")
{
die('No license at this url.');
}
elseif($license[stats] == "suspended")
{
die('Your license has been suspended.');
}

Luno1599
19-11-2007, 09:36 PM
okay well i think your still needing the server bit this is only to show to it will or may not work.


$server = $_GET[server];
$license = mysql_query("SELECT * FROM license WHERE server= '$server'");
$license = mysql_fetch_array($license);
if($license == "0")
{
die('No license at this url.');
}
elseif($license[stats] == "suspended")
{
die('Your license has been suspended.');
}


Thanks XD
you can delete it now becasue ur making one yourself witch i plan to use when its out :)

QuickScriptz
20-11-2007, 12:36 AM
Well.... heres a little insight....

The Script

<?php
$d = $_SERVER['HTTP_HOST']; //Get current domain
$d1 = str_replace('www.', '', $d); //Remove unwanted stuff
$domain = str_replace('w3.', '', $d1); //And removing more...
$result = mysql_query("SELECT license FROM settings"); //Get license
$row = mysql_fetch_array($result);
$license = $row['license'];
if($file = @file_get_contents("http://licensing.yoursite.com?d=$domain&l=$license")){
echo $file;
}else{
echo 'Could not connect to licensing server.';
?>Your Server

<?php
//Connect To Your License DB Here
$d = $_GET['domain'];
$l = $_GET['license'];
if($domain != ""&&$license != ""){
//Get Licenses From Your DB
$ls = mysql_query("SELECT * FROM licenses WHERE license = '$l'"); //Check db for license
$i = mysql_fetch_array($ls);
$count = mysql_query("SELECT COUNT(id) FROM licenses WHERE license = '$l'"); //Count instances found
$total = mysql_num_rows($count);
if($total == "1"&&$d = $i['domain']){ //What happens if the license is valid
echo 'Yay! Your license is valid.';
}else{ //What happens if it can't verify license
echo 'Could not validate license. Please contact us.';
echo '<meta http-equiv="refresh" content="2;url=http://licensing.yoursite.com/error.php">';
}
}
?>Don't use that exact code but its something to build on :) Hope it helps!

Note: The domains should be listed as "yoursite.com" not "www.yoursite.com" or "http://yoursite.com" for the above to work properly.

(Refer to code commenting for help as to what does what)

Luno1599
20-11-2007, 03:47 PM
Thanks Scriptz +rep if i can XD and vistaboy

Want to hide these adverts? Register an account for free!