\n", 'iso-8859-1'); ?>
Behavior should be much like STRICT, except that sometimes wikilinks will show up as undefined (with the question mark) when in fact they refer to (recently) created pages. (Hitting your browsers reload or perhaps shift-reload button should fix the problem.)
This setting will result in quirky behavior. When you edit a page your changes may not show up until you shift-reload the page, etc...
This setting is generally not advisable, however it may be useful in certain cases (e.g. if your wiki gets lots of page views, and few edits by knowledgable people who won't freak over the quirks.)
phptype(dbsyntax)://username:password@protocol+hostspec/databaseFor a MySQL database, the following should work:
mysql://user:password@host/databasenameTo connect over a unix socket, use something like
mysql://user:password@unix(/path/to/socket)/databasename
'dsn' => 'mysql://guest@:/var/lib/mysql/mysql.sock/test', 'dsn' => 'mysql://guest@localhost/test', 'dsn' => 'pgsql://localhost/test',"); // Choose ADODB or SQL to use an SQL database with ADODB or PEAR. // Choose dba to use one of the standard UNIX dbm libraries. $properties["SQL Type"] = new _variable_selection('_dsn_sqltype', array('mysql' => "MySQL", 'pgsql' => "PostgreSQL"), " SQL DB types"); $properties["SQL User"] = new _variable('_dsn_sqluser', "wikiuser", " SQL User Id:"); $properties["SQL Password"] = new _variable('_dsn_sqlpass', "", " SQL Password:"); $properties["SQL Database Host"] = new _variable('_dsn_sqlhostorsock', "localhost", " SQL Database Hostname: To connect over a local named socket, use something like
unix(/var/lib/mysql/mysql.sock)here."); $properties["SQL Database Name"] = new _variable('_dsn_sqldbname', "phpwiki", " SQL Database Name:"); list($dsn_sqltype,) = $properties["SQL Type"]->value(); $dsn_sqluser = $properties["SQL User"]->value(); $dsn_sqlpass = $properties["SQL Password"]->value(); $dsn_sqlhostorsock = $properties["SQL Database Host"]->value(); $dsn_sqldbname = $properties["SQL Database Name"]->value(); $properties["SQL dsn"] = new unchangeable_variable("DBParams['dsn']", "\$DBParams['dsn'] = \"\$_dsn_sqltype://{$dsn_sqluser}:{$dsn_sqlpass}@{$dsn_sqlhostorsock}/{$dsn_sqldbname}\";", ""); $properties["dba directory"] = new _variable("DBParams|directory", "/tmp", " dba directory:"); $properties["dba handler"] = new _variable_selection('DBParams|dba_handler', array('gdbm' => "Gdbm - GNU database manager", 'dbm' => "DBM - Redhat default. On sf.net there's dbm and gdbm", 'db2' => "DB2 - Sleepycat Software's DB2", 'db3' => "DB3 - Sleepycat Software's DB3. Fine on Windows but not on every Linux"), " Use 'gdbm', 'dbm', 'db2' or 'db3' depending on your DBA handler methods supported:"); $properties["dba timeout"] = new _variable("DBParams|timeout", "20", " Recommended values are 20 or 5."); /////////////////// $properties["Page Revisions"] = new unchangeable_variable('_parttworevisions', "", " The next section controls how many old revisions of each page are kept in the database. There are two basic classes of revisions: major and minor. Which class a revision belongs in is determined by whether the author checked the \"this is a minor revision\" checkbox when they saved the page. There is, additionally, a third class of revisions: author revisions. The most recent non-mergable revision from each distinct author is and author revision. The expiry parameters for each of those three classes of revisions can be adjusted seperately. For each class there are five parameters (usually, only two or three of the five are actually set) which control how long those revisions are kept in the database.
define('THEME', 'default'); define('THEME', 'Hawaiian'); define('THEME', 'MacOSX'); define('THEME', 'Portland'); define('THEME', 'Sidebar'); define('THEME', 'SpaceWiki');"); $properties["Character Set"] = new _define_optional('CHARSET', 'iso-8859-1', " Select a valid charset name to be inserted into the xml/html pages, and to reference links to the stylesheets (css). For more info see: http://www.iana.org/assignments/character-sets. Note that PhpWiki has been extensively tested only with the latin1 (iso-8859-1) character set. If you change the default from iso-8859-1 PhpWiki may not work properly and it will require code modifications. However, character sets similar to iso-8859-1 may work with little or no modification depending on your setup. The database must also support the same charset, and of course the same is true for the web browser. (Some work is in progress hopefully to allow more flexibility in this area in the future)."); $properties["Language"] = new _define_selection_optional('DEFAULT_LANGUAGE', array('en' => "English", 'nl' => "Nederlands", 'es' => "Español", 'fr' => "Français", 'de' => "Deutsch", 'sv' => "Svenska", 'it' => "Italiano", 'ja' => "Japanese", '' => "none"), " Select your language/locale - default language is \"en\" for English. Other languages available:
English \"en\" (English - HomePage) Dutch \"nl\" (Nederlands - ThuisPagina) Spanish \"es\" (Español - PáginaPrincipal) French \"fr\" (Français - Accueil) German \"de\" (Deutsch - StartSeite) Swedish \"sv\" (Svenska - Framsida) Italian \"it\" (Italiano - PaginaPrincipale) Japanese \"ja\" (Japanese - ¥Û¡¼¥à¥Ú¡¼¥¸)If you set DEFAULT_LANGUAGE to the empty string, your systems default language (as determined by the applicable environment variables) will be used."); $properties["Wiki Page Source"] = new _define_optional('WIKI_PGSRC', 'pgsrc', " WIKI_PGSRC -- specifies the source for the initial page contents of the Wiki. The setting of WIKI_PGSRC only has effect when the wiki is accessed for the first time (or after clearing the database.) WIKI_PGSRC can either name a directory or a zip file. In either case WIKI_PGSRC is scanned for files -- one file per page.
// Default (old) behavior: define('WIKI_PGSRC', 'pgsrc'); // New style: define('WIKI_PGSRC', 'wiki.zip'); define('WIKI_PGSRC', '../Logs/Hamwiki/hamwiki-20010830.zip');"); $properties["Default Wiki Page Source"] = new _define('DEFAULT_WIKI_PGSRC', 'pgsrc', " DEFAULT_WIKI_PGSRC is only used when the language is *not* the default (English) and when reading from a directory: in that case some English pages are inserted into the wiki as well. DEFAULT_WIKI_PGSRC defines where the English pages reside. FIXME: is this really needed? "); $properties["Generic Pages"] = new array_variable('GenericPages', array('ReleaseNotes', 'SteveWainstead', 'TestPage'), " These are the pages which will get loaded from DEFAULT_WIKI_PGSRC. FIXME: is this really needed? Can't we just copy these pages into the localized pgsrc? "); $properties["Part Five"] = new part('_partfive', $SEPARATOR."\n", " Part Five: Mark-up options. "); $properties["Allowed Protocols"] = new list_variable('AllowedProtocols', 'http|https|mailto|ftp|news|nntp|ssh|gopher', " allowed protocols for links - be careful not to allow \"javascript:\" URL of these types will be automatically linked. within a named link [name|uri] one more protocol is defined: phpwiki"); $properties["Inline Images"] = new list_variable('InlineImages', 'png|jpg|gif', " URLs ending with the following extension should be inlined as images"); $properties["WikiName Regexp"] = new _variable('WikiNameRegexp', "(? "true", 'false' => "false"), " Display a warning if the internal lib/interwiki.map is used, and not the public InterWikiMap page. This map is not readable from outside."); $properties["Keyword Link Regexp"] = new _variable('KeywordLinkRegexp', '(?<=^Category|^Topic)[[:upper:]].*$', " Regexp used for automatic keyword extraction. Any links on a page to pages whose names match this regexp will be used keywords in the keywords meta tag. (This is an aid to classification by search engines.) The value of the match is used as the keyword. The default behavior is to match Category* and Topic* links."); $properties["Part Six"] = new part('_partsix', $SEPARATOR."\n", " Part Six (optional): URL options -- you can probably skip this section. "); $properties["Server Name"] = new _define_commented_optional('SERVER_NAME', $HTTP_SERVER_VARS['SERVER_NAME'], " Canonical name and httpd port of the server on which this PhpWiki resides."); $properties["Server Port"] = new numeric_define_commented('SERVER_PORT', $HTTP_SERVER_VARS['SERVER_PORT'], "", "onchange=\"validate_ereg('Sorry, \'%s\' is no valid port number.', '^[0-9]+$', 'SERVER_PORT', this);\""); $scriptname = preg_replace('/configurator.php/','index.php',$HTTP_SERVER_VARS["SCRIPT_NAME"]); $properties["Script Name"] = new _define_commented_optional('SCRIPT_NAME', $scriptname, " Relative URL (from the server root) of the PhpWiki script."); $properties["Data Path"] = new _define_commented_optional('DATA_PATH', dirname($scriptname), " URL of the PhpWiki install directory. (You only need to set this if you've moved index.php out of the install directory.) This can be either a relative URL (from the directory where the top-level PhpWiki script is) or an absolute one."); $properties["PhpWiki Install Directory"] = new _define_commented_optional('PHPWIKI_DIR', dirname(__FILE__), " Path to the PhpWiki install directory. This is the local filesystem counterpart to DATA_PATH. (If you have to set DATA_PATH, your probably have to set this as well.) This can be either an absolute path, or a relative path interpreted from the directory where the top-level PhpWiki script (normally index.php) resides."); $properties["Use PATH_INFO"] = new boolean_define_commented_optional('USE_PATH_INFO', array('true' => 'use PATH_INFO', 'false' => 'do not use PATH_INFO'), " PhpWiki will try to use short urls to pages, eg http://www.example.com/index.php/HomePage If you want to use urls like http://www.example.com/index.php?pagename=HomePage then define 'USE_PATH_INFO' as false by uncommenting the line below. NB: If you are using Apache >= 2.0.30, then you may need to to use the directive \"AcceptPathInfo On\" in your Apache configuration file (or in an appropriate <.htaccess> file) for the short urls to work: See http://httpd.apache.org/docs-2.0/mod/core.html#acceptpathinfo See also http://phpwiki.sourceforge.net/phpwiki/PrettyWiki for more ideas on prettifying your urls. Default: PhpWiki will try to divine whether use of PATH_INFO is supported in by your webserver/PHP configuration, and will use PATH_INFO if it thinks that is possible."); $properties["Virtual Path"] = new _define_commented_optional('VIRTUAL_PATH', '/SomeWiki', " VIRTUAL_PATH is the canonical URL path under which your your wiki appears. Normally this is the same as dirname(SCRIPT_NAME), however using, e.g. apaches mod_actions (or mod_rewrite), you can make it something different. If you do this, you should set VIRTUAL_PATH here. E.g. your phpwiki might be installed at at /scripts/phpwiki/index.php, but you've made it accessible through eg. /wiki/HomePage. One way to do this is to create a directory named 'wiki' in your server root. The directory contains only one file: an .htaccess file which reads something like:
Action x-phpwiki-page /scripts/phpwiki/index.php SetHandler x-phpwiki-page DirectoryIndex /scripts/phpwiki/index.phpIn that case you should set VIRTUAL_PATH to '/wiki'. (VIRTUAL_PATH is only used if USE_PATH_INFO is true.) "); $properties["Part Seven"] = new part('_partseven', $SEPARATOR."\n", " Part Seven: Miscellaneous settings "); $properties["Pagename of Recent Changes"] = new _define_optional('RECENT_CHANGES', 'RecentChanges', " Page name of RecentChanges page. Used for RSS Auto-discovery."); $properties["Disable HTTP Redirects"] = new boolean_define_commented_optional ('DISABLE_HTTP_REDIRECT', array('false' => 'Enable HTTP Redirects', 'true' => 'Disable HTTP Redirects'), " (You probably don't need to touch this.) PhpWiki uses HTTP redirects for some of it's functionality. (e.g. after saving changes, PhpWiki redirects your browser to view the page you just saved.) Some web service providers (notably free European Lycos) don't seem to allow these redirects. (On Lycos the result in an \"Internal Server Error\" report.) In that case you can set DISABLE_HTTP_REDIRECT to true. (In which case, PhpWiki will revert to sneakier tricks to try to redirect the browser...)"); $end = " $SEPARATOR // Check if we were included by some other wiki version (getimg, en, ...) // or not. // If the server requested this index.php fire up the code by loading lib/main.php. // Parallel wiki scripts can now simply include /index.php for the // main configuration, extend or redefine some settings and // load lib/main.php by themselves. // This overcomes the index as config problem. $SEPARATOR // This doesn't work with php as CGI yet! if (defined('VIRTUAL_PATH') and defined('USE_PATH_INFO')) { if (\$HTTP_SERVER_VARS['SCRIPT_NAME'] == VIRTUAL_PATH) { include \"lib/main.php\"; } } else { if (defined('SCRIPT_NAME') and (\$HTTP_SERVER_VARS['SCRIPT_NAME'] == SCRIPT_NAME)) { include \"lib/main.php\"; } elseif (strstr(\$HTTP_SERVER_VARS['PHP_SELF'],'index.php')) { include \"lib/main.php\"; } } // (c-file-style: \"gnu\") // Local Variables: // mode: php // tab-width: 8 // c-basic-offset: 4 // c-hanging-comment-ender-p: nil // indent-tabs-mode: nil // End: ?> "; // end of configuration options /////////////////////////////// // begin class definitions /** * A basic index.php configuration line in the form of a variable. * * Produces a string in the form "$name = value;" * e.g.: * $WikiNameRegexp = "value"; */ class _variable { var $config_item_name; var $default_value; var $description; var $prefix; var $jscheck; function _variable($config_item_name, $default_value, $description, $jscheck = '') { $this->config_item_name = $config_item_name; $this->description = $description; $this->default_value = $default_value; $this->jscheck = $jscheck; if (preg_match("/variable/i",get_class($this))) $this->prefix = "\$"; elseif (preg_match("/ini_set/i",get_class($this))) $this->prefix = "ini_get: "; else $this->prefix = ""; } function value() { global $HTTP_POST_VARS; if (isset($HTTP_POST_VARS[$this->config_item_name])) return $HTTP_POST_VARS[$this->config_item_name]; else return $this->default_value; } function _config_format($value) { $v = $this->get_config_item_name(); // handle arrays: a|b --> a['b'] if (strpos($v, '|')) { list($a, $b) = explode('|', $v); $v = sprintf("%s['%s']", $a, $b); } return sprintf("\$%s = \"%s\";", $v, $value); } function get_config_item_name() { return $this->config_item_name; } function get_config_item_id() { return str_replace('|', '-', $this->config_item_name); } function get_config_item_header() { if (strchr($this->config_item_name,'|')) { list($var,$param) = explode('|',$this->config_item_name); return "" . $this->prefix . $var . "['" . $param . "']
get_config_item_id() . "\" style=\"color: green\">Input accepted.
"; } } class unchangeable_variable extends _variable { function _config_format($value) { return ""; } // function get_html() { return false; } function get_html() { return $this->get_config_item_header() . "Not editable." . "" . $this->default_value.""; } function _get_config_line($posted_value) { if ($this->description) $n = "\n"; return "${n}".$this->default_value; } function get_instructions($title) { global $tdwidth; $i = "
" . $this->default_value.""; return "
get_config_item_id() . "\" style=\"color: green\">Input accepted.
"; } } class _define_commented extends _define { function _get_config_line($posted_value) { if ($this->description) $n = "\n"; if ($posted_value == $this->default_value) return "${n}//" . $this->_config_format($posted_value); else if ($posted_value == '') return "${n}//" . $this->_config_format(""); else return "${n}" . $this->_config_format($posted_value); } } class _define_commented_optional extends _define_commented { function _config_format($value) { $name = $this->get_config_item_name(); return sprintf("if (!defined('%s')) define('%s', '%s');", $name, $name, $value); } } class _define_optional extends _define { function _config_format($value) { $name = $this->get_config_item_name(); return sprintf("if (!defined('%s')) define('%s', '%s');", $name, $name, $value); } } class _define_optional_notempty extends _define_optional { function get_html() { $s = $this->get_config_item_header() . "get_config_item_name() . "\" value=\"" . $this->default_value . "\" {$this->jscheck} />"; if (empty($this->default_value)) return $s . "get_config_item_id() . "\" style=\"color: red\">Cannot be empty.
"; else return $s . "get_config_item_id() . "\" style=\"color: green\">Input accepted.
"; } } class _variable_commented extends _variable { function _get_config_line($posted_value) { if ($this->description) $n = "\n"; if ($posted_value == $this->default_value) return "${n}//" . $this->_config_format($posted_value); else if ($posted_value == '') return "${n}//" . $this->_config_format(""); else return "${n}" . $this->_config_format($posted_value); } } class numeric_define_commented extends _define { // var $jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);\""; function get_html() { return numeric_define::get_html(); } function _get_config_line($posted_value) { if ($this->description) $n = "\n"; if ($posted_value == $this->default_value) return "${n}//" . $this->_config_format($posted_value); else if ($posted_value == '') return "${n}//" . $this->_config_format('0'); else return "${n}" . $this->_config_format($posted_value); } } class _define_selection extends _variable_selection { function _config_format($value) { return sprintf("define('%s', '%s');", $this->get_config_item_name(), $value); } function _get_config_line($posted_value) { return _define::_get_config_line($posted_value); } function get_html() { return _variable_selection::get_html(); } } class _define_selection_optional extends _define_selection { function _config_format($value) { $name = $this->get_config_item_name(); return sprintf("if (!defined('%s')) define('%s', '%s');", $name, $name, $value); } } class _variable_selection_optional extends _variable_selection { function _config_format($value) { $v = $this->get_config_item_name(); // handle arrays: a|b --> a['b'] if (strpos($v, '|')) { list($a, $b) = explode('|', $v); $v = sprintf("%s['%s']", $a, $b); } return sprintf("if (!isset(\$%s)) { \$%s = \"%s\"; }", $v, $v, $value); } } class _define_password extends _define { // var $jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\""; function _get_config_line($posted_value) { if ($this->description) $n = "\n"; if ($posted_value == '') { $p = "${n}//" . $this->_config_format(""); $p = $p . "\n// If you used the passencrypt.php utility to encode the password"; $p = $p . "\n// then uncomment this line:"; $p = $p . "\n//if (!defined('ENCRYPTED_PASSWD')) define('ENCRYPTED_PASSWD', true);"; return $p; } else { if (function_exists('crypt')) { $salt_length = max(CRYPT_SALT_LENGTH, 2 * CRYPT_STD_DES, 9 * CRYPT_EXT_DES, 12 * CRYPT_MD5, 16 * CRYPT_BLOWFISH); // generate an encrypted password $crypt_pass = crypt($posted_value, rand_ascii($salt_length)); $p = "${n}" . $this->_config_format($crypt_pass); return $p . "\ndefine('ENCRYPTED_PASSWD', true);"; } else { $p = "${n}" . $this->_config_format($posted_value); $p = $p . "\n// Encrypted passwords cannot be used:"; $p = $p . "\n// 'function crypt()' not available in this version of php"; $p = $p . "\ndefine('ENCRYPTED_PASSWD', false);"; return $p; } } } function get_html() { return _variable_password::get_html(); } } class _define_password_optional extends _define_password { function _config_format($value) { $name = $this->get_config_item_name(); return sprintf("if (!defined('%s')) define('%s', '%s');", $name, $name, $value); } } class _variable_password extends _variable { // var $jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' cannot be empty.', '^.+$', '" . $this->get_config_item_name() . "', this);\""; function get_html() { global $HTTP_POST_VARS, $HTTP_GET_VARS; $s = $this->get_config_item_header(); if (isset($HTTP_POST_VARS['create']) or isset($HTTP_GET_VARS['create'])) { $new_password = random_good_password(); $this->default_value = $new_password; $s .= "Created password: $new_passwordget_config_item_id() . "\" style=\"color: red\">Cannot be empty.
"; elseif (strlen($this->default_value) < 4) $s .= "get_config_item_id() . "\" style=\"color: red\">Must be longer than 4 chars.
"; else $s .= "get_config_item_id() . "\" style=\"color: green\">Input accepted.
"; return $s; } } class numeric_define extends _define { // var $jscheck = "onchange=\"validate_ereg('Sorry, \'%s\' is not an integer.', '^[-+]?[0-9]+$', '" . $this->get_config_item_name() . "', this);\""; function _config_format($value) { return sprintf("define('%s', %s);", $this->get_config_item_name(), $value); } function _get_config_line($posted_value) { if ($this->description) $n = "\n"; if ($posted_value == '') return "${n}//" . $this->_config_format('0'); else return "${n}" . $this->_config_format($posted_value); } } class list_variable extends _variable { function _get_config_line($posted_value) { // split the phrase by any number of commas or space characters, // which include " ", \r, \t, \n and \f $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY); $list_values = join("|", $list_values); return _variable::_get_config_line($list_values); } function get_html() { $list_values = explode("|", $this->default_value); $rows = max(3, count($list_values) +1); $list_values = join("\n", $list_values); $ta = $this->get_config_item_header(); $ta .= ""; $ta .= "get_config_item_id() . "\" style=\"color: green\">Input accepted.
"; return $ta; } } class array_variable extends _variable { function _config_format($value) { return sprintf("\$%s = array(%s);", $this->get_config_item_name(), $value); } function _get_config_line($posted_value) { // split the phrase by any number of commas or space characters, // which include " ", \r, \t, \n and \f $list_values = preg_split("/[\s,]+/", $posted_value, -1, PREG_SPLIT_NO_EMPTY); if (!empty($list_values)) { $list_values = "'".join("', '", $list_values)."'"; return "\n" . $this->_config_format($list_values); } else return "\n//" . $this->_config_format(''); } function get_html() { $list_values = join("\n", $this->default_value); $rows = max(3, count($this->default_value) +1); $ta = $this->get_config_item_header(); $ta .= ""; $ta .= "get_config_item_id() . "\" style=\"color: green\">Input accepted.
"; return $ta; } } class _ini_set extends _variable { function value() { global $HTTP_POST_VARS; if ($v = $HTTP_POST_VARS[$this->config_item_name]) return $v; else { return ini_get($this->get_config_item_name); } } function _config_format($value) { return sprintf("ini_set('%s', '%s');", $this->get_config_item_name(), $value); } function _get_config_line($posted_value) { if ($posted_value && ! $posted_value == $this->default_value) return "\n" . $this->_config_format($posted_value); else return "\n//" . $this->_config_format($this->default_value); } } class boolean_define extends _define { function _get_config_line($posted_value) { if ($this->description) $n = "\n"; return "${n}" . $this->_config_format($posted_value); } function _config_format($value) { if (strtolower(trim($value)) == 'false') $value = false; return sprintf("define('%s', %s);", $this->get_config_item_name(), (bool)$value ? 'true' : 'false'); } function get_html() { $output = $this->get_config_item_header(); $output .= '\n"; return $output; } } class boolean_define_optional extends boolean_define { function _config_format($value) { $name = $this->get_config_item_name(); return "if (!defined('$name')) " . boolean_define::_config_format($value); } } class boolean_define_commented extends boolean_define { function _get_config_line($posted_value) { if ($this->description) $n = "\n"; list($default_value, $label) = each($this->default_value); if ($posted_value == $default_value) return "${n}//" . $this->_config_format($posted_value); else if ($posted_value == '') return "${n}//" . $this->_config_format('false'); else return "${n}" . $this->_config_format($posted_value); } } class boolean_define_commented_optional extends boolean_define_commented { function _config_format($value) { $name = $this->get_config_item_name(); return "if (!defined('$name')) " . boolean_define_commented::_config_format($value); } } class part extends _variable { function value () { return; } function get_config($posted_value) { $d = stripHtml($this->_get_description()); global $SEPARATOR; return "\n".$SEPARATOR . str_replace("\n", "\n// ", $d) ."\n$this->default_value"; } function get_instructions($title) { $group_name = preg_replace("/\W/","",$title); $i = ".*?|
|
$par
"; $text .= $par; } return $text; } function stripHtml($text) { $d = str_replace("", "", $text); $d = str_replace("", "", $d); $d = str_replace("
", "", $d); $d = str_replace("
", "", $d); //restore html entities into characters // http://www.php.net/manual/en/function.htmlentities.php $trans = get_html_translation_table (HTML_ENTITIES); $trans = array_flip ($trans); $d = strtr($d, $trans); return $d; } /** * Seed the random number generator. * * better_srand() ensures the randomizer is seeded only once. * * How random do you want it? See: * http://www.php.net/manual/en/function.srand.php * http://www.php.net/manual/en/function.mt-srand.php */ function better_srand($seed = '') { static $wascalled = FALSE; if (!$wascalled) { if ($seed === '') { list($usec,$sec)=explode(" ",microtime()); if ($usec > 0.1) $seed = (double) $usec * $sec; else // once in a while use the combined LCG entropy $seed = (double) 1000000 * substr(uniqid("",true),13); } if (function_exists('mt_srand')) { mt_srand($seed); // mersenne twister } else { srand($seed); } $wascalled = TRUE; } } function rand_ascii($length = 1) { better_srand(); $s = ""; for ($i = 1; $i <= $length; $i++) { // return only typeable 7 bit ascii, avoid quotes if (function_exists('mt_rand')) // the usually bad glibc srand() $s .= chr(mt_rand(40, 126)); else $s .= chr(rand(40, 126)); } return $s; } //// // Function to create better user passwords (much larger keyspace), // suitable for user passwords. // Sequence of random ASCII numbers, letters and some special chars. // Note: There exist other algorithms for easy-to-remember passwords. function random_good_password ($minlength = 5, $maxlength = 8) { $newpass = ''; // assume ASCII ordering (not valid on EBCDIC systems!) $valid_chars = "!#%&+-.0123456789=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"; $start = ord($valid_chars); $end = ord(substr($valid_chars,-1)); better_srand(); if (function_exists('mt_rand')) // mersenne twister $length = mt_rand($minlength, $maxlength); else // the usually bad glibc rand() $length = rand($minlength, $maxlength); while ($length > 0) { if (function_exists('mt_rand')) $newchar = mt_rand($start, $end); else $newchar = rand($start, $end); if (! strrpos($valid_chars,$newchar) ) continue; // skip holes $newpass .= sprintf("%c",$newchar); $length--; } return($newpass); } // debugging function printArray($a) { echo "\n"; print_r($a); echo "\n\n
The configuration was written to $config_file
.
A backup was made to $new_filename
.
You must rename or copy this $config_file
file to index.php
.
A configuration file could not be written. You should copy the above configuration to a file, and manually save it as index.php
.
Here's the configuration file based on your answers:
\n"; echo "To make any corrections, edit the settings again.
\n"; } else { // first time or create password $posted = $GLOBALS['HTTP_POST_VARS']; /* No action has been specified - we make a form. */ echo ' '; } ?>