Author Topic: I need to know how to make listmail allow duplicates  (Read 1829 times)

cwboaze

  • Posts: 37
    • View Profile
I need to know how to make listmail allow duplicates
« on: February 15, 2007, 10:36:32 pm »
Hi,

i need listmail to allow duplicate subscribers.
I have a pdf for download and if someone requests,
it they get it as a attachment.

ok, the first time is a charm. but, I have
a client who lost his pdf, and wanted to re-request
it well when he tried to subscribe to list (#1),
it said he is already subscribed, how do I make it not
filter this and allow him to re-request his pdf.

thanks in advance,!

CB.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
I need to know how to make listmail allow duplicates
« Reply #1 on: February 16, 2007, 12:40:07 am »
Greetings,

You can use the 'overwritedupes' variable in your signup form.  (help page) Or you can replace your signup.php with as follows to enable 'ignoredupes' which will allow you to keep repeat subscribers at the same followup and seq #:

Code: [Select]
<?php/* ListMail (c) 2002 - 2006 Dean Wiebe <dean@listmailpro.com>   You may not modify or distribute the program without express permission from the author.   Files are overwritten when updates are released, so it's not a good idea anyway. */header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");header("Cache-Control: no-store, no-cache, must-revalidate");header("Cache-Control: post-check=0, pre-check=0", false);header("Pragma: no-cache");include("./config.php");include("./admin.php");// $DEBUG = 1;// echo "list=$list<br>lists=$lists<br>cgi=$cgi<br>";if($ignore_dupes) $ignoredupes=1;if($overwrite_dupes) $overwritedupes=1;if($list && !$lists && !$cgi){ $lists = array(); $lists[0] = $list;}if($cgi) $lists = explode(',',$list);sort($lists);// **BUG** LISTSTR SHOULD HAVE SEPARATOR CHARACTERS$liststr = '';while(list($k,$v)=each($lists)){ if($k>0) $liststr .= ','; $liststr .= $v;}reset($lists);if($submode=='unsub'){/* if($lists){ } elseif($list){ */  // get uid  Header("Location: rem.php?r=".$liststr."&email=$email");  exit;/* } else {  exit('no list defined'); } */}// initial setup// get return-path from config$today = date("Y-m-d");$ipaddr = getip();if($ipaddr<>'Unknown') $iphost = @gethostbyaddr($ipaddr);$refurl = $_SERVER["HTTP_REFERER"];if(!$refurl) $refurl = $HTTP_REFERER;if(!$refurl) $refurl = "Unknown";if($cgi) $ipaddr = "Unknown";if($cgi) $refurl = 'Email';if(!$htmail || strtoupper($htmail)=='HTML') $html = '1';if(strtoupper($htmail)=='TEXT') $html = '0';$dupes = array();$oklists = array();$badlists = array();$bademails = array();$uids = array();$required = array();$closed = array();$rem_lists = array();$add_lists = array();$email = trim($email);// check closed listswhile(list($key,$list)=each($lists)){ $listopts = getlistopts($list); if($listopts[0]==1){  $closed[$list] = 1;  if(!in_array($list,$badlists)) $badlists[] = $list; }}reset($lists);// check required fieldswhile(list($key,$list)=each($lists)){ if(!$cgi){  $reqerr = '';  $requx = '';  $cmd = "select req1,req2,field1,field2,field3,field4,field5,field6,field7,field8,field9,field10 from $ltable where listnum = '$list' limit 1";  $listrow = mysql_query($cmd);  list($req1,$req2,$u1,$u2,$u3,$u4,$u5,$u6,$u7,$u8,$u9,$u10) = mysql_fetch_row($listrow);  for($i=1;$i<=10;$i++){   list($null,$reqd,$errm)=explode('/*LMP*/',${"u".$i});   if($reqd=='1' && !${"user".$i}){    $requx=1;    $reqerr .= $errm.'<br>';   }  }  if($req1==1 && !$fname){ $reqfn=1; } else $reqfn = false;  if($req2==1 && !$lname){ $reqln=1; } else $reqln = false;  if(!$email) $reqem = 1; else $reqem = false;    if($reqem || $reqfn || $reqln || $requx){   $required[$list] = array($reqfn,$reqln,$reqem,$requx,$reqerr);   if(!in_array($list,$badlists)) $badlists[] = $list;  } }}reset($lists);// check email formatwhile(list($key,$list)=each($lists)){ // check email structure if(!valid_email($email)){  $bademails[$list] = 1;  if(!in_array($list,$badlists)) $badlists[] = $list; }}reset($lists);// check dupeswhile(list($key,$list)=each($lists)){ if(!$allowdupes && !$allow_dupes){  // check for duplicates  $cmd = "select id,uid,cnf from $utable where list = '$list' and email like '".addslashes($email)."';";  $result = mysql_query($cmd);  if(mysql_num_rows($result)>0){   list($xid,$xuid,$xcnf)=mysql_fetch_row($result);   if($xcnf<>'1'){    // overwrite    $uids[$list] = $xuid;   } else {    if($overwritedupes){     // overwrite     $uids[$list] = $xuid;    } elseif($ignoredupes){     $uids[$list] = $xuid;     $dupes[$list] = 1;    } else {     $dupes[$list] = 1;     if(!in_array($list,$badlists)) $badlists[] = $list;    }   }  } } else {  $dupes[$list] = false; }}reset($lists);// do oklistswhile(list($key,$list)=each($lists)){ if($closed[$list]) $errorout = 1; if($required[$list]) $errorout = 1; if(!$bademails[$list] && !$required[$list] && (!$dupes[$list] || $ignoredupes) && !$closed[$list]){  $oklists[] = $list; }}reset($lists);sort($badlists);// error outif(count($oklists)==0 || $errorout){ if(!$cgi){  // get custom subscribe error page options  if($chtmlid && is_numeric($chtmlid)) $chid = $chtmlid;  else {   // get first badlist HTML   $chid = listopts('chtmlid',$badlists[0]);   $eid = listopts('errorid',$badlists[0]);  }  $data = chtml('suberror',$chid);  // get errors for badlist  list($rfn,$rln,$rem,$ux,$uerr)=$required[$badlists[0]];  if($closed[$badlists[0]]) $msg .= 'You may not subscribe to a closed list!<br>';  elseif($dupes[$badlists[0]]) $msg .= emsg('email_dupe',$eid).'<br>';  else {   if($bademails[$badlists[0]]) $msg .= emsg('email_bad',$eid).'<br>';   elseif($rem) $msg .= emsg('email_req',$eid).'<br>';   if($rfn) $msg .= emsg('fname_req',$eid).'<br>';   if($rln) $msg .= emsg('lname_req',$eid).'<br>';   if($ux) $msg .= $uerr;  }  $data = str_replace('!data',$msg,$data);  if(strpos(' '.$data,'URL:')=='1') header('Location: '.str_replace('URL:','',$data)); else echo $data;  exit; } else {  exit(); }}while(list($key,$list)=each($oklists)){ list($welcact,$cnfact) = @mysql_fetch_row(mysql_query("select welcact,cnfact from $ltable where listnum = '$list'")); // allow customizing seq and delay on signup form if(($ignoredupes && !$dupes[$list]) || !$ignoredupes){  if($seq && is_numeric($seq) && $seq > 0 && $del && is_numeric($del) && $del >= 0){   $userseq = $seq;   $userdel = $del;  } else {   // find seq & delay   $cmd = "select del,seq from $ftable where list = '$list' order by seq limit 1";   $result = mysql_query($cmd);   if(mysql_num_rows($result) == '0'){    if(!$seq) $userseq = 1; else $userseq = $seq;    if(!$del) $userdel = 0; else $userdel = $del;    $userdel = 0;   } else {    list($del2,$seq2) = @mysql_fetch_row($result);    $thelst = $list;    if(!$seq) $userseq = $seq2; else $userseq = $seq;    if(!$del) $userdel = $del2; else $userdel = $del;   }   $seq = ''; $del = '';  } }  if($cnfact=='1') $confirmed = '0'; else $confirmed = '1'; // removed unneeded $cnf = $cquery; if(!$uids[$list]){  $uniq = '';  while(!$uniq){   $uid = unique_id(7);   if(@mysql_num_rows(mysql_query("select id from $utable where uid = '$uid'",$link))==0) $uniq=1;  } } else $uid = $uids[$list]; if(($ignoredupes && !$dupes[$list]) || !$ignoredupes){  if(!$added){   $list = addslashes($list); $email = addslashes($email); $fname = addslashes($fname);  $lname = addslashes($lname);  $user1 = addslashes($user1);   $user2 = addslashes($user2);  $user3 = addslashes($user3);  $user4 = addslashes($user4);   $user5 = addslashes($user5);  $user6 = addslashes($user6);  $user7 = addslashes($user7);   $user8 = addslashes($user8);  $user9 = addslashes($user9);  $user10 = addslashes($user10);   $refurl=addslashes($refurl);   $added = 1;  } }  if($uids[$list] && !$dupes[$list]){  mysql_query("delete from $utable where uid = '".$uids[$list]."'") or die(mysql_error());  // echo "deleted rows.. ".mysql_affected_rows()."..<br>"; }  if(!$ignoredupes || ($ignoredupes && !$dupes[$list])){  $cmd = "INSERT INTO $utable VALUES ('null','$uid','$list','$fname','$lname','$email','$user1','$user2','$user3','$user4','$user5','$user6','$user7','$user8','$user9','$user10','$userseq','$userdel','$confirmed','$today','$ipaddr','$refurl','$html','0');";  mysql_query($cmd) or die("Database error while inserting..");  $userid = mysql_insert_id(); } elseif($ignoredupes && $dupes[$list]){  // get userid  list($userid)=mysql_fetch_row(mysql_query("select id from $utable where uid = '".$uids[$list]."';"));  if(!$userid) exit('error: could not get dupe userid'); } if($key==0) $chuserid = $userid; $listopts = getlistopts($list); if($listopts[2]=='1') $rem_lists[] = $list; if($listopts[3]=='1') $add_lists[] = $list; if($cnfact=='1' || ($cnfact<>'1' && $welcact == '1') && !($ignoredupes && $ignoredupes_nowelcome && $dupes[$list])){  if($welcact) $procmid = "3$list"; else $procmid = "4$list";  sendwelcome($userid); } // admin notification (welcome only) if($cnfact=='0'){  $narr = getnotifs($list);  if($narr[0]=='1'){   sendnotif('subscriber',$userid,$cgi);  }  // signup-xtra  if(!$ignoredupes || ($ignoredupes && !$dupes[$list])){   if(file_exists('./signup-xtra.php')){    include('./signup-xtra.php');    mysql_select_db($sqldb,$link);   }  } } else {  // signup-confirm-xtra  if(!$ignoredupes || ($ignoredupes && !$dupes[$list])){   if(file_exists('./signup-confirm-xtra.php')){    include('./signup-confirm-xtra.php');    mysql_select_db($sqldb,$link);   }  } }} // end loopreset($oklists);// add/rem users from other lists// SOMEHOW STOP THIS WHEN USER IS SUBSCRIBING HERE TO TARGET LISTSif($rem_lists){ while(list($k,$v)=each($rem_lists)) remlists($email,$v,2,$lists);}if($add_lists){ while(list($k,$v)=each($add_lists)) addlists($email,$v,3,$lists);}// display custom success page (or confirm page)if(!$cgi){ if($cnfact=='1') $confirmed = 'preconfirm'; else $confirmed = 'subscribe'; if($chtmlid) $chid = $chtmlid; else $chid = listopts('chtmlid',$oklists[0]);  if($chtmlid && is_numeric($chtmlid)) $chid = $chtmlid; $eid = listopts('errorid',$oklists[0]); $data = chtml($confirmed,$chid); list($data) = processmsg($chuserid,$data,'','','0'); if($key==0) if(strpos(' '.$data,'URL:')==1) header('Location: '.str_replace('URL:','',$data)); else echo $data;}// EOF?>



Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

cwboaze

  • Posts: 37
    • View Profile
I need to know how to make listmail allow duplicates
« Reply #2 on: February 16, 2007, 10:24:34 am »
thanks,

I will test this asap.
and keep you posted.

thanks,
CB.