Location: PHPKode > scripts > phpEmailUser > config.inc.php
<?php
// mysql database
$mysqlhost = "localhost";
$mysqluser = "root";
$mysqlpass = "";
$mysqldb = "phpemailuser";

// environment, paths
// we should be able to automatically retrieve them
// if there are problems with the paths, enter them manually
$dirurl = dirname(curPageURL());
//echo "my url: ".$dirurl."<br>";
$dirpath = dirname($_SERVER["SCRIPT_FILENAME"]);
//echo "my server path: ".$dirpath."<br>";


// user login / registration settings
$needactivation = true; // do we request email-activation from user?
$activationkeyexpire = 48; // email activation key expires after ? hours
$minpasslen = 4; // minimum required length for password

// wrong password timeout
$enableattemptlimit = true; // if false, user can try wrong passwords as often as he/she wants
$allowedattempts = 5;
$loginfailtimeout = 15; // minutes blocked after failed login attempts (wrong password provided too often)

// include mathcaptcha for registration and resend password/activation?
$inclmathcaptcha = true;

// info about your site (this info will appear in the confirmation email
$sitename = 'mycoolsite'; // e.g. your company name
$sendfromemail = 'hide@address.com';

// open this page after successful login
$startpage = 'mypage.php';

// setup for fields: array $fieldnames
// the array keys (e.g. "first_name") have to be identical to the mysql column names for user-input data (tables user and userdata) => dont change key names!
// if required we can add more columns to the mysql tables 'user' and 'userdata', but they must be all strings or date(time); then they will be automatically used in the registration form; just add them to $fieldnames; also (if you add new columns tables user or userdata) make sure that there are no duplicate column names between and within tables user and userdata
//---------------------------------
// array $fieldnames (see below):
//---------------------------------
// first value = the displayed field names (e.g. "First Name") in the registration form; you can change these names, fields that are not in use can be used for something else by renaming them for the user interface
// second value: display in form? "yes" or "no"
// third value: required field? "yes" or "no" (if "no", we allow user to leave field empty when entering data)
// (if you have displayed=no and required=yes for any field, display=no overrides required)
// (user_email and password must be displayed and are required! => set both values to "yes", otherwise the database will explode)
// forth value: regular expression to check entered data with preg_match
// you can choose the order of the entries in array $fieldnames => it will set the order of the displayed fields in the registration form
// you can also just comment out fields in this list; this has the same effect as display=no; don't comment out user_email and password!
$fieldnames = array(
	// these fields are in table user
	"user_email" => array("User Email","yes","yes","//"),	// has to be yes for both, displayed and required! email addresses are checked with checkdnsrr and filter_var, so i dont have to specify a string for preg_match (however, if a string is provided, preg_match will check it)
	"password" => array("Password","yes","yes","//"),	// has to be yes for both, displayed and required! i dont use preg_match for passwords, since they will be md5 encrypted
	"first_name" => array("First Name","yes","yes","/^[A-Za-z' -]{1,50}$/"),
	"last_name" => array("Last Name","yes","yes","/^[A-Za-z' -]{1,50}$/"),
	// these fields are in table userdata, this table could be used for e.g. multiple addresses per registered user
	"ship_first_name" => array("First Name","no","no","/^[A-Za-z' -]{1,50}$/"),
	"ship_last_name" => array("Last Name","no","no","/^[A-Za-z' -]{1,50}$/"),
	"street" => array("Street","yes","no","/^[A-Za-z0-9.,' -]{1,50}$/"),
	"street2" => array("Street Line 2","yes","no","/^[A-Za-z0-9.,' -]{1,50}$/"),
	"city" => array("City","yes","no","/^[A-Za-z0-9.,' -]{1,50}$/"),
	"state" => array("State","yes","no","/^[A-Za-z0-9.,' -]{1,50}$/"),
	"zip" => array("Zip","yes","no","/^[0-9]{5,5}(\-[0-9]{4,4})?$/"),
	"country" => array("Country","yes","no","/^[A-Za-z0-9.,' -]{1,50}$/"),
	"phone" => array("Phone","yes","no","/^[0-9)(xX -]{7,20}$/"),
  "fax" => array("Fax","yes","no","/^[0-9)(xX -]{7,20}$/"));


// there is of course a single row per user in mysql table user (contains email address, an internal user id, etc.)
// but there could be multiple rows linked to a single user in table userdata (e.g. maybe our main application will allow adding multiple addresses for a single user)
// should we display the fields from userdata (address fields) in our account-data-change user interface (login_reg_change.php)?
// (if our main application will have a separate interface to let user add/change addresses, we may want to suppress display of these fields in our simple interface)
// also, our interface checks if there are multiple rows assigned to current user in userdata; if yes, we automatically exclude them from display our simple account-data-change user interface
$addrchange_disp = true;


// default status of the value 'blocked' is 0 (n); if admin changes this status to 1 (y), we prevent user from logging in, and display this warning message:
$blockedwarning = "Your account has been temporarily disabled. This could be due to website maintenance.<br>
If the problem persists, please contact $sendfromemail.";


// userlevels; the available user levels, stored in database as integers
// choosing a userlevel has no meaning to this user account management system
// but i implemented it and made it accessible to admin, since it may be useful for main application
$userlevels = array(
	1 => "user"
	,2 => "superuser"
//	,3 => "hyperuser"
//	,4 => "useroftheyear"
	);
	


function curPageURL() {
 $pageURL = 'http';
 if (@$_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}

?>
Return current item: phpEmailUser