PHP 4.4.9 released!
2008-10-29 08:54:11
The PHP development team would like to announce the immediate availability of PHP 4.4.9. It continues to improve the security and the stability of the 4.4 branch and all users are strongly encouraged to upgrade to it as soon as possible. This release wraps up all the outstanding patches for the PHP 4.4 series, and is therefore the last PHP 4.4 release.
Security Enhancements and Fixes in PHP 4.4.9:
- Updated PCRE to version 7.7.
- Fixed overflow in memnstr().
- Fixed crash in imageloadfont when an invalid font is given.
- Fixed open_basedir handling issue in the curl extension.
- Fixed mbstring.func_overload set in .htaccess becomes global.
For a full list of changes in PHP 4.4.9, see the ChangeLog.
email validation
2008-02-12 03:00:00<?php
/**
Verifies whether the given mail address exists.
@param mail the email address to verify
@return NULL if the address exists, as far as we could check.
an error message if we found a problem with the address
*/
function email_verify_check($mail) {
$host = substr(strchr($mail, '@'), 1);
if (!checkdnsrr($host, 'ANY')) {
return t('Email host %host does not seem valid', array('%host' => "$host"));
}
$mxHosts = array();
if (! getmxrr($host, $mxHosts)) {
$mxHosts[] = $host;
}
// Try to connect to one SMTP server
foreach ($mxHosts as $smtpServer) {
$connect = @fsockopen($smtpServer, 25, $errno, $errstr, 30);
if (!$connect) continue;
if (ereg("^220", $out = fgets($connect, 1024))) {
// OK, we have a SMTP connection
break;
} else {
echo("Could not verify email address at host $host: $out");
return;
}
}
if (! $connect)
return t('Email host %host does not seem valid, it does not answer', array('%host' => "$host"));
$from = "web@hotmail.com";
// Extract the <...> part if there is one
if (preg_match('/<(.*)>/', $from, $match) > 0) {
$from = $match[1];
}
$localhost = $_SERVER["HTTP_HOST"];
if (!$localhost) // Happens with HTTP/1.0
//should be good enough for RFC compliant SMTP servers
$localhost = 'localhost';
fputs($connect, "HELO $localhostrn");
$out = fgets($connect, 1024);
fputs($connect, "MAIL FROM: <$from>rn");
$from = fgets($connect, 1024);
fputs($connect, "RCPT TO: <{$mail}>rn");
$to = fgets($connect, 1024);
fputs($connect, "QUITrn");
fclose($connect);
if (!ereg ("^250", $from)) {
// Again, something went wrong before we could really test the address,
// be on the safe side and accept it.
echo ("Could not verify email address at host $host: $from");
return;
}
if (ereg("(Client host|Helo command) rejected", $to)) {
// This server does not like us, accept the email address
// (noos.fr behaves like this for instance)
echo("Could not verify email address at host $host: $to");
return;
}
if (!ereg ("^250", $to )) {
echo("Rejected email address: $mail. Reason: $to");
// return('Email address %mail does not seem valid', array('%mail' => "$mail"));
}
// Everything OK
echo "Valid email";
return;
}
email_verify_check("user@email.com");
?>
Simple IP block script
2008-01-24 14:17:50Sometimes we need block some ip to access files here is a simple script to make this !
<?php
// HERE IS A IP LIST SEPARETED BY COMA
$__blockthis="127.0.0.3,127.0.0.1";
// HERE WE ADD ALL IPS IN ARRAY
$_ct=explode(",",$__blockthis);
// NOW WE CHECK IF CURRENT USER IP ARE IN ARRAY
if (in_array($_SERVER['REMOTE_ADDR'], $_ct))
{
// YES THE IP ARE IN ARRAY WE DISPLAY A DIE MESSAGE
die("Sorry your ip has blocked ");
}
?>
simple but work :)
Server Status Checker
2007-03-26 13:40:20 This small script will allow you to check if the servers on a website are online or offline.
<?php
$up = @fsockopen("sitename.com", 80, $errno, $errstr, 30);
if($up)
{
echo 'Online';
}
else
{
echo 'Offline';
}
?>
Ok we will start with the "sitename.com" you need to edit that to the website you would like to check and it will check it on port 80 and make shore you don’t add http:// to the web address. the $errno and $errstr are both standard error parameters. The last number "30" is how long the connection should stay open until it is classed as timed out.
More about the port 80 it means you are looking up if the websites HTTP is online using that part but you can change it and have it check other parts of the server by entering any of the port numbers below.
HTTP - 80
FTP - 21
SSH - 22
MYSQL - 3306
CPANEL - 2082
WHM - 2086
POP3 - 110
SMTP - 25
1



