LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-27-2012, 06:10 AM   #1
Elmware
Member
 
Registered: May 2006
Location: Canada
Distribution: Slackware 13 and fedora 15
Posts: 32

Rep: Reputation: 0
Question 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:
Code:
<?php
$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>
<head>
<title>
Binary Decoder
</title>
</head>

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

// 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>
</body>
</html>\r\n";
}
?>
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.

Last edited by Elmware; 12-27-2012 at 06:12 AM.
 
Old 12-27-2012, 06:52 AM   #2
rylan76
Senior Member
 
Registered: Apr 2004
Location: Potchefstroom, South Africa
Distribution: Fedora 17 - 3.3.4-5.fc17.x86_64
Posts: 1,552

Rep: Reputation: 103Reputation: 103
Check your

post_max_size

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?
 
Old 01-03-2013, 11:38 PM   #3
Elmware
Member
 
Registered: May 2006
Location: Canada
Distribution: Slackware 13 and fedora 15
Posts: 32

Original Poster
Rep: Reputation: 0
Thankks for the response.

Apparently, it shows in PHP.ini as:
Quote:
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
processing forms with PHP 3vra Programming 15 02-16-2009 02:28 PM
processing email forms with php 3vra Programming 4 01-23-2009 03:27 PM
master - details forms with php htamayo Programming 1 04-09-2008 04:48 PM
LXer: Html Forms and PHP LXer Syndicated Linux News 0 01-09-2007 01:33 AM
Best mailer to use for a website with PHP email forms gbkyle Linux - Software 1 07-07-2005 04:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration