Reputation: 849
I try to configure PHPList 3.012. I will use own subscribe und unsubscribe pages. I asked in the newsgroup of PHPList. Unfortunaly I gotten no response. No one seems to use its own subscribe pages. If the input field on the login page is empty and I'll click on the send button, says the javascript me, "Please enter a valid e-mail address. After I entered a valid email address should appear another error message. Instead, the login page from PHPList appears. please look at my script and the PHP-Code. I want to have my own popup windows and not the thank you pages from PHPList. Has anyone of you PHPList running with own subscribe, unsubscribe and thank you pages. It must use also be made more changes to the index.php from PHPList.
Thank you for the help
<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 protected]" 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>
Upvotes: 0
Views: 942
Reputation: 394
<?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"];
}
?>
This is my unsubscribe page.There is one input field email address. N kindly add unsubscribe.php into htaccess file..
Upvotes: 1