I will give you details, but first another problem...
Please help me how to signup from my php script. My #1 list has the email, fname, user1, user2 fields. Only email and fname is required. User1 field is a domain, user2 field is an url value.
My custom php script receive these 4 data from html form: the e-mail, the first name, and user1 and user2 custom fields. I want to insert these data to listmail database. This code does not work:
<?php$domain = $_POST["user1"];$email = $_POST["email"];$name = $_POST["name"];$url = $_POST["user2"];//now I have the data, I want to insert it $lmurl = "http://www.mydomain.com/listmail/signup.php?list=1&fname=".urlencode($name) ."&email=".urlencode($email)."&user1=".urlencode($domain)."&user2=".urlencode($url)."&seq=1&del=0"; $lmp = fopen($lmurl,'r'); fclose($lmp);?>
If I enter the following url in the browser, then it works (with random values):
http://www.mydomain.com/listmail/signup.php?list=1&fname=asd&email=asd@asd.hu&user1=akarmi.hu&user2=httpakarmi.hu&seq=1&del=0
My php scirpt is placed in listmail folder on my host.
Sorry for lame question :)
So user1 must checked against unsubscribed and subscribed user1 values to prevent duplicate values, like in e-mail. I think I would use a separete database
You shouldn't need an additional database since everything that needs to be checked is stored in the ListMail user table.
Consider this code, which could be called "mysignup.php" and placed in the ListMail folder:
<?phpinclude('./config.php');include('./admin.php');// check if this user1 exists in ListMail -anywhere- with any status on all listslist($exists)=@mysql_fetch_row(mysql_query("select id from $utable where user1 = '".addslashes($user1)."';"));if($exists){ // echo an error, echo a page, redirect, etc. header('Location: http://example.com');} else { // does not exist, continue with signup header("Location: http://example.com/mail/signup.php?list=$list&email=".urlencode($email) ."&fname=".urlencode($fname)."&user1=".urlencode($user1) ."&user2=".urlencode($user2));}?>
how to handle more than 10 custom fields?
At this time ListMail can only support 10 custom fields and it is non-trivial to add more... this is eventually coming.
If you just want to store data for use in your own scripts you might consider imploding and exploding the data based on a separator string, to store more than one value in a single field.
Regards
Thank you very much, this works.
But I want to add the searching in removed e-mail function, as discussed in thread http://listmailpro.com/forum/index.php?topic=1835.0
Here is my current code:
<?phpinclude('./config.php');include('./admin.php');$domain = $_POST["domain"];$email = $_POST["email"];$name = $_POST["name"];$url = $_POST["url"];// check if this $domain exists in ListMail -anywhere- with any status on all listslist($exists)=@mysql_fetch_row(mysql_query("select id from $utable where user1 = '".addslashes($domain)."';"));if($exists){ // do nothing } else { // does not exist, continue with signup header("Location: http://www.mydomain.com/listmail/signup.php?list=2&fname=".urlencode($name)."&email=".urlencode($email)."&user1=".urlencode($domain)."&user2=".urlencode($url));}?>
Please help me extend this code:
-if the e-mail is already exists in removed addresses, then halt the singup (LM is cofigured to keep removed addresses in database)
-if the domain already exists in removed or not removed (this is already done) data, then halt the signup
Thank you!
Greetings,
admin.php will automatically "make global" any POST or GET vars as well as remove magic quotes, so you can omit these lines:
$domain = $_POST["domain"];
$email = $_POST["email"];
$name = $_POST["name"];
$url = $_POST["url"];
Removed users have "cnf" set to 2, so here is the final script:
<?phpinclude('./config.php');include('./admin.php');// check if this $domain exists in ListMail -anywhere- with any status on all listslist($exists)=@mysql_fetch_row(mysql_query("select id from $utable where user1 = '".addslashes($domain)."';"));if($exists) exit();// check if this email exists in ListMail -anywhere- as a removed user on all listslist($exists)=@mysql_fetch_row(mysql_query("select id from $utable where email like '".addslashes($email)."' and cnf = '2';"));if($exists) exit();// does not exist, continue with signupheader("Location: http://www.mydomain.com/listmail/signup.php?list=2&fname=".urlencode($name)."&email=".urlencode($email)."&user1=".urlencode($domain)."&user2=".urlencode($url));?>