'."\n"; include $_SERVER["ConfigFile"]; } elseif (isset($_ENV["CONFIG"]) && is_file($_ENV["CONFIG"])) { # print ''."\n"; include $_ENV["CONFIG"]; } elseif (is_file("config/config.php")) { # print ''."\n"; include "config/config.php"; } else { print "Error, cannot find config file\n"; exit; } if (isset($GLOBALS["developer_email"])) { error_reporting(E_ALL); } else { error_reporting(0); } require_once dirname(__FILE__) .'/admin/commonlib/lib/magic_quotes.php'; require_once dirname(__FILE__).'/admin/init.php'; require_once dirname(__FILE__).'/admin/'.$GLOBALS["database_module"]; require_once dirname(__FILE__)."/texts/english.inc"; include_once dirname(__FILE__)."/texts/".$GLOBALS["language_module"]; require_once dirname(__FILE__)."/admin/defaultconfig.inc"; require_once dirname(__FILE__).'/admin/connect.php'; include_once dirname(__FILE__)."/admin/languages.php"; include_once dirname(__FILE__)."/admin/lib.php"; $I18N= new phplist_I18N(); if ($require_login || ASKFORPASSWORD) { # we need session info if an admin subscribes a user if (!empty($GLOBALS["SessionTableName"])) { require_once dirname(__FILE__).'/admin/sessionlib.php'; } @session_start(); # it may have been started already in languages } if (!isset($_POST) && isset($HTTP_POST_VARS)) { require "admin/commonlib/lib/oldphp_vars.php"; } /* We request you retain the inclusion of pagetop below. This will add invisible additional information to your public pages. This not only gives respect to the large amount of time given freely by the developers but also helps build interest, traffic and use of PHPlist, which is beneficial to it's future development. Michiel Dethmers, Tincan Ltd 2000,2004 */ include "admin/pagetop.php"; if (isset($_GET['id'])) { $id = sprintf('%d',$_GET['id']); } else { $id = 0; } if (isset($_GET['uid']) && $_GET["uid"]) { $req = Sql_Fetch_Row_Query(sprintf('select subscribepage,id,password,email from %s where uniqid = "%s"', $tables["user"],$_GET["uid"])); $id = $req[0]; $userid = $req[1]; $userpassword = $req[2]; $emailcheck = $req[3]; } elseif (isset($_GET["email"])) { $req = Sql_Fetch_Row_Query(sprintf('select subscribepage,id,password,email from %s where email = "%s"', $tables["user"],$_GET["email"])); $id = $req[0]; $userid = $req[1]; $userpassword = $req[2]; $emailcheck = $req[3]; } elseif (isset($_REQUEST["unsubscribeemail"])) { $req = Sql_Fetch_Row_Query(sprintf('select subscribepage,id,password,email from %s where email = "%s"', $tables["user"],$_REQUEST["unsubscribeemail"])); $id = $req[0]; $userid = $req[1]; $userpassword = $req[2]; $emailcheck = $req[3]; /* } elseif ($_SESSION["userloggedin"] && $_SESSION["userid"]) { $req = Sql_Fetch_Row_Query(sprintf('select subscribepage,id,password,email from %s where id = %d', $tables["user"],$_SESSION["userid"])); $id = $req[0]; $userid = $req[1]; $userpassword = $req[2]; $emailcheck = $req[3]; */ } else { $userid = ""; $userpassword = ""; $emailcheck = ""; } if (isset($_REQUEST['id']) && $_REQUEST["id"]){ $id = sprintf('%d',$_REQUEST["id"]); } # make sure the subscribe page still exists $req = Sql_fetch_row_query(sprintf('select id from %s where id = %d',$tables["subscribepage"],$id)); $id = $req[0]; $msg = ""; if (!empty($_POST["sendpersonallocation"])) { if (isset($_POST['email']) && $_POST["email"]) { $uid = Sql_Fetch_Row_Query(sprintf('select uniqid,email,id from %s where email = "%s"', $tables["user"],$_POST["email"])); if ($uid[0]) { sendMail ($uid[1],getConfig("personallocation_subject"),getUserConfig("personallocation_message",$uid[2]),system_messageheaders(),$GLOBALS["envelope"]); $msg = $GLOBALS["strPersonalLocationSent"]; addSubscriberStatistics('personal location sent',1); } else { $msg = $GLOBALS["strUserNotFound"]; } } } if (isset($_GET['p']) && $_GET["p"] == "subscribe") { $_SESSION["userloggedin"] = 0; $_SESSION["userdata"] = array(); } $login_required = (ASKFORPASSWORD && $userpassword && $_GET["p"] == "preferences") || (ASKFORPASSWORD && UNSUBSCRIBE_REQUIRES_PASSWORD && $userpassword && $_GET["p"] == "unsubscribe"); if ($login_required && empty($_SESSION["userloggedin"])) { $canlogin = 0; if (!empty($_POST["login"])) { if (empty($_POST["email"])) { $msg = $strEnterEmail; } elseif (empty($_POST["password"])) { $msg = $strEnterPassword; } else { if (ENCRYPTPASSWORD) { $canlogin = md5($_POST["password"]) == $userpassword && $_POST["email"] == $emailcheck; } else { $canlogin = $_POST["password"] == $userpassword && $_POST["email"] == $emailcheck; } } if (!$canlogin) { $msg = $strInvalidPassword; } else { loadUser($emailcheck); $_SESSION["userloggedin"] = $_SERVER["REMOTE_ADDR"]; } } elseif (!empty($_POST["forgotpassword"])) { if (!empty($_POST["email"]) && $_POST["email"] == $emailcheck) { sendMail ($emailcheck,$GLOBALS["strPasswordRemindSubject"],$GLOBALS["strPasswordRemindMessage"]." ".$userpassword,system_messageheaders()); $msg = $GLOBALS["strPasswordSent"]; } else { $msg = $strPasswordRemindInfo; } } elseif (isset($_SESSION["userdata"]["email"]["value"]) && $_SESSION["userdata"]["email"]["value"] == $emailcheck) { $canlogin = $_SESSION["userloggedin"]; $msg = $strEnterPassword; } } else { $canlogin = 1; } 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]; } } if ($login_required && empty($_SESSION["userloggedin"]) && !$canlogin) { print LoginPage($id,$userid,$emailcheck,$msg); } elseif (isset($_GET['p']) && preg_match("/(\w+)/",$_GET["p"],$regs)) { if ($id) { switch ($_GET["p"]) { case "subscribe": require "admin/subscribelib2.php"; print SubscribePage($id); break; case "preferences": if (!isset($_GET["id"]) || !$_GET['id']) $_GET["id"] = $id; require "admin/subscribelib2.php"; if (!$userid) { # print "Userid not set".$_SESSION["userid"]; print sendPersonalLocationPage($id); } elseif (ASKFORPASSWORD && $userpassword && !$canlogin) { print LoginPage($id,$userid,$emailcheck); } else { print PreferencesPage($id,$userid); } break; case "forward": print ForwardPage($id); break; case "confirm": print ConfirmPage($id); break; case "unsubscribe": print UnsubscribePage($id); break; default: FileNotFound(); } } else { FileNotFound(); } } else { if ($id) $data = PageData($id); print '
| '.$GLOBALS["strEmail"].' | |
| '.$GLOBALS["strPassword"].' |
'.$GLOBALS["strUnsubscribe"].'
'; $html .= ''.$GLOBALS["PoweredBy"]; $html .= $data["footer"]; return $html; } function sendPersonalLocationPage($id) { $data = PageData($id); list($attributes,$attributedata) = PageAttributes($data); $html = '| '.$GLOBALS["strEmail"].' |
'.$GLOBALS["strUnsubscribe"].'
'; $html .= ''.$GLOBALS["PoweredBy"]; $html .= $data["footer"]; return $html; } function preferencesPage($id,$userid) { $data = PageData($id); list($attributes,$attributedata) = PageAttributes($data); $selected_lists = explode(',',$data["lists"]); $html = ''.$GLOBALS["strUnsubscribe"].'
'.$GLOBALS["PoweredBy"]; $html .= $data["footer"]; return $html; } function subscribePage($id) { $data = PageData($id); list($attributes,$attributedata) = PageAttributes($data); $selected_lists = explode(',',$data["lists"]); $html = ''.$GLOBALS["strUnsubscribe"].'
'.$GLOBALS["PoweredBy"]; $html .= $data["footer"]; return $html; } function confirmPage($id) { global $tables,$envelope; if (!$_GET["uid"]) { FileNotFound(); } $req = Sql_Query("select * from {$tables["user"]} where uniqid = \"".$_GET["uid"]."\""); $userdata = Sql_Fetch_Array($req); if ($userdata["id"]) { $blacklisted = isBlackListed($userdata["email"]); $html = '".$GLOBALS["PoweredBy"].'
'; $res .= $data["footer"]; return $res; } function unsubscribePage($id) { $pagedata = pageData($id); global $tables; $res = $pagedata["header"]; $res .= '"; $res .= $GLOBALS["PoweredBy"].'
'; $res .= $pagedata["footer"]; return $res; } elseif (isset($_POST["unsubscribe"]) && !$_POST["unsubscribeemail"]) { $msg = ''.$GLOBALS["strEnterEmail"]."| '.$GLOBALS["strEnterEmail"].': | |||
';
} else {
list($r,$c) = explode(",",getConfig("textarea_dimensions"));
if (!$r) $r = 5;
if (!$c) $c = 65;
$res .= $GLOBALS["strUnsubscribeRequestForReason"];
$res .= sprintf('
',$c,$r).'
'.$finaltext.'
'.$GLOBALS["PoweredBy"].'
'; $res .= $pagedata["footer"]; return $res; } function forwardPage($id) { global $tables,$envelope; $html = ''; $subtitle = ''; if (!isset($_GET["uid"]) || !$_GET['uid']) FileNotFound(); $forwardemail = ''; if (isset($_GET['email'])) { $forwardemail = $_GET['email']; } $mid = 0; if (isset($_GET['mid'])) { $mid = sprintf('%d',$_GET['mid']); $req = Sql_Query(sprintf('select * from %s where id = %d',$tables["message"],$mid)); $messagedata = Sql_Fetch_Array($req); $mid = $messagedata['id']; if ($mid) { $subtitle = $GLOBALS['strForwardSubtitle'].' '.stripslashes($messagedata['subject']); } } $req = Sql_Query("select * from {$tables["user"]} where uniqid = \"".$_GET["uid"]."\""); $userdata = Sql_Fetch_Array($req); $req = Sql_Query(sprintf('select * from %s where email = "%s"',$tables["user"],$forwardemail)); $forwarduserdata = Sql_Fetch_Array($req); if ($userdata["id"] && $mid) { if (!is_email($forwardemail)) { $info = $GLOBALS['strForwardEnterEmail']; $html .= '',$GLOBALS['strContinue']); } else { # check whether the email to forward exists and whether they have received the message if ($forwarduserdata['id']) { $sent = Sql_Fetch_Row_Query(sprintf('select entered from %s where userid = %d and messageid = %d', $tables['usermessage'],$forwarduserdata['id'],$mid)); # however even if that's the case, we don't want to reveal this information } $done = Sql_Fetch_Array_Query(sprintf('select user,status,time from %s where forward = "%s" and message = %d', $tables['user_message_forward'],$forwardemail,$mid)); if ($done['status'] === 'sent') { $info = $GLOBALS['strForwardAlreadyDone']; } else { if (!TEST) { # forward the message require 'admin/sendemaillib.php'; # sendEmail will take care of blacklisting if (sendEmail($mid,$forwardemail,'forwarded',$userdata['htmlemail'],array(),$userdata)) { $info = $GLOBALS["strForwardSuccessInfo"]; sendAdminCopy("Message Forwarded",$userdata["email"] . " has forwarded a message $mid to $forwardemail"); Sql_Query(sprintf('insert into %s (user,message,forward,status,time) values(%d,%d,"%s","sent",now())', $tables['user_message_forward'],$userdata['id'],$mid,$forwardemail)); } else { $info = $GLOBALS["strForwardFailInfo"]; sendAdminCopy("Message Forwarded",$userdata["email"] . " tried forwarding a message $mid to $forwardemail but failed"); Sql_Query(sprintf('insert into %s (user,message,forward,status,time) values(%d,%d,"%s","failed",now())', $tables['user_message_forward'],$userdata['id'],$mid,$forwardemail)); } } } } } else { logEvent("Forward request from invalid user ID: ".substr($_GET["uid"],0,150)); $info = $GLOBALS["strForwardFailInfo"]; } $data = PageData($id); $res = '".$GLOBALS["PoweredBy"].'
'; $res .= $data["footer"]; return $res; } ?>