SlideShare a Scribd company logo
Codeigniter Framework
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
5. Email & User agent & Security
Agenda
• Email.
• User agent.
• Security.
• Conclusion.
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Email
• Email class.
• Sending Email.
• Email class functions.
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Email class
• supports the following features.
- Multiple Protocols: Mail, Sendmail, and
SMTP.
- Multiple recipients.
- HTML or Plaintext email.
- Attachments
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Sending Email
$this->load->library('email');
$this->email->from('your@example.com',
'Your Name');
$this->email->to('to@example.com');
$this->email->subject('Email Test');
$this->email->message('Testing the email
class.');
$this->email->send();
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Email class functions
• from() Sets the email address and name
of the person sending the email.
• to() Sets the email address(s) of the
recipient(s).
• subject() Sets the email subject.
• message() Sets the email message body.
• send() The Email sending function.
Returns boolean TRUE or FALSE.
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Let’s Try It
Live!
User agent
• User agent class.
• Class functions.
• Example.
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
User agent class
• provides functions that help identify
information about the browser, mobile
device, or robot visiting your site.
• Agent class is must initialize in your
controller using as following:
$this->load->library('user_agent');
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Class functions
• $this->agent->is_browser()
• $this->agent->is_mobile()
• $this->agent->is_robot()
• $this->agent->browser()
• $this->agent->mobile()
• $this->agent->robot()
• $this->agent->platform()
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Example
$this->load->library('user_agent');
if ($this->agent->is_browser()){
$agent = $this->agent->browser();
}elseif ($this->agent->is_robot()){
$agent = $this->agent->robot();
}
echo $agent;
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Let’s Try It
Live!
Security
• URI Security
• Error reporting
• XSS Filtering
• Data escape
• Data validation
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
URI Security
• minimize the possibility that malicious data
can be passed to your application.
• URIs may only contain the following:
Alpha-numeric text
Tilde: ~ Period: .
Colon: : Underscore: _
Dash: -
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Error reporting
• it is typically desirable to disable PHP's
error reporting by setting the internal
error_reporting flag to a value of 0.
• This disables native PHP errors from
being rendered as output, which may
potentially contain sensitive information.
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
XSS Filtering
• CodeIgniter comes with a Cross Site
Scripting Hack prevention filter which can
either run automatically to filter all POST
and COOKIE data that is encountered, or
you can run it on a per item basis
• Loading security helper
$this->load->helper('security');
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
XSS Filtering
• xss_clean():
Provides Cross Site Script Hack filtering.
to run automatically every time it
encounters POST or COOKIE data you
can enable it by set this in config file
$config['global_xss_filtering'] = TRUE;
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
XSS Filtering
• sanitize_filename():
Provides protection against directory
traversal.
• Enable csrf protection:
by setting this in config file
$config['csrf_protection'] = TRUE;
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Data escape
• Escape data before inserting it into
database.
• $this->db->escape()
This function determines the data type so
that it can escape only string data.
• $this->db->escape_like_str()
This method should be used when strings are to
be used in LIKE conditions
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Data validation
• Validating, Filtering, and Prepping data
• We saw this in session 2 : )
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Let’s Try It
Live!
Conclusion
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
THANK YOU
Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
Questions?

More Related Content

PPSX
CodeIgniter L2 helper & libraries & form validation
PPSX
CodeIgniter L1 introduction to CodeIgniter framework
PPSX
CodeIgniter L3 model & active record & template
PPSX
CodeIgniter L4 file upload & image manipulation & language
PDF
Php workshop L03 superglobals
PDF
Php workshop L04 database
PPTX
Java script
PDF
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHP
CodeIgniter L2 helper & libraries & form validation
CodeIgniter L1 introduction to CodeIgniter framework
CodeIgniter L3 model & active record & template
CodeIgniter L4 file upload & image manipulation & language
Php workshop L03 superglobals
Php workshop L04 database
Java script
PHP Experience 2016 - [Workshop] Elastic Search: Turbinando sua aplicação PHP

What's hot (8)

PPT
Php basic for vit university
PDF
JSP : Creating Custom Tag
PDF
Unit 4(it workshop)
PPTX
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
PDF
Laravel admin20170819
PPTX
Mongo - an intermediate introduction
PPTX
Black Hat: XML Out-Of-Band Data Retrieval
PDF
Replacing Oracle with MongoDB for a templating application at the Bavarian go...
Php basic for vit university
JSP : Creating Custom Tag
Unit 4(it workshop)
Internet and Web Technology (CLASS-14) [JSP] | NIC/NIELIT Web Technology
Laravel admin20170819
Mongo - an intermediate introduction
Black Hat: XML Out-Of-Band Data Retrieval
Replacing Oracle with MongoDB for a templating application at the Bavarian go...
Ad

Viewers also liked (8)

DOC
Php acak
PPTX
CodeIgniter i18n Security Flaw
PPTX
File upload for the 21st century
PDF
File Upload 2015
PDF
How to insert json data into my sql using php
PPT
Benefits of the CodeIgniter Framework
ODP
CodeIgniter PHP MVC Framework
PDF
RESTful API Design & Implementation with CodeIgniter PHP Framework
Php acak
CodeIgniter i18n Security Flaw
File upload for the 21st century
File Upload 2015
How to insert json data into my sql using php
Benefits of the CodeIgniter Framework
CodeIgniter PHP MVC Framework
RESTful API Design & Implementation with CodeIgniter PHP Framework
Ad

Similar to CodeIgniter L5 email & user agent & security (20)

PDF
The top 10 security issues in web applications
PPT
Eight simple rules to writing secure PHP programs
PPT
Web application security
PPT
Securing Your Webserver By Pradeep Sharma
PPTX
Code Igniter Security
ODP
My app is secure... I think
PPT
secure php
PPTX
OWASP Top 10 vs Drupal - OWASP Benelux 2012
PDF
Rails and security
PDF
Security in php
PPT
XSS Primer - Noob to Pro in 1 hour
PDF
Massive emailing with Linux, Postfix and Ruby on Rails
PPT
Defending Against Attacks With Rails
PPT
Secure Programming
PDF
null Bangalore meet - Php Security
PPTX
Open source security
PPTX
Top Ten Java Defense for Web Applications v2
PDF
PHP SA 2014 - Releasing Your Open Source Project
PPT
pop3-imap.ppt
PPT
pop3-imap.ppt
The top 10 security issues in web applications
Eight simple rules to writing secure PHP programs
Web application security
Securing Your Webserver By Pradeep Sharma
Code Igniter Security
My app is secure... I think
secure php
OWASP Top 10 vs Drupal - OWASP Benelux 2012
Rails and security
Security in php
XSS Primer - Noob to Pro in 1 hour
Massive emailing with Linux, Postfix and Ruby on Rails
Defending Against Attacks With Rails
Secure Programming
null Bangalore meet - Php Security
Open source security
Top Ten Java Defense for Web Applications v2
PHP SA 2014 - Releasing Your Open Source Project
pop3-imap.ppt
pop3-imap.ppt

More from Mohammad Tahsin Alshalabi (11)

PDF
NUMA optimized Parallel Breadth first Search on Multicore Single node System
PDF
Learning Management System in Damascus University-Information Technology Engi...
PPSX
Learning management system in information technology engineering faculty
PDF
Moodle documentation
PDF
Moodle plugins programing manual
PPSX
Comparison between web and mobile application requirements
PDF
Introduction to web services
PDF
Introduction to HTML5
PDF
Php workshop L02 php basics
PDF
Php workshop L01 CSS
PDF
Php workshop L0 Introduction
NUMA optimized Parallel Breadth first Search on Multicore Single node System
Learning Management System in Damascus University-Information Technology Engi...
Learning management system in information technology engineering faculty
Moodle documentation
Moodle plugins programing manual
Comparison between web and mobile application requirements
Introduction to web services
Introduction to HTML5
Php workshop L02 php basics
Php workshop L01 CSS
Php workshop L0 Introduction

Recently uploaded (20)

PPTX
Machine Learning_overview_presentation.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
A Presentation on Artificial Intelligence
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PPTX
TLE Review Electricity (Electricity).pptx
PPTX
cloud_computing_Infrastucture_as_cloud_p
PPTX
Spectroscopy.pptx food analysis technology
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Empathic Computing: Creating Shared Understanding
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
August Patch Tuesday
Machine Learning_overview_presentation.pptx
Spectral efficient network and resource selection model in 5G networks
Mobile App Security Testing_ A Comprehensive Guide.pdf
Approach and Philosophy of On baking technology
Assigned Numbers - 2025 - Bluetooth® Document
A Presentation on Artificial Intelligence
A comparative study of natural language inference in Swahili using monolingua...
SOPHOS-XG Firewall Administrator PPT.pptx
TLE Review Electricity (Electricity).pptx
cloud_computing_Infrastucture_as_cloud_p
Spectroscopy.pptx food analysis technology
A comparative analysis of optical character recognition models for extracting...
Unlocking AI with Model Context Protocol (MCP)
Group 1 Presentation -Planning and Decision Making .pptx
Encapsulation_ Review paper, used for researhc scholars
Heart disease approach using modified random forest and particle swarm optimi...
Per capita expenditure prediction using model stacking based on satellite ima...
Empathic Computing: Creating Shared Understanding
Network Security Unit 5.pdf for BCA BBA.
August Patch Tuesday

CodeIgniter L5 email & user agent & security

  • 1. Codeigniter Framework Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi 5. Email & User agent & Security
  • 2. Agenda • Email. • User agent. • Security. • Conclusion. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 3. Email • Email class. • Sending Email. • Email class functions. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 4. Email class • supports the following features. - Multiple Protocols: Mail, Sendmail, and SMTP. - Multiple recipients. - HTML or Plaintext email. - Attachments Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 5. Sending Email $this->load->library('email'); $this->email->from('[email protected]', 'Your Name'); $this->email->to('[email protected]'); $this->email->subject('Email Test'); $this->email->message('Testing the email class.'); $this->email->send(); Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 6. Email class functions • from() Sets the email address and name of the person sending the email. • to() Sets the email address(s) of the recipient(s). • subject() Sets the email subject. • message() Sets the email message body. • send() The Email sending function. Returns boolean TRUE or FALSE. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 7. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi Let’s Try It Live!
  • 8. User agent • User agent class. • Class functions. • Example. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 9. User agent class • provides functions that help identify information about the browser, mobile device, or robot visiting your site. • Agent class is must initialize in your controller using as following: $this->load->library('user_agent'); Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 10. Class functions • $this->agent->is_browser() • $this->agent->is_mobile() • $this->agent->is_robot() • $this->agent->browser() • $this->agent->mobile() • $this->agent->robot() • $this->agent->platform() Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 11. Example $this->load->library('user_agent'); if ($this->agent->is_browser()){ $agent = $this->agent->browser(); }elseif ($this->agent->is_robot()){ $agent = $this->agent->robot(); } echo $agent; Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 12. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi Let’s Try It Live!
  • 13. Security • URI Security • Error reporting • XSS Filtering • Data escape • Data validation Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 14. URI Security • minimize the possibility that malicious data can be passed to your application. • URIs may only contain the following: Alpha-numeric text Tilde: ~ Period: . Colon: : Underscore: _ Dash: - Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 15. Error reporting • it is typically desirable to disable PHP's error reporting by setting the internal error_reporting flag to a value of 0. • This disables native PHP errors from being rendered as output, which may potentially contain sensitive information. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 16. XSS Filtering • CodeIgniter comes with a Cross Site Scripting Hack prevention filter which can either run automatically to filter all POST and COOKIE data that is encountered, or you can run it on a per item basis • Loading security helper $this->load->helper('security'); Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 17. XSS Filtering • xss_clean(): Provides Cross Site Script Hack filtering. to run automatically every time it encounters POST or COOKIE data you can enable it by set this in config file $config['global_xss_filtering'] = TRUE; Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 18. XSS Filtering • sanitize_filename(): Provides protection against directory traversal. • Enable csrf protection: by setting this in config file $config['csrf_protection'] = TRUE; Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 19. Data escape • Escape data before inserting it into database. • $this->db->escape() This function determines the data type so that it can escape only string data. • $this->db->escape_like_str() This method should be used when strings are to be used in LIKE conditions Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 20. Data validation • Validating, Filtering, and Prepping data • We saw this in session 2 : ) Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 21. Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi Let’s Try It Live!
  • 22. Conclusion Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi
  • 23. THANK YOU Mhd Opada Al-Bosh & Mhd Tahsin Al-Shalabi Questions?