system: Linux mars.sprixweb.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
<?php
class Model_MInbox
{
function showInbox()
{
$inbox="SELECT * FROM contactus_table where contactus_status='Inbox'";
$obj=new Bin_Query();
$obj->executeQuery($inbox);
return Display_DInbox::showInbox($obj->records);
}
function showSent()
{
$inbox="SELECT * FROM contactus_table where contactus_status='Sent'";
$obj=new Bin_Query();
$obj->executeQuery($inbox);
return Display_DInbox::showInbox($obj->records);
}
function showTrash()
{
$inbox="SELECT * FROM contactus_table where contactus_status='Trash'";
$obj=new Bin_Query();
$obj->executeQuery($inbox);
return Display_DInbox::showInbox($obj->records);
}
function showMails()
{
$id=(int)$_GET['id'];
$inbox="SELECT * FROM contactus_table where contactus_id=$id";
$obj=new Bin_Query();
$obj->executeQuery($inbox);
return $obj->records[0];
}
function SendMail()
{
$email=$_POST['txtto'];
$name='SACB';
$subject=$_POST['txtsubject'];
$message=$_POST['txtmessage'];
$phone=$_POST['txtphone'];
$from='help@specialanticrimebureau.org';
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
$headers .= "From: ". $from."\n";
$date = date("F j, Y, g:i a");
$status='Sent';
$mail=mail($email,$subject,$message,$headers);
if($mail)
{
$obj = new Bin_Query();
$insertmember="INSERT INTO contactus_table(contactus_name,contactus_phone,contactus_email,contactus_subject,contactus_message,contactus_date,contactus_status) VALUES('$name','$phone','$from','$subject','$message','$date','$status')";
if($obj->updateQuery($insertmember))
{
$_SESSION['contactsuc']="Mail Send Successfully";
header("Location:?do=inbox&action=compose");
}
}
else
{
$_SESSION['contactsuc']="Mail Sending Failed";
header("Location:?do=inbox&action=compose");
}
}
function process()
{
if(isset($_POST['trash']))
{
$count = count($_POST['checkbox']);
$obj=new Bin_Query();
if($count > 0)
{
foreach($_POST['checkbox'] as $key=>$value)
{
$sql="update contactus_table set contactus_status='Trash' WHERE contactus_id='".$value."'";
if($obj->updateQuery($sql))
{
$_SESSION['message']=' Mail Deleted Sucessfully';
header('Location:?do=inbox');
}
else
{
$_SESSION['error_message']='Please Select Any One Mail for Deletion';
header('Location:?do=inbox');
}
}
}
else
{
$_SESSION['error_message']='Please Select Any One Mail for Deletion';
header('Location:?do=inbox');
}
}
if(isset($_POST['delete']))
{
$count = count($_POST['checkbox']);
$obj=new Bin_Query();
if($count > 0)
{
foreach($_POST['checkbox'] as $key=>$value)
{
$sql1="delete from contactus_table WHERE contactus_id='".$value."' ";
if($obj->updateQuery($sql1))
{
$_SESSION['message']='Mail Deleted Sucessfully';
header('Location:?do=inbox&action=trash');
}
else
{
$_SESSION['error_message']='Please select the Mail(s) to be Deleted';
header('Location:?do=inbox&action=trash');
}
}
}
else
{
$_SESSION['error_message']='Select Any One Mail For Deletion';
header('Location:?do=inbox&action=trash');
}
}
}
}
?>