-
Notifications
You must be signed in to change notification settings - Fork 3
/
newsletter.php
135 lines (115 loc) · 6.11 KB
/
newsletter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/*
##########################################################################
# #
# Version 4 / / / #
# -----------__---/__---__------__----__---/---/- #
# | /| / /___) / ) (_ ` / ) /___) / / #
# _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ #
# Free Content / Management System #
# / #
# #
# #
# Copyright 2005-2011 by webspell.org #
# #
# visit webSPELL.org, webspell.info to get webSPELL for free #
# - Script runs under the GNU GENERAL PUBLIC LICENSE #
# - It's NOT allowed to remove this copyright-tag #
# -- http://www.fsf.org/licensing/licenses/gpl.html #
# #
# Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at), #
# Far Development by Development Team - webspell.org #
# #
# visit webspell.org #
# #
##########################################################################
##########################################################################
# #
# Version 4 / / / #
# -----------__---/__---__------__----__---/---/- #
# | /| / /___) / ) (_ ` / ) /___) / / #
# _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ #
# Society / Edition #
# / #
# #
# modified by webspell|k3rmit (Stefan Giesecke) in 2009 #
# #
# - Modifications are released under the GNU GENERAL PUBLIC LICENSE #
# - It is NOT allowed to remove this copyright-tag #
# - http://www.fsf.org/licensing/licenses/gpl.html #
# #
##########################################################################
*/
$_language->read_module('newsletter');
if(isset($_GET['action'])) $action = $_GET['action'];
else $action='';
if($action=="save") {
$email = $_POST['email'];
if(!validate_email($email)) redirect('index.php?site=newsletter', $_language->module['email_not_valid'],3);
else {
$ergebnis = safe_query("SELECT * FROM ".PREFIX."newsletter WHERE email='".$email."'");
if(!mysql_num_rows($ergebnis)) {
$pass = RandPass(7);
safe_query("INSERT INTO ".PREFIX."newsletter ( email, pass) values ('".$email."', '".$pass."')");
$header="From:".$hp_title."<".$admin_email.">\n";
$header .= "Reply-To: ".$admin_email."\n";
$header.= "Content-Type: text/html; charset=utf-8\n";
$vars = Array('%delete_key%', '%homepage_url%', '%mail%');
$repl = Array($pass, $hp_url, $email);
mail($email, $hp_title.": ".$_language->module['newsletter_registration'], str_replace($vars, $repl, $_language->module['success_mail']), $header);
redirect('index.php?site=newsletter', $_language->module['thank_you_for_registration'],3);
}
else redirect('index.php?site=newsletter', $_language->module['you_are_already_registered'],3);
}
}
elseif($action=="delete") {
$ergebnis = safe_query("SELECT pass FROM ".PREFIX."newsletter WHERE email='".$_POST['email']."'");
$any=mysql_num_rows($ergebnis);
if($any){
$dn=mysql_fetch_array($ergebnis);
if($_POST['password'] == $dn['pass']) {
safe_query("DELETE FROM ".PREFIX."newsletter WHERE email='".$_POST['email']."'");
redirect('index.php?site=newsletter', $_language->module['your_mail_adress_deleted'],3);
}
else {
redirect('index.php?site=newsletter', $_language->module['mail_pw_didnt_match'],3);
}
}
else {
redirect('index.php?site=newsletter', $_language->module['mail_not_in_db'],3);
}
}
elseif($action=="forgot") {
$ergebnis = safe_query("SELECT pass FROM ".PREFIX."newsletter WHERE email='".$_POST['email']."'");
$dn=mysql_fetch_array($ergebnis);
if($dn['pass'] != "") {
$email = $_POST['email'];
$pass = $dn['pass'];
$header="From:".$hp_title."<".$admin_email.">\n";
$header .= "Reply-To: ".$admin_email."\n";
$header.= "Content-Type: text/html; charset=utf-8\n";
$vars = Array('%delete_key%', '%homepage_url%', '%mail%');
$repl = Array($pass, $hp_url, $email);
mail($email, $hp_title.": ".$_language->module['deletion_key'], str_replace($vars, $repl, $_language->module['request_mail']), $header);
redirect('index.php?site=newsletter', $_language->module['password_had_been_send'],3);
}
else redirect('index.php?site=newsletter', $_language->module['no_such_mail_adress'],3);
}
else {
$bg1=BG_1;
$bg2=BG_2;
$bg3=BG_3;
$bg4=BG_4;
$usermail = getemail($userID);
if(isset($_GET['mail'])) $get_mail = getforminput($_GET['mail']);
else $get_mail='';
if($get_mail == "") $get_mail = $_language->module['mail_adress'];
if(isset($_GET['pass'])) $get_pw = getforminput($_GET['pass']);
else $get_pw='';
if($get_pw == "") $get_pw = $_language->module['del_key'];
eval ("\$newsletter_title = \"".gettemplate("title_newsletter")."\";");
echo $newsletter_title;
eval ("\$newsletter = \"".gettemplate("newsletter")."\";");
echo $newsletter;
}
?>