diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-04-17 17:00:33 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-04-17 17:00:33 +0000 |
| commit | d2db3f75bce2f824d5a9d19c0323a934a3e77167 (patch) | |
| tree | 75fb3be592500257290f54cc22650403250261f8 /phpBB/includes/functions_user.php | |
| parent | 37f8fbb5f73a523bed4724296a2d855abcaff476 (diff) | |
| download | forums-d2db3f75bce2f824d5a9d19c0323a934a3e77167.tar forums-d2db3f75bce2f824d5a9d19c0323a934a3e77167.tar.gz forums-d2db3f75bce2f824d5a9d19c0323a934a3e77167.tar.bz2 forums-d2db3f75bce2f824d5a9d19c0323a934a3e77167.tar.xz forums-d2db3f75bce2f824d5a9d19c0323a934a3e77167.zip | |
Some change-arounds ... hopefully not introducing problems ...
git-svn-id: file:///svn/phpbb/trunk@3870 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_user.php')
| -rw-r--r-- | phpBB/includes/functions_user.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index d6dd83e723..40eaaf2cfc 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -19,6 +19,46 @@ * ***************************************************************************/ +// Does supplementary validation of optional profile fields. This +// expects common stuff like trim() and strip_tags() to have already +// been run. Params are passed by-ref, so we can set them to the empty +// string if they fail. +function validate_optional_fields(&$icq, &$aim, &$msnm, &$yim, &$website, &$location, &$occupation, &$interests, &$sig) +{ + $check_var_length = array('aim', 'msnm', 'yim', 'location', 'occupation', 'interests', 'sig'); + + for($i = 0; $i < count($check_var_length); $i++) + { + if (strlen($$check_var_length[$i]) < 2) + { + $$check_var_length[$i] = ''; + } + } + + // ICQ number has to be only numbers. + if (!preg_match('/^[0-9]+$/', $icq)) + { + $icq = ''; + } + + // website has to start with http://, followed by something with length at least 3 that + // contains at least one dot. + if ($website != '') + { + if (!preg_match('#^http[s]?:\/\/#i', $website)) + { + $website = 'http://' . $website; + } + + if (!preg_match('#^http[s]?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $website)) + { + $website = ''; + } + } + + return; +} + // Handles manipulation of user data. Primary used in registration // and user profile manipulation class userdata extends user |
