Skip to content

Commit 3f53bae

Browse files
committed
Limit username length to 16 characters
According to master.php.net database username field of varchar(16) the maximum length for Git usernames is 16 characters.
1 parent 8283c32 commit 3f53bae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

git-php.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
// Check for errors
5959
if (empty($_POST['id'])) {
6060
$error .= "You must supply a desired Git user id. <br>";
61-
} elseif(!preg_match('!^[a-z]\w+$!', $_POST['id'])) {
62-
$error .= "Your user id must be >1 char long, start with ".
61+
} elseif(!preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) > 16) {
62+
$error .= "Your user id must be from 1-16 characters long, start with ".
6363
"a letter and contain nothing but a-z, 0-9, and _ <br>";
6464
}
6565
if (empty($_POST['fullname'])) {
@@ -394,7 +394,7 @@ class="max" value="<?php if (isset($_POST['email'])) echo clean($_POST['email'])
394394
<td><input type="checkbox" name="guidelines" value="1" id="vcs-guidelines"> <label for="vcs-guidelines">Check the box if you agree</label></td>
395395
</tr>
396396
<tr>
397-
<th class="subr">User ID:<br> <small>(single word, lower case)</small></th>
397+
<th class="subr">User ID:<br> <small>(single word, lower case, max 16 characters)</small></th>
398398
<td><input type="text" size="10" name="id"
399399
class="max" value="<?php if (isset($_POST['id'])) echo clean($_POST['id']);?>"></td>
400400
</tr>

0 commit comments

Comments
 (0)