-   Linux - General (
-   -   Anybody having this issue with PHP scripts using forms? (

Elmware 12-27-2012 07:10 AM

Anybody having this issue with PHP scripts using forms?
So I wrote a simple PHP script which uses a form. The form submits fine if there is less than 113 characters, however, if I submit 113 or more characters in the field, I keep getting a 403 - forbidden message.

If it's of any help, here is the actual code:

$script_file = basename($_SERVER['SCRIPT_NAME']);
$script_path = str_replace("/".$script_file, "",$_SERVER['SCRIPT_FILENAME']);

if (isset($_POST['codedMsg'])) $codedMsg = $_POST['codedMsg'];
  else $codedMsg = "";

echo '<html>
Binary Decoder

<form method="post" action="'.$script_file.'">
<textarea name="codedMsg" cols="80" rows="5" style="border: #000000 1px solid;"></textarea>
<br><input type="submit" value="Decode">

// Strip entry to bare 0s and 1s.
for ($i = 0; $i < 48; $i++) $codedMsg = str_replace(chr($i), '', "$codedMsg");
for ($i = 50; $i < 256; $i++) $codedMsg = str_replace(chr($i), '', "$codedMsg");

if (is_numeric($codedMsg)) {
  $len = strlen($codedMsg);
  $fraLen = $len / 8;
  $totChars = floor($fraLen);
  for($i = 0; $i < $totChars; $i++) {
    $num = $i * 8;
    $binChar[] = bindec(substr("$codedMsg", $num, 8));
// substr
  echo "<b>Decoded:</b><p>";
  for ($i = 0; $i < count($binChar); $i++) echo chr($binChar[$i]);
  echo "</p>

I think the issue is with the server itself though.

I've even tried to lookup this problem on Google, and the results are from messages posted about mod_secure issues over a couple years ago, which is different than this problem.

rylan76 12-27-2012 07:52 AM

Check your


PHP parameter? What is it set to?

113 chars sounds obscenely small though, but the above config setting is the first place to start checking?

What "kind" of PHP are you running? One you compiled yourself or a binary package?

Elmware 01-04-2013 12:38 AM

Thankks for the response.

Apparently, it shows in PHP.ini as:

post_max_size = 8M
Both PHP and HTTPD were installed using the Software Management that comes with fedora 16. Updates are done whenever Apper notifies me.

All times are GMT -5. The time now is 04:23 PM.