Discuti il tutorial sul forum !

Come realizzare un gestore di licenze con php

// make sure fopen is not disabled
if( !( ini_get(allow_url_fopen) ) ) exit(’Configuration Error: allow_url_fopen must be turned on for this script to work’);

//if kill file does not exist you will get an error (client can see url of kill file) so turn off errors
error_reporting(0);

//get kill file
$lines = file(’http://www.example.com/killer/clientname.txt’);

//if the word kill is in the text file then exit script and show license message
foreach ($lines as $line_num => $line) {
         $license = htmlspecialchars($line);

         if ((strcmp($license,"kill") == 0 )) {
                 exit ("<font color=red size=large><b>There is a problem with this php script’s license please contact support at www.mydomain.com</b></font>");
        
         }
 }

//turn error messages back on
error_reporting(E_ALL);

//this section used to check to see if this script is run in a particular domain
//get the domain name
preg_match("/^(http:\/\/)?([^\/]+)/i", $_SERVER['SERVER_NAME'], $matches);
$host = $matches[2];
// get last two segments of host name
preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
//echo "domain name is: {$matches[0]}\n";

$valid_domain = ‘clientdomain.com’;
$domain_name = $matches[0];
if ( $domain_name !== $valid_domain) {
    exit("<font color=red><b>The Script License for this script is valid for use on " . $valid_domain . " only </b></font>");
}

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • blinkbits
  • BlinkList
  • blogmarks
  • co.mments
  • del.icio.us
  • De.lirio.us
  • digg
  • Fark
  • feedmelinks
  • Furl
  • LinkaGoGo
  • Ma.gnolia
  • NewsVine
  • Reddit
  • scuttle
  • Smarking
  • Spurl
  • YahooMyWeb
  • DZone
  • Internetmedia
  • Snap2r
  • Technorati


Correlati


Commenti

Scrivi un commento





Commenti recenti:


Ultimi dal forum

Selezionando contrassegno si aggiungono spese al totale
Ho inserito postepay come pagamento
Inserire metakeywords
Problemi di installazione
Scaricare correttore ortografico italiano
Vari problemi
Installazione su server remoto
Installazione
Problema aggiornamento quantità prodotti carrello
Info
Bug utente + suggerimento formattazione
Problema cancellazione dalla mailing list
Problemi login
Problemi di visualizzazione nella home page
Fireworks appiattisce livelli quando salvo in png