Posts tagged Magic Tricks
FCKEditor solution – How to store full URL for images (Show absolute path)
Today i came across a problem with FCKEditor. When i upload an image from fckeditor Browser Server option, it uploades correctly and insert image in content as well. But if i will send this content in email (for newsletter) than image will not be there as fckeditor inserts relative path in source of image. There should be a complete URL for image if you are sending this content into email. I was trying to find the way that how to insert the full url path when image uploads from FCKEditor.
Get Visitors Real IP Address in PHP
If you want track visitor's or user's IP address than you may use $_SERVER['REMOTE_ADDR']. Well, you might be shocked to know that it may not return the real IP address of the visitor/user at all time. Here are the cases when it happens. If visitor/user is connected to the Internet through Proxy Server then $_SERVER['REMOTE_ADDR'] in PHP will give the IP address of the proxy server and it will not be visitor's/user's IP address.
301 Redirect old dynamic URLs to new static URLs using .htaccess
Today i faced a situation where i need to redirect dynamic URL of my shopping cart to static url. I have changed the Dynamic URL(with query string , ? and &) to static one in my sunshop shopping cart. But still if i will open dynamic url with query string than it shows the content. This is a big issue with search engine as they will consider this dynamic page and static page as two different page and duplicate content issue araise.
Some of Unknown and rarely used but very helpful functions of PHP
Today i have searched google and php manual to find out some of useful inbuilt functions which are not general use but having some great functionality. I found some of the function which developers rarely use but these are the very useful functions. You must spend some time to read this functions and i am sure that this functions help you while developing an application.
How to restrict users from accessing files & directory level(Protect directory) using .htaccess
Today i faced a situation where i have to restrict or deny users from accessing files and folders of my web application directly by entering URL in browser which contain very important contents like images,pdfs,docs,etc. For this what i need to do is to protect the files and folders(directory) which contains images,pdfs and docs. We can restrict users from accessing files,folders and subfolders by using .htaccess(Hyper Text Files).
Use of jQuery with other Javascript Libraries like Prototype, MooTools, or YUI..
Today i faced i problem where i want to use jquery with other javascript library (Prototype). By default jquery is using "$" as a short key for jQuery. When you use jQuery with other javascript library,jQuery object and prototype object were using same variable($). As a result they conflict with eachother and one of the functionality of javascript library will be missed. If you want to use jquery with other javascript library(Prototype, MooTools, or YUI) at the same time than you have to use different object instead of "$".
For vs Foreach – Difference between For and Foreach
You must familiar with all loops if you are a programmer/developer. There are so many loops available and you can select appropriate one when you develop an application. I found For and Foreach loops almost same. I googled for finding the difference between For and Foreach(For Vs Foreach) but didn't get any clear idea. Here i am sharing my knowledge about some of difference between For and Foreach loop.
jQuery validation : End date should be Greater than Start date
In some case when you are working around dates you need to validate two dates. For e.g if you are working with Start Date and End date than "End Date must be Greater than Start Date". This can be done by javascript by comparing two dates. But if you are using jquery validation than below is the easy and simple way to check that End date is Greater than Start Date or not.
How to differentiate Addition Operator with Concatenation Operator in Javascript
All we know about Concatenation operator (+) in JavaScript which combine two string with "+" operator in JavaScript(If you want to do concatenation in PHP than use "." character between two strings). Problem creates when you want to do addition of two JavaScript variables.


I am
Recent Comments