<?php require_once('connections/reg_conn.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_reg_conn, $reg_conn);
$query_rsOK = "SELECT * FROM `registration` ORDER BY id DESC LIMIT 1";
$rsOK = mysql_query($query_rsOK, $reg_conn) or die(mysql_error());
$row_rsOK = mysql_fetch_assoc($rsOK);
$totalRows_rsOK = mysql_num_rows($rsOK);

$my_activation = $row_rsOK['activation'];
$my_regcode = $row_rsOK['regcode'];
$to = $row_rsOK['email'];
$subject = "Registration Confirmation";
$body = "<html><body>" .
		"<h2>Thank you for your registration.</h2>" .
		"<h3>Your Registration Code: ".$my_regcode."<br></h3>" .
		"<p>Please verify your registration by click the link below</p>".
		"http://pksplipb.or.id/int/icmmbt/reg/activate.php?activation=".$my_activation."".
		"<p><p><br><br><br><br>
		Center for Coastal and Marine Resources Studies<br>
		Bogor Agricultural University<br>
		Kampus IPB Baranangsiang, Jl. Raya Pajajaran No. 1<br>
		Bogor - Post 16127 - Jawa Barat - Indonesia";


$headers = 	"From: ICM-MB 2016 <icmbt2016@pksplipb.or.id>\r\n" . 
			"MIME-Version: 1.0\r\n" .
			"Content-type: text/html; charset=UTF-8";
			
			
if (!mail($to, $subject, $body, $headers)) {
	$redirect= "register_error.php";
  header( "Location: ".$redirect ) ;
 } 

?>

<!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>Success</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style1 {color: #FF0000}
-->
</style>
</head>

<body>
<div class="container">
  <div class="header"></div>
  <div class="content">
    <h2>Thank you for your registration.</h2>
    <h3>To continue with online registration, you need confirm your email that you provided. An email with <span class="style1">confirmation link</span> and &quot;<span class="style1">Registration Code</span>&quot; already sent to your e-mail.</h3>
    
    If you didn't receive any email, please check your spam folder. <br /><br />
  </div>
  <div class="footer"><a href="http://pksplipb.or.id/int/icmmbt/">Home</a> | <a href="http://pkspl.ipb.ac.id">About</a> | <a href="mailto:icmbt2016@pksplipb.or.id">Contact Us</a> | <a href="login.php">Login</a> | <a href="admin.php">Admin</a> | Log Out</div>
</div>
</body>
</html>
<?php
mysql_free_result($rsOK);
?>
