Your IP : 216.73.216.26


Current Path : /home2/wtmwscom/www/member/
Upload File :
Current File : /home2/wtmwscom/www/member/email.php

<?php 
$title= "Email";
include 'header.php';
include('imageresize.php');
$uid = $_SESSION['userid'];
if(isset($_POST['submit'])){
    $subject = mysqli_real_escape_string($connection,$_POST['subject']);
    $message = mysqli_real_escape_string($connection,$_POST['message']);
    $allowedExts = array("pdf", "doc", "docx", "txt", "zip"); 
    $extension = end(explode(".", $_FILES["attach_file"]["name"]));
    if($_FILES['attach_file']['name']==''){
        mysqli_query($connection, "INSERT INTO `message` (`by`,`to`,`subject`,`message`,`datetime`) VALUES('".$uid."','admin','".$subject."','".$message."','".date('Y-m-d H:i:s')."')");
    
        setMessage('Message send successfully.', 'alert-msg success');
        redirect("./outbox.php");
    }
    elseif($_FILES['attach_file']['name']!='' && !empty($_FILES['attach_file'])){
        if(isset($_FILES['attach_file']['name']) && array_search($_FILES['attach_file']['type'],array("image/gif", "image/jpeg" , "image/png" ,"image/jpg") ) !== FALSE){
            $resize = new resizeImage();
            // upload image in three dimesions
        
            //$largePath      = "uploads/news/large/";
            //$largeImage     = $resize->do_resize(500,400  ,$_FILES['attach_file'],$largePath,0,"large");
        
            $smallPath      = "../static/backend/user-resource/uploads/attachment/";
            $smallImage     = $resize->do_resize(400,800  ,$_FILES['attach_file'],$smallPath,0,"thumb", 90);
            
            mysqli_query($connection, "INSERT INTO `message` (`by`,`to`,`subject`,`message`,`filename`,`datetime`) VALUES('".$uid."','admin','".$subject."','".$message."','".$smallImage."','".date('Y-m-d H:i:s')."')");
            setMessage('Message send successfully.', 'alert-msg success');
            redirect("./outbox.php");
        }
        //elseif((($_FILES["attach_file"]["type"] == "application/txt") || ($_FILES["attach_file"]["type"] == "application/doc") || ($_FILES["attach_file"]["type"] == "application/zip") || ($_FILES["attach_file"]["type"] == "application/docx") || ($_FILES["attach_file"]["type"] == "text/pdf")) && ($_FILES["attach_file"]["size"] < 2000000) && in_array($extension, $allowedExts)){
        elseif(isset($_FILES['attach_file']['name']) && ($_FILES["attach_file"]["size"] < 2000000) && in_array($extension, $allowedExts)){
            $newf   = time().".".str_replace(array(" ","_"),".",$extension);
            move_uploaded_file($_FILES["attach_file"]["tmp_name"], "uploads/attachment/" . $newf); 
            mysqli_query($connection, "INSERT INTO `message` (`by`,`to`,`subject`,`message`,`filename`,`datetime`) VALUES('".$uid."','admin','".$subject."','".$message."','".$newf."','".date('Y-m-d H:i:s')."')");
            setMessage('Message send successfully.', 'alert-msg success');
            redirect("./outbox.php");
        }
        else{
            // Unsupported file format
            setMessage('Unsupported file format.', 'alert-msg error');
            redirect("./email.php");
        }
    }
    die();
}
?>

    <!---container starts here--->
    <div class="container-fluid">

        <div class="row">
            <div class="col-sm-12">
                <div class="page-title-box">
                    <h4 class="page-title">Email</h4>
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="index.php">Home</a></li>
                        <li class="breadcrumb-item"><a href="">Support</a></li>
                        <li class="breadcrumb-item active">Email</li>
                    </ol>

                    <!--                                    <div class="state-information d-none d-sm-block">
                                                            <div class="state-graph">
                                                                <div id="header-chart-1"></div>
                                                                <div class="info">Balance $ 2,317</div>
                                                            </div>
                                                            <div class="state-graph">
                                                                <div id="header-chart-2"></div>
                                                                <div class="info">Item Sold 1230</div>
                                                            </div>
                                                        </div>-->
                </div>
            </div>
        </div>
        <!-- end row -->

        <div class="row">
            <div class="col-12">
                <div class="card m-b-20">
                    <div class="card-body">
                        <form name="form" id="form" action="email.php" method="post" enctype="multipart/form-data"">
                            <!--                                        <h4 class="mt-0 header-title">Textual inputs</h4>
                                                                    <p class="text-muted m-b-30">Here are examples of <code
                                                                            class="highlighter-rouge">.form-control</code> applied to each
                                                                        textual HTML5 <code class="highlighter-rouge">&lt;input&gt;</code> <code
                                                                                class="highlighter-rouge">type</code>.</p>-->

                            <div class="form-group row">
                                <!--                                            <label for="example-text-input" class="col-sm-2 col-form-label">Text</label>-->
                                    <label for="subject" class="col-sm-2 col-form-label">Subject <span>*</span></label>
<!--                                            <label class="col-sm-2 col-form-label" for="dob"> Name<span>*</span></label>-->
                                <div class="col-sm-10">
                                                                               
                               <input class="form-control" type="text" name="subject" id="subject" required="required" maxlength="200">
                                </div>
                            </div>
                            <div class="form-group row">
                                  <label class="col-sm-2 col-form-label" for="message">Message </label>
                                <div class="col-sm-10">
                                  <textarea required class="form-control" name="message" id="message" required="required" style="width: 30%;"></textarea>
<!--                                    <input class="form-control" type="password" name="new_password" id="new_password" pattern="\w{6,20}" onchange="form.confirm_password.pattern = this.value;" required="required" maxlength="20">-->
                                </div>
                            </div>
                              <div class="form-group row">
                                  <label class="col-sm-2 col-form-label" for="attach_file">Attach File </label>
                                <div class="col-sm-10">
                                  <input class="form-control" type="file" name="attach_file" id="attach_file">
<!--                                    <input class="form-control" type="password" name="new_password" id="new_password" pattern="\w{6,20}" onchange="form.confirm_password.pattern = this.value;" required="required" maxlength="20">-->
                                </div>
                            </div>
                           
                         
                            <div class="form-group">
                                <div>
                                    <button name="submit" type="submit" id="submit" value="Save" class="btn btn-primary waves-effect waves-light">
                                        Submit
                                    </button>
                                </div>
                            </div>
                            <!--                                        <div class="form-group row">
                                                                        <label for="example-color-input" class="col-sm-2 col-form-label">Color</label>
                                                                        <div class="col-sm-10">
                                                                            <input class="form-control" type="color" value="#67a8e4" id="example-color-input">
                                                                        </div>
                                                                    </div>-->
                            <!--                                        <div class="form-group row">
                                                                        <label class="col-sm-2 col-form-label">Select</label>
                                                                        <div class="col-sm-10">
                                                                            <select class="form-control">
                                                                                <option>Select</option>
                                                                                <option>Large select</option>
                                                                                <option>Small select</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>
                                                                    <div class="form-group row">
                                                                        <label class="col-sm-2 col-form-label">Custom Select</label>
                                                                        <div class="col-sm-10">
                                                                            <select class="custom-select">
                                                                                <option selected>Open this select menu</option>
                                                                                <option value="1">One</option>
                                                                                <option value="2">Two</option>
                                                                                <option value="3">Three</option>
                                                                            </select>
                                                                        </div>
                                                                    </div>-->
                            <!--                                        <div class="form-group row">
                                                                        <label for="example-text-input-lg" class="col-sm-2 col-form-label">Large</label>
                                                                        <div class="col-sm-10">
                                                                            <input class="form-control form-control-lg" type="text" placeholder=".form-control-lg" id="example-text-input-lg">
                                                                        </div>
                                                                    </div>
                                                                    <div class="form-group row">
                                                                        <label for="example-text-input-sm" class="col-sm-2 col-form-label">Small</label>
                                                                        <div class="col-sm-10">
                                                                            <input class="form-control form-control-sm" type="text" placeholder=".form-control-sm" id="example-text-input-sm">
                                                                        </div>
                                                                    </div>-->
                        </form>
                    </div>

                </div>
            </div> <!-- end col -->
        </div> <!-- end row -->


    </div> <!-- container-fluid -->
<?php include 'footer.php';?>