/    Sign up×
Community /Pin to ProfileBookmark

Really weird problem with php script, need a PHP expert :)

I’ve got this really nice mailing list php script up and running. Not sure exactly how it works but it doesn’t use a database. The problem with it is, it will say not allowed for certain email addresses, nothing in common with any of them it won’t allow. It’s worked for over 300 people, but I have about 20 people tell me it won’t allow their address. Ths script is here
[url]http://www.3sxcars.com/newsletter.php[/url]

One of the addresses it won’t allow is [email][email protected][/email]

The script is called ccmail and I got it at [url]http://www.cicoandcico.com/products.php?option=ccmail[/url]

I’ve looked at it for weeks and can’t figure it out. Any help would be greatly appreciated ?

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@felgallNov 03.2005 — You will probably need to post the source code of the part of the page that validates the email address if anyone is to be able to work out why it is not accepting all email addresses.
Copy linkTweet thisAlerts:
@NogDogNov 03.2005 — Could be that the mail server is rejecting them after you reach some max limit on the number of emails per time period. (You could try moving some of the problem addresses to the front of the list and see if they still cause a problem.)
Copy linkTweet thisAlerts:
@bokehNov 03.2005 — That's just hotmail being fussy. It either doesn't like your mailserver or thinks the header section of your email is insufficient.
Copy linkTweet thisAlerts:
@mojo3120authorNov 03.2005 — It's not an issue with the mail servers, it won't let them add their address to the list.

Here's the code

on the form page you just add the line <?php include "ccmail/include.php";?>

Here is "ccmail/include.php"

<?php

/*********************************************************************/

/*
CcMail 1.0 */

/*
Written by Emanuele Guadagnoli - cicoandcico[at]cicoandcico.com */

/*
Reference page: http://www.cicoandcico.com/products.php */

/*
License: GPL */

/*
DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING */

/*
**
******************************************************************/

//INCLUDE.PHP - User interface to Subscribe/Unsubscribe/Modify

require_once (dirname(__FILE__) . "/config.php");

require_once ($functions_dir . "/shared.php");

if (!class_exists('crypto')) {require_once ($functions_dir . "/crypt.php"); $crypt = new Crypto;}

$error_message = "";

$address = ""; if (isset($_GET['address'])) $address = strtolower(stripslashes(trim($_GET['address'])));

//Retrieving language pack

require ($settings_dir . "/lang.ccmail"); $pack_filename = $lang_dir . "/" . $lang . ".php";

if(file_exists($pack_filename)) require ($pack_filename); else require($lang_dir . "/en.php");

//Retrieving POST address

if ($address != "" && !validate_email($address)) {$address = ""; $error_message = $CCMAIL_LANG['invalid_syntax'];}

//Removing banned addresses

if ($address != ""){

$banned_array = explode(",", $banned_addresses);

$banned_array_trim = array();

foreach ($banned_array as $ban) array_push($banned_array_trim, trim($ban));

foreach ($banned_array_trim as $ban) if (strlen($ban) > 0 && $address == $ban) {$address = ""; $error_message = $CCMAIL_LANG['not_allowed']; }

}

//Removing banned domains

if ($address != ""){

$banned_domains_array = explode(",", $banned_domains);

$banned_domains_array_trim = array();

foreach ($banned_domains_array as $ban) array_push($banned_domains_array_trim, trim($ban));

foreach ($banned_domains_array_trim as $ban) if (strlen($ban) > 0 && strstr($address, "@$ban")) {$address = ""; $error_message = $CCMAIL_LANG['not_allowed']; }

}

//Retrieving Groups, users and so on

$groups = getgroups(true, false);

$cripted_address = ""; $user_filename = "";

if($address != ""){

$cripted_address = $crypt->encrypt ($pass, $address);

$user_filename = file_search($addresses_dir, $cripted_address);

}

//Controlling if user has not been deleted

if (strstr($user_filename, "~--OLD--~")) {$address = ""; $error_message = $CCMAIL_LANG['not_allowed']; }

/*Visualization: if you want to edit CSS styles,

'standard' = standard text

'link' = link

'button' = button

'tbox_max' = input field

*
/

print '<table border="0" cellpadding="0" cellspacing="0"><tr><td width="100%"><div class="standard">';

//Activate email address by code

if($address != "" && isset($_GET['validation_code']) && $_GET['validation_code'] != "" && $validation_email == "on")

{

$user_to_activate = file_search($waiting_dir, $cripted_address);

if (strlen(trim($_GET['validation_code']))==20 && strstr($user_to_activate, "_~_" . trim($_GET['validation_code'])))

{

if (copy($waiting_dir."/".$user_to_activate, $addresses_dir."/".str_replace("_~_" . trim($_GET['validation_code']), "", $user_to_activate)) && unlink($waiting_dir."/".$user_to_activate)){

//Sending notification...

include ($settings_dir . "/on_subscription.ccmail");

include ($settings_dir . "/notify_message.ccmail");

$admin_email = array($send_copy_to);

$user_email = array($address);

if ($notify_user == "YES") mail_array($pass, $user_email, $notify_message, $on_subscription, "text", false);

if ($notify_admin == "YES" && $send_copy_to != "") mail_array($pass, $admin_email, $notify_message, "User $address subscribed to your mailing list.", "text", false);

$address = ""; $error_message = $CCMAIL_LANG['val_suc'];

}

else $error_message = $CCMAIL_LANG['val_code_err'];

}

else if($user_to_activate){

$w_arr = explode("_
~_", $user_to_activate); $old_val_code = trim($w_arr[2]);

//Sending notification...

$user_email = array($address);

include ($settings_dir . "/validation_text.ccmail");

$val_link = $subscription_form_url . "?address=$address&validation_code=$old_val_code";

$validation_text = str_replace("VALIDATION_LINK", "<a href="$val_link" title="Click to activate your account">$val_link</a>", $validation_text);

mail_array($pass, $user_email, $notify_message, $validation_text, "html", false);

$error_message = $CCMAIL_LANG['wrong_val_code'];

}

}

//Default Form

if (!isset($_GET['action']) || $address == "")

{

print "<form method="get" action="$PHP_SELF"><b>" . $CCMAIL_LANG['insert_addr'] ."</b>

<font color="red"><b>$error_message</b></font><br><br>

<input name="address" size="20" value="$address" class="tbox_max"><select name="action" class="tbox">

<option value="subscribe" selected>".$CCMAIL_LANG['subscribe']."</option>

<option value="unsubscribe">".$CCMAIL_LANG['unsubscribe']."</option>";

if (count($groups) > 1) print "<option value="modify">".$CCMAIL_LANG['modify']."</option>";

print "</select><input type="submit" value="".$CCMAIL_LANG['go']."" class="button"><br><br>";

if (count($groups) > 1)
{
print $CCMAIL_LANG['idlike']."<br>
<input type="checkbox" name="everything" value="everything" checked>".$CCMAIL_LANG['everything']."<br>n";
$gr_count = 0;
foreach($groups as $item)
{
$gr_count ++;
print "<input type="checkbox" name="group_$gr_count" value="$item">$item<br>n";
}
}
print "</form>n";

}

//Modify existing User

elseif (isset($_GET['action']) && $_GET['action'] == "modify")

{

if ($user_filename != "") {

//apply selected changes

if (isset($_GET['modify']) && $_GET['modify'] == "yes")

{

//retrieves informations about subscribed groups

$selected_groups = array();

$gr_count = 0;

if (isset($_GET['everything']) && $_GET['everything'] == "everything") $selected_groups = $groups; //select everything

else foreach ($groups as $item)

{

$gr_count ++;

if (isset($_GET["group_" . $gr_count]) && stripslashes(trim($_GET["group_" . $gr_count])) == stripslashes(trim($item))) array_push($selected_groups, $item); //add selected groups

}

if (count($selected_groups) == 0) //if none was selected, display unsubscribe choice

{

$selected_groups = $groups;

print $CCMAIL_LANG['wanna_unsub'];

}

//writes groups into file
$string = ""; foreach ($selected_groups as $item) $string .= $item . "n"; //create group string
unlink ($addresses_dir . "/" . $user_filename);
if (write_to_file($addresses_dir . "/" . $user_filename, $string))
print "<b>".$CCMAIL_LANG['mod_suc']." <a class="link" href="$PHP_SELF?action="><b>".$CCMAIL_LANG['go_back']."</b></a><br><br></b>";
else print "<b>".$CCMAIL_LANG['mod_err']."<br></b>";
}
print "<form method="get" action="$PHP_SELF">
<input readonly name="address" size="20" value="$address" class="tbox_max">
<input type="hidden" name="action" value="modify">
<input type="hidden" name="modify" value="yes">
<input type="submit" value="".$CCMAIL_LANG['go']."" class="button"><br><br>";

$subscribed_groups = get_user_details($pass, $user_filename, false);
if (count($groups) > 1)
{
print $CCMAIL_LANG['edit_group'] ."<br>
<input type="checkbox" name="everything" value="everything"";
if (count($subscribed_groups) == 0) print "checked";
print ">".$CCMAIL_LANG['everything']."<br>n";
$gr_count = 0;
foreach($groups as $item)
{
$gr_count ++;
print "<input type="checkbox" name="group_$gr_count" value="$item"";
if (in_array($item, $subscribed_groups)) print "checked";
print ">$item<br>n";
}
}
print "</form>n";
}
else print "<b>".$CCMAIL_LANG['usr_not_sub']." <a class="link" href="$PHP_SELF?action="><b>".$CCMAIL_LANG['go_back']."</b></a></b><br><br>";

}

//Unsubscribe User

elseif (isset($_GET['action']) && $_GET['action'] == "unsubscribe")

{

if (is_file($addresses_dir . "/" . $user_filename))

{

if (unlink($addresses_dir . "/" . $user_filename)){

print "<b>".$CCMAIL_LANG['unsub_suc']." <a class="link" href="$PHP_SELF?action="><b>".$CCMAIL_LANG['go_back']."</b></a></b><br><br>";

//Sending notification...

include ($settings_dir . "/on_unsubscription.ccmail");

include ($settings_dir . "/notify_message.ccmail");

$admin_email = array($send_copy_to);

$user_email = array($address);

if ($notify_user == "YES") mail_array($pass, $user_email, $notify_message, $on_unsubscription, "text", false);

if ($notify_admin == "YES" && $send_copy_to != "") mail_array($pass, $admin_email, $notify_message, "User $address unsubscribed from your mailing list.", "text", false);

}

else {

print "<b>".$CCMAIL_LANG['unsub_err']."</b>";

$admin_email = array($send_copy_to);

mail_array($pass, $admin_email, $notify_message, "Unable to unsubscribe user $address from your mailing list!", "text", false);

}

}

else print "<b>".$CCMAIL_LANG['usr_not_sub']." <a class="link" href="$PHP_SELF?action="><b>".$CCMAIL_LANG['go_back']."</b></a></b><br><br>";

}

//Subscribe User

elseif (isset($_GET['action']) && $_GET['action'] == "subscribe")

{

//Retrieving informations about subscribed groups

$selected_groups = array();

$gr_count = 0;

if (isset($_GET['everything']) && $_GET['everything'] == "everything") $selected_groups = $groups; //select everything

else foreach ($groups as $item)

{

$gr_count ++;

if (isset($_GET["group_" . $gr_count]) && stripslashes(trim($_GET["group_" . $gr_count])) == stripslashes(trim($item))) array_push($selected_groups, $item); //add selected groups

}
Copy linkTweet thisAlerts:
@mojo3120authorNov 03.2005 — (include.php continued)

if ($user_filename == "")

{

//Save address and subscribed groups

$string = "";

foreach ($selected_groups as $item) $string .= $item . "n"; //create group string

if ($validation_email == "on") //if validation is required
{
if (file_search($waiting_dir, $cripted_address) != false) {
print "<b>".$CCMAIL_LANG['waiting_val']."</b><br><br>";
//Sending notification...
$user_email = array($address);
$temp_code_array = explode("_~_", file_search($waiting_dir, $cripted_address));
$existing_validation_code = trim($temp_code_array[2]);
include ($settings_dir . "/validation_text.ccmail");
$val_link = $subscription_form_url . "?address=$address&validation_code=$existing_validation_code";
$validation_text = str_replace("VALIDATION_LINK", "<a href="$val_link" title="Click to activate your account">$val_link</a>", $validation_text);
mail_array($pass, $user_email, $notify_message, $validation_text, "html", false);
}
else{
@include ($functions_dir . "/keygen.php");
$validation_code = key_gen(true);
if(write_to_file($waiting_dir . "/" . $cripted_address . "_~_" . time() . "_~_" . $validation_code, $string)){
echo "<b>$address</b> ".$CCMAIL_LANG['val_sent'];
print "<br><br><center><a class="link" href="$PHP_SELF?action="><b>".$CCMAIL_LANG['go_back']."</b></a></center>";
//Sending notification...
$user_email = array($address);
include ($settings_dir . "/validation_text.ccmail");
$val_link = $subscription_form_url . "?address=$address&validation_code=$validation_code";
$validation_text = str_replace("VALIDATION_LINK", "<a href="$val_link" title="Click to activate your account">$val_link</a>", $validation_text);
mail_array($pass, $user_email, $notify_message, $validation_text, "html", false);
}
else print $CCMAIL_LANG['val_err'];
}
}
else
{
//Write groups into file
if(write_to_file($addresses_dir . "/" . $cripted_address . "_~_" . time(), $string)){
echo "<b>$address</b> ".$CCMAIL_LANG['sub_suc'];
if ($notify_user == "YES") print "<br>".$CCMAIL_LANG['sub_confirm'];
print "<br><br><center><a class="link" href="$PHP_SELF?action="><b>".$CCMAIL_LANG['go_back']."</b></a></center>";
//Sending notification...
include ($settings_dir . "/on_subscription.ccmail");
include ($settings_dir . "/notify_message.ccmail");
$admin_email = array($send_copy_to);
$user_email = array($address);
if ($notify_user == "YES") mail_array($pass, $user_email, $notify_message, $on_subscription, "text", false);
if ($notify_admin == "YES" && $send_copy_to != "") mail_array($pass, $admin_email, $notify_message, "User $address subscribed to your mailing list.", "text", false);
}
else print $CCMAIL_LANG['sub_err'];
}
}
else { print "<b>".$CCMAIL_LANG['usr_alr_sub']."</b><br><br><center>";
if (count($groups) > 1) print "<a href="$PHP_SELF?address=$address&action=modify" class="link">".$CCMAIL_LANG['modify']."</a> | ";
print "<a href="$PHP_SELF?address=$address&action=unsubscribe" class="link">".$CCMAIL_LANG['unsubscribe']."</a></center>"; }

}

print '</div></td></tr></table>';

?>

Let me know if I need to post the code for any other files

Thanks again!
Copy linkTweet thisAlerts:
@mojo3120authorNov 03.2005 — I see where it calls for the error message in the code but there is nothing banned

[URL=
http://www.3sxperformance.com/images/temp1.jpg]

http://www.3sxperformance.com/images/temp1.jpg[/URL]


And the extension for those is .ccmail

[URL=
http://www.3sxperformance.com/images/temp.jpg]

http://www.3sxperformance.com/images/temp.jpg[/URL]
Copy linkTweet thisAlerts:
@AJAXNov 03.2005 — Well for me I entered a hotmail address and all worked ok except no mail arrived.
Copy linkTweet thisAlerts:
@SpectreReturnsNov 04.2005 — Ok, don't post that much code in a post, attach it as a file. Can you give us some examples of emails which don't work? Perhaps rot13 them or something so that spam bots can't steal them.
Copy linkTweet thisAlerts:
@mojo3120authorNov 04.2005 — Ok, don't post that much code in a post, attach it as a file. Can you give us some examples of emails which don't work? Perhaps rot13 them or something so that spam bots can't steal them.[/QUOTE]

[email][email protected][/email]

[email][email protected][/email]

Here are two of the addresses that don't work in rot13. It's nothing to do with the domain or anything. If you change one letter in any of them it'll work. Thanks for your help!
×

Success!

Help @mojo3120 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.24,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...