This is a plugin for Ecommerce Templates (http://www.ecommercetemplates.com) shopping cart software:
Copy the following code into a file named incListMail.php and follow the instructions in the script.
<?php// Ecommerce Templates cart plugin by DW// http://listmailpro.com// http://ecommercetemplates.com// to enable:// in vsadmin/inc/incemail.php before this line:// if($doshowhtml)// add this:// include('incListMail.php');// and upload this file to vsadmin/inc// incoming vars:// $custEmail - buyers email// $ordName - buyers name (first and last)// $ordAddInfo - additional info// $ordSessionID// ListMail custom fields// user1 - order 'additional info'// user2 - product id// user3 - product name// only show test output to my IPif($_SERVER['REMOTE_ADDR']=='12.34.56.78') $test=1; else $test='';// get product id via ordSessionID$row=mysql_query("select cartProdID from cart where cartSessionID = '".addslashes($ordSessionID)."';") or print(mysql_error());list($prodid)=@mysql_fetch_row($row);// get product name via product id$row=mysql_query("select pName from products where pID = '$prodid';") or print(mysql_error());list($pname)=@mysql_fetch_row($row);// split up first and last name (yes, I cheated)list($fname,$n1,$n2,$n3)=explode(' ',$ordName);$lname = trim($n1.' '.$n2.' '.$n3);if($test){ echo "verify variables...:<br>$custEmail - buyers email<br>$fname - buyers first name<br>$lname - buyers last name<br>$ordAddInfo - additional info<br>$ordSessionID - session ID<br>$prodid - product id<br>$pname - product name<br>";}// example to change list based on product// if($prodid=='example') $list = '1';// elseif($prodid=='example2') $list = '2';// else $list = '4';// just set list to 4$list = '4';// ListMail database connection// Enter your MySQL Information! (Copy & paste from LM config.php)$sqlhost = 'localhost';$sqluser = 'USERNAME';$sqlpass = 'PASSWORD';$sqldb = 'DATABASE';$link2=mysql_connect($sqlhost,$sqluser,$sqlpass);mysql_select_db($sqldb,$link2);// check if user was previously removed, skip if so, otherwise overwrite_dupes=1$row=mysql_query("select id from lm_users where list = '$list' and email like '".addslashes($custEmail)."' and cnf = '2';") or print(mysql_error());list($removed)=@mysql_fetch_row($row);if($test) echo "removed=$removed<br>";if(!$removed){ // add user to listmail // get listmailpath list($lmp)=@mysql_fetch_row(mysql_query("select listmailpath from lm_config where 1;",$link2)); $url = $lmp."signup.php?list=$list&email=".urlencode($custEmail)."&fname=".urlencode($fname)."&lname=".urlencode($lname)."&overwrite_dupes=1&user1=".urlencode($ordAddInfo)."&user2=".urlencode($prodid)."&user3=".urlencode($pname); if($test) echo "URL=$url<br>"; $fp=fopen($url,'r'); fclose($fp);}mysql_close($link2);?>
Good luck! :D