if ($curStep == 0) { $email = strval($_POST['email']); $fullname = strval($_POST['fullname']); // 验证邮箱格式 if (preg_match("/^([0-9A-Za-z\\-_\\.]+)@([0-9a-z]+\\.[a-z]{2,3}(\\.[a-z]{2})?)\$/i", $email)) { // "邮箱地址正确!"; } else { $rs['code'] = '-4'; $rs['ok'] = '-4'; $rs['msg'] = "邮箱不符合邮箱规则,请重新核对您的邮箱地址^_^"; echo json_encode($rs); return; } // 用户名,全名记录DB if (!empty($email)) { $inviteParicipant = new \Ss\Market\InviteParticipant(); if (empty($inviteParicipant->GetInviteParticipantArray($email))) { $inviteParicipant->AddInviteParticipant($email, $fullname); $rs['code'] = '1'; $rs['ok'] = '1'; $rs['p'] = '1'; $rs['msg'] = "提交成功"; setcookie("PUE", base64_encode($email), time() + 300); // header("Location:invite_game.php?p=1"); // return; } else { $rs['code'] = '-2'; $rs['ok'] = '-2'; $rs['msg'] = "该用户已参加过该活动"; } } else {
* @date 7/22/15 * @time 10:28 PM * @description invite_game.php */ $subjectIds = array(); $inviteSubject = new \Ss\Market\InviteSubject(); for ($i = 0; sizeof($subjectIds) < 5; $i++) { $id = rand(1, 15); if (in_array($id, $subjectIds)) { continue; } else { array_push($subjectIds, $id); } } $subjectContents = $inviteSubject->GetInviteSubjectArray($subjectIds); $inviteParticipant = new \Ss\Market\InviteParticipant(); // 设置活动上限数为50个用户 if ($inviteParticipant->GetInviteParticipantArrayCount() >= 50) { $curStep = -1; } // 初始化流量 $gameResultGPRS = rand(0, 2048); if ($curStep == 2 && !empty($_COOKIE['PUE'])) { $inviteParticipantData = $inviteParticipant->GetInviteParticipantArray(strval(base64_decode($_COOKIE['PUE']))); if ($inviteParticipantData['init_gprs'] == 0) { $inviteParticipant->UpdateInviteParticipantInitGPRS($gameResultGPRS, strval(base64_decode($_COOKIE['PUE']))); } else { $gameResultGPRS = $inviteParticipantData['init_gprs']; } } ?>