Tags » Php

Ajax Email Send in Codeigniter

// routes

$route['admin/objednavka/send_email'] = "backend/order/send_email";

// html 

    <input id="user_email" type="hidden" name="user_email" value="getsolved@gmail.com">

    <input id="user_email_sub" type="text" name="user_email_sub" value="getsolved@gmail.com">

    <textarea id="user_email_body" type="text" name="user_email_body">

        Send Order Email

       assets/backend/img/preloader.gif" width="100%">

// jquery 

$("#sendOrderEmail").click(function () {

    var url = $(".url").val();
    var email = $('#user_email').val();
    var user_email_sub= $('#user_email_sub').val();
    var user_email_body= $('#user_email_body').val();

    // alert(email + email_type)
        url: url + "admin/objednavka/send_email",
        // url: url + "backend/order/send_email",
        type: 'post',
        data: { 
             'user_email_sub': user_email_sub,  
             'email': email, 
             'user_email_body': user_email_body 
        dataType: 'json',
        beforeSend: function () {
        success: function (json) {
            if (json.success) {
                alert('Email Successfully Sent')
        error: function (request, status, error) {
            alert("Nepodařilo se změnit.");

// controller
class Order extends Base_backend

    public function __construct()

        $this->layout->title('Objadnávka | Weboo Shop 2.0');

        $this->menuOpen->m_order = 1;

    public function sendEmailBackend($to, $subject, $body)
        $sender = $this->setting_model->get_setting("email", "sender", DEFAULT_LANG)->value;
        $senderName = $this->setting_model->get_setting("email", "sender-name", DEFAULT_LANG)->value;

        include_once APPPATH.'/libraries/phpmailer/PHPMailerAutoload.php';
        $mail = new PHPMailer;

        $mail->isSMTP();                            // Set mailer to use SMTP
        $mail->Host = _s("mail-server");            // Specify main and backup SMTP servers
        $mail->SMTPAuth = true;                     // Enable SMTP authentication
        $mail->Username = _s("mail-login");         // SMTP username
        $mail->Password = _s("mail-password");      // SMTP password
        $mail->SMTPSecure = 'ssl';                  // Enable TLS encryption, `ssl` also accepted
        $mail->Port = _s("mail-port");              // TCP port to connect to
        $mail->CharSet = 'UTF-8';
        $mail->setFrom(_s("mail-login"), $senderName);
        $mail->addReplyTo($sender, $senderName);

        $mail->isHTML(true);                         // Set email format to HTML

        $mail->Subject = $subject;
        $mail->Body = $body;
        $mail->AltBody = $body;

        return 1;

    public function send_email()
        $item = $_POST['email_type'];
        $email_text  = $this->b_order_model->get_email_text_by_status($item);

        $email = $_POST['email'];
        $user_email_sub= $_POST['user_email_sub'];
        $user_email_body = $_POST['user_email_body '];

        $status = $this->sendEmailBackend($email,$user_email_sub, $user_email_body );

        echo json_encode(['success' => 1,'status' => $status]);
} 146 more words


Install Composer

  1. Go to composer official website (https://getcomposer.org/doc/00-intro.md)
  2. Download installer and rename it to ‘composer-setup.php’
  3. Execute this command line: php composer-setup.php --install-dir=/usr/local/bin
  4. Rename ‘composer.phar’ to ‘composer’ under /usr/local/bin…
  5. 164 more words

Hide PHP Version in HTTP Headers on Nginx

The PHP version is revealed in the HTTP headers by default on nginx. This can be demonstrated by CURLing the URL of your choice.

curl -I… 54 more words

Web Development

PHP Namespaces

There are possible conflicts that we can encounter with two classes with the same name. Namespaces in php helps resolve that issue.

Following is an simple illustration of the use of Namespace in php. 176 more words


Integer Exceptions

The Integer-Overflow (IOF) vulnerability family is responsible for a dominant part of C/C++ code vulnerabilities, as I shown in my previous post with a specific example. 324 more words

Integer Overflow