Internet Programming lab 3

Due: Tuesday Dec 2 at 11:59pm

summary : You are going to create a web based submission system in php.


 The submit system should have functionality similar to the existing  java based system. You should implement at least the following functionality.

Implementation technology.

I'm having trouble with getting something on csdev01 at the moment. I'm going to suggest using (quick php)

It was brought to my attention that QuickPHP is doing something odd with file uploads. The PHP server allows file uploads, but the files array is always empty. I used the following script to investigate what superglobals had values and what they were:

print("Get array:<br>");
print("POST array:<br>");
print("FILES array:<br>");
print("COOKIE array:<br>");
print("SESSION ARRAY:<br>");
print("SERVER ARRAY:<br>");
print("ENV ARRAY:<br>");
<form enctype="multipart/form-data" action="test.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />

This is what was produced for a sample result for a small binary file:
Get array:
Array ( ) POST array:
Array ( [-----------------------------23281168279961 Content-Disposition:_form-data;_name] => \"MAX_FILE_SIZE\" 100000 -----------------------------23281168279961 Content-Disposition: form-data; name=\"uploadedfile\"; filename=\"\" Content-Type: application/octet-stream ISc(\0p\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0­\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0PзïÒÊÔ³M\0Z#Ý\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0½®÷ºÒN}J¢¶Î% k™ËË»Þ3”>B›f»ùîb ) FILES array:
Array ( ) COOKIE array:
Array ( [DOCUMENT_ROOT] => C:\workspace [GATEWAY_INTERFACE] => CGI/1.1 [HTTP_HOST] => localhost:5723 [HTTP_USER_AGENT] => Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/2008102920 Firefox/3.0.4 [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 [HTTP_ACCEPT_LANGUAGE] => en-us,en;q=0.5 [HTTP_ACCEPT_ENCODING] => gzip,deflate [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 [HTTP_KEEP_ALIVE] => 300 [HTTP_CONNECTION] => keep-alive [HTTP_REFERER] => http://localhost:5723/test.php [HTTP_CONTENT_TYPE] => multipart/form-data; boundary=---------------------------23281168279961 [HTTP_CONTENT_LENGTH] => 832 [QUERY_STRING] => [REDIRECT_STATUS] => 200 [REMOTE_ADDR] => [REMOTE_PORT] => 1233 [REQUEST_METHOD] => POST [REQUEST_URI] => /test.php [SCRIPT_FILENAME] => C:\workspace\test.php [SCRIPT_NAME] => /test.php [SERVER_ADDR] => [SERVER_NAME] => localhost [SERVER_PORT] => 5723 [SERVER_PROTOCOL] => HTTP/1.1 [SERVER_SIGNATURE] =>
QuickPHP/1.4.0 Server at localhost Port 5723

As you can see from the sample output, the uploaded file information (includeing the stream for the file itself) is being stored in the post array rather than the files array for some reason.

Those of you using quick php have two choices
  1. check both the post and files array so that your application will work for either web server
  2. tell me in your writeup that your app only works using quickphp and I'll grade them using quickphp.

If you have an apache setup you want to try this site sent to me by one of your classmates that might help.

for those who want to do the work on your windows machines. I'm going to have you submit your php and supporting files only. I'll run them on my private web server. For those of you who did the project using quickphp, If your stuff doesn't work on apache, I'll get a copy and a windows machine myself and try your work out.


Its been brought to my attention that I did not formally specify a writeup. As always, you will need to include a writeup of your project with your submission of the project. The writeup should include at least:

submit as usual on csdev01. Use scp/winscp to copy your files to csdev01 when done.