Code: Select all
<?php
// Program Functions
// Encrypt IP (Found in /includes/functions.php)
function encode_ip($dotquad_ip)
{
$ip_sep = explode('.', $dotquad_ip);
return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
//
##############################################################################
// Main Program
// Connect to Database (This is using MySQL)
mysql_connect([host],[username],[password]); // Set the "[ ]" stuff to the appropriate items
mysql_select_db([database name]); // [database name] = The name of the database that PHPBB uses
// Encrypt User's IP
$ip=encode_ip($_SERVER['REMOTE_ADDR']);
// Scan fo user's IP Address
$access=mysql_query("SELECT loged_in FROM phpbb_sessions WHERE id='$ip'");
// Test to see if the IP address is found and if so, see if it's logged in. logged in
if (mysql_num_rows ($access)) exit; // If User is logged in, exit program (a simple way to show the data)
else header("location: http://example.com/login.php"); // If failed, sen user to login page
?>
Code: Select all
// Program Functions
// Encrypt IP (Found in /includes/functions.php)
function encode_ip($dotquad_ip)
{
$ip_sep = explode('.', $dotquad_ip);
return sprintf('%02x%02x%02x%02x', $ip_sep[0], $ip_sep[1], $ip_sep[2], $ip_sep[3]);
}
//
Code: Select all
$template->assign_vars(array(