The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
php to append emails to text file
I'm looking for a simple modification to register.php that will append the email addresses of newly registered users to a text file for addition to my mailing list (lyris). I looked through the hack archives, and found some other more robust mailing list features, but I'm looking for something a lot simpler. I'm coming from a perl background, and am relatively new to php.
I just need a plain checkbox on my registration form "check here to receive our newsletters, etc.", that will append the email to a text file. Then, I'll just cron something nightly to add the email addresses to my lyris list. I don't need to check it against a list to see if they are already subscribed. |
#2
|
|||
|
|||
in register somewhere (I'd suggest just below the insert database query around line 459 in register.php
PHP Code:
|
#3
|
|||
|
|||
PHP can access anywhere in the file system if I'm not mistaken. So put your mailing list ABOVE the web root folder in a writable folder. It's safe from hackers and you don't have to have a public writable folder.
|
#4
|
|||
|
|||
I think that's what I meant The path would be something like:
/home/username/emails.txt |
#5
|
|||
|
|||
Thanks -- that was easy . Is there a simple way to only append the email to the text file if a checkbox was checked? This way, I can keep my list opt-in only.
|
#6
|
|||
|
|||
Try this.
in the register templates add... <tr> <td bgcolor="{firstaltcolor}"><normalfont><b>Join our mailing list?</b></normalfont><br> <smallfont>Selecting yes will add you to our mailing list.</smallfont></td> <td bgcolor="{firstaltcolor}"><normalfont> <input type="radio" name="wantsmail" value="yes"> yes <input type="radio" name="wantsmail" value="no" checked> no </normalfont></td> </tr> in register.php at around line 350 add $maillist=iif($wantsmail=="yes",1,0); then wrap the append code in an if()... if($maillist) { $fp = fopen("emails.txt", "a"); fwrite($fp, "$email\r\n"); fclose($fp); } This is not tested. |
#7
|
|||
|
|||
Thanks noppid -- worked perfectly .
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|