Serial Number Validation

For all your non-technical questions.
mhale
Posts: 1
Joined: Sun Dec 21, 2008 5:55 pm

Serial Number Validation

Postby mhale » Sun Dec 21, 2008 5:56 pm

I found the serial number sample and I know how to make it work.

My question is though, how can I generate a serial using PHP on my server?

CandiceJones
Posts: 904
Joined: Thu Dec 22, 2005 7:03 pm
Contact:

Postby CandiceJones » Sun Dec 21, 2008 6:17 pm

That's hardly an InstallAware question.
Candice Jones
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/

tommykjensen
Posts: 29
Joined: Fri Jan 16, 2009 11:56 am
Location: Denmark
Contact:

Postby tommykjensen » Wed Jan 21, 2009 5:57 pm

I have created a project that combines 2 of the samples provided with the product. The Serial Validation and the Online User Authentication.

I took the Serial Validation and modified it to include the online check. On my website I have a script like this that validates if the information sent is valid (you need to modify it to your own needs).

Hope this helps.

Code: Select all

<?

$sql_host =   '';  //add host information here (localhost, mysql.host.com, etc.)
$sql_un   =   '';  //add your user name here
$sql_pass =   '';  //add your password here
$sql_db   =   '';  //add your database name here

$link = mysql_connect($sql_host, $sql_un , $sql_pass);
if (!$link)
{
   die('Could not connect: ' . mysql_error());
}
else
{
   $db_selected = mysql_select_db($sql_db , $link);
   if (!$db_selected)
   {
     die ('Can\\'t use foo : ' . mysql_error());
   }
   else
   {
      if(get_magic_quotes_gpc())
      {
         $parm = stripslashes($_GET['parm']);
      }
      else
      {
         $parm = stripslashes($_GET['parm']);
      }
      if (isset($parm) )
      {
         
         $query_string = sprintf("SELECT * FROM `table` WHERE parm='%s''",   mysql_real_escape_string($parm, $link));
         
         $result = mysql_query($query_string, $link);
         if (!$result)
         {
            die('Invalid query: ' . mysql_error());
         }
         else
         {
            $row = mysql_fetch_row($result);
            //print("<BR>".$result);
            if ($row)
            {
               print("OK\\n");
            }
            else
            {
               print("INVALID SERIAL 1");
            }
         }
      }
      else
      {
         print("INVALID SERIAL 2");
      }   
   }
}
?>

CandiceJones
Posts: 904
Joined: Thu Dec 22, 2005 7:03 pm
Contact:

Postby CandiceJones » Wed Jan 21, 2009 6:57 pm

Thank you very much for sharing this with the InstallAware community!
Candice Jones

InstallAware

Home of The Next Generation MSI Installer

Get your free copy today - http://www.installaware.com/


Return to “Non-Technical”

Who is online

Users browsing this forum: No registered users and 36 guests