| 1 |
<?php |
<?php |
| 2 |
// $Id: regcode.api.php,v 1.1.2.8 2009/09/27 09:16:25 aidan Exp $ |
// $Id: regcode.api.php,v 1.1.2.9 2009/09/30 18:17:26 aidan Exp $ |
| 3 |
|
|
| 4 |
define('REGCODE_VALIDITY_NOTEXISTING', 0); |
define('REGCODE_VALIDITY_NOTEXISTING', 0); |
| 5 |
define('REGCODE_VALIDITY_NOTAVAILABLE', -1); |
define('REGCODE_VALIDITY_NOTAVAILABLE', -1); |
| 122 |
} |
} |
| 123 |
|
|
| 124 |
if ($action == 'overwrite') { |
if ($action == 'overwrite') { |
| 125 |
db_query('DELETE FROM {regcode} WHERE code = "%s" LIMIT 1', $code['code']); |
db_query("DELETE FROM {regcode} WHERE code = '%s' LIMIT 1", $code['code']); |
| 126 |
} |
} |
| 127 |
|
|
| 128 |
// Format data |
// Format data |
| 148 |
* Count codes |
* Count codes |
| 149 |
*/ |
*/ |
| 150 |
function regcode_count($where = '') { |
function regcode_count($where = '') { |
| 151 |
return db_result(db_query('SELECT COUNT(rid) FROM {regcode}' . $where)); |
return db_result(db_query('SELECT COUNT(rid) AS count FROM {regcode}' . $where)); |
| 152 |
} |
} |
| 153 |
|
|
| 154 |
|
|