Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static public function generatePromocodes($data)
- {
- $pool = array();
- for ($i = 0; $i < $data["amount"]; $i++) {
- $promocode = Lib_Utils::generatePassword(7, false, "ld");
- $updateArr = array(
- "region" => $data["region"],
- "company" => $data["company"],
- "promocode" => $promocode,
- "quality" => $data["quality"],
- "time_generated" => time(),
- "user_id" => $data["user"],
- "status" => 0,
- );
- $query = Lib_MysqlManage::insertRequestFromArray($updateArr, "promocodes");
- $result = Lib_MysqlManage::makeQuery($query);
- if ($result != "1") {
- $i--;
- } else {
- array_push($pool, $promocode);
- }
- }
- return implode("\r\n", $pool);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement