PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Bas Jobsen   Storeip   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Storeip
Store ip-addresses in a database
Author: By
Last change:
Date: 22 years ago
Size: 558 bytes
 

Contents

Class file image Download
<?
/* example code */
include('storeip.php');
$IP=new storeip;

$ips=array('0.0.0.0','255.255.255.255','127.127.128.128','10.123.0.4','247.6.0.13','156.256.0.0');
foreach (
$ips as $ip)
{
echo
$IP->get_decoded($ip)."\n";
$IP->decode($ip);
if(
$ip==false && is_bool($ip)) echo 'wrong number';
else echo
$ip."\n";


echo
$IP->get_encoded($ip)."\n";
$IP->encode($ip);
if(
$ip==false && is_bool($ip)) echo 'wrong number';
else echo
$ip."\n";
}
/*
The get_ calls return the decode/encode value
but don't change your original IP-variable.
*/
?>