<?php /* * To change this template, choose Tools | Templates * and open the template in the editor. */ $sqlendrow = "SELECT * FROM user_info WHERE user_id = :user_id"; $sthendrow = $dbconn->prepare($sqlendrow); $sthendrow->execute(array(':user_id' => $_SESSION['view_user_id'])); $result = $sthendrow->fetch(PDO::FETCH_ASSOC); $name_to = $result['first_name'] . ' ' . $result['last_name']; $name_from = $_SESSION['name']; $batchadmin_email = getBatchAdmin($result['batch']); $email = $result['email_primary']; if (isset($_GET['action']) && $_GET['action'] == 'requpdate') { $subject = "Please update your profile"; $message = $_POST['f_description']; if ($message == "") { $message = "Please update your profile"; } $bodyContent = file_get_contents('mail_templates/new_requestupdate.html'); $_SESSION['msg_type'] = 's'; $_SESSION['msg'] = 'You have requested ' . $name_to . ' to update his profile!!'; } else { if (isset($_GET['action']) && $_GET['action'] == 'flag') { $subject = "Your account has been flagged"; $message = $_POST['flag_description']; if ($message == "") { $message = "Your profile has been flagged for abusive content."; } $bodyContent = file_get_contents('mail_templates/new_flag.html');
$student_id = $_POST['student_id']; $email_from = $_POST['email']; $phone = $_POST['phone']; unset($_POST['student_id']); unset($_POST['email']); unset($_POST['phone']); if ($student_id != '' && $email_from != '' && $phone != '') { $num_array = str_split($student_id); if ($num_array[0] == "0") { $batch = "20" . $num_array[0] . $num_array[1]; } else { $batch = "19" . $num_array[0] . $num_array[1]; } if (checkCurrentStudent($student_id) == true) { $email_to = getBatchAdmin($batch); if ($email_to == "") { $_SESSION['msg_type'] = 'e'; $_SESSION['msg'] = 'Sorry!There is no admin for your batch.Try again later.'; header('location:login.php'); } else { $bodyContent = file_get_contents('mail_templates/new_signup.html'); $tags = array("##BATCH##", "##STUDENT_ID##", "##EMAIL##", "##PHONE##"); $values = array($batch, $student_id, $email_from, $phone); $body = str_replace($tags, $values, $bodyContent); $sqlmail = "INSERT INTO mail_dispatcher (email_from,email_to,cc,subject,body) VALUES (:from, :to, :cc, :subject, :body)"; $sthmail = $dbconn->prepare($sqlmail); $from = "*****@*****.**"; $subject = "New signup request"; $sthmail->execute(array(':from' => $from, ':to' => $email_to, ':cc' => '', ':subject' => $subject, ':body' => $body)); $_SESSION['msg_type'] = 's';