Protecting Your CakePhp Application Against SQL Injection

SQL injection is a technique where malicious users can inject the SQL commands /queries into an SQL statement, resulting in false input of the web page and the security of a web application.

Eventually CakePhp already protects the application against the SQL Injection if you are using the CakePhp’s methods like find() and save() and proper array notation (ie. array(‘field’ => $value))

Still, it is sometimes necessary to perform manual queries, which can be done with Model::Query.

– Read the full Blog at: Protecting Your CakePhp Application Against SQL Injection

Our Php questions and answers forum is developed for those tech geeks who don’t want to wait for a longer duration of time, as the community members within FindNerd can answer any android query within shortest possible time frame.

Apart from this, If you have any language query like C, Java, JavaScript, iOS, Html, PHP etc . you can post at FindNerd’s Java developer forum.

Protecting Your CakePhp Application Against SQL Injection

How to create an “Admin Panel” for a project in cakephp ?

We can use a plugin, that will help us to create an admin panel in a very short span of time.
For cakephp framework there is a plugin named as “BrowniePHP”.


Prerequisite:

One should know how to create web sites and web applications using cakephp framework.


Setting up the BrowniePHP:

    1. . Create a basic web application in cakephp framework that have it’s own database.
    2. . Download the pluging (link: https://github.com/plusglobal/BrowniePHP).
    3. . Now extract the downloaded package into the floder : app/Plugin/Brownie
    4. . Now add the Brownie panel component in the below mentioned file of your main application :

project-folder/app/Controller/AppController.php

-Read the full Blog at: How to create an “Admin Panel” for a project in cakephp ?

Our Php developer forum forum is developed for those tech geeks who don’t want to wait for a longer duration of time, as the community members within FindNerd can answer any android query within shortest possible time frame.

Apart from this, If you have any language query like C, Java, JavaScript, iOS, Html, PHP etc . you can post at FindNerd’s Java questions and answers.

How to create an “Admin Panel” for a project in cakephp ?

InterNationalization in CakePHP

Hello Readers ,
Today we will learn about the concept of ” InterNationalization in CakePHP ” .

“InterNationalization” simply means if you are making an application and you wants to make that applications to reach a larger audience to cater for multiple languages.

InterNationalization in CakePHP

To do this below are the steps-
Create a new CakePHP project:
Download the latest version from http://cakephp.org/.

For full set of steps/ Code, Visit at: InterNationalization in CakePHP

FindNerd: Being an effective C, C#, Java , PHP forum here you can also post & look for various programming queries along with their solutions including android, java, PHP questions and answers etc.

InterNationalization in CakePHP

Using multiple database connections in CakePHP model

Hello Readers,

Till now we may develop our application with single database . Is their any ways to integrate our application with multiple databases ? . Yes we have.

There are methods to use multiple databases for development and for production without changing anything but rewriting a function in DATABASE_CONFIG class.

Just open your database.php file inside config folder and search this class “DATABASE_CONFIG”.

Here you can add multiple database configuration.

  1. class DATABASE_CONFIG {
  2. public $default = array(
  3. ‘datasource’ => ‘Database/Mysql’,
  4. ‘persistent’ => false,
  5. ‘host’ => ‘localhost’,
  6. ‘login’ => ‘username’,
  7. ‘password’ => ‘password’,
  8. ‘database’ => ‘database1’,
  9. ‘prefix’ => ,
  10. //’encoding’ => ‘utf8’,
  11. );
  12. public $test1 = array(
  13. ‘datasource’ => ‘Database/Mysql’,
  14. ‘persistent’ => false,
  15. ‘host’ => ‘localhost’,
  16. ‘login’ => ‘username’,
  17. ‘password’ => ‘password’,
  18. ‘database’ => ‘database2’,
  19. Prefix PHP => ,
  20. //’encoding’ => ‘utf8’,
  21. );
  22. public $test2 = array(
  23. ‘datasource’ => ‘Database/Mysql’,
  24. ‘persistent’ => false,
  25. ‘host’ => ‘localhost’,
  26. ‘login’ => ‘username’,
  27. ‘password’ => ‘password’,
  28. ‘database’ => ‘database3’,
  29. ‘prefix’ => ,
  30. //’encoding’ => ‘utf8’,
  31. );
  32. }

The default database is “public $default” , if you want to use database2 you have to initialize “public $test 1” in your Model.

Open your UserModel.php

For further queries or PHP Programming Questions and Answers you can Visit to our  PHP Developer Forum

Using multiple database connections in CakePHP model

How to create a custom error page

In Cakephp we have some default error pages but we can create our own error page. Here we will create a custom error page to show error if controller not found. If controller not found then we will show 404 error page. Below are few steps for creating custom error page

First create a error.ctp file for layout if you want to show error page with different UI Open appController.php under /app/Controller and add the below code

  1. function beforeRender() {
  2. $this->setErrorLayout();
  3. }
  4. function setErrorLayout() {
  5. if ($this->name == ‘CakeError’) {
  6. $this->layout = ‘error’;
  7. }
  8. }

– See more at: http://findnerd.com/list/view/How-to-create-a-custom-error-page/3470/

For any  issue about PHP Programming Questions and Answers you can Visit to our  PHP Developer Forum

How to create a custom error page

Add prefix to urls in CakePHP

CakePHP has power to do a lot with conventions by using routes. It’s additionally possible to utilize custom prefixes adjacent to your admin routes for extra flexibility. Prefix routing can be enabled from within the core configuration file by setting the prefixes with Routing.prefixes.

Configure::write('Routing.prefixes', array('admin'));

We can create our prefix route as follows:

Router::connect('/employer/:controller/:action/*', array('prefix' => 'employer', 'employer' => true));

– See more at: http://findnerd.com/list/view/Add-prefix-to-urls-in-CakePHP/3553/

For queries about PHP Programming Questions and Answers

You can also Visit to PHP Developer Forum

Add prefix to urls in CakePHP