back to phpList.org

Code in forums test post

Code worked here Auto-insertion of <p> element around the [CONTENT] section tag

Let’s test

Test code

    ## 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(); # it may have been started already in languages

if (!isset($_POST) && isset($HTTP_POST_VARS)) {
  require 'admin/commonlib/lib/oldphp_vars.php';
}

if (isset($_GET['id'])) {
  $id = sprintf('%d',$_GET['id']);
} else {
  $id = 0;
}

// What is id - id of subscribe page
// What is uid - uid of subscriber
// What is userid - userid of subscriber

$userid = "";
$userpassword = "";
$emailcheck = "";

if (isset($_GET['uid']) && $_GET["uid"]) {
  $query
  = ' select subscribepage, id, password, email'
  . ' from ' . $tables['user']
  . ' where uniqid = ?';
  $rs = Sql_Query_Params($query, array($_GET['uid']));
  $req = Sql_Fetch_Row($rs);
  $id = $req[0];
  $userid = $req[1];
  $userpassword = $req[2];
  $emailcheck = $req[3];
} elseif (isset($_GET['p']) && ($_GET['p'] == 'subscribe' || $_GET['p'] == 'unsubscribe' || $_GET['p'] == 'blacklist' || $_GET['p'] == 'donotsend')) {
  if (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"])) {
    $query
    = ' select subscribepage, id, password, email'
    . ' from ' . $tables['user']
    . ' where email = ?';
    $rs = Sql_Query_Params($query, array($_REQUEST['unsubscribeemail']));
    $req = Sql_Fetch_Row($rs);
    $id = $req[0];
    $userid = $req[1];
    $userpassword = $req[2];
    $emailcheck = $req[3];

test code

This is just a test to post code like it was possible in the old forums, can (and should) be ignored.

?PHP

# Code collated by  Dragonrider for phpList forums

# You will need to add \connect.php to the end of the following line in lists/.htaccess file
#
#<FilesMatch "(index.php|dl.php|ut.php|lt.php|download.php|connector.php|connect.php)$">
#
#emove the |connect.php after testing the connection!
#
#
require_once dirname(__FILE__) .'/config/config.php';
#
echo "Database Host: ".$database_host."<br>";
echo "Database Name: ".$database_name."<br>";
echo "Database User: ".$database_user."<br>";
echo "Database Pass: ".$database_password."<p>";

#  Now try to connect

mysql_connect($database_host,$database_user,$database_password);
@mysql_select_db($database_name) or die( "Unable to select database"); //if it fails, say so.


echo "Success!";

# Close the connection

mysql_close();

?>    indent preformatted text by 4 spaces

going to get to the bottom of this issue!

There seems to be agreement from senior devs at discourse that the code paste is too hard to use https://meta.discourse.org/t/difficulty-using-the-code-tag/31075/10 trying to negotiate a fix