Internet Programming lab 3
Due: Tuesday Dec 2 at 11:59pm
summary : You are going to create a web based submission system in php.
Details:
The submit system should have functionality similar to the
existing java based system. You should implement at least the
following functionality.
- There needs to be an authentication system
- the user needs a way to register
- created the users submit directory when they register.
- once registered the user needs to be able to log in
- There should be a way for the faculty member to change which classes are represented each semester without touching any code
- There should be a way for the user to select a file to submit
- the directory structure for submitted files should have the following form
- <submit master dir>/<class>/<username>/<files>
- there should be a way for the student/user to view the file names, sizes and dates of the files that they submit.
- of course there should be no way to see anyone elses files.
- Grad student extra features: (to be completed by grad students)
- have a way to display the contents of a zip file in the view submissions view
- include a time stamp in the name files submitted (eg
11-1-08myfile.zip) but do not display these timestamps when showing the
students what they submitted.( so the above should look to the student
like myfile.zip)
Implementation technology.
I'm having trouble with getting something on csdev01 at the moment. I'm going to suggest using
http://www.zachsaw.co.cc/?pg=quickphp_php_tester_debugger (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:
<?php
print("Get array:<br>");
print_r($_GET);
print("POST array:<br>");
print_r($_POST);
print("FILES array:<br>");
print_r($_FILES);
print("COOKIE array:<br>");
print_r($_COOKIE);
print("SESSION ARRAY:<br>");
print_r($_SESSION);
print("SERVER ARRAY:<br>");
print_r($_SERVER);
print("ENV ARRAY:<br>");
print_r($_ENV);
?>
<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" />
</form>
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=\"data2.cab\" 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 ( ) SESSION ARRAY:
SERVER 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:1.9.0.4)
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] => 127.0.0.1 [REMOTE_PORT] => 1233
[REQUEST_METHOD] => POST [REQUEST_URI] => /test.php
[SCRIPT_FILENAME] => C:\workspace\test.php [SCRIPT_NAME] =>
/test.php [SERVER_ADDR] => 127.0.0.1 [SERVER_NAME] => localhost
[SERVER_PORT] => 5723 [SERVER_PROTOCOL] => HTTP/1.1
[SERVER_SIGNATURE] =>
QuickPHP/1.4.0 Server at localhost Port 5723
<snip>
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
- check both the post and files array so that your application will work for either web server
- 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.
Writeup
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:
- Your name!!
- How do I use your program?
- and how should I set up the classes
- how does a user select the classes
- hows does the student register?
- how does the student view his/her files?
- how do I configure the program
- what port should I connect to
- where do I place your files to run them (in relation to the web root) What file should I use as the entry point?
- How did you write your program?
- what design decisions did you make?
- how well did it work?
- what false starts did you have?
- How well did your program work?
- is there any bugs that I will encounter?
- does your program do everything? is it easy to use?
submit as usual on csdev01. Use scp/winscp to copy your files to csdev01 when done.