Tag Archives: php

PHP based password protected access point

I found a PHP based script that will protect data from the general public. This is done using a simple PHP script that will terminate the page data from processing in HTTP request if a correct credential is not entered. The key part of this script is that it can be saved in any folder on the server regardless of the folder access is public or private. The script can be used to protect any web page using the PHP’s native data loading mechanism. I have no idea how secure the PHP script now protecting the secure science area. That’s where detailed user records comes in handy because in an event of a hack or a flooding, I can monitor the situation and close down all lose ends of the system. Continue reading PHP based password protected access point

Adding an IP log code to PHP files

A lot of people want to keep track of who visit their site. There are several ways to collect user data and the most easiest method would be to collect data using a third party company that logs IPs, page visited and other information such as web browser, data, time, etc. Then then data can be modify to create data on demographics and Internet service providers by extrapolating the IP addresses. However, what is fun of having a third party do your code for you? The fun part comes win when we can make our own code such as the one posted below:

<!--ip log-->
<?php
$v_ip = $_SERVER['REMOTE_ADDR'];
$v_date = date("l d F H:i:s");
$v_page = $_SERVER['REQUEST_URI'];
$u_ref = $_SERVER['HTTP_REFERER'];
$fp = fopen("sanuja.com-ip_log.php", "a");
if ($v_ip != "192.168.1.1") {
fputs($fp, "<strong>IP: $v_ip - </strong><strong>PAGE:</strong> $v_page - <strong>DATE:</strong> $v_date - <strong>REFERER:</strong> $u_refn
");
}
fclose($fp);
?>

Continue reading Adding an IP log code to PHP files