ob_start(); $er = error_reporting(0); # some ppl have warnings on if ($_SERVER["ConfigFile"] && is_file($_SERVER["ConfigFile"])) { print ''."\n"; include $_SERVER["ConfigFile"]; } elseif ($_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; } error_reporting($er); if ($require_login || ASKFORPASSWORD) { # we need session info if an admin subscribes a user session_start(); } 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 2003 */ include "admin/pagetop.php"; $id = sprintf('%d',$_GET["id"]); if ($_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]; $passwordcheck = $req[2]; $emailcheck = $req[3]; } else { $userid = ""; $passwordcheck = ""; $emailcheck = ""; } # 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]; if ($_POST["sendpersonallocation"]) { if ($_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"]; } else { $msg = $GLOBALS["strUserNotFound"]; } } } if (ASKFORPASSWORD) { $canlogin = 0; if ($_POST["login"]) { if (!$_POST["email"]) { $msg = $strEnterEmail; } elseif (!$_POST["password"]) { $msg = $strEnterPassword; } else { if (ENCRYPTPASSWORD) { $canlogin = md5($_POST["password"]) == $passwordcheck && $_POST["email"] == $emailcheck; } else { $canlogin = $_POST["password"] == $passwordcheck && $_POST["email"] == $emailcheck; } } if (!$canlogin) { $msg = $strInvalidPassword; } else { loadUser($emailcheck); } } elseif ($_POST["forgotpassword"]) { if ($_POST["email"] && $_POST["email"] == $emailcheck) { sendMail ($emailcheck,$GLOBALS["strPasswordRemindSubject"],$GLOBALS["strPasswordRemindMessage"]." ".$passwordcheck,system_messageheaders(),$GLOBALS["envelope"]); $msg = $GLOBALS["strPasswordSent"]; } else { $msg = $strPasswordRemindInfo; } } elseif ($_SESSION["userdata"]["email"]["value"] == $emailcheck) { $canlogin = 1; } } 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 (preg_match("/(\w+)/",$_GET["p"],$regs)) { if ($id) { switch ($_GET["p"]) { case "subscribe": require "admin/subscribelib2.php"; print SubscribePage($id); break; case "preferences": if (!$_GET["id"]) $_GET["id"] = $id; require "admin/subscribelib2.php"; if (!$userid) { print sendPersonalLocationPage($id); } elseif (ASKFORPASSWORD && $passwordcheck && !$canlogin) { print LoginPage($id,$userid,$emailcheck); } else { print PreferencesPage($id,$userid); } break; case "confirm": print ConfirmPage($id); break; case "unsubscribe": if (ASKFORPASSWORD && UNSUBSCRIBE_REQUIRES_PASSWORD && $passwordcheck && !$canlogin) { print LoginPage($id,$userid,$emailcheck); } else { 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 = 'You are logged in as '.$_SESSION["logindetails"]["adminname"].'
'; $html .= 'Please choose:
Make confirmed immediately
Send request for confirmation email
'.$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"]) { $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 ($_POST["unsubscribe"] && !$_POST["email"]) { $msg = ''.$GLOBALS["strEnterEmail"]."'.$GLOBALS["strEnterEmail"].': |
'; } else { $res .= $out; $res .= '
'; } $res .= '
'.$GLOBALS["PoweredBy"].'
'; $res .= $pagedata["footer"]; return $res; } ?>