Get real ip adress

This will print user’s real IP Address
does’t matter if user using proxy or not.

Example:
54.81.196.35

Code:

<?php
function getip() {
	if (!empty($_SERVER["HTTP_CLIENT_IP"])) {
		$ip = $_SERVER["HTTP_CLIENT_IP"];
	} elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
		$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
	} else {
		$ip = $_SERVER["REMOTE_ADDR"];
	}
	echo $ip;
}
getip();
?>

Continue reading Get real ip adress

Friends in War Content Management v1.1

Friends in War Content Management is a free is a user-friendly Content Management script.
Users can register. A admin can see the users and edit or delete them.
The script comes with a very user friendly admin system where you can change things such as: Edit members and site looks.
Friends in War Content Management has an optional admin selectable theme system with a number of themes pre-installed, You can select your theme in the admin menu.
This script is still in development and i will post a newer version asap.
Continue reading Friends in War Content Management v1.1

Total execution time in seconds

Sometimes is very handy when you want to know/show the total execution time of a page.
It’s not a big job to do but i will post the code anyway for you.

<?php
// At start of script
$time_start = microtime(true); 

//Give the server what to do
for($i=0; $i<1000000; $i++){
	$sum=99-99;
}

// Anywhere else in the script (at end)
echo 'Total execution time in seconds: ' . (microtime(true) - $time_start);
?>

The outcome will be something like this:
Total execution time in seconds: 0.13049697875977
Continue reading Total execution time in seconds

How how many years old

Sometimes it’s very to show the age of someone.
With this tiny little function it shows the number of years between then and now.

the function:

<?php
function birthday($birthday) {
    $age = date_create($birthday)->diff(date_create('today'))->y;
    return $age;
}
?>

and show the number of years with:

<?php
$date = "1980-08-14";
birthday($date);
?>

Continue reading How how many years old

Friends in War Content Management v1.0

Friends in War Content Management is a free is a user-friendly Content Management script.
Users can register. A admin can see the users and edit or delete them.
The script comes with a very user friendly admin system where you can change things such as: Edit members and site looks.
Friends in War Content Management has an optional admin selectable theme system with a number of themes pre-installed, You can select your theme in the admin menu.
This script is still in development and i will post a newer version asap.
Continue reading Friends in War Content Management v1.0