If you have a web server where you have catch-all emails setup, You may find this modification (bug fix) useful.
What this fix does: It adds a check email address function to the Recommend_Us module of your PhpNuke website.
Examples of the problems:
[b]- User recommends your site using an invalid email address for the Your Friend part such as www.user@domain.com, user@www.domain.com,
phpNuke will let the user know that his/her suggestion has been sent, but it actually hasn't. Meanwhile, your mail system to return an invalid email to your catch-all account.
Apply this fix and the user is returned a specific error message based on thier invalid formatted email address.
In the file index.php from /modules/Recommend_Us directory, insert the following lines at line 26(approx.)
Code:
function emailCheck($fmail) {
global $stop;
$item = explode("@", $fmail);
$domain = $item["1"];
if ((strlen($domain) >= 3) && (substr($domain, 0, 4) == 'www.')) $stop = "<center>ERROR: Please remove the <b>www.</b> from the domain section of your email address.</center>";
if ((strlen($fmail) >= 4) && (substr($fmail, 0, 4) == 'www.')) $stop = "<center>ERROR: Email addresses do not start with <b>www.</b></center><br>";
if ((!$fmail) || ($fmail=="") || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$",$fmail))) $stop = "<center>ERROR: Invalid email address.</center><br>";
if (strrpos($fmail,' ') > 0) $stop = "<center>Please remove spaces from email address.</center><br>";
return($stop);
}
In the function SendSite, Find the following lines (approx line 68)...
I suggest you read the RFC on email addresses because your fix here is filtering out valid ones and entering a new bug of your own. The two you cite as being invalid are actually in a correct format per the RFC. The regular expression you're using accounts for only a subset of allowable address formats.
This fix will not prevent bounce backs. It will only make sure the person entered a certain format. To prevent bounce backs it's better to make a connection to determine the address' validity.
You are correct as far as domains and subdomains. Most emails will still deliver if you address to user@www.domain.com but the www. is not required in the address.
As fas as using an address such as www.user@domain.com. I have found that systems such as Yahoo, AOL, and Hotmail do not accept emails with such a format. I am guessing that unless a user registers his account as "www.username" then the system will not accept the email and instead return an error. This is exactly what I have been encountering. A large majority of the users which visit my site have email accounts at AOL, Hotmail, and Yahoo. A lot of email providers follow the same rules.
If you can, please provide quotes or additional information. I would appreciate it.
or you could just do a reverse DNS lookup on the domain of the email address. if it doesn't return "true", then the address is more than likely invalid. notify the user and allow them to override if they so desire (as DNS takes a day or so to propogate through the net, so newly registered domains may not resolve immediately).
use getdnsrr for this ( http://www.php.net/getdnsrr )
purasorte Nuke Soldier
Joined: Jan 25, 2004
Posts: 10
Posted:
Sun Jan 25, 2004 3:56 am
chican0 and friends
I am trying to make this change but it dont work.
I am using 7.0 and would like someone could send modules/Reccomend_us/index.php via email or URL to download.
I made so many changes in it that it dont works anyway, now.
Sorry bad English.
Thanks
chican0 Nuke Soldier
Joined: Dec 15, 2003
Posts: 34
Location: New Orleans, LA
Posted:
Sun Jan 25, 2004 4:20 am
Code:
<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/************************************************************************/
if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
die ("You can't access this file directly...");
}
require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);
$pagetitle = "- "._RECOMMEND."";
function emailCheck($fmail) {
global $stop;
$item = explode("@", $fmail);
$domain = $item["1"];
if ((strlen($domain) >= 3) && (substr($domain, 0, 4) == 'www.')) $stop = "<center>ERROR: Please remove the <b>www.</b> from the domain section of your email address.</center>";
if ((strlen($fmail) >= 4) && (substr($fmail, 0, 4) == 'www.')) $stop = "<center>ERROR: Email addresses do not start with <b>www.</b></center><br>";
if ((!$fmail) || ($fmail=="") || (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$",$fmail))) $stop = "<center>ERROR: Invalid email address.</center><br>";
if (strrpos($fmail,' ') > 0) $stop = "<center>Please remove spaces from email address.</center><br>";
return($stop);
}
function SiteSent($fname) {
include ('header.php');
OpenTable();
echo "<center><font class=\"content\">"._FREFERENCE." $fname...<br><br>"._THANKSREC."</font></center>";
CloseTable();
include ('footer.php');
}
switch($op) {
case "SendSite":
SendSite($yname, $ymail, $fname, $fmail);
break;
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 vote in polls in this forum