this code is coped here for learning purpose!!!!!!!!!!!
<?php
/* Is That an IP Address?
*
* Given a string as input, create a program to evaluate
* whether or not it is a valid IPv4 address.
*
* A valid IP address should be in the form of: a.b.c.d where a, b, c and d
* are integer values ranging from 0 to 255 inclusive.
*
* For example:
* 127.0.0.1 - valid
* 127.255.255.255 - valid
* 257.0.0.1 - invalid
* 255a.0.0.1 - invalid
* 127.0.0.0.1 - invalid
*
*
* Author: Mickel Sánchez.
* Creation date: February 24, 2018.
* Bugs: Unknown.
*/
function checkIP($ip) {
$octets = explode(".", $ip);
$check = true;
if (count($octets) <> 4) {
$check = false;
}
foreach ($octets as $octet) {
if ((!is_numeric($octet)) || $octet < 0 || $octet > 255) {
$check = false;
}
}
if ($check) {
echo "$ip : It's a valid IP address. <br/>";
} else {
echo "$ip : It's not a valid IP address. <br/>";
}
}
checkIP("127.0.0.1");
checkIP("127.255.255.255");
checkIP("257.0.0.1");
checkIP("255a.0.0.1");
checkIP("127.0.0.0.1");
checkIP("A01.0.0.1");
?>
amzn_assoc_placement = "adunit0";
amzn_assoc_tracking_id = "sellingon-20";
amzn_assoc_ad_mode = "search";
amzn_assoc_ad_type = "smart";
amzn_assoc_marketplace = "amazon";
amzn_assoc_region = "US";
amzn_assoc_default_search_phrase = "Beauty";
amzn_assoc_default_category = "All";
amzn_assoc_linkid = "8a5aeb9d02c991348d0d037e1d535d71";
amzn_assoc_design = "in_content";
amzn_assoc_title = "Search your favorites but";
Subscribe to:
Post Comments (Atom)
form validation
function formsubmit ( ) { var empname = document .getElementById ( 'emp_name' ). value ; var email = document .getElem...
-
<!DOCTYPE html> <html> <title>basic encruption example</title> <head> <?php // DEFINE our cipher ...
-
PHP - Sacar XSS function RemoveXSS($val) { $val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val); // ...
No comments:
Post a Comment