Colorbox is very cool js plug-in which is used by many developers.
I was creating a facebook app and had situation where i wanted to close Colorbox/popup and open new page which was not suppose to open in Colorbox.
I was searching and found really simple code which can be used in several ways with any php technology stuff.
<a onclick="parent.$.fn.colorbox.close();" href="http://www.phpmind.com" target="_top">PHPMIND.COM</a> This is good for normal site
<a onclick="parent.$.fn.colorbox.close();" href="http://www.phpmind.com" target="_parent">PHPMIND.COM</a> This works when we have Iframe like in facebook apps
If you are LAMP developer and your server is connected with LoadBlancer now LoadBlancer is big advantage in production to distribute traffic but sometimes it could be trouble for developer as you want to access one server out of two.
Now here is the analogy.
You have 2 servers and web1 and web2. Web1 is main and you are accessing through FTP and adding files then web2 is synced with web1 but while you are developing few files or code you want to access only web1 how to do that ?
Well this is simple, change host file and one config file!
I am using MAC so add these 2 lines in host file and you will be accessing only web1.
add the lines
at the bottom of the file
add the line
order hosts, bind
to the top of the file
And you are done!
First login to your server using ssh
A. ssh firstname.lastname@example.org
B. Enter proper password
Then switch back to the root and use this command.
Benefit of “-f” option is as you hit your php page in browser terminal will auto refresh errors and you can see most recent errors.
tail -f /var/log/apache2/phpmind.com-error.log
Your Path may be diffrent! I have different sub domains parked in my server. So this is my error log path in LAMP.
Hope it will work for you.
Every php coder want to store IP address of user for tracking and other different purpose.
Here is the function which i am using in my code to store ip address in db.
//This returns the True IP of the client calling the requested page
// Checks to see if HTTP_X_FORWARDED_FOR
// has a value then the client is operating via a proxy
$userIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
if($userIP == "")
$userIP = $_SERVER['REMOTE_ADDR'];
// return the IP we've figured out:
You can use this simple php function in different ways.
When Display_errors is off in php.ini it is hard to see where the bug is!
While you are working in server where display errors are off you can add this code on top of the page and it will show whats going on in your php code.
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
I prefer to use this code through a function or include file and when you are done you can close or disable.