aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorPaul S. Owen <psotfx@users.sourceforge.net>2003-01-08 18:27:16 +0000
committerPaul S. Owen <psotfx@users.sourceforge.net>2003-01-08 18:27:16 +0000
commitf236f3f838bd133f15d1f1caf8e15de8cb91bd37 (patch)
tree27f7daaa50dc37dd0bd866588c518c867b63f41d /phpBB/includes/functions.php
parentf58083b8af9e09cec182791b3e2ac72de6c7ee82 (diff)
downloadforums-f236f3f838bd133f15d1f1caf8e15de8cb91bd37.tar
forums-f236f3f838bd133f15d1f1caf8e15de8cb91bd37.tar.gz
forums-f236f3f838bd133f15d1f1caf8e15de8cb91bd37.tar.bz2
forums-f236f3f838bd133f15d1f1caf8e15de8cb91bd37.tar.xz
forums-f236f3f838bd133f15d1f1caf8e15de8cb91bd37.zip
Updates as opposed to downdates
git-svn-id: file:///svn/phpbb/trunk@3284 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php26
1 files changed, 16 insertions, 10 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 50d495f6b8..8e80b1de8d 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -671,16 +671,22 @@ function redirect($url)
$db->sql_close();
}
- $protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
- $server = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['server_name']));
- $path = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($config['script_path']));
- $port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/';
+ $server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://';
+ $server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['server_name']));
+ $server_port = ($config['server_port'] <> 80) ? ':' . trim($config['server_port']) . '/' : '/';
+ $script_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($config['script_path']));
+ $url = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($url));
+ // Redirect via an HTML form for PITA webservers
if (@preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')))
{
- header('HTTP/1.0 302 Redirect');
+ header('Refresh: 0; URL=' . $server_protocol . $server_name . $server_port . $script_name . $url);
+ echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta http-equiv="refresh" content="0; url=' . $server_protocol . $server_name . $server_port . $script_name . $url . '"><title>Redirect</title></head><body><div align="center">If your browser does not support meta redirection please click <a href="' . $server_protocol . $server_name . $server_port . $script_name . $url . '">HERE</a> to be redirected</div></body></html>';
+ exit;
}
- header('Location: ' . $protocol . $server . $path . $port . $url);
+
+ // Behave as per HTTP/1.1 spec for others
+ header('Location: ' . $server_protocol . $server_name . $server_port . $script_name . $url);
exit;
}
@@ -691,7 +697,7 @@ function validate_username($username)
{
global $db, $user;
- $username = sql_quote($username);
+ $username = $db->sql_escape($username);
$sql = "SELECT username
FROM " . USERS_TABLE . "
@@ -719,7 +725,7 @@ function validate_username($username)
while ($row = $db->sql_fetchrow($result))
{
- if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['disallow_username'])) . ')\b#i', $username))
+ if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['disallow_username'], '#')) . ')\b#i', $username))
{
return $user->lang['Username_disallowed'];
}
@@ -731,7 +737,7 @@ function validate_username($username)
while ($row = $db->sql_fetchrow($result))
{
- if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['word'])) . ')\b#i', $username))
+ if (preg_match('#\b(' . str_replace('\*', '.*?', preg_quote($row['word'], '#')) . ')\b#i', $username))
{
return $user->lang['Username_disallowed'];
}
@@ -761,7 +767,7 @@ function validate_email($email)
while ($row = $db->sql_fetchrow($result))
{
- if (preg_match('/^' . str_replace('*', '.*?', $row['ban_email']) . '$/is', $email))
+ if (preg_match('#^' . str_replace('*', '.*?', $row['ban_email']) . '$#is', $email))
{
return $user->lang['Email_banned'];
}