<?php

require_once("db_conn_class.php");

class app

{

	public $id;

	public $name;

	public $email;

	public $contact;

	public $course;

	public $location;

	public $coursedate;

	public $qualification;

	public $comment;

	public $status;

	public $deleted;

	

	//constructor [initialize the value of the variables]

	function _construct()

	{

		$this->id  				= 0;

		$this->name         	= "";

		$this->email     		= "";

		$this->contact  		= "";

		$this->course	 		= "";

		$this->location 		= "";

		$this->coursedate 		= "";

		$this->qualification	= "";

		$this->comment			= "";

		$this->status   		= "";

		$this->deleted  		= 0;

	}

    //generate max resume id

	function GenerateDataID()

	{

		$dbh = new db_conn();

		$dbh->set_conn();		

		$sql_max_id = "select max(data_id) from tbl_data_entry";

		$result_max_id = mysqli_query($dbh->link ,$sql_max_id);

		//$result_max_id = mysql_query($sql_max_id,$dbh->link);

		if($result_max_id)

		{

			$row = mysqli_fetch_row($result_max_id);

			//$row = mysql_fetch_row($result_max_id);

			$this->id = $row[0] + 1;

		}

	}

	//insert function

	function InsertData()

	{

		$dbh = new db_conn();

		$dbh->set_conn();

		$this->GenerateDataID();

		date_default_timezone_set('Asia/Kolkata');

		//============================================================================

		//insert data into tbl_data_entry table				

		$insert_sql = "insert into tbl_data_entry values ( ";

		$insert_sql = $insert_sql . $this->id. ",";

		$insert_sql = $insert_sql . "'".$this->name."', ";

		$insert_sql = $insert_sql . "'".$this->course. "', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'3', ";

		$insert_sql = $insert_sql . "'Teacher Training Course - Bangalore TTBlore.com', ";

		$insert_sql = $insert_sql . "'".$this->email. "', ";

		$insert_sql = $insert_sql . "'".$this->contact. "', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'25', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'1',";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'ACTIVE', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d h:i:s")."',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'".$this->location."', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'".$this->comment."', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'n/a')";

		

		//echo "insert_sql = ".$insert_sql;

		//return;

		$insert_result = mysqli_query($dbh->link ,$insert_sql);

		//$insert_result = mysql_query($insert_sql,$dbh->link);

		if (!$insert_result)

		{

			$this->msg = "Error: ".mysqli_error($dbh->link);

			//$this->msg = "Error: ".mysql_error($dbh->link);

			return;

		}

		else

		{

			$this->msg = "Thank you for for filling the application form";

		}		

	}	

	function SendMail()

	{

		//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

			//sending application entry mail to 

			

			require 'PHPMailerAutoload.php';

			//if(!$_POST) exit;

			//$email = $this->email;    //$res->email;

			$email = "nikkitefl@gmail.com";

			//$email = "nikita94.act@gmail.com";

			

			$errors = 0;

					

			//Create a new PHPMailer instance

			$mail = new PHPMailer;

			

			//Tell PHPMailer to use SMTP

			$mail->isSMTP();

			

			//Enable SMTP debugging

			// 0 = off (for production use)

			// 1 = client messages

			// 2 = client and server messages

			$mail->SMTPDebug = 0;

			

			//Ask for HTML-friendly debug output

			$mail->Debugoutput = 'html';

			

			//Set the hostname of the mail server

			//$mail->Host = 'smtp.gmail.com';

			$mail->Host = 'vps.teflindia.in';

			

			//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission

			$mail->Port = 465;

			

			//Set the encryption system to use - ssl (deprecated) or tls

			$mail->SMTPSecure = 'ssl';

			

			//Whether to use SMTP authentication

			$mail->SMTPAuth = true;

			

			//Username to use for SMTP authentication - use full email address for gmail

			$mail->Username = "applications@teacherstrainingnepal.com";

			//$mail->Username = "admin@teachersjobworld.com";

			

			//Password to use for SMTP authentication

			$mail->Password = "ACTApplications$56";

			//$mail->Password = "tjwportal20!";

			

			//Set who the message is to be sent from

			$mail->setFrom("applications@teacherstrainingnepal.com", "Asian College Of Teachers");

			//mail->setFrom("admin@teachersjobworld.com", "Teachers Job World");

			

			//Set an alternative reply-to address

			//$mail->addReplyTo('replyto@example.com', 'First Last');

			

			//Set who the message is to be sent to

			$mail->addAddress($email);

			$mail->addAddress("asiancollegeapplications@gmail.com");

			//$mail->addAddress("sampade.ati@gmail.com");

			//Set the subject line

			$mail->Subject = "Teacher Training Course - Bangalore TTBlore.com[#".$this->id."]";

			

			//Read an HTML message body from an external file, convert referenced images to embedded,

			//convert HTML into a basic plain-text alternative body

			

			$body = "";

			$body = "<html>

			<head>

			<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

			<title>Teacher Training Course - Bangalore TTBlore.com</title>

			</head>

			<body>

			 <table>

			<tbody>

			<tr>

			<td><b> Name </b></td>

			<td>".$this->name."</td>

			</tr>

			<tr>

			<td><b>Phone Number</b></td>

			<td>".$this->contact."</td>

			</tr>

			<tr>

			<td><b>E-mail </b></td>

			<td>".$this->email."</td>

			</tr>
			
			<tr>

			<td><b>Course </b></td>

			<td>".$this->course."</td>

			</tr>
			
			<tr>

			<td><b>Location</b></td>

			<td>".$this->location."</td>

			</tr>



			<tr>

			<td><b>Why are you interested in this course?</b></td>

			<td>".$this->comment."</td>

			</tr>

			

		

			</tbody>

			</table>

			</body>

			</html>";

			$mail->msgHTML($body);

			

			//Replace the plain text body with one created manually

			$mail->AltBody = 'This is a plain-text message body';

			

			//Attach an image file

			//$mail->addAttachment('images/phpmailer_mini.png');

			

			//send the message, check for errors

			if (!$mail->send()) {

				$this->msg = "Sorry! Unable to send Mail";

				return;

			} 

			else

			{

				$this->msg = "Thank you for for filling the application form";

			}	

			

		}

		//insert function

	function InsertData_sf()

	{

		$dbh = new db_conn();

		$dbh->set_conn();

		$this->GenerateDataID();

		date_default_timezone_set('Asia/Kolkata');

		//============================================================================

		//insert data into tbl_data_entry table				

		$insert_sql = "insert into tbl_data_entry values ( ";

		$insert_sql = $insert_sql . $this->id. ",";

		$insert_sql = $insert_sql . "'".$this->name."', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'3', ";

		$insert_sql = $insert_sql . "'Special Education - Bangalore', ";

		$insert_sql = $insert_sql . "'".$this->email. "', ";

		$insert_sql = $insert_sql . "'".$this->contact. "', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'356', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'1',";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'ACTIVE', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d h:i:s")."',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'".$this->location."', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'".$this->comment."', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'n/a')";

		

		//echo "insert_sql = ".$insert_sql;

		//return;

		$insert_result = mysqli_query($dbh->link ,$insert_sql);

		//$insert_result = mysql_query($insert_sql,$dbh->link);

		if (!$insert_result)

		{

			$this->msg = "Error: ".mysqli_error($dbh->link);

			//$this->msg = "Error: ".mysql_error($dbh->link);

			return;

		}

		else

		{

			$this->msg = "Thank you for for filling the application form";

		}		

	}	

	function SendMail_sf()

	{

		//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

			//sending application entry mail to 

			

			require 'PHPMailerAutoload.php';

			//if(!$_POST) exit;

			//$email = $this->email;    //$res->email;

			$email = "nikkitefl@gmail.com";
			//$email = "sulagna.act@gmail.com";

			//$email = "nikita94.act@gmail.com";

			

			$errors = 0;

					

			//Create a new PHPMailer instance

			$mail = new PHPMailer;

			

			//Tell PHPMailer to use SMTP

			$mail->isSMTP();

			

			//Enable SMTP debugging

			// 0 = off (for production use)

			// 1 = client messages

			// 2 = client and server messages

			$mail->SMTPDebug = 0;

			

			//Ask for HTML-friendly debug output

			$mail->Debugoutput = 'html';

			

			//Set the hostname of the mail server

			//$mail->Host = 'smtp.gmail.com';

			$mail->Host = 'vps.teflindia.in';

			

			//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission

			$mail->Port = 465;

			

			//Set the encryption system to use - ssl (deprecated) or tls

			$mail->SMTPSecure = 'ssl';

			

			//Whether to use SMTP authentication

			$mail->SMTPAuth = true;

			

			//Username to use for SMTP authentication - use full email address for gmail

			$mail->Username = "applications@teacherstrainingnepal.com";

			//$mail->Username = "admin@teachersjobworld.com";

			

			//Password to use for SMTP authentication

			$mail->Password = "ACTApplications$56";

			//$mail->Password = "tjwportal20!";

			

			//Set who the message is to be sent from

			$mail->setFrom("applications@teacherstrainingnepal.com", "Asian College Of Teachers");

			//mail->setFrom("admin@teachersjobworld.com", "Teachers Job World");

			

			//Set an alternative reply-to address

			//$mail->addReplyTo('replyto@example.com', 'First Last');

			

			//Set who the message is to be sent to

			$mail->addAddress($email);

			$mail->addAddress("asiancollegeapplications@gmail.com");

			//$mail->addAddress("sampade.ati@gmail.com");

			//Set the subject line

			$mail->Subject = "Special Education - Bangalore[#".$this->id."]";

			

			//Read an HTML message body from an external file, convert referenced images to embedded,

			//convert HTML into a basic plain-text alternative body

			

			$body = "";

			$body = "<html>

			<head>

			<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

			<title>Special Education - Bangalore</title>

			</head>

			<body>

			 <table>

			<tbody>

			<tr>

			<td><b> Name </b></td>

			<td>".$this->name."</td>

			</tr>

			<tr>

			<td><b>Phone Number</b></td>

			<td>".$this->contact."</td>

			</tr>

			<tr>

			<td><b>E-mail </b></td>

			<td>".$this->email."</td>

			</tr>

			<tr>

			<td><b>Why are you interested in this course?</b></td>

			<td>".$this->comment."</td>

			</tr>

			

		

			</tbody>

			</table>

			</body>

			</html>";

			$mail->msgHTML($body);

			

			//Replace the plain text body with one created manually

			$mail->AltBody = 'This is a plain-text message body';

			

			//Attach an image file

			//$mail->addAttachment('images/phpmailer_mini.png');

			

			//send the message, check for errors

			if (!$mail->send()) {

				$this->msg = "Sorry! Unable to send Mail";

				return;

			} 

			else

			{

				$this->msg = "Thank you for for filling the application form";

			}	

			

		}


		//insert function for Subscribe to our Newsletter! (ACT)

		function InsertData1()

		{

			$dbh = new db_conn();

			$dbh->set_conn();

	

			$this->GenerateDataID();

			date_default_timezone_set('Asia/Kolkata');

			//============================================================================

	

			//insert data into tbl_data_entry table		

			$insert_sql = "insert into tbl_data_entry values ( ";

			$insert_sql = $insert_sql . $this->id. ",";

			$insert_sql = $insert_sql . "'".$this->name. "', ";

			$insert_sql = $insert_sql . "'Subscribe to our Newsletter! (ACT)', ";

			$insert_sql = $insert_sql . "'0', ";

			$insert_sql = $insert_sql . "'0', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'0', ";

			$insert_sql = $insert_sql . "'31', ";

			$insert_sql = $insert_sql . "'Subscribe to our Newsletter! (ACT)', ";

			$insert_sql = $insert_sql . "'".$this->email. "', ";

			$insert_sql = $insert_sql . "'".$this->contact. "', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'25', ";

			$insert_sql = $insert_sql . "'0', ";

			$insert_sql = $insert_sql . "'".date("Y-m-d H:i:s")."',";

			$insert_sql = $insert_sql . "'".date("Y-m-d H:i:s")."',";

			$insert_sql = $insert_sql . "'1',";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'ACTIVE', ";

			$insert_sql = $insert_sql . "'0', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'0', ";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'".date("Y-m-d h:i:s")."',";

			$insert_sql = $insert_sql . "'0',";

			$insert_sql = $insert_sql . "'0',";

			$insert_sql = $insert_sql . "'0',";

			$insert_sql = $insert_sql . "'".$this->location. "', ";

			$insert_sql = $insert_sql . "'n/a',";

			$insert_sql = $insert_sql . "'n/a', ";

			$insert_sql = $insert_sql . "'n/a',";

			$insert_sql = $insert_sql . "'n/a')";

			

	

			//echo "insert_sql = ".$insert_sql;

			//return;

	

			$insert_result = mysqli_query($dbh->link,$insert_sql);

			//$insert_result = mysql_query($insert_sql,$dbh->link);

	

			if (!$insert_result)

			{

				$this->msg = "Error: ".mysqli_error($dbh->link);

				//$this->msg = "Error: ".mysql_error($dbh->link);

				return;

			}

			else

			{

				$this->msg = "Thank you for filling the application form";

			}		

		}	

	

		//for Subscribe to our Newsletter! (ACT)

		function SendMail1()

		{

			//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

			//sending application entry mail to 

			

			require 'PHPMailerAutoload.php';

			//if(!$_POST) exit;

			//$email = $this->email;    //$res->email;

			$email = "nikkitefl@gmail.com";

			//$email = "nikita94.act@gmail.com";

			

			$errors = 0;

					

			//Create a new PHPMailer instance

			$mail = new PHPMailer;

			

			//Tell PHPMailer to use SMTP

			$mail->isSMTP();

			

			//Enable SMTP debugging

			// 0 = off (for production use)

			// 1 = client messages

			// 2 = client and server messages

			$mail->SMTPDebug = 0;

			

			//Ask for HTML-friendly debug output

			$mail->Debugoutput = 'html';

			

			//Set the hostname of the mail server

			//$mail->Host = 'smtp.gmail.com';

			$mail->Host = 'vps.teflindia.in';

			

			//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission

			$mail->Port = 465;

			

			//Set the encryption system to use - ssl (deprecated) or tls

			$mail->SMTPSecure = 'ssl';

			

			//Whether to use SMTP authentication

			$mail->SMTPAuth = true;

			

			//Username to use for SMTP authentication - use full email address for gmail

			$mail->Username = "applications@teacherstrainingnepal.com";

			//$mail->Username = "admin@teachersjobworld.com";

			

			//Password to use for SMTP authentication

			$mail->Password = "ACTApplications$56";

			//$mail->Password = "tjwportal20!";

			

			//Set who the message is to be sent from

			$mail->setFrom("applications@teacherstrainingnepal.com", "Asian College Of Teachers");

			

			//Set an alternative reply-to address

			//$mail->addReplyTo('replyto@example.com', 'First Last');

			

			//Set who the message is to be sent to

			$mail->addAddress($email);

			$mail->addAddress("asiancollegeapplications@gmail.com");

			//$mail->addAddress("sampade.ati@gmail.com");

			//Set the subject line

			$mail->Subject = "Subscribe to our Newsletter! (Teachertrainingbangalore) [#".$this->id."]";

			

			//Read an HTML message body from an external file, convert referenced images to embedded,

			//convert HTML into a basic plain-text alternative body

			

			$body = "";

			$body = "<html>

			<head>

			<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

			<title>Subscribe to our Newsletter! (Teachertrainingbangalore)</title>

			</head>

			<body>

			 <table>

			<tbody>

			<tr>

			<td><b>Please mention your Name</b></td>

			<td>".$this->name."</td>

			</tr>

			<tr>

			<td><b>Please mention your Email</b></td>

			<td>".$this->email."</td>

			</tr>

			<tr>

			<td><b>Please mention your Phone Number</b></td>

			<td>".$this->contact."</td>

			</tr>

			<tr>

			<td><b>Location </b></td>

			<td>".$this->location."</td>

			</tr>

			

			</tbody>

			</table>

			</body>

			</html>";

			$mail->msgHTML($body);

			

			//Replace the plain text body with one created manually

			$mail->AltBody = 'This is a plain-text message body';

			

			//Attach an image file

			//$mail->addAttachment('images/phpmailer_mini.png');

			

			//send the message, check for errors

			if (!$mail->send()) {

				$this->msg = "Sorry! Unable to send Mail";

				return;

			} 

			else

			{

				$this->msg = "Thank you for filling the application form";

			}	

			

		}

		

		//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

		

				

		//for Subscribe to our Newsletter! (ACT)

		function SendMailToCandidate()

		{

			//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

				//sending application entry mail to 

				

				//require 'PHPMailerAutoload.php';

				//if(!$_POST) exit;

				$email = $this->email;  

				//$email = "nikkitefl@gmail.com";

				//$email = "nikita94.act@gmail.com";

				

				//Create a new PHPMailer instance

				$mail = new PHPMailer;

				

				//Tell PHPMailer to use SMTP

				$mail->isSMTP();

				

				//Enable SMTP debugging

				// 0 = off (for production use)

				// 1 = client messages

				// 2 = client and server messages

				$mail->SMTPDebug = 0;

				

				//Ask for HTML-friendly debug output

				$mail->Debugoutput = 'html';

				

				//Set the hostname of the mail server

				//$mail->Host = 'smtp.gmail.com';

				$mail->Host = 'vps.teflindia.in';

				

				//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission

				$mail->Port = 465;

				

				//Set the encryption system to use - ssl (deprecated) or tls

				$mail->SMTPSecure = 'ssl';

				

				//Whether to use SMTP authentication

				$mail->SMTPAuth = true;

				

				//Username to use for SMTP authentication - use full email address for gmail

				$mail->Username = "applications@teacherstrainingnepal.com";

				//$mail->Username = "admin@teachersjobworld.com";

				

				//Password to use for SMTP authentication

				$mail->Password = "ACTApplications$56";

				//$mail->Password = "tjwportal20!";

				

				//Set who the message is to be sent from

				$mail->setFrom("applications@teacherstrainingnepal.com", "Asian College Of Teachers");

						

				//Set an alternative reply-to address

				//$mail->addReplyTo('replyto@example.com', 'First Last');

				

				//Set who the message is to be sent to

				$mail->addAddress($email);

				//$mail->addAddress("asiancollegeapplications@gmail.com");

				//$mail->addAddress("sampade.ati@gmail.com");

				//Set the subject line

				$mail->Subject = "Subscribe to our Newsletter! (ACT)";

				

				//Read an HTML message body from an external file, convert referenced images to embedded,

				//convert HTML into a basic plain-text alternative body

				

				$body = "";

				$body = "<html>

				<head>

				<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

				<title>Subscribe to our Newsletter! (ACT)</title>

				</head>

				<body>

				<a href='http://asiancollegeofteachers.education/' target='_blank'><img src='http://asiancollegeofteachers.education/admin_act/design/dist/img/logo.png' alt='' width='180' style='border:none;' /></a><br />

				Thank you for signing up for ACT newsletter. Keep up-to-date with the latest information and features on Asian College of Teachers. Learn more about our events, activities and celebrations!<br><br>

	

	Find out more by clicking on the link below: -<br>

	

	<a href='https://www.asiancollegeofteachers.com/newsletter-images/' target='_blank'>https://www.asiancollegeofteachers.com/newsletter-images/</a><br><br>

	Regards,<br />

	Asian College of Teachers

	<br />

	

	 

				</body>

				</html>";

				$mail->msgHTML($body);

				

				//Replace the plain text body with one created manually

				$mail->AltBody = 'This is a plain-text message body';

				

				//Attach an image file

				//$mail->addAttachment('images/phpmailer_mini.png');

				

				//send the message, check for errors

				if (!$mail->send()) {

					$this->msg = "Sorry! Unable to send Mail";

					return;

				} 

				else

				{

					$this->msg = "Thank you for filling the application form";

				}	

				

			}

			//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

	

	//insert function

	function InsertData2()

	{

		$dbh = new db_conn();

		$dbh->set_conn();

		$this->GenerateDataID();

		date_default_timezone_set('Asia/Kolkata');

		//============================================================================

		//insert data into tbl_data_entry table				

		$insert_sql = "insert into tbl_data_entry values ( ";

		$insert_sql = $insert_sql . $this->id. ",";

		$insert_sql = $insert_sql . "'".$this->name."', ";

		$insert_sql = $insert_sql . "'Application - www.teacherstrainingnepal.com', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'3', ";

		$insert_sql = $insert_sql . "'Application - www.teacherstrainingnepal.com', ";

		$insert_sql = $insert_sql . "'".$this->email. "', ";

		$insert_sql = $insert_sql . "'".$this->contact. "', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'102', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'1',";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'ACTIVE', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d h:i:s")."',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'".$this->comment."', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'n/a')";

		

		//echo "insert_sql = ".$insert_sql;

		//return;

		$insert_result = mysqli_query($dbh->link ,$insert_sql);

		//$insert_result = mysql_query($insert_sql,$dbh->link);

		if (!$insert_result)

		{

			$this->msg = "Error: ".mysqli_error($dbh->link);

			//$this->msg = "Error: ".mysql_error($dbh->link);

			return;

		}

		else

		{

			$this->msg = "Thank you for for filling the application form";

		}		

	}	

	function SendMail2()

	{

		//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

			//sending application entry mail to 

			

			require 'PHPMailerAutoload.php';

			//if(!$_POST) exit;

			//$email = $this->email;    //$res->email;

			$email = "nikkitefl@gmail.com";

			//$email = "nikita94.act@gmail.com";

			

			$errors = 0;

					

			//Create a new PHPMailer instance

			$mail = new PHPMailer;

			

			//Tell PHPMailer to use SMTP

			$mail->isSMTP();

			

			//Enable SMTP debugging

			// 0 = off (for production use)

			// 1 = client messages

			// 2 = client and server messages

			$mail->SMTPDebug = 0;

			

			//Ask for HTML-friendly debug output

			$mail->Debugoutput = 'html';

			

			//Set the hostname of the mail server

			//$mail->Host = 'smtp.gmail.com';

			$mail->Host = 'vps.teflindia.in';
           
            //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
            $mail->Port = 465;
           
            //Set the encryption system to use - ssl (deprecated) or tls
            $mail->SMTPSecure = 'ssl';
           
            //Whether to use SMTP authentication
            $mail->SMTPAuth = true;
           
            //Username to use for SMTP authentication - use full email address for gmail
            $mail->Username = "applications@teacherstrainingnepal.com";
            //$mail->Username = "admin@teachersjobworld.com";
           
            //Password to use for SMTP authentication
            $mail->Password = "ACTApplications$56";
            //$mail->Password = "tjwportal20!";
           
            //Set who the message is to be sent from
            $mail->setFrom("applications@teacherstrainingnepal.com", "Asian College Of Teachers");

			

			//Set an alternative reply-to address

			//$mail->addReplyTo('replyto@example.com', 'First Last');

			

			//Set who the message is to be sent to

			$mail->addAddress($email);

			$mail->addAddress("asiancollegeapplications@gmail.com");

			//$mail->addAddress("sampade.ati@gmail.com");

			//Set the subject line

			$mail->Subject = "Application - www.teacherstrainingnepal.com[#".$this->id."]";

			

			//Read an HTML message body from an external file, convert referenced images to embedded,

			//convert HTML into a basic plain-text alternative body

			

			$body = "";

			$body = "<html>

			<head>

			<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

			<title>Application - www.teacherstrainingnepal.com</title>

			</head>

			<body>

			 <table>

			<tbody>

			<tr>

			<td><b> Name </b></td>

			<td>".$this->name."</td>

			</tr>

			<tr>

			<td><b>Phone Number</b></td>

			<td>".$this->contact."</td>

			</tr>

			<tr>

			<td><b>E-mail </b></td>

			<td>".$this->email."</td>

			</tr>

		

			<tr>

			<td><b>Why are you interested in this course? </b></td>

			<td>".$this->comment."</td>

			</tr>

			

			</tbody>

			</table>

			</body>

			</html>";

			$mail->msgHTML($body);

			

			//Replace the plain text body with one created manually

			$mail->AltBody = 'This is a plain-text message body';

			

			//Attach an image file

			//$mail->addAttachment('images/phpmailer_mini.png');

			

			//send the message, check for errors

			if (!$mail->send()) {

				$this->msg = "Sorry! Unable to send Mail";

				return;

			} 

			else

			{

				$this->msg = "Thank you for  filling the application form";

			}	

			

		}
		
		//insert function

	function InsertData3()

	{

		$dbh = new db_conn();

		$dbh->set_conn();

		$this->GenerateDataID();

		date_default_timezone_set('Asia/Kolkata');

		//============================================================================

		//insert data into tbl_data_entry table				

		$insert_sql = "insert into tbl_data_entry values ( ";

		$insert_sql = $insert_sql . $this->id. ",";

		$insert_sql = $insert_sql . "'".$this->name."', ";

		$insert_sql = $insert_sql . "'Application - (www.teacherstrainingnepal.com/apply.php)', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'3', ";

		$insert_sql = $insert_sql . "'Application - (www.teacherstrainingnepal.com/apply.php)', ";

		$insert_sql = $insert_sql . "'".$this->email. "', ";

		$insert_sql = $insert_sql . "'".$this->contact. "', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'520', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'" .date("Y-m-d H:i:s")."',";

		$insert_sql = $insert_sql . "'1',";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'ACTIVE', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'0', ";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'" .date("Y-m-d h:i:s")."',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'0',";

		$insert_sql = $insert_sql . "'n/a', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'".$this->comment."', ";

		$insert_sql = $insert_sql . "'n/a',";

		$insert_sql = $insert_sql . "'n/a')";

		

		//echo "insert_sql = ".$insert_sql;

		//return;

		$insert_result = mysqli_query($dbh->link ,$insert_sql);

		//$insert_result = mysql_query($insert_sql,$dbh->link);

		if (!$insert_result)

		{

			$this->msg = "Error: ".mysqli_error($dbh->link);

			//$this->msg = "Error: ".mysql_error($dbh->link);

			return;

		}

		else

		{

			$this->msg = "Thank you for for filling the application form";

		}		

	}	

	function SendMail3()

	{

		//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

			//sending application entry mail to 

			

			require 'PHPMailerAutoload.php';

			//if(!$_POST) exit;

			//$email = $this->email;    //$res->email;

			$email = "nikkitefl@gmail.com";

			//$email = "nikita94.act@gmail.com";

			

			$errors = 0;

					

			//Create a new PHPMailer instance

			$mail = new PHPMailer;

			

			//Tell PHPMailer to use SMTP

			$mail->isSMTP();

			

			//Enable SMTP debugging

			// 0 = off (for production use)

			// 1 = client messages

			// 2 = client and server messages

			$mail->SMTPDebug = 0;

			

			//Ask for HTML-friendly debug output

			$mail->Debugoutput = 'html';

			

			//Set the hostname of the mail server

			//$mail->Host = 'smtp.gmail.com';

			$mail->Host = 'vps.teflindia.in';
           
            //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
            $mail->Port = 465;
           
            //Set the encryption system to use - ssl (deprecated) or tls
            $mail->SMTPSecure = 'ssl';
           
            //Whether to use SMTP authentication
            $mail->SMTPAuth = true;
           
            //Username to use for SMTP authentication - use full email address for gmail
            $mail->Username = "applications@teacherstrainingnepal.com";
            //$mail->Username = "admin@teachersjobworld.com";
           
            //Password to use for SMTP authentication
            $mail->Password = "ACTApplications$56";
            //$mail->Password = "tjwportal20!";
           
            //Set who the message is to be sent from
            $mail->setFrom("applications@teacherstrainingnepal.com", "Asian College Of Teachers");

			

			//Set an alternative reply-to address

			//$mail->addReplyTo('replyto@example.com', 'First Last');

			

			//Set who the message is to be sent to

			$mail->addAddress($email);

			$mail->addAddress("asiancollegeapplications@gmail.com");

			//$mail->addAddress("sampade.ati@gmail.com");

			//Set the subject line

			$mail->Subject = "Application - (www.teacherstrainingnepal.com/apply.php)[#".$this->id."]";

			

			//Read an HTML message body from an external file, convert referenced images to embedded,

			//convert HTML into a basic plain-text alternative body

			

			$body = "";

			$body = "<html>

			<head>

			<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />

			<title>Application - (www.teacherstrainingnepal.com/apply.php)</title>

			</head>

			<body>

			 <table>

			<tbody>

			<tr>

			<td><b> Name </b></td>

			<td>".$this->name."</td>

			</tr>

			<tr>

			<td><b>Phone Number</b></td>

			<td>".$this->contact."</td>

			</tr>

			<tr>

			<td><b>E-mail </b></td>

			<td>".$this->email."</td>

			</tr>

		

			<tr>

			<td><b>Why are you interested in this course? </b></td>

			<td>".$this->comment."</td>

			</tr>

			

			</tbody>

			</table>

			</body>

			</html>";

			$mail->msgHTML($body);

			

			//Replace the plain text body with one created manually

			$mail->AltBody = 'This is a plain-text message body';

			

			//Attach an image file

			//$mail->addAttachment('images/phpmailer_mini.png');

			

			//send the message, check for errors

			if (!$mail->send()) {

				$this->msg = "Sorry! Unable to send Mail";

				return;

			} 

			else

			{

				$this->msg = "Thank you for  filling the application form";

			}	

			

		}

}

?>