<head>
<meta http-equiv="refresh" content="4; URL='http://portal.niqs.org.ng'" />
</head>
<?php
//PHP Mail Salisu
                    // Import PHPMailer classes into the global namespace
                    // These must be at the top of your script, not inside a function
                    use PHPMailer\PHPMailer\PHPMailer;
                    use PHPMailer\PHPMailer\SMTP;
                    use PHPMailer\PHPMailer\Exception;

                    // Load Composer's autoloader
                    require './vendor/autoload.php';

                    // Instantiation and passing `true` enables exceptions
                    $mail = new PHPMailer(true);

                    try {
                        //Server settings
                        $mail->isSMTP();                                            // Send using SMTP
                        $mail->Host       = 'c16252.sgvps.net';                    // Set the SMTP server to send through
                        $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
                        $mail->Username   = 'exams@niqs.org.ng';                     // SMTP username
                        $mail->Password   = 'exam2020??';                               // SMTP password
                        $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;         // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
                        $mail->Port       = 587;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

                        //Recipients
                        $mail->setFrom('exams@niqs.org.ng', 'NIQS');
                        //$mail->addAddress('info@niqs.org.ng', 'Joe User');     // Add a recipient
                        //$email = "salisu@niqs.org.ng";
                        if(isset($_GET['email'])){$email = $_GET['email']; }
                        if(isset($_GET['pin'])){$pin = $_GET['pin']; }
                        if(isset($_GET['memberNo'])){$memberNo = $_GET['memberNo']; }
                        if(isset($_GET['regSet'])){$regSet = $_GET['regSet']; }
                        if(isset($_GET['amount'])){$amount = $_GET['amount']; }
                        
                        //get details
                        require("database.php");
                        $q = "Select * from members where memberNo='$memberNo' limit 1";
                        $qry=mysqli_query($con, $q);
                        $row=mysqli_fetch_assoc($qry);
                        extract($row);

                        $memberSurname = str_replace("'", "\'", $memberSurname);
                        $memberOthernames = str_replace("'", "\'", $memberOthernames);
                        
           $content1 = '<table align="center" style="width: 100%; border: 1pt outset #d9950d;" border="1" cellspacing="0" cellpadding="0"><tr><td> <img src="http://www.niqs.org.ng/logo_niqs.png"> </td></tr>   <tr><td>
			
			<table width="95%" align="center">
			<tr><td>
			<p>
			Dear '.$memberSurname.' '.$memberOthernames.', <br/><br/>
			
			<p align="justify">
			This is to acknowledge the receipt of your payment for Matured Route Registration of the Nigerian Institute of Quantity Surveyors. <br><br>Kindly use your PIN below to login and continue with your application here: <a href="http://www.niqs.org.ng/onlineapplication/phd/login.php">http://www.niqs.org.ng/onlineapplication/mature/login.php</a> </p>';
			
			$content1 = $content1.'<table><tr><td bgcolor=""><b> &nbsp;  &nbsp; PIN: </td> <td>'.$pin.'</td> </tr>';
			$content1 = $content1.'<tr><td bgcolor=""><b> &nbsp;  &nbsp; Diet:  </td> <td>'.$regSet.'</td> </tr>';
			$content1 = $content1.'<tr><td bgcolor=""><b> &nbsp;  &nbsp; Amount:  </td> <td> <del>N</del>'.number_format($amount, 2).'</td> </tr>';
			$content1 = $content1.'<tr><td bgcolor=""><b> &nbsp;  &nbsp;  </td> <td> </td> </tr> </table>';
			
			$content1 .= '
			
	
			
			Thank you. 
			<br>
			<br>
			Secretary General

			<br><br><b>For more enquiries, please contact</b> 
	<br>Tel:  <a href="tel:+2348167593807">08167593807</a>
	<br>E-mail: <a href="mailto:info@niqs.org.ng" style="color: #336699;">info@niqs.org.ng</a>
				
		
		</td>
		</tr>
		</table>
				
	</td>  
	</tr>
	
	<tr style="height: 17px;">
<td style="width: 100%; padding: 0.75pt; height: 17px;">
<p style="text-align: center;" align="center"><a href="http://www.niqs.org.ng">www.niqs.org.ng</a>&nbsp;|&nbsp;<a href="http://twitter.com/niqslive">Twitter</a>&nbsp;|&nbsp;<a href="http://facebook.com/TheNigerianInstituteOfQuantitySurveyors">Facebook</a></p>
</td>
</tr>

	</table>   ';


                        $email = "salisu@niqs.org.ng";
                        $mail->addAddress($email);               // Name is optional
                        $mail->addReplyTo('exams@niqs.org.ng', 'NIQS Examination');

                        // Content
                        $mail->isHTML(true);                                  // Set email format to HTML
                        $mail->Subject = "Matured Route Payment Acknowledgement - PIN: #".$pin;
			
                        $mail->Body    =  $content1;
                        
                        //$mail->AltBody = 'Hello, You requested a password reset recently on the portal. Your new password is '.$password.'. Kind regards.';

                        $mail->send();
                        echo '<script>window.alert("PIN Generated and sent to registered email");</script>';
                        //echo '<script>window.location.replace("https://niqs.org.ng/onlineapplication/mature"); </script>';              
                    } catch (Exception $e) {
                        echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
                    }
                    //PHP Mail Salisu--

?>