<?php// process specified link code// create a new list with all users who clicked code// ** Be sure to place this script IN your ListMail directory// v1.8 Note: List is configured with the Default HTML and Error Messagesinclude("./config.php");include("./admin.php");$islogged = islogged();ini_set("max_execution_time","0");if($islogged){$isadmin='true';} else { adminheader('Not logged in','Not logged in','x');echo "<center>You must <a href=login.php>login</a>."; exit; }if ($isadmin == 'true'){$link = mysql_connect($sqlhost,$sqluser,$sqlpass);mysql_selectdb($sqldb);if($_POST['submit']=='Copy'){ $copy = 1; $move = ''; $append = '';}if($_POST['submit']=='Move'){ $copy = ''; $move = 1; $append = '';}if($_POST['submit']=='Append'){ $copy = ''; $move = ''; $append = 1; }if($move) $txt = 'moved'; elseif($copy) $txt = 'copied'; elseif($append) $txt = 'appended';echo "<a href=./>Back to ListMail</a><br><br>";if($process_link){ // create new list with link ref code (if doesn't exist) list($kref)=mysql_fetch_row(mysql_query("select refcode from $ktable where id = '".addslashes($process_link)."'")); if($append){ $newlist = $list; echo "Target "; } else { $newlist = new_list($kref); echo "New "; } echo "list num = $newlist<br>"; // get user hits for this link $cmd = "select uid from lm_hits where kid = '".addslashes($process_link)."' group by uid"; $rows = mysql_query($cmd); echo "new list: $newlist<br>$txt users: "; if(@mysql_num_rows($rows)>0){ while(list($uid)=mysql_fetch_row($rows)){ if($move){ // update the user with the new list mysql_query("update lm_users set list = '$newlist' where id = '".addslashes($uid)."'"); } elseif($copy || $append){ // get all user data and create a new user on the new list list($fn,$ln,$em,$u1,$u2,$u3,$u4,$u5,$u6,$u7,$u8,$u9,$u10,$cn,$da,$ip,$ru,$htm)=mysql_fetch_row(mysql_query("select fname,lname,email,user1,user2,user3,user4,user5,user6,user7,user8,user9,user10,cnf,dateadd,ipaddr,refurl,htmail from lm_users where id = '".addslashes($uid)."';")); // create new uid $uniq = ''; while(!$uniq){ $newuid = unique_id(7); if(@mysql_num_rows(mysql_query("select id from $utable where uid = '$newuid'"))==0) $uniq=1; } // insert user if not already on new list $trow = mysql_query("select id from lm_users where email like '$em' and list = '$newlist'"); if(@mysql_num_rows($trow)==0){ mysql_query("insert into lm_users values('','$newuid','$newlist','".addslashes($fn)."','".addslashes($ln)."','".addslashes($em)."','".addslashes($u1)."','".addslashes($u2)."','".addslashes($u3)."','".addslashes($u4)."','".addslashes($u5)."','".addslashes($u6)."','".addslashes($u7)."','".addslashes($u8)."','".addslashes($u9)."','".addslashes($u10)."','1','','$cn','".addslashes($da)."','".addslashes($ip)."','".addslashes($ru)."','".addslashes($htm)."','0');") or die('user insert error..'.mysql_error()); } else { echo "skip"; } } echo "$uid "; flush(); } } else echo "process aborted: no tracked users found for selected link<br>"; echo "<br><br>";}// show all links$cmd = "select id,refcode,title,http,hits from $ktable where 1 order by refcode";$rows = mysql_query($cmd);echo "This script will create a new list containing all users from any list who have clicked through a certain link. Users can be copied or moved from their old list.<br><br>";if(@mysql_num_rows($rows)>0){ echo " Select link to process:<br><br><form method=post><input type=hidden name=process value=1><select name=process_link>"; while(list($i,$r,$t,$h,$s)=mysql_fetch_row($rows)){ echo "<option value=$i>$r - $h"; } echo "</select><br><br><input name=submit type=submit value=\"Move\"> <input name=submit type=submit value=\"Copy\"> or <input name=submit type=submit value=\"Append\"> to <select name=list>\n"; $lrows = mysql_query("select listnum,title from $ltable where 1 order by listnum"); while(list($li,$ti)=mysql_fetch_row($lrows)){ echo "<option value=$li>$li: $ti\n"; } echo "</select></form>";} else echo "no links found!<br>";}function new_list($refcode){ global $link; global $ltable; global $vtable; $cmd = "select id,listnum from $ltable where title like '".addslashes($refcode)."' limit 1"; $result = mysql_query($cmd); if(@mysql_num_rows($result)>0){ list($id,$nlnum)=mysql_fetch_row($result); } else { $cmd = "select id,listnum from $ltable where id >= '0' order by listnum desc limit 0,1"; $result = mysql_query($cmd); while(list($id,$listnum) = @mysql_fetch_row($result)){ $nlnum = $listnum+1; $xmails = explode(';',$adminmail); $adminmail = $xmails[0]; $dom = getdomain(); $cmd2 = "insert into $ltable values('null','$nlnum','".addslashes($refcode)."','news@$dom','New List Newsletter','Welcome!','Welcome to the mailing list!','','','1','Please verify your subscription','Click the link below to verify your email address for subscription to the yoursite.com newsletter\n\n!confirm','','','0','remsubj','remmsg','','','','','','', '','','','','','','','','','','0;0;0;0;0','$adminmail','0;1','1','1','')"; mysql_query($cmd2) or die('list creation error: '.mysql_error()); } } return $nlnum;}?>
Worked around the idiocyincracy of the lists deleting themselves - if anyone wantd details just post request and I'll explain my experience.
$cmd2 = "insert into $ltable values('null','$nlnum','".addslashes($refcode)."','news@$dom','New List Newsletter','Welcome!','Welcome to the mailing list!','','','1','Please verify your subscription','Click the link below to verify your email address for subscription to the yoursite.com newsletter\n\n!confirm','','','0','','', '','','','','','','','','','','0;0;0;0;0','$adminmail','0;1','1','1')";
but welcome messages are not actually sent.
Correct, the confirmation is also not sent. This line of code is simply to create the list - there are no mailing functions used.
KEEP the users in the list, and COPY them to another list....
echo "This script will create a new list containing all users from any list who have clicked through a certain link. Users are _$txt_ from their old list.<br><br>";
echo "This script will create a new list containing all users from any list who have clicked through a certain link. Users are _" . $txt . "_ from their old list.<br><br>";
$move = false;
$copy = true;
if($move) $txt = 'moved'; elseif($copy) $txt = 'copied';
(new) list num = 33
new list: 33
copied users: problem inserting..
include("./config.php");
include("./admin.php");
/* ====== THE MEAT ======== */
if ( $p == "password-of-your-choice" ) {
// continue
} else {
echo "<html><head></head><body>Cannot Access Extract Hits</body></html>";
exit;
}
$islogged = islogged();
http://yourdomain.com/mail/extracthits.php?p=password-of-your-choice
copied users: problem inserting..
SELECT *
FROM lm_users a
WHERE a.list = '2'
AND cnf = '1'
AND EXISTS (
SELECT *
FROM lm_hits b
WHERE a.id = b.uid
AND b.kid = '1'
);
<input type=hidden name=saveid value=$kid>
<input type=hidden name=saveid value=$kid>$kid
Here's a way to send to all users on a list who are not on another list
I think what he's looking for instead is having this added to Dailymail (as an option possibly), so that it AUTOMATICALLY moves the clicked links over to the other lists...
I like that idea, but only if I can get reliable Statistics on the lists after the move such as How Many Clicks happened between these dates, etc, etc...
appended users: skip0
Target list num = 87
new list: 87
appended users: 302555
<td width=1>
<form name=add method=post action=$PHP_SELF>
<input type=hidden name=doadd value=yes>
<input type=hidden name=list value=$list>
<input class=button type=submit name=asub value=\"Add Link\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 80px\">
</td></form>
<td width=3><img src=1.gif width=3></td>
<td width=1>
<form name=vhits method=post>
<input type=hidden name=hitpage value=1>
<input type=hidden name=list value=$list>
<input class=button type=submit value=\"Tracked Hits\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 100px\">
</td></form>
<td align=right>";
<!-- Start New Button Code -->
<td width=3><img src=1.gif width=3></td>
<td width=1>
<form name=vhits method=post action=trackedlinklist.php>
<input class=button type=submit value=\"Tracked Hits List Builder\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 200px\">
</td></form>
<!-- End New Button Code -->
<td width=1>
<form name=add method=post action=$PHP_SELF>
<input type=hidden name=doadd value=yes>
<input type=hidden name=list value=$list>
<input class=button type=submit name=asub value=\"Add Link\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 80px\">
</td></form>
<td width=3><img src=1.gif width=3></td>
<td width=1>
<form name=vhits method=post>
<input type=hidden name=hitpage value=1>
<input type=hidden name=list value=$list>
<input class=button type=submit value=\"Tracked Hits\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 100px\">
</td></form>
<!-- Start New Button Code -->
<td width=3><img src=1.gif width=3></td>
<td width=1>
<form name=vhits method=post action=trackedlinklist.php>
<input class=button type=submit value=\"Tracked Hits List Builder\" onmouseover=\"this.className='button_over'\" onmouseout=\"this.className='button'\" style=\"width: 200px\">
</td></form>
<!-- End New Button Code -->
<td align=right>";
You could take this one step further and set rules for the amount of times a link is clicked to copy/move to a list. if they click on it 1-4 times copy to one list or 5 + copy to another list. and remove from the the 1-4 times list. etc....
simply automating this process daily would be HUGE for me....