상세보기

수정

스시

경력: ㅁㄴㅇㄹ
학력: ㅁㄴㅇㄹ
고용형태: ㅁㄴㅇㄹ
급여: ㅁㄴㅇㄹ
지역: ㅁㄴㅇㄹ
근무시간: ㅁㄴㅇㄹ
접수마감일: 2025-08-01
접수방법: ㅁㄴㅇㄹ
상세내용
function send_sms_code($to, $code) { $url = 'https://api.twilio.com/2010-04-01/Accounts/' . TWILIO_SID . '/Messages.json'; $post = http_build_query([ 'From' => TWILIO_FROM, 'To' => $to, 'Body' => "인증코드: {$code} (5분 이내 유효)" ]); $ch = curl_init($url); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $post, CURLOPT_USERPWD => TWILIO_SID . ':' . TWILIO_AUTH_TOKEN ]); $res = curl_exec($ch); if ($res === false) { error_log('Twilio curl error: ' . curl_error($ch)); } curl_close($ch); } function send_welcome_email($toEmail, $toName) { $payload = [ 'personalizations' => [[ 'to' => [[ 'email' => $toEmail, 'name' => $toName ]] ]], 'from' => [ 'email' => MAIL_FROM, 'name' => MAIL_FROM_NAME ], 'subject' => '회원가입이 완료되었습니다', 'content' => [[ 'type' => 'text/plain', 'value' => "안녕하세요, {$toName}님. 가입이 완료되었습니다." ]] ]; $ch = curl_init('https://api.sendgrid.com/v3/mail/send'); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . SENDGRID_API_KEY, 'Content-Type: application/json' ], CURLOPT_POSTFIELDS => json_encode($payload) ]); $res = curl_exec($ch); if ($res === false) { error_log('SendGrid curl error: ' . curl_error($ch)); } curl_close($ch); } function make_code($len = 6) { return str_pad(strval(random_int(0, 999999)), $len, '0', STR_PAD_LEFT); } // Verification session helpers (SMS only, 5-minute TTL) function set_verification_session($phone, $user_id) { $_SESSION['verification'] = [ 'phone' => $phone, 'user_id' => $user_id, 'code' => make_code(6), 'expires_at' => time() + 300 // 5 minutes ]; return $_SESSION['verification']; } function get_verification_session() { return $_SESSION['verification'] ?? null; } function clear_verification_session() { unset($_SESSION['verification']); }
← 목록으로 수정