Please upgrade or ask your hosting to upgrade."); if (!extension_loaded('PDO')) die("PHP on your webhosting has no [pdo] extension enabled. Please ask the webhosting support to install it"); if (!extension_loaded('pdo_mysql')) die("PHP on your webhosting has no [pdo_mysql] extension enabled. Please ask the webhosting support to install it"); } check_versions(); define('ROOT_DIR', realpath(dirname(__FILE__) . '/..')); $_amAutoloader = require_once __DIR__.'/../library/vendor/autoload.php'; define('CODE_ROOT_DIR', ROOT_DIR); error_reporting(E_ALL); @ini_set('display_errors', 1); /*************************************************************************** * Author: Alex Scott * Email: alex@cgi-central.net * Web: http://www.cgi-central.net * Details: The installation file * FileName $RCSfile$ * Release: 6.3.31 ($Revision$) * * Please direct bug reports,suggestions or feedback to the cgi-central forums. * http://www.cgi-central.net/forum/ * * aMember PRO is a commercial software. Any distribution is strictly prohibited. * Web-based setup. Steps: 0 - check for installed config.php, check if it writeable - main config.php data form 1 - check config.php data - display mysql connection form 2 - check mysql connection - check for tables installed - if installed, skip to step 4 - if not installed ask to install it 3 - install mysql db 4 - plugins configuration (except MySQL) 5 - save all config files */ /** * Retrieve input vars, trim spaces and return as array * @return array array of input vars (_POST or _GET) */ class SetupController { protected $title; protected $vars = []; protected $errors = []; protected $pageTemplate = "<!--TITLE-->"; /** @var DbSimple_Mysql */ protected $db; protected $setup; function get($varName, $default = null) { return $this->vars[$varName] ?? $default; } function e($varName, $default = null) { return htmlentities($this->get($varName, $default) ?? ''); } function setPageTemplate($pageTemplate) { $this->pageTemplate = $pageTemplate; } function _set_input_vars() { $REQUEST_METHOD = $_SERVER['REQUEST_METHOD']; $vars = $REQUEST_METHOD == 'POST' ? $_POST : $_GET; foreach ($vars as $k=>$v){ if (is_array($v)) continue; $vars[$k] = trim($v); } $this->vars = $vars; } function make_password($length=16) { $vowels = 'aeiouy'; $consonants = 'bdghjlmnpqrstvwxz'; $password = ''; $alt = time() % 2; for ($i = 0; $i < $length; $i++) { if ($alt == 1) { $password .= $consonants[(rand() % 17)]; $alt = 0; } else { $password .= $vowels[(rand() % 6)]; $alt = 1; } } return $password; } function render_errors() { if (!$this->errors) return ""; $out = '"; return $out; } function fatal($errs = []) { if ($errs && !is_array($errs)) $errs = [$errs]; $this->errors = array_merge($this->errors, $errs); print "


"; $this->display(); exit(); } function check_for_existance() { $root_dir = ROOT_DIR; $cf = "$root_dir/application/configs/config.php"; if (file_exists($cf) && filesize($cf)) $this->addError("File 'config.php' in amember folder is already exists and non-empty. Please remove it or delete all content if you want to do full reconfiguration"); return !$this->errors; } function addError($err) { $this->errors[] = $err; } function check_for_extensions() { $ext = ['pdo', 'pdo_mysql', 'gd', 'openssl', 'mbstring', 'iconv', 'xml', 'xmlwriter', 'xmlreader', 'ctype']; foreach ($ext as $e) if (!extension_loaded($e)) $this->addError("aMember require $e extension to be installed in php. Please check installation instructions"); return !$this->errors; } function check_for_writeable() { $root_dir = ROOT_DIR; foreach(["$root_dir/data/", "$root_dir/data/cache", "$root_dir/data/new-rewrite/", "$root_dir/data/public/"] as $d) { if (!is_writeable($d)) $this->addError("Directory '$d' is not writable. Please fix it"); } return !$this->errors; } function getRewriteCheckJs() { return << jQuery(function(){ var func = function(resp){ if (!resp.responseText.match(/aMember is not configured yet/, resp)) { jQuery('#rewrite-error').show(); }; } var url = window.location.href; url = url.replace(/\/setup.*/, '/test-rewrite/test-xx'); $.get(url) .error(func); }); CUT; } function checkHtaccess() { $htaccess = ROOT_DIR . '/.htaccess'; $cnt = @file_get_contents($htaccess); if (!$cnt) { $this->fatal("File [$htaccess] is not uploaded"); exit(); } $base = preg_replace('|/setup/.*$|', '', $_SERVER['REQUEST_URI']); if(!$base) $base = '/'; // if no uncommented lines, seek for commented out if (!preg_match_all('|^()(\s*)RewriteBase\s+([\\\/a-zA-Z0-9_-]+)\s*$|m', $cnt, $regs)) preg_match_all('|^(#*)(\s*)RewriteBase\s+([\\\/a-zA-Z0-9_-]+)\s*$|m', $cnt, $regs); if ($regs[0]) { foreach ($regs[3] as $i => $r) { if ($regs[1][$i]) continue; // the line is commented out! if ($r == $base) return true; // Rewritebase is set } foreach ($regs[0] as $i => $r) { $cnt = preg_replace('|^'.preg_quote($regs[0][$i]).'$|m', $regs[2][$i] . 'RewriteBase ' . $base, $cnt); break; // one line is enough } } else { // no regs at all , add new $cnt = str_replace('RewriteEngine on', "RewriteEngine on\n RewriteBase $base", $cnt); } // new .htaccess is ready in $cnt if (!is_writable($htaccess)) { $cnt = htmlentities($cnt); $this->fatal( "File [$htaccess] is not writeable. Please use your FTP client ". "or Web-hosting control panel file manager to update this file \n". "that is the file named .htaccess inside $base folder \n". "edit the file and replace file content to the following (copy&paste) \n". "
$cnt
". "

". "Once .htaccess file is updated, click this link to continue setup" ); exit(); } return file_put_contents($htaccess, $cnt); } function step1() { $root_dir = ROOT_DIR; $SERVER_ADMIN = array_key_exists('SERVER_ADMIN', $_SERVER) ? $_SERVER['SERVER_ADMIN'] : ""; $this->checkHtaccess(); $myurl = preg_replace('|/setup/.*$|', '', $this->getSelfUrl()); $root_url = $this->e('@ROOT_URL@', $myurl); $root_surl = $this->e('@ROOT_SURL@', $myurl); $admin_email = $this->e('@ADMIN_EMAIL@', $SERVER_ADMIN); $admin_login = $this->e('@ADMIN_LOGIN@', 'admin'); $admin_pass = $this->e('@ADMIN_PASS@', ''); $admin_pass_c = $this->e('@ADMIN_PASS_C@', ''); $license = $this->e('@LICENSE@', ''); $site_title = $this->e('@SITE_TITLE@', 'aMember Pro'); $i_agree = $this->e('@i_agree@') ? 'checked' : ''; print $this->getRewriteCheckJs(); print <<Enter configuration parameters
You may modify these values later via the aMember Control Panel
do not place a trailing slash ( / ) at the end! Please note that url must match your license.
please keep default (not-secure) value if you are unsure. No trailing slash ( / ) please! That url must match your license.
the address that alerts and other email should be sent to
admin
username for login to the Admin interface
Confirm Admin Password
password for login to the Admin interface
EOF; if ('==TRIAL==' != '=='.'TRIAL==') print ""; else print <<
enter the license key
EOF; print <<

Thank You for Your Purchase from BeGPL! Activated by BeGPL using LicenseDash Licensing Servers

BeGPL Logo

Your transaction was successful. Welcome to BeGPL,
your trusted source for GPL WordPress themes and plugins.

Why Choose BeGPL?

  • ✅ Lifetime Free Updates
  • ✅ Unlimited Downloads Membership
  • ✅ Access to 45,000+ Premium Themes & Plugins
  • ✅ Instant Downloads After Purchase
  • ✅ Secure Checkout and Payment
  • ✅ 100% Original & Unmodified Files
  • ✅ Money-Back Guarantee
  • ✅ Priority Support

Explore 45,000+ GPL WordPress Plugins and Themes

If you don't find what you need, we can help you get it!

Save money on renewals! We offer pre-activated
themes, plugins, or scripts at a one-time cost.

Need Help? Contact Us:

WhatsApp: +44 7 4455 0 5361

EOF; } function check_step1() { $vars = $this->vars; if (empty($vars['@i_agree@'])) $this->errors[] = 'Please accept License Agreement to continue'; if (!strlen($vars['@SITE_TITLE@'])) $this->errors[] = "Please enter Site Title"; if (!strlen($vars['@ROOT_URL@'])) $this->errors[] = "Please enter root url of script"; if (!strlen($vars['@ROOT_SURL@'])) $this->errors[] = "Please enter secure root url of script (or keep DEFAULT VALUE - set it equal to Not-secure root URL - it will work anyway)"; if (!strlen($vars['@ADMIN_EMAIL@'])) $this->errors[] = "Please enter admin email"; if (!strlen($vars['@ADMIN_LOGIN@'])) $this->errors[] = "Please enter admin login"; if (!strlen($vars['@ADMIN_PASS@'])) $this->errors[] = "Please enter admin password"; if (strlen($vars['@ADMIN_PASS@'])<6) $this->errors[] = "Admin password cannot be shorter than 6 characters"; if ($vars['@ADMIN_PASS_C@'] != $vars['@ADMIN_PASS@']) $this->errors[] = "Admin password and password confirmation do not match"; if ('@TRIAL@' == '@'.'TRIAL@'){ if (!strlen($vars['@LICENSE@'])) $this->errors[] = "Please enter license code"; else { if (!preg_match('/^L[A-Za-z0-9\/=+]+X$/', $vars['@LICENSE@'])) $this->errors[] = "Please enter full license code (it should start with L and ends with X)"; } } return !$this->errors; } function get_hidden_vars() { $res = ''; foreach ($this->vars as $k=>$v){ if ($k[0] == '@') if (is_array($v)) // array foreach ($v as $kk=>$vv) $res .= sprintf(''."\n", htmlspecialchars($k), htmlspecialchars($vv)); else $res .= sprintf(''."\n", htmlspecialchars($k), htmlspecialchars($v)); } return $res; } function step2() { $hidden = $this->get_hidden_vars(); $host = $this->e('@DB_MYSQL_HOST@', 'localhost'); $db = $this->e('@DB_MYSQL_DB@', ''); $user = $this->e('@DB_MYSQL_USER@', ''); $pass = $this->e('@DB_MYSQL_PASS@', ''); $port = $this->e('@DB_MYSQL_PORT@', ''); $prefix = $this->e('@DB_MYSQL_PREFIX@', 'am_'); print <<Enter MySQL configuration parameters
$hidden
very often 'localhost'
normally you do not need to enter anything into this field. Keep default value
note: setup does not create the database for you. Use the default database created by your host or create a new database, for example 'amember'
If not sure, keep the default value 'am_'
EOF; } function check_step2() { $vars = $this->vars; if ($this->errors) return false; /// really connect try { // PDO always generate warning if connection failed. // To disable that warning change error handler; set_error_handler(function(){}); $this->getSetup()->connectDb(); restore_error_handler(); } catch (Am_Setup_Exception_Db $e) { switch ($e->getCode()) { case 1045: $this->errors[] = "MySQL user access denied - check username, password and hostname"; break; case 1049: //try to create database on the fly if ($this->getSetup()->tryCreateDbAndConnnect()) return true; // failed $this->errors[] = "Unknown MySQL database - check database name"; break; case 2002: $this->errors[] = "Can't connect to local MySQL server through socket. Try to use 127.0.0.1 for MySQL Host setting. If this will not help contact hosting support and ask to provide correct MySQL Host"; default: $this->errors[] = $e->getMessage(); } return false; } return true; } function step3() { $hidden = $this->get_hidden_vars(); print <<Continue installation?
aMember Setup Wizard is now ready to finish installation and create database tables. If database tables are already created, aMember will intelligently modify its structure to match latest aMember version. Your existing configuration and database records will not be removed.
$hidden
EOF; } /** @return Am_Setup */ function getSetup() { if (!$this->setup) { $this->setup = new Am_Setup(dirname(__FILE__), ROOT_DIR . '/application/configs', [CODE_ROOT_DIR . '/application/default/db.xml',], $this->vars); } return $this->setup; } function display_error(Exception $e) { $this->title = "aMember Setup: Internal Error"; $msg = $e->getMessage(); print <<
  • $msg
  • CUT; } function display_send_files_form() { $this->title = "aMember Setup: could not save config file"; $hidden = $this->get_hidden_vars(); $configFn = $this->getSetup()->getConfigFileFn(); $content = $this->getSetup()->getConfigFileContent(); print <<
    • Installation script is unable to save file $configFn. For complete setup you may download new config files to your computer and upload it back to your server.

    File config.php. Upload it to your FTP:
    $configFn

    $hidden

    Internet Explorer sometimes rename files when save it. For example, it may rename config.php to config[1].php. Don't forget to fix it before uploading!

    Or, alternatively, you may copy&paste this text to application/configs/config.php file.


    Copy to clipboard


    When the file is copied or created, click this link to continue

    CUT; } function send_config_file() { header('Content-Disposition: attachment; filename="config.php"'); header("Content-Type: application/php"); echo $this->getSetup()->getConfigFileContent(); exit(); } function step4() { try { $this->getSetup()->process(); } catch (Am_Setup_Exception_WriteConfigFiles $e) { return $this->display_send_files_form(); } catch(Exception $e){ return $this->display_error($e); } $link = $this->getSelfUrl() . '?step=5'; print "

    Installation finished. Please click this link to continue.

    "; } function getSelfUrl() { $ssl = !empty($_SERVER['HTTPS']) && ('off' != strtolower($_SERVER['HTTPS'])); return ($ssl ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME']; } function step5() { print <<Thank you for choosing aMember Pro

    You can find the aMember Pro User's Guide here. Feel free to contact CGI-Central any time if you have any issues with the script.

    Please review the following (You may want to bookmark this page):

    Before aMember is ready to use you will also need to do the following:

    Go to the Admin Setup/Configuration page Enable any additional payment plugins you need and 'Save'. Then configuration pages for plugins will appear in the top of page. Visit them and configure enabled plugins.

    Go to the Admin Products page and add your products or subscription types.

    You may prefer to refer to them as 'Products' or 'Subscription Types' depending upon the type of business you are in. For example, you might choose to refer to a newsletter as a 'Subscription', while you might call computer software or hardware a 'Product'. It's up to you what you choose to call these aMember database records.

    Remember, a 'Product' or 'Subscription Type' is just a different way to refer to the same thing, which is an aMember database record.

    You may specify the Subscription Type (free or paid signup, etc.) as you enter each product.

    It is important to set up at least one product!

    Determine whether your payment system(s) require any special configuration. If so then you can refer to the Installation Manual for more information, or contact CGI-Central for script customization services.

    Visit Setup your protection for protected areas or upload files for customers.

    Check your installation by testing your Signup Page.

    Feel free to contact CGI-Central Support if you need any customization of the script.

    You can also find a lot of useful info in the aMember Forum.

    CUT; } function display() { $out = $this->render_errors() . "\n\n" . ob_get_clean(); $tpl = $this->pageTemplate; $tpl = str_replace('', $this->title, $tpl); $tpl = str_replace('', $out, $tpl); echo $tpl; } function run() { $this->_set_input_vars(); ob_start(); $step = intval(@$_REQUEST['step']); if ($step != 5 && !$this->check_for_existance()) { $this->title = "Amember Setup : is already installed"; return $this->display(); } if (!$this->check_for_writeable()) { $this->title = "Amember Setup : folders permissions must be fixed"; return $this->display(); } if (!$this->check_for_extensions()) { $this->title = "Amember Setup : Extensions required"; return $this->display(); } $this->title = "aMember Setup: Step ".($step+1)." of 4"; switch ($step){ case 0: case '0': $this->step1(); break; case 1: case '1': if (!$this->check_step1()) $this->step1(); else $this->step2(); break; case 2: case '2': if (!$this->check_step2()) $this->step2(); else $this->step3(); break; case 3: case '3': if (!$this->check_step1()) $this->step1(); elseif (!$this->check_step2()) $this->step2(); else $this->step4(); break; case 5: case '5': $this->title = "aMember Setup: Step ".($step-1)." of 4"; $this->step5(); break; case 9: case '9': // no header return $this->send_config_file(); break; default: die('Unknown step: ' . $step); } return $this->display(); } } $controller = new SetupController; $year = date('Y'); $controller->setPageTemplate(<< <!--TITLE-->
    aMember Pro
    EOF ); $controller->run();