%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php //error_reporting(E_ALL); define('DB_SERVER', "shardauniversitywriter.cluster-custom-c8m5zlhotfbm.ap-south-1.rds.amazonaws.com"); define('DB_USERNAME', "quizbyte_user"); define('DB_PASSWORD', "quiz@byte121!"); define('DB_DATABASE', "shardaac_quizbyte_db"); define('COMPANY', "ShardaTech pvt ltd."); /* Connect to MySQL and select the database. */ $conn = mysqli_connect(DB_SERVER, DB_USERNAME, DB_PASSWORD, DB_DATABASE); if (!$conn) { mysqli_connect_error(); } $new_time = time(); //$currentDate = date('Y-m-d').' 18:00:00'; //$nextTHours = date("Y-m-d H:i:s", strtotime('+5 hours')); $nextTHours = date('Y-m-d').' 20:59:59'; $currentDate = date('Y-m-d H:i:s'); //$sql = "SELECT quid, gids, quiz_name,start_date,end_date, duration, maximum_questions FROM savsoft_quiz WHERE quiz_type='1' AND email_alert='0' AND FROM_UNIXTIME(start_date) between '$currentDate' AND '$nextTHours'"; //$sql = "SELECT quid, gids, quiz_name,start_date,end_date, duration, maximum_questions FROM savsoft_quiz WHERE quiz_type='1' AND email_alert='0' AND FROM_UNIXTIME(start_date) >= '$currentDate' "; $sql = "SELECT quid, gids, quiz_name,start_date,end_date, duration, maximum_questions FROM savsoft_quiz WHERE quiz_type='1' AND email_alert='0' AND quid='87' "; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) > 0) { echo ("total count - " . mysqli_num_rows($result) . "<br/>"); while ($row = mysqli_fetch_assoc($result)) { $listGids = $row['gids']; $quid = $row['quid']; $quiz_name = $row['quiz_name']; // Get Total Registration $tsql = mysqli_query($conn,"SELECT uid from savsoft_result Where quid=$quid"); $totalRegistration = mysqli_num_rows($tsql); // Update Alert Email Status //$sqlUpdate = "UPDATE `savsoft_qbank` SET email_alert='1' WHERE quid = $quid" ; //mysqli_query($conn, $sqlUpdate); //Get User List from user and result table $sql = "SELECT su.*, group_name from savsoft_users as su JOIN savsoft_group as sg ON su.gid= sg.gid WHERE su.gid IN(".$listGids.") AND su.status='1' AND verify_code='0' AND su.uid NOT IN( SELECT uid from savsoft_result Where quid='".$quid."') limit 700"; $query=mysqli_query($conn,$sql); $k = 0; while($resp = mysqli_fetch_assoc($query)){ if($resp['email']) { $token = ''; $token = base64_encode(serialize(array('email'=>$resp['email'],'password'=>$resp['user_key']))); $url = "https://quizbyte.sharda.ac.in/login/autologin?token=$token"; $template = emailTemplate($resp, $quiz_name,$totalRegistration,$url,$row); $to_email = $resp['email']; echo $subject = "$quiz_name is available in your Quizbyte dashboard. Participate Now!!"; send_email_pepipost($to_email,$subject,$template); if($k%100==0){ send_email_pepipost('quizbyte@sharda.ac.in',$subject,$template); } $k++; } } } echo "<br/> $k end<br/>"; } else { echo "no record found"; } /* * Function : send_email_pepipost * Description : Send Email */ function send_email_pepipost($to_emails, $subject, $message, $fromname='', $fromemail='', $replyto=''){ $fromname=$fromname?$fromname:'Quizbyte'; $fromemail=$fromemail?$fromemail:'quizbyte@shardauniversity.com'; //Change This Email ID; $replyto=$replyto?$replyto:'noreply@sharda.ac.in'; //Change the Email ID; if(!$to_emails){ return; } if(is_string($to_emails)){ $to_emails=explode(",", $to_emails); } foreach($to_emails as $to){ $d=array ( 'personalizations' => array (0 => array ('recipient' => $to)), 'from' => array ('fromEmail' => $fromemail, 'fromName' => $fromname), 'replyToId'=>$replyto, 'subject' => $subject, 'content' => $message, ); $email_jason_data=json_encode($d); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => "https://api.pepipost.com/v2/sendEmail", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => $email_jason_data, CURLOPT_HTTPHEADER => array( "api_key: c77184012dcf9bd5cd1886b4e0a2bb89", // "api_key: aab3f77715e90569034f0c6e5d912714", "content-type: application/json" ), )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } // else { // echo $response; // } // die; } //EOF //EOF } /* * Function : emailTemplate * * */ function emailTemplate($userDetails, $quiz_name, $totalRegistration, $url, $row){ $full_name = $userDetails["first_name"].' '.$userDetails["list_name"]; $maximum_questions = $row['maximum_questions']; $duration = $row['duration']; $start_date = date('d F Y',$row['start_date']); $end_date = date('d F Y',$row['end_date']); $start_time = date('h:i A',$row['start_date']); $end_time = date('h:i A',$row['end_date']); $message = 'If you have any questions, please let us know by sending an email to quizbyte@sharda.ac.in'; if($row['camera_req']=='1') { $message = 'Login on Quizbyte to take the test. A webcam is mandatory for tests. It is highly recommended to take a test with webcam enabled laptop or desktop.Avoid Use of mobile phone to give a quiz.'; } $template = ''; $template = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Participate Now Alert - Quizbyte An Ultimate Quizzing Platform</title> </head> <body> <table style="width:600px; margin:0px auto;" cellpadding="0" border="0" cellspacing="0"> <tr> <td colspan="2"> <a href="'.$url.'"><img src="https://quizbyte.sharda.ac.in/images/participate_now.png" width="100%" /></a> </td> </tr> <tr> <td colspan="2" style="font-family:Tahoma, Geneva, sans-serif; padding:20px 50px 20px 20px; border-right:1px solid #ccc;border-left:1px solid #ccc;"> <p style="font-size:16px; font-family:Tahoma, Geneva, sans-serif; color:#444;">Dear '.trim($full_name).',</p> <p style="font-size:14px; font-family:Tahoma, Geneva, sans-serif; color:#444;padding-top:20px;">The Quiz <strong>'.$quiz_name.'</strong> is added in your quizbyte account.</p> <p style="font-size:14px; font-family:Tahoma, Geneva, sans-serif; color:#444;padding-top:5px;">Quiz will open from <strong>'.$start_date.'</strong> at <strong>'.$start_time.'</strong> and End on <strong>'.$end_date.'</strong> at <strong>'.$end_time.'</strong>.</p> <p style="font-size:14px; font-family:Tahoma, Geneva, sans-serif; color:#444;">Total No. of question: <strong>'.$maximum_questions.'</strong></p> <p style="font-size:14px; font-family:Tahoma, Geneva, sans-serif; color:#444;">Duration of Quiz: <strong>'.$duration.'</strong></p> <p style="padding:0; text-align:center;margin:0px;font-size:14px; font-family:Tahoma, Geneva, sans-serif; color:#444;"> <a href="'.$url.'" style="display:inline-block; text-decoration:none; margin:12px auto; padding:12px 30px; border-radius:30px; color:#fff; background:#ed5b7a;">Participate Now</a> </p> <br/><br/> <p style="padding:0; margin:0px;font-size:12px; font-family:Tahoma, Geneva, sans-serif; color:#444; font-style:italic;">Note: '.$message.'</p><br /> </td> </tr> <tr bgcolor="#220038"></tr> <tr bgcolor="#220038"> <td colspan="2"> <table width="100%"> <tr> <td align="center" colspan="2" valign="middle" style="padding:30px 10px 30px 10px; "> <a href="https://quizbyte.sharda.ac.in" style="color:#fff; font-size:16px; font-family:Tahoma, Geneva, sans-serif; text-decoration:none; padding:2px 0; line-height:20px;"> quizbyte.sharda.ac.in</a> </td> </tr> </table> </td> </tr> </table> </body> </html>'; return $template; }