init
This commit is contained in:
21
modules/EcmProducts/freeCodes.php
Normal file
21
modules/EcmProducts/freeCodes.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = substr($_REQUEST['code'], 0,2);
|
||||
$type = strtoupper($type);
|
||||
echo $type."<br><br>";
|
||||
$db = $GLOBALS['db'];
|
||||
for ($i=0; $i<10000; $i++) {
|
||||
$s = (string) $i;
|
||||
while (strlen($s) < 5)
|
||||
$s = '0'.$s;
|
||||
$res = $db->query("SELECT id FROM ecmproducts WHERE code='".$type.$s."'");
|
||||
$e = '';
|
||||
if ($res->num_rows==0) {
|
||||
$ress = $db->query("SELECT code FROM ecmproducts WHERE code LIKE '".$type.$s."%'");
|
||||
while ($rr = $db->fetchByAssoc($ress))
|
||||
$e.=$rr['code'].' ';
|
||||
if ($ress->num_rows>0)
|
||||
$e = ' ('.$e.')';
|
||||
echo $type.$s.$e.'<br>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user