It may be a bit sloppy. Clean it up if you wish. However, in an effort to move people from my free list to a paid list.
THE ONLY 2 LISTS ON THE SERVER NEVER HAVING THE SITUATION WHERE A SINGLE USER WILL BE SUBSCRIBED TO BOTH LISTS.
I came up with the following code based on the LMinsert.pl at
http://listmailpro.com/forum/index.php?topic=171.0If you want to remove this post DW I won't get my feeling hurt. I just thought it was pretty good for a new user. We could probably make it better by adding and and list='1' at the end of the WHERE statement below to make sure it only affects a single person. Then it doesn't matter if you have a single user signed up for multiple lists.
This is all done in Perl and I have never done anything like this before today so....It works for me but if you think it is garbage tell me what and I'll change it.
#!/usr/bin/perl
#
# v1.77 lm_users MySQL Table Format
#
# id mediumint(9) - auto incrementing id
# uid varchar(7) - unique user id, must be generated
# list smallint(5) - list user belongs to
# fname tinytext - first name
# lname tinytext - last name
# email tinytext - email address
# user1-user10 text - custom fields 1 thru 10
# cseq smallint(6) - user's current seq # (next followup)
# cdel smallint(6) - days to delay to next followup (0 is next dailymail)
# cnf char(1) - 0=unconfirmed 1=confirmed 2=removed 3=bounced
# dateadd date - YYYY-MM-DD date
# ipaddr varchar(15) - ip address
# refurl varchar(75) - referring URL
# htmail char(1) - 1=HTML+Text 2=Just Text
# bounces tinytext - dont mess with this one :/
#
#
# ListMail Change User Function
#
# This function simply finds the user in Listmail using the email address and updates their information.
#
#********************WARNING!!!!!!!!!!!!!!
# THIS FUNCTION SHOULD NEVER BE USED IF YOU HAVE A SINGLE EMAIL ADDRESS SUBSCRIBED TO MULTIPLE LISTS!!
# IN MY CASE LIST 1 IS A FREE LIST AND LIST 2 IS A PAID LIST. WHEN THEY UPGRADE THEY NO LONGER NEED THE EMAILS FROM THE FREE LIST.
# All parameters are required: list, email, cseg, cdel
#
# example usage:
# require './LMChange.pl';
#
# LMChange($list,$email,'1','0');
# begin function
use DBI;
sub LMChange {
if(!$_[0]){
print 'You must enter a list number';
return 0;
}
if(!$_[1]){
print 'You must enter an email address';
return 0;
}
$list = $_[0]; $em = $_[1]; $sq = $_[2]; $de = $_[3];
# default seq
if(!$sq){ $sq = '1'; }
# default delay
if(!$de){ $de = '0'; }
# You -must- set the MySQL connection information below:
$sqlhost = 'localhost';
$sqldb = 'database';
$utable = 'teble to edit';
$sqluser = 'db user name';
$sqlpass = 'db password';
# End config
# Begin script
# Connect to MySQL
$dbh = '';
$dbh = DBI->connect("DBI:mysql:$sqldb:$sqlhost",$sqluser,$sqlpass);
$dbh->do("UPDATE lm_users SET list='2',cseq='$sq',cdel='$de' WHERE email='$em'");
return 1;
}
return 1;