'add-note.css']); // Copy over "sect" and "redirect" from GET to POST if (empty($_POST['sect']) && isset($_GET['sect'])) { $_POST['sect'] = $_GET['sect']; } if (empty($_POST['redirect']) && isset($_GET['redirect'])) { $_POST['redirect'] = $_GET['redirect']; } // Assume English if we didn't get a language if (empty($_POST['repo'])) { $_POST['repo'] = 'en'; } // Decide on whether all vars are present for processing $process = true; $needed_vars = ['note', 'user', 'sect', 'redirect', 'action', 'func', 'arga', 'argb', 'answer']; foreach ($needed_vars as $varname) { if (empty($_POST[$varname])) { $process = false; break; } } // We have a submitted form to process if ($process) { // Clean off leading and trailing whitespace $user = trim($_POST['user']); $note = trim($_POST['note']); // Convert all line-endings to unix format, // and don't allow out-of-control blank lines $note = str_replace(["\r\n", "\r"], "\n", $note); $note = preg_replace("/\n{2,}/", "\n\n", $note); // Don't pass through example username if ($user === "user@example.com") { $user = "Anonymous"; } // We don't know of any error now $error = false; // No note specified if (strlen($note) == 0) { $error = "You have not specified the note text."; } // SPAM challenge failed elseif (!test_answer($_POST['func'], $_POST['arga'], $_POST['argb'], $_POST['answer'])) { $error = 'SPAM challenge failed.'; } // The user name contains a malicious character elseif (stristr($user, "|")) { $error = "You have included bad characters within your username. We appreciate you may want to obfuscate your email further, but we have a system in place to do this for you."; } // Check if the note is too long elseif (strlen($note) >= 4096) { $error = "Your note is too long. You'll have to make it shorter before you can post it. Keep in mind that this is not the place for long code examples!"; } // Check if the note is not too short elseif (strlen($note) < 32) { $error = "Your note is too short. Trying to test the notes system? Save us the trouble of deleting your test, and don't. It works."; } // Check if any line is too long else { // Split the note by whitespace, and check length foreach (preg_split("/\\s+/", $note) as $chunk) { if (strlen($chunk) > 120) { $error = "Your note contains a bit of text that will result in a line that is too long, even after using wordwrap()."; break; } } } // No error was found, and the submit action is required if (!$error && strtolower($_POST['action']) !== "preview") { $redirip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? ($_SERVER['HTTP_VIA'] ?? ''); // Post the variables to the central user note script $result = posttohost( "https://main.php.net/entry/user-note.php", [ 'user' => $user, 'note' => $note, 'sect' => $_POST['sect'], 'ip' => $_SERVER['REMOTE_ADDR'], 'redirip' => $redirip, ], ); // If there is any non-header result, then it is an error if ($result) { if (strpos($result, '[TOO MANY NOTES]') !== false) { echo "

As a security precaution, we only allow a certain number of notes to be submitted per minute. At this time, this number has been exceeded. Please re-submit your note in about a minute.

"; } elseif (($pos = strpos($result, '[SPAMMER]')) !== false) { $ip = trim(substr($result, $pos + 9)); $spam_url = $ip_spam_lookup_url . $ip; echo '

Your IP is listed in one of the spammers lists we use, which aren\'t controlled by us. More information is available at ' . $spam_url . '.

'; } elseif (strpos($result, '[SPAM WORD]') !== false) { echo '

Your note contains a prohibited (usually SPAM) word. Please remove it and try again.

'; } elseif (strpos($result, '[CLOSED]') !== false) { echo '

Due to some technical problems this service isn\'t currently working. Please try again later. Sorry for any inconvenience.

'; } else { echo ""; echo "

There was an internal error processing your submission. Please try to submit again later.

"; } } // There was no error returned else { echo '

Your submission was successful -- thanks for contributing! Note ', 'that it will not show up for up to a few hours, ', 'but it will eventually find its way.

'; } // Print out common footer, and end page site_footer(); exit(); } // There was an error, or a preview is needed // If there was an error, print out if ($error) { echo "

$error

\n"; } // Print out preview of note echo '

This is what your entry will look like, roughly:

'; echo '
'; manual_note_display(new UserNote('', '', '', time(), $user, $note)); echo '


'; } // Any needed variable was missing => display instructions else { ?>

Adding a note to the manual

User Contributed Notes 3 notes

up
3
Anonymous
1 year ago
eval() is the best for all sorts of things
up
1
rasmus () lerdorf ! com
2 days ago
If eval() is the answer, you're almost certainly asking the wrong question.
up
0
spam () spam ! spam
1 hour ago
egg bacon sausage spam spam baked beans

Thou shall not enter! (No, really, don't)

User notes may be edited or deleted for any reason, whether in the list above or not!

Email address conversion

We have a simple conversion in place to convert the @ signs and dots in your address. You may still want to include a part in the email address that is understandable only by humans as our conversion can be performed in the opposite direction. You may submit your email address as user@NOSPAM.example.com for example (which will be displayed as user at NOSPAM dot example dot com. If we remove your note we can only send an email if you use your real email address.

Formatting

Note that HTML tags are not allowed in the posts, but the note formatting is preserved. URLs will be turned into clickable links, PHP code blocks enclosed in the PHP tags <?php and ?> will be source highlighted automatically. So always enclose PHP snippets in these tags. Double-check that your note appears as you want during the preview; that's why it is there!

Additional information

Please note that periodically the developers go through the notes and may incorporate information from them into the documentation. This means that any note submitted here becomes the property of the PHP Documentation Group and will be available under the same license as the documentation.

Your IP Address will be logged with the submitted note and made public on the PHP manual user notes mailing list. The IP address is logged as part of the notes moderation process, and won't be shown within the PHP manual itself.

It may take up to an hour for your note to appear in the documentation.

The SPAM challenge requires numbers to written out in English, so, an appropriate answer may be nine but not 9.

To add a note, you must click on the "Add Note" button (the plus sign) ', 'on the bottom of a manual page so we know where to add the note!

'; } // Everything is in place, so we can display the form else {?>

Click here to go to the support pages.
Click here to submit an issue about the documentation.
Click here to submit an issue about PHP itself.
(Again, please note, if you ask a question, report an issue, or request a feature, your note will be deleted.)
:
:
:
?
(Example: nine)