Posts

Showing posts from November, 2013

PHP Basic Interview Questions and Answers for Web Developers - Part 1

PHP Basic Interview Questions and Answers for Web Developers - Part 1 In this article on PHP Interview Questions, I have compiled a list of very basic and fundamental PHP interview questions and answers for web developers. Every PHP web developer should know these basic questions of PHP. So, if you are preparing for any interview in PHP development, you should go through the following list of PHP basic interview questions. There PHP questions are based on very simple PHP concepts like basic introduction to PHP, Sessions and Cookies in PHP, Input / Output in PHP, Error Management in PHP, MySQL database connectivity in PHP, SQL Injection in PHP, Encryption and Decryption in PHP, Sending Emails in PHP, datatypes in PHP and many more. Lets have a look... 1. What is PHP? PHP is a server side scripting object oriented language commonly used for web applications.  2. What is the use of "echo" in php? It is used to print a data in the webpage. Example:  <?php echo 'Hi'; ?&

How to use TpFIBDataSet, TpFIBQuery and TpFIBTransaction FIBPlus components to connect with Firebird / Interebase database in Delphi XE4?

How to use TpFIBDataSet, TpFIBQuery and TpFIBTransaction FIBPlus components to connect with Firebird / Interebase database in Delphi XE4? Following is the basic article on Firebird / Interbase database connectivity in Delphi XE4 using FIBPlus database components like TpFIBDataSet, TpFIBQuery and TpFIBTransaction. I will explain all these FIBPlus database components in detail. I have written a small article on TpFIBDatabase before this article. Please go through that before reading this one. Read FIBPlus TpFIBDatabase... FIBPlus TpFIBQuery Component An application works with a database by issuing SQL instructions. They are used to get and modify data\metadata. FIBPlus has a special TpFIBQuery component responsible for SQL operator execution. This robust, light and powerful component can perform any actions with the database.  TpFIBQuery is very easy-to-use: just set the TpFIBDatabase component, fill in the SQL property and call any ExecQuery method (ExecQueryWP, ExecQueryWPS).  NOTE: Th

How to use TpFIBDatabase FIBPlus Component to connect with Firebird database in Delphi XE4?

How to use TpFIBDatabase FIBPlus Component to connect with Firebird database in Delphi XE4? TpFIBDatabase component is used to make database connectivity with Firebird database in Delphi. For using TpFIBDatabase component, you should have FIBPlus and Firebird installed on your system. I am using Delphi XE4, Firebird 2.5.2 and FIBPlus 7.5 to make database connection. Connection parameters are typical for InterBase/Firebird server: 1) path to a database file; 2) user name and password; 3) user role; 4) charset; 5) dialect; 6) client library (gds32.dll for InterBase and fbclient.dll for Firebird). To connect to a database you should call the Open method or set the Connected property to True. It’s also possible to use this code to connect to a database: function Login(DataBase: TpFIBDatabase; dbpath, uname, upass, urole: string): Boolean; begin  if DataBase.Connected then DataBase.Connected := False;   with FDataBase.ConnectParams do begin    UserName := uname;    Password := upass;    R

HTML5 MENU Tag Redefined

HTML5 <menu> Tag Redefined The <menu> tag provides an easy way to create menus on a web page. The HTML <menu> element was deprecated in HTML 4.01 but is redefined in HTML5. The HTML <menu> tag defines a list/menu of commands. The <menu> tag is used for context menus, toolbars and for listing form controls and commands. <li> tag is used within the <menu> tag . For example: Which pet do you own? <menu>  <li>Dog</li>  <li>Cat</li> </menu> You can also place radio buttons and check boxes inside <menu> tags. Have a look at following simple example of <menu> tag radiobuttons inside <menu> tag <menu>    <li><input type="radio" id="radDog" class="radPets" name="radDog"/>Dog</li>    <li><input type="radio" id="radCat" class="radPets" name="radCat"/>Cat</li> </menu> checkboxe

How to secure jQuery AJAX calls in PHP from hackers?

How to secure jQuery AJAX calls in PHP from hackers? If you are making jQuery AJAX calls in your PHP website, please ensure that those jQuery AJAX calls are secure from website hackers. Your code should not be vulnerable to hackers. Below are some methods and steps which need to be taken to secure your jQuery AJAX calls to PHP files. I am writing this post because I had written a simple post " How to call PHP function from JavaScript function? Always use AJAX. " without mentioning any security code. I got following comment on that post: " Your code is very vulnerable. You're not filtering the $_POST variable at all. This opens yourself to HTML injection. A hacker could pwn your web site very quickly if you used this code. Careless examples like yours is exactly why so many web sites are hacked. " That's why this is my small attempt to make your jQuery AJAX calls secure.  1. Use $_SERVER['HTTP_X_REQUESTED_WITH'] :  This is a basic check to see if the

How to call PHP function from JavaScript function? Always use AJAX.

How to call PHP function from JavaScript function? Always use AJAX. Recently, I was developing a web application in PHP. I get into the need of calling my PHP function from my Javascript function. This is the common thing when you are developing a web application in PHP and have to call a PHP code from Javascript to refresh only a certain portion of your web page with server results. Always use AJAX to achieve this functionality. Using AJAX you can call server side code / functions (your PHP code) from client side (Javascript). Below is the PHP and Javascript code snippet to illustrate this concept.  This is very simple example on how to call server side functions of PHP from client browsers (Javascript)? In following example, I have a PHP file named myscript.php which has function named myfunction(). This function uses two $_POST variables and just echoes them. I have mydiv HTML div anywhere on my webpage which I want to refresh with the result which is returned from my PHP script. In