session_start();
include "config.php";
$template_status = true;
$current_page = str_replace('^', '', str_replace(' ', '', urldecode($current_page)));
if($current_page){
if($current_page=="resend-all-author" && intval($current_after_page)>0 && $_SESSION['LOGIN_ID']>0){
$my_id = intval(mb_substr(strip_tags(trim($_SESSION['LOGIN_ID'])), 0, 8, 'UTF-8'));
$research_id = $current_after_page;
$q = "select * from research where id='".$research_id."'";
$qr = mysqli_query($Conn, $q);
$rs = mysqli_fetch_assoc($qr);
$qw = "select * from authors where `research_id`='".$research_id."' and member_id='".$my_id."' and `status`='0' and `corresponding`='1'";
$qrw = mysqli_query($Conn, $qw);
if(mysqli_num_rows($qrw)>0){
while ($rsw = mysqli_fetch_array($qrw)) {
$id = $rsw['research_id'];
$emailA = $rsw['email'];
$tokenA = $rsw['token'];
$link = $myWeb . 'corresponding-author/' . $emailA . '/' . $tokenA;
$title = strip_tags(stripslashes($rs['name_th'])).' / '.strip_tags(stripslashes($rs['name_en']));
$email_title_for_author = str_replace("{{TITLE}}", $title , $email_title_for_author);
$body_html = $email_body_for_author;
$body_html = str_replace("{{TITLE}}", $title , $body_html);
$body_html = str_replace("{{AUTHOR_LINK}}", $link, $body_html);
sendmail($emailA, $email_title_for_author, $body_html, $sendEmail);
}
echo '';
exit();
}else{
echo '';
exit();
}
}
if($current_page=="resend-corresponding-author" && $current_after_page){
$email = $current_after_page;
$qw = "select * from authors where `email`='".$email."' and `status`='0' and `corresponding`='1'";
$qrw = mysqli_query($Conn, $qw);
if(mysqli_num_rows($qrw)>0){
while ($rsw = mysqli_fetch_array($qrw)) {
$id = $rsw['research_id'];
$emailA = $rsw['email'];
$tokenA = $rsw['token'];
$q = "select * from research where id='".$id."'";
$qr = mysqli_query($Conn, $q);
$rs = mysqli_fetch_assoc($qr);
$link = $myWeb . 'corresponding-author/' . $emailA . '/' . $tokenA;
$title = strip_tags(stripslashes($rs['name_th'])).' / '.strip_tags(stripslashes($rs['name_en']));
$email_title_for_author = str_replace("{{TITLE}}", $title , $email_title_for_author);
$body_html = $email_body_for_author;
$body_html = str_replace("{{TITLE}}", $title , $body_html);
$body_html = str_replace("{{AUTHOR_LINK}}", $link, $body_html);
sendmail($emailA, $email_title_for_author, $body_html, $sendEmail);
}
echo '';
exit();
}else{
echo '';
exit();
}
}
if($current_page=="papers-submission" && $_GET['ref']){
$_SESSION['REF'] = $_GET['ref'];
}
if($current_page=="logout"){
//session_destroy();
unset($_SESSION['LOGIN_MEMBER']);
unset($_SESSION['LOGIN_LEVEL']);
unset($_SESSION['LOGIN_ID']);
unset($_SESSION['LOGIN_NAME']);
header("location: ".$myWeb."login");
exit();
}
if(in_array($current_page, $pleaseLogin_slug)){
if($_SESSION['LOGIN_MEMBER'] == false && intval($_SESSION['LOGIN_ID']) <= 0){
header("location: ".$myWeb."login");
exit();
}
}
if(in_array($current_page, $notLogin_slug)){
if($_SESSION['LOGIN_MEMBER'] == true && intval($_SESSION['LOGIN_ID']) > 0){
if($_SESSION['LOGIN_LEVEL']==2){
header("location: ".$myWeb."review");
}else{
header("location: ".$myWeb."papers-submission");
}
exit();
}
}
if($current_page=="papers-submission" && $_SESSION['LOGIN_MEMBER'] == true && intval($_SESSION['LOGIN_ID']) > 0 && $_SESSION['LOGIN_LEVEL']==2){
header("location: ".$myWeb."review");
exit();
}
$result = mysqli_query($Conn, "select count(*) as total from page where slug='".($current_page)."'");
$find = mysqli_fetch_assoc($result);
if($find['total'] > 0){
if(in_array($current_page, $system_slug)){
$slug = $current_page;
$template_status = false;
$edit_access = false;
}else{
$slug = ($current_page);
}
}else{
$slug = "home";
}
}else{
$qL = "select id,status from landing where id='1'";
$qrL = mysqli_query($Conn, $qL);
$rwL = mysqli_fetch_assoc($qrL);
if($rwL['status']==1){
include "start.php";
exit();
}else{
$slug = "home";
}
}
if(in_array($slug, $hasFuntion_slug)){
include "function/_".$slug.".php";
}
$q = "select * from page where slug='".$slug."'";
$qr = mysqli_query($Conn, $q);
$rw = mysqli_fetch_assoc($qr);
$page_id = $rw['id'];
$title = $rw['title'];
$keyword = $rw['keyword'];
$description = $rw['description'];
$slug = $rw['slug'];
$pageName = $rw['name'];
$template = "_".$rw['template'].".php";
delete_recovery();
include "system/_header.php";
if($template_status){
if($edit_access) {
$data = stripslashes($rw['data']);
}else{
$data = codeReplace(stripslashes($rw['data']));
}
include "template/".$template;
}else{
include "system/_".$slug.".php";
}
include "system/_footer.php";
?>