Loaded Commerce Community

Banner


Board index » CRE Loaded Support » CRE Loaded 6.4

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Help with tep_validate_email() function - validations.php
PostPosted: Thu Sep 15, 2011 2:08 pm 
Offline
CRE Newbie

Joined: Tue Sep 13, 2011 9:57 am
Posts: 4
Hello, i have 2 problems on my website. Both are related to the tep_validate_email() functon. I'm not too good with php, but i can edit and save files without problems. I also saw that there are many people with the same problem but not one reply to how it can be fixed. Anyone who can offer help i would greatly appreciate it.

1. When creating an account for someone under Admin the following error comes up:
• "Fatal error: Call to undefined function tep_validate_email() in /home/content/38/7595538/html/admin/create_account_process.php on line 103"

2. Editing and Saving a users Account in Admin gives error:
• "Fatal error: Call to undefined function tep_validate_email() in /homepages/27/d276362377/htdocs/caviar4you.com/admin/customers.php on line 78"

My validation.php looks like this:

<?php
/*
$Id: validations.php,v 1.1.1.1 2004/03/04 23:40:51 ccwjr Exp $

osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com

Copyright (c) 2003 osCommerce

Released under the GNU General Public License
*/

////////////////////////////////////////////////////////////////////////////////////////////////
//
// Function : tep_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
//
//
////////////////////////////////////////////////////////////////////////////////////////////////
function tep_validate_email($email) {
$valid_address = true;

$mail_pat = '^(.+)@(.+)$';
$valid_chars = "[^] \(\)<>@,;:\.\\\"\[]";
$atom = "$valid_chars+";
$quoted_user='(\"[^\"]*\")';
$word = "($atom|$quoted_user)";
$user_pat = "^$word(\.$word)*$";
$ip_domain_pat='^\[([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\]$';
$domain_pat = "^$atom(\.$atom)*$";

if (eregi($mail_pat, $email, $components)) {
$user = $components[1];
$domain = $components[2];
// validate user
if (eregi($user_pat, $user)) {
// validate domain
if (eregi($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 (eregi($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]);
// Allow all 2-letter TLDs (ccTLDs)
if (eregi('^[a-z][a-z]$', $top_level_domain) != 1) {
$tld_pattern = '';
// Get authorized TLDs from text file
$tlds = file(DIR_WS_INCLUDES . 'tld.txt');
while (list(,$line) = each($tlds)) {
// Get rid of comments
$words = explode('#', $line);
$tld = trim($words[0]);
// TLDs should be 3 letters or more
if (eregi('^[a-z]{3,}$', $tld) == 1) {
$tld_pattern .= '^' . $tld . '$|';
}
}
// Remove last '|'
$tld_pattern = substr($tld_pattern, 0, -1);
if (eregi("$tld_pattern", $top_level_domain) == 0) {
$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;
}
?>


Top
 Profile  
 
 Post subject: Re: Help with tep_validate_email() function - validations.php
PostPosted: Mon Sep 19, 2011 6:18 am 
Offline
CRE Legend
User avatar

Joined: Thu Jun 12, 2008 6:39 am
Posts: 2404
Location: New Zealand
Some of this doesn't add up:

/home/content/38/7595538/html/admin/
but
/homepages/27/d276362377/htdocs/caviar4you.com/admin/

so where is your admin?

Plus the code you've posted is from the store side:
/includes/functions/validations.php
and not
/admin/includes/functions/validations.php

There's a whole extra block on the /admin version that isn't present in the store side version.

which is what /admin/create_account_process.php would be looking for.

simon

_________________
www.codemehappy.com
For Cre Loaded tips, how-to articles and more


Top
 Profile  
 
 Post subject: Re: Help with tep_validate_email() function - validations.php
PostPosted: Wed Jan 11, 2012 1:28 pm 
Offline
CRE Newbie

Joined: Tue Sep 13, 2011 9:57 am
Posts: 4
Got it solved. All i had to do is uncomment the line in admin/includes/application_top.php around line 236
it was:
// require(DIR_FS_FUNCTIONS . 'validations.php');
became:
require(DIR_FS_FUNCTIONS . 'validations.php');

and now it all works great.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

Board index » CRE Loaded Support » CRE Loaded 6.4

All times are UTC - 5 hours


Who is online

Users browsing this forum: Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
It is currently Wed May 23, 2012 8:04 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Forums Latest Activity

Top Listing

1. Cart2Cart - Shopping...
    Category: Shopping Cart Database Conversion Scripts
    
2. Points & Rewards PLUS!...
    Category: Add-Ons
    
3. Configuration Server...
    Category: Fixes
    
4. Credit Card with CCV
    Category: Payment Modules
    
5. CC7333_ATS
    Category: Templates
    
Show more...

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy