You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 62 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - [Bug Fix]CheckEmail Function for Recommend_Us Module [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
chican0
Nuke Soldier
Nuke Soldier


Joined: Dec 15, 2003
Posts: 34

Location: New Orleans, LA

PostPosted: Sat Jan 10, 2004 10:43 am Reply with quoteBack to top

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)...
Code:
    mail($fmail, $subject, $message, "From: \"$yname\" <$ymail>\nX-Mailer: PHP/" . phpversion());
    update_points(3);
    Header("Location: modules.php?name=$module_name&op=SiteSent&fname=$fname");

And change to the following....
Code:
    emailCheck($fmail);
    if ($stop) {
    include("header.php");
    OpenTable();
   echo "<center><font class=\"title\"><b>Input Error!</b></font><br><br>";
   echo "<font class=\"content\">$stop<br>"._GOBACK."</font></center>";
    CloseTable();
    include("footer.php");
   } else {
    mail($fmail, $subject, $message, "From: \"$yname\" <$ymail>\nX-Mailer: PHP/" . phpversion());
    update_points(3);
    Header("Location: modules.php?name=$module_name&op=SiteSent&fname=$fname");
    }



Hope this helps for some of you who have the same setup as I do.

_________________
SoyChicano.com | ViewMyIP.com
Find all posts by chican0View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
kipuka
Sergeant
Sergeant


Joined: Dec 19, 2003
Posts: 105


PostPosted: Sat Jan 10, 2004 3:57 pm Reply with quoteBack to top

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.
Find all posts by kipukaView user's profileSend private message
chican0
Nuke Soldier
Nuke Soldier


Joined: Dec 15, 2003
Posts: 34

Location: New Orleans, LA

PostPosted: Sat Jan 10, 2004 4:20 pm Reply with quoteBack to top

From what I have read at http://www.w3.org/Protocols/rfc822/rfc822.txt

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.

_________________
SoyChicano.com | ViewMyIP.com
Find all posts by chican0View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
georgiaguy
Sergeant
Sergeant


Joined: Jun 13, 2003
Posts: 98


PostPosted: Sun Jan 11, 2004 5:58 pm Reply with quoteBack to top

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 )
Find all posts by georgiaguyView user's profileSend private message
purasorte
Nuke Soldier
Nuke Soldier


Joined: Jan 25, 2004
Posts: 10


PostPosted: Sun Jan 25, 2004 3:56 am Reply with quoteBack to top

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
Find all posts by purasorteView user's profileSend private message
chican0
Nuke Soldier
Nuke Soldier


Joined: Dec 15, 2003
Posts: 34

Location: New Orleans, LA

PostPosted: Sun Jan 25, 2004 4:20 am Reply with quoteBack to top

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 RecommendSite() {
    global $user, $cookie, $prefix, $dbi, $user_prefix, $module_name;
    include ("header.php");
    title(""._RECOMMEND."");
    OpenTable();
    echo "<center><font class=\"content\"><b>"._RECOMMEND."</b></font></center><br><br>"
   ."<form action=\"modules.php?name=$module_name\" method=\"post\">"
   ."<input type=\"hidden\" name=\"op\" value=\"SendSite\">";
    if (is_user($user)) {
   $result=sql_query("select username, user_email from ".$user_prefix."_users where username='$cookie[1]'", $dbi);
   list($yn, $ye) = sql_fetch_row($result, $dbi);
    }
    echo "<b>"._FYOURNAME." </b> <input type=\"text\" name=\"yname\" value=\"$yn\"><br><br>\n"
   ."<b>"._FYOUREMAIL." </b> <input type=\"text\" name=\"ymail\" value=\"$ye\"><br><br><br>\n"
   ."<b>"._FFRIENDNAME." </b> <input type=\"text\" name=\"fname\"><br><br>\n"
   ."<b>"._FFRIENDEMAIL." </b> <input type=\"text\" name=\"fmail\"><br><br>\n"
   ."<input type=submit value="._SEND.">\n"
   ."</form>\n";
    CloseTable();
    include ('footer.php');
}


function SendSite($yname, $ymail, $fname, $fmail) {
    global $stop, $sitename, $slogan, $nukeurl, $module_name;
    $fname = removecrlf($fname);
    $fmail = removecrlf($fmail);
    $yname = removecrlf($yname);
    $ymail = removecrlf($ymail);
    $subject = ""._INTSITE." $sitename";
    $message = ""._HELLO." $fname:\n\n"._YOURFRIEND." $yname "._OURSITE." $sitename "._INTSENT."\n\n\n"._FSITENAME." $sitename\n$slogan\n"._FSITEURL." $nukeurl\n";
    emailCheck($fmail);
    if ($stop) {
    include("header.php");
    OpenTable();
   echo "<center><font class=\"title\"><b>Input Error!</b></font><br><br>";
   echo "<font class=\"content\">$stop<br>"._GOBACK."</font></center>";
    CloseTable();
    include("footer.php");
   } else {
    mail($fmail, $subject, $message, "From: \"$yname\" <$ymail>\nX-Mailer: PHP/" . phpversion());
    update_points(3);
    Header("Location: modules.php?name=$module_name&op=SiteSent&fname=$fname");
    }
}

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;
   
    case "SiteSent":
    SiteSent($fname);
    break;

    default:
    RecommendSite();
    break;

}

?>


Just cut-n-paste that.

_________________
SoyChicano.com | ViewMyIP.com
Find all posts by chican0View user's profileSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN Messenger
purasorte
Nuke Soldier
Nuke Soldier


Joined: Jan 25, 2004
Posts: 10


PostPosted: Sun Jan 25, 2004 5:58 am Reply with quoteBack to top

Great chican0

Now its working fine.

purasorte
Find all posts by purasorteView user's profileSend private message
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
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



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by · TOGETHER TEAM srl ITALY http://www.togetherteam.it · DONDELEO E-COMMERCE http://www.DonDeLeo.com
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.239 Seconds - 308 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::