1<?php 2/* 3 This page supports the PHP.net automoderation system 4 with enabling users to confirm their emails via the web. 5 This script only need to run on the primary php.net box. 6*/ 7 8$_SERVER['BASE_PAGE'] = 'mod.php'; 9include_once __DIR__ . '/include/prepend.inc'; 10 11site_header("Email confirmation", ["current" => "community"]); 12 13// Only run on main php.net box. 14if (!is_primary_site()) { 15 echo <<<ERROR 16<h1>Email confirmation failed</h1> 17 18<p class="formerror"> 19 This server is not capable of handling email confirmations. 20</p> 21ERROR; 22 site_footer(); 23 exit; 24} 25 26// These sites are handled by automoderation 27$sites = ["php.net", "lists.php.net"]; 28 29// Get data from the URL 30[$none, $site, $token, $sender] = explode("/", $_SERVER["PATH_INFO"]); 31 32// Error in input data 33if ($sender == "" || strlen($token) < 32 || !isset($sites[$site])) { 34 echo <<<ERROR 35<h1>Email confirmation failed</h1> 36 37<p class="formerror"> 38 Sorry, the URL is incomplete. Please verify that you used the 39 complete URL even if it spans multiple lines. 40</p> 41ERROR; 42} 43 44// Data OK, send confirmation mail 45else { 46 mail( 47 "confirm@" . $sites[$site], 48 "confirm", 49 "[confirm: $token $sender]", 50 "From: $sender", 51 ); 52 53 echo <<<THANKS 54<h1>Email confirmation successful</h1> 55 56<p> 57 Thanks for confirming your email address. No further 58 action is required on your part. 59</p> 60THANKS; 61 62} 63 64site_footer(); 65