Please help me with this Programming Exercise for school.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jayson
Forum Newbie
Posts: 2
Joined: Sat May 27, 2006 8:33 am

Please help me with this Programming Exercise for school.

Post by Jayson »

Hey, I have this programming exercise for school. I dont think it is too difficult, the problem is, ist has to be completely in OOP. Ok here it goes:


Step 01:

Create a HTML/PHP Webform to upload files. The files should be stored in a temporary Directory on the Server. The directory should be able to be defined by an administrator.

The File should be checked if it is in binary- or text-format. Binary Files aren't allowed, and if one attemtps to upload them, they should get an error message.


Step 02:

List the lines of the Textfile in Input Fields. a One Line Input Field for each line of text. The User should be able to edit the data in the Input fields, before they are imported into the database via a buttonclick. The Lines should belong to an entry of that textfile.


Step 03:


After the Import, display the textlines out of the imported File. The Lines should be generated out of the database.

This Procedure of Uploading, Editing, Importing and Displaying should be able to be done more than once. Please keep that in Mind when designing your database. The Combination of Line and File should always be recognizable, and as an added Information the time and date of the Import.



Other Rules:

- please document your classes and functions
- Use the template Engine http://smarty.php.net
- Javascript based plausibility checks arent allowed
- Please use PHP version 4 and MySQL version 4.1
- The Script should be easy to install for anybody, therefore all required parameters should be stored in a seperate config file
- Create Classes for: Database Access, Input checking, File Handling, PHP Input Parameters Handling($_REQUEST cannot be used in the actual Program File, only in the class)
- please send us the SQL Statements for creation of the database tables







Please help me, I dont expect someone to code the entire thing for me (although that would be awesome:-), but at least a roadmap please.

thanks
Jayson
Forum Newbie
Posts: 2
Joined: Sat May 27, 2006 8:33 am

Post by Jayson »

To be more clear on the type of help I am looking for, since I just read over my post and it seemed like I just wanted someone to code it for me:

Some resources on OOP PHP besides the one at phpfreaks, and maybe a tutorial on how object oriented programs are built. Ever read the book "Build your own Database Driven Website with PHP and MySQL" ? Thats the book that helped me learn PHP in the first place. He gave a little theory of PHP and mySQL in the beginning, and then jumped straight into applying it to real situations. Thats the type of material I need to really understand programming concepts.

There is no doubt that I could learn this on my own given enough time, but I got the assignment on friday and it has to be done by monday.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Spoono.com used to have some nice beginners tutorials for OOP.

I can see from this that you're ideally going to want 3 classes:

An upload class
A database class
A form class

Are you familiar with general procedural PHP coding and the resources such as php.net and PEAR?

If you can get your upload class and form class working together to deal with somone uploading a plain text file to the server you're at least off the ground. As for what they say about editting it over and over it doesn't strike me that you could even do that a bad way - even with things being exploded and imploded rather than stored on separate rows in the database it would still work.

Have a read of the stuff on spoono. sitepoint has some slighty more advanced tutorials too. Once you've made a start come back for some more help/guidance :)
Post Reply