function check_text_input_in_array($var, $arr, $errname, $erraddr) { $ret = $var; if (!in_array($ret, $arr)) { do_err($erraddr, $errname . " not found"); } return $ret; }
/** * Validate that this plugin is configured correctly * * @return boolean Whether or not there was a * configuration error for this plugin. * */ function demo_check_configuration_do() { // test for something that this plugin requires, print error if // misconfigured or requirements are missing // if (FALSE) { do_err('Demo plugin is missing something important', FALSE); return TRUE; // return FALSE if you only want to display a non-critical error } return FALSE; }
do_err($dbtype . ' database support not present!'); } else { // Non-fatal error do_err($dbtype . ' database support not present or not configured! Trying to dynamically load ' . $dbtype . ' extension. Please note that it is advisable to not rely on dynamic loading of extensions.', FALSE); } // now, test this interface: $dbh = DB::connect($dsn, true); if (DB::isError($dbh)) { do_err('Database error: ' . htmlspecialchars(DB::errorMessage($dbh)) . ' in ' . $type . ' DSN.'); } $dbh->disconnect(); echo "{$IND}{$type} database connect successful.<br />\n"; } } else { $db_error = 'Required PHP PEAR DB support is not available.' . ' Is PEAR installed and is the include path set correctly to find <tt>DB.php</tt>?' . ' The include path is now: "<tt>' . ini_get('include_path') . '</tt>".'; do_err($db_error); } } else { echo $IND . "not using database functionality.<br />\n"; } ?> <p>Congratulations, your SquirrelMail setup looks fine to me!</p> <p><a href="login.php">Login now</a></p> </body> </html>
do_err($erraddr3, "Email in use"); } // check username still available $result = doSQL("select * from users where username=?;", $username) or do_err($erraddr1, "Database Error"); if (is_array($result)) { // no, exists, quit do_err($erraddr1, "Username in use"); } // check recaptcha $rcc = $_POST["rcc"]; $rcr = $_POST["rcr"]; $rch = base64_decode($_POST["rch"]); $rcstr = $_SERVER["REMOTE_ADDR"] . "836429" . $rcc . "7364528" . $rcr; if (!(crypt($rcstr, $rch) === $rch)) { do_err($erraddrrc, "The reCAPTCHA was wrong " . $rcerr); } // hash password // create a random salt $salt = "\$2y\$10\$" . bin2hex(openssl_random_pseudo_bytes(22)); // Hash the password with the salt $hash = crypt($password, $salt); // insert user $result = doSQL("insert into users (username, password, email) values (?, ?, ?);", $username, $hash, $email) or do_err($erraddr3, "Database Error"); $nid = $db->insert_id; // signin sessionstart($nid); // jump header('Location: ../account/index.php?signup=1'); ?>
echo "{$IND} LDAP connect to " . $param['host'] . " successful: " . $linkid . "<br />\n"; if (!empty($param['protocol']) && !ldap_set_option($linkid, LDAP_OPT_PROTOCOL_VERSION, $param['protocol'])) { do_err('Unable to set LDAP protocol'); } if (empty($param['binddn'])) { $bind = ldap_bind($linkid); } else { $bind = ldap_bind($param['binddn'], $param['bindpw']); } if ($bind) { echo "{$IND} LDAP Bind Successful <br />"; } else { do_err('Unable to Bind to LDAP Server'); } ldap_close($linkid); } else { do_err('Connection to LDAP failed'); } } } } ?> <p>Congratulations, your SquirrelMail setup looks fine to me!</p> <p><a href="login.php">Login now</a></p> </body> </html> <?php // vim: et ts=4
if (isset($db_functions[$dbtype]) && function_exists($db_functions[$dbtype])) { echo "{$IND}{$dbtype} database support present.<br />\n"; // now, test this interface: $dbh = DB::connect($dsn, true); if (DB::isError($dbh)) { do_err('Database error: ' . htmlspecialchars(DB::errorMessage($dbh)) . ' in ' . $type . ' DSN.'); } $dbh->disconnect(); echo "{$IND}{$type} database connect successful.<br />\n"; } else { do_err($dbtype . ' database support not present!'); } } } else { do_err('Required PHP PEAR DB support is not available. Is PEAR installed and is the include path set correctly to find <tt>DB.php</tt>? The include path is now: "<tt>' . ini_get('include_path') . '</tt>".'); } } else { echo $IND . "not using database functionality.<br />\n"; } ?> <p>Congratulations, your SquirrelMail setup looks fine to me!</p> <p><a href="login.php">Login now</a></p> </body> </html> <?php // vim: et ts=4