Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Anyone written code to replace SYS(2015)?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01157093
Message ID:
01157924
Vues:
18
Hello again, folks/Sergey.

Here's our PHP version, just incase anyone else out there
has to move import/export tables back and forth between VFP
and some other RDBMS.

Best Regards,

Randall
<?php

// VFP's (Visual FoxPro) SYS2015() for PHP.
//
// Generates a unique key that's compatible with VFP. Written
// for backward compatibility for those who need to generate
// VFP keys. 
// We wrote this code and decided to post it just incase anyone
// else out there has to import/export tables back and forth
// between VFP and some other RDBMS.
//
// Based on the VFP code from convertdatetime.prg, which is
// located at levelextreme.com's VFP download area as
// convert2015.zip (File #9704).
//
// Enjoy!
//
// Code released into the public domain for the VFP community.

FUNCTION SYS2015()
{
 $cBase36="0123456789ABCDEFGHIJKLMONPQRSTUVWXYZ";
 $cSys2015=""; 
 $hour=(int)date("H");
 $nmilli=($hour*3600 + (int)date("i")*60+(int)date("s"))*1000;
 $year=date("Y");
 $t=mktime(0,0,0,1,1,$year);
 $days = (int)((time(void)-mktime(0,0,0,1,1,$year))/86400)+ ($year%100)*367;


 for ($counter=1;$counter<7;$counter++)
 {
  $cSys2015=substr($cBase36,(int)($nmilli % 36) +1,1) . $cSys2015;
  $nmilli=(int)($nmilli/36);
 }

 for ($counter=1;$counter<4;$counter++)
 {
  $cSys2015=substr($cBase36,($days%36) +1,1) . $cSys2015;
  $days=(int)($days/36);
 }

 $cSys2015="_".$cSys2015;

 return $cSys2015;

}

?>
--
Randall Jouett
Amateur/Ham Radio: AB5NI
I eat spaghetti code out of a bit bucket while sitting at a hash table! Someone
asked me if I needed salt, and I said, "I'm not into encryption." :^)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform