我尝试配置PHPList 3.012。我将使用自己的订阅和取消订阅页面。我在PHPList的新闻组中问道。不幸的是,我没有得到回应。似乎没有人使用自己的订阅页面。 如果登录页面上的输入字段为空,我将点击发送按钮,javascript me,"请输入有效的电子邮件地址。我输入有效的电子邮件地址后应该出现 另一条错误消息。而是显示PHPList的登录页面。请查看我的脚本和PHP代码。我想拥有自己的弹出窗口而不是PHPList的感谢页面。 有没有人PHPList运行自己的订阅,取消订阅和感谢页面。它还必须使用来自PHPList的index.php进行更多更改。
感谢您的帮助
<div class="page-footer">
<div id="newsletter">
<div class="form-horizontal">
<form action="http://example.com/?p=subscribe&id=1" method="post" class="newsletter" name="subscribeform" id="subscribeform">
<div class="form-group">
<label class="col-lg-2 col-md-2 col-sm-2 col-sx-2 control-label">Form of address:</label>
<div class="col-lg-6 col-md-6 col-sm-6 col-sx-6">
<label class="radio-inline">
<input type="radio" name="attribute1" value="1">Mr</label>
<label class="radio-inline">
<input type="radio" name="arttibute1" value="2">Ms</label>
</div>
<!-- /.col-lg-6 col-md-6 col-sm-6 col-sx-6 -->
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="subscriber_titel col-lg-2 col-md-2 col-sm-2 col-sx-2 control-label">Title:</label>
<div class="col-lg-6 col-md-6 col-sm-6 col-sx-6">
<input type="text" class="form-control" name="attribute2" id="titel" placeholder="Title" value="" />
</div>
<!-- /.col-lg-6 col-md-6 col-sm-6 col-sx-6 -->
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="subscriber_vorname col-lg-2 col-md-2 col-sm-2 col-sx-2 control-label">First Name:</label>
<div class="col-lg-6 col-md-6 col-sm-6 col-sx-6">
<input type="text" class="form-control" name="attribute3" id="vorname" placeholder="First Name" value="" />
</div>
<!-- /.col-lg-6 col-md-6 col-sm-6 col-sx-6 -->
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="subscriber_name col-lg-2 col-md-2 col-sm-2 col-sx-2 control-label">Last Name:</label>
<div class="col-lg-6 col-md-6 col-sm-6 col-sx-6">
<input type="text" class="form-control" name="attribute4" id="name" placeholder="Last Name" value="" />
</div>
<!-- /.col-lg-6 col-md-6 col-sm-6 col-sx-6 -->
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="subscriber_email col-lg-2 col-md-2 col-sm-2 col-sx-2 control-label">E-Mail:</label>
<div class="col-lg-6 col-md-6 col-sm-6 col-sx-6">
<input type="text" class="form-control" name="email" id="email" placeholder="email@example.com" value="" />
</div>
<!-- /.col-lg-6 col-md-6 col-sm-6 col-sx-6 -->
</div>
<!-- /.form-group -->
<div class="form-group">
<label class="subscriber_land col-lg-2 col-md-2 col-sm-2 col-sx-2 control-label">Land:</label>
<div class="col-lg-6 col-md-6 col-sm-6 col-sx-6">
<input type="text" class="form-control" name="attribute5" id="land" placeholder="Land" value="" />
</div>
<!-- /.col-lg-6 col-md-6 col-sm-6 col-sx-6 -->
</div>
<!-- /.form-group -->
<input type="hidden" name="htmlemail" value="1">
<div class="form-group">
<div class="col-sm-offset-0 col-sm-12">
<div class="checkbox">
<label>
<input type="checkbox" name="list[1]" value="signup" checked />Newsletter</label>
</div>
<!-- /.col-sm-offset-0 col-sm-12 -->
</div>
<!-- /.checkbox -->
</div>
<!-- /.form-group -->
<div class="form-group">
<div class="col-sm-offset-0 col-sm-12">
<div class="checkbox">
<label>
<input type="checkbox" name="list[2]" value="signup" checked />Newsletter 2</label>
</div>
<!-- /.col-sm-offset-0 col-sm-12 -->
</div>
<!-- /.checkbox -->
</div>
<!-- /.form-group -->
<div class="form-group">
<div class="col-lg-8 col-md-8 col-sm-8 col-sx-8">
<input type="reset" name="reset" value="Reset" class="btn btn-default btn-sm" title="Formular zurücksetzen">
<button class="btn btn-success btn-sm" role="button" type="submit" name="subscribe" id="postname" onclick="return checkform();" value="Subscribe" title="Subscirbe">Subscribe Newsletter</button>
</div>
<!-- /.col-lg-8 col-md-8 col-sm-8 col-sx-8 -->
</div>
<!-- /.form-group -->
<hr class="style-red">
<div class="form-group">
<div class="col-lg-8 col-md-8 col-sm-8 col-sx-8"> <a class="btn btn-warning btn-xs" role="button" href="newsletter-unsubscribe.php" title="Newsletter unsubscribe">Unsubscribe</a>
<a class="btn btn-info btn-xs" role="button" href="newsletter-change-personal-information.php" title="Change personal information">Change personal information</a>
</div>
<!-- /.col-lg-8 col-md-8 col-sm-8 col-sx-8 -->
</div>
<!-- /.form-group -->
</form>
<!-- /.form action-->
</div>
<!-- /.form-horizontal -->
</div>
<!-- /.newsletter -->
</div>
<!-- /.page-footer -->
</div>
<!-- /.well-white-01 -->
</div>
<!-- /.lg-col-8 col-md-8 col-sm-8 col-sx-8 -->
<script type="text/javascript">
function checkform() {
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var address = document.forms['subscribeform'].elements['email'].value;
if (reg.test(address) == false) {
alert('Bitte geben Sie Ihre gültige Email-Adresse ein!');
document.forms['subscribeform'].elements['email'].focus();
return false;
} else {
document.forms['unsubscribeform'].elements['unsubscribeemail'].value = document.forms['subscribeform'].elements['email'].value;
}
if (document.forms['subscribeform'].elements['attribute1'].value == "") {
alert('Bitte die Anrede auswählen!');
document.forms['subscribeform'].elements['attribute1'].focus();
return false;
} else {
document.forms['unsubscribeform'].elements['attribute1'].value = document.forms['subscribeform'].elements['attribute1'].value;
return true;
}
if (document.forms['subscribeform'].elements['attribute3'].value == "") {
alert('Bitte geben Sie Ihren Vornamen ein!');
document.forms['subscribeform'].elements['attribute3'].focus();
return false;
} else {
document.forms['unsubscribeform'].elements['attribute3'].value = document.forms['subscribeform'].elements['attribute3'].value;
return true;
}
if (document.forms['subscribeform'].elements['attribute4'].value == "") {
alert('Bitte geben Sie Ihren Nachnamen ein!');
document.forms['subscribeform'].elements['attribute4'].focus();
return false;
} else {
document.forms['unsubscribeform'].elements['attribute4'].value = document.forms['subscribeform'].elements['attribute4'].value;
return true;
}
if (document.forms['subscribeform'].elements['attribute5'].value == "") {
alert('Bitte geben Sie das Land ein!');
document.forms['subscribeform'].elements['attribute5'].focus();
return false;
} else {
document.forms['unsubscribeform'].elements['attribute5'].value = document.forms['subscribeform'].elements['attribute5'].value;
return true;
}
}
</script>
答案 0 :(得分:1)
<?php
ob_start();
//$er = error_reporting(0);
require_once dirname(__FILE__) .'/admin/commonlib/lib/unregister_globals.php';
require_once dirname(__FILE__) .'/admin/commonlib/lib/magic_quotes.php';
## none of our parameters can contain html for now
$_GET = removeXss($_GET);
$_POST = removeXss($_POST);
$_REQUEST = removeXss($_REQUEST);
$_SERVER = removeXss($_SERVER);
$_COOKIE = removeXss($_COOKIE);
## remove a trailing punctuation mark on the uid
if (isset($_GET['uid'])) {
if (preg_match('/[\.,:;]$/',$_GET['uid'])) {
$_GET['uid'] = preg_replace('/[\.,:;]$/','',$_GET['uid']);
}
}
if (isset($_SERVER["ConfigFile"]) && is_file($_SERVER["ConfigFile"])) {
include $_SERVER["ConfigFile"];
} elseif (is_file("config/config.php")) {
include 'config/config.php';
} else {
print "Error, cannot find config file\n";
exit;
}
require_once dirname(__FILE__).'/admin/init.php';
$GLOBALS["database_module"] = basename($GLOBALS["database_module"]);
$GLOBALS["language_module"] = basename($GLOBALS["language_module"]);
require_once dirname(__FILE__).'/admin/'.$GLOBALS["database_module"];
# load default english and language
include_once dirname(__FILE__)."/texts/english.inc";
if (is_file(dirname(__FILE__).'/texts/'.$GLOBALS["language_module"])) {
include_once dirname(__FILE__).'/texts/'.$GLOBALS["language_module"];
}
# Allow customisation per installation
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS["language_module"])) {
include_once $_SERVER['DOCUMENT_ROOT'].'/'.$GLOBALS["language_module"];
}
include_once dirname(__FILE__)."/admin/languages.php";
require_once dirname(__FILE__)."/admin/defaultconfig.php";
require_once dirname(__FILE__).'/admin/connect.php';
include_once dirname(__FILE__)."/admin/lib.php";
$I18N = new phplist_I18N();
header('Access-Control-Allow-Origin: '.ACCESS_CONTROL_ALLOW_ORIGIN);
if (!empty($GLOBALS["SessionTableName"])) {
require_once dirname(__FILE__).'/admin/sessionlib.php';
}
@session_start();
if (!isset($_POST) && isset($HTTP_POST_VARS)) {
require 'admin/commonlib/lib/oldphp_vars.php';
}
$req = Sql_fetch_row_query(sprintf('select id from %s where id = %d',$tables["subscribepage"],$id));
$id = $req[0];
$msg = "";
if (isset($_GET['p']) && $_GET["p"] == "subscribe") {
$_SESSION["userloggedin"] = 0;
$_SESSION["userdata"] = array();
}
if (!$id) {
# find the default one:
$id = getConfig("defaultsubscribepage");
# fix the true/false issue
if ($id == "true") $id = 1;
if ($id == "false") $id = 0;
if (!$id) {
# pick a first
$req = Sql_Fetch_row_Query(sprintf('select ID from %s where active',$tables["subscribepage"]));
$id = $req[0];
}
}
$pagedata = array();
if ($id) {
$GLOBALS['pagedata'] = PageData($id);
if (isset($pagedata['language_file']) && is_file(dirname(__FILE__).'/texts/'.basename($pagedata['language_file']))) {
@include dirname(__FILE__).'/texts/'.basename($pagedata['language_file']);
# Allow customisation per installation
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.basename($pagedata['language_file']))) {
include_once $_SERVER['DOCUMENT_ROOT'].'/'.basename($pagedata['language_file']);
}
}
}
include 'admin/ui/'.$GLOBALS['ui'].'/publicpagetop.php';
print $pagedata["header"];
if($_POST['email']!='' && isset($_POST['email']))
{
$email_address = $_POST['email'];
$query = sprintf('INSERT INTO %s (email,status) values("%s","%s")',
'phplist_user_unsubscriber',$email_address,"Block");
$result = Sql_query($query);
header("Location: unsubscribe.php?m=1");
die();
}
if($_GET['m']!='' && isset($_GET['m']))
{
print '<h4 class="pagetitle">You have been unsubscribed from our newsletters and you will receive a confirmation message shortly.</h4>';
}
if($_GET['emailid']=='' && !isset($_GET['emailid']))
{
print '<h3>'. $GLOBALS["strUnsubscribeInfo"].'</h3>';
print '<form method="post" action=""><input type="hidden" name="p" value="unsubscribe" />';
print '<p>'.$GLOBALS["strEnterEmail"].': <input type="text" name="email" value="'.$email.'" size="40" /></p>';
print '<input type="submit" name="unsubscribe" value="'.$GLOBALS['strContinue'].'"></form>';
print '<title>'.$GLOBALS["strSubscribeTitle"].'</title>';
print $pagedata["footer"];
}
&GT;
这是我的取消订阅页面。有一个输入字段电子邮件地址。 N请将unsubscribe.php添加到htaccess文件中。