| Server IP : 85.158.181.41 / Your IP : 216.73.217.12 Web Server : Apache System : Linux cloud9-vm129 6.1.178+1-ph #ph SMP PREEMPT_DYNAMIC Wed Jul 29 09:00:54 UTC 2026 x86_64 User : moncbefd ( 1024) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/moncbefd/www.moneta.at/admin/includes/functions/ |
Upload File : |
<?php
/* --------------------------------------------------------------
$Id: validations.php 950 2005-05-14 16:45:21Z mz $
XT-Commerce - community made shopping
http://www.xt-commerce.com
Copyright (c) 2003 XT-Commerce
IMPORTANT! THIS FILE IS DEPRECATED AND WILL BE REPLACED IN THE FUTURE.
MODIFY IT ONLY FOR FIXES. DO NOT APPEND IT WITH NEW FEATURES, USE THE
NEW GX-ENGINE LIBRARIES INSTEAD.
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommerce(validations.php,v 1.1 2003/03/15); www.oscommerce.com
(c) 2003 nextcommerce (validations.php,v 1.5 2003/08/18); www.nextcommerce.org
Released under the GNU General Public License
--------------------------------------------------------------*/
////////////////////////////////////////////////////////////////////////////////////////////////
//
// Function : xtc_validate_email
//
// Arguments : email email address to be checked
//
// Return : true - valid email address
// false - invalid email address
//
// Description : function for validating email address that conforms to RFC 822 specs
//
// This function is converted from a JavaScript written by
// Sandeep V. Tamhankar (stamhankar@hotmail.com). The original JavaScript
// is available at http://javascript.internet.com
//
// Sample Valid Addresses:
//
// first.last@host.com
// firstlast@host.to
// "first last"@host.com
// "first@last"@host.com
// first-last@host.com
// first.last@[123.123.123.123]
//
// Invalid Addresses:
//
// first last@host.com
//
//
////////////////////////////////////////////////////////////////////////////////////////////////
defined( '_VALID_XTC' ) or die( 'Direct Access to this location is not allowed.' );
function xtc_validate_email($email) {
$valid_address = true;
$mail_pat = '/^(.+)@(.+)$/i';
$valid_chars = "[^] \(\)<>@,;:\.\\\"\[]";
$atom = "$valid_chars+";
$quoted_user='(\"[^\"]*\")';
$word = "($atom|$quoted_user)";
$user_pat = "|^$word(\.$word)*$|i";
$ip_domain_pat='/^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$/i';
$domain_pat = "|^$atom(\.$atom)*$|i";
if (preg_match($mail_pat, $email, $components)) {
$user = $components[1];
$domain = $components[2];
// validate user
if (preg_match($user_pat, $user)) {
// validate domain
if (preg_match($ip_domain_pat, $domain, $ip_components)) {
// this is an IP address
for ($i=1;$i<=4;$i++) {
if ($ip_components[$i] > 255) {
$valid_address = false;
break;
}
}
} else {
// Domain is a name, not an IP
if (preg_match($domain_pat, $domain)) {
/* domain name seems valid, but now make sure that it ends in a valid TLD or ccTLD
and that there's a hostname preceding the domain or country. */
$domain_components = explode(".", $domain);
// Make sure there's a host name preceding the domain.
if (sizeof($domain_components) < 2) {
$valid_address = false;
} else {
$top_level_domain = strtolower($domain_components[sizeof($domain_components)-1]);
if(strlen_wrapper($top_level_domain) < 2)
{
$valid_address = false;
}
}
} else {
$valid_address = false;
}
}
} else {
$valid_address = false;
}
} else {
$valid_address = false;
}
if ($valid_address && ENTRY_EMAIL_ADDRESS_CHECK == 'true') {
if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) {
$valid_address = false;
}
}
return $valid_address;
}