Monthly Archives: July 2014

PHP Questions on Files

1) How to include remote file in PHP? To allow inclusion of remote files, the directive allow_url_include must be set to On in php.ini But it is bad, in a security-oriented point of view ; and, so, it is generally … Continue reading

Posted in PHP | Leave a comment

What are different ways to change url in javascript?

1) window.location.href = “http://www.yahoo.com/home.html”; // document.URL is alternative to window.location.href 2) window.location.assign(“http://www.yahoo.com/home.html”); // this will not alter the browser’s history. 3) window.location.replace(“http://www.yahoo.com/home.html”); // this will alter the browser’s history 4) window.location.reload(true); // force to get page from server 5) window.location.reload(false); … Continue reading

Posted in Javascript | Leave a comment

Joins

INNER JOIN: Returns all rows when there is at least one match in BOTH tables LEFT JOIN: Return all rows from the left table, and the matched rows from the right table (Tip: Read it as : All rows from … Continue reading

Posted in Database | Leave a comment

What is your greatest weakness and strength?

Weakness: 1) Effective Delegation : Sometimes end up taking responsibility to complete task on myself which I could have easily delegated. 2) Learning to say NO: Often times we end up saying “Maybe I will try it out”. When it’s … Continue reading

Posted in HR | Leave a comment

Javascript Scope of Variables (Infamous Loop Problem)

http://stackoverflow.com/questions/500431/javascript-variable-scope http://zsoltfabok.com/blog/2012/08/javascript-foreach/ http://robertnyman.com/2008/10/09/explaining-javascript-scope-and-closures/ http://madebyknight.com/javascript-scope/

Posted in Javascript | Leave a comment

Javascript Set1 of 10 Interview Questions

1) What are the basic types used in JavaScript? Ans: Primitive: String, Number, Boolean, Null, Undefined . undefined means a variable has been declared but has not yet been assigned a value. On the other hand, null is an assignment … Continue reading

Posted in Javascript | Leave a comment

Why should I use node.js?

http://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js real-time websites with push capability unifies the language and data format (JSON) across the stack web applications with real-time, two-way connections, where both the client and server can initiate communication, allowing them to exchange data freely non-blocking, event-driven I/O … Continue reading

Posted in Concepts, Javascript | Leave a comment

htmlentities, htmlspecialchars, html_entity_decode

htmlspecialchars : converts only some characters to their html equivalents. This is preferred over htmlentities. htmlentities: converts all characters to their html equivalents. This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML … Continue reading

Posted in PHP | Leave a comment

Input Validation

1) Use in built functions filter_input, filter_var, filter_input_array $search_html = filter_input(INPUT_GET, ‘search’, FILTER_SANITIZE_SPECIAL_CHARS); $args = array( ‘product_id’ => FILTER_SANITIZE_ENCODED, ‘component’ => array(‘filter’ => FILTER_VALIDATE_INT, ‘flags’ => FILTER_REQUIRE_ARRAY, ‘options’ => array(‘min_range’ => 1, ‘max_range’ => 10) ), ‘versions’ => FILTER_SANITIZE_ENCODED, ‘doesnotexist’ … Continue reading

Posted in PHP | Leave a comment

Cross Site Scripting (XSS), CSRF and SQL Injection

SQL Injection: It is the type of attack that takes advantage of improper coding of your web applications that allows hacker to inject SQL commands into say a login form to allow them to gain access to the data held … Continue reading

Posted in Concepts, Security | Comments Off on Cross Site Scripting (XSS), CSRF and SQL Injection