Jump to content

learning area


Recommended Posts

I have never started with this before, so I wanted to clarify a few things first, before I get too confused.In order for me to prepare the form, to start getting information to php I added the

enctype="multipart/form-data"

Ok I know that was needed to prepare the form, now on the form file field, before it you are supposed to input something along the lines of

<input type="hidden" name="MAX_FILE_SIZE" value="30000" />

This would go above the file form field. Now here is my entire form right now, but I had a few questions, I will be wading through it, but after I get done I will have tripled my php knowledge, I am learning so fast lately, I do everything I can on my own and seek help when I get stuck.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><link rel="stylesheet" type="text/css" href="funnyemails.css" /><meta name="Description" content="If you have a funny email, feel free to put it into our database, to send to all the people signed up to recieve funny emails" /><meta name="Keywords" content="funny, emails, email, fowards, joke, video, song, poem, picture, yellow pages, services" /> <!-- Search engine preparation --><!-- If you have a funny email, feel free to put it into our database, to send to all the people signed up to recieve funny emails --><!-- funny, emails, email, fowards, joke, video, song, poem, picture, yellow pages, services --><!-- Above comment tags accommodate search engines that do not pick up Meta Tags --><meta name="author" content="A service of Yellow Pages Online" /><title>Funny Email Forwards</title></head><body><div id="header"><!-- Begin top area, with logo, and text below it --><img src="images/logo.gif" alt="Logo" /><br /><p id="headertext">The web's directory of funny Email forwards<br /><a href="http://www.yellowpagesservices.com" id="headerbelow" target="_blank"><img src="images/ypol.gif" alt="The Yellow Pages" /></a></p></div><!-- End top area --><!-- Begin middle area, this is the place that contains masses of information, it has the 2 forms.  The search form, and the add something form, they both go to different pages, and have different functions.  I wrapped them all inside of other divs, to allow for maximum flexibility, for future designs or re-designs --><div id="containleftright"><div id="leftdiv"><h3>Add Something Funny:</h3><form name="submitinformation" id="submitinformation" enctype="multipart/form-data" action="whatever.php" method="post"><label for="type">What Type of Funny is it:</label><select tabindex="1"name="type" id="type"><option>Video</option><option>Picture</option><option selected="selected">Joke</option><option>Song</option><option>Poem</option><option>Story</option></select><br /><label for="name">Name the Funny:</label><input tabindex="2" name="name" id="name" type="text" maxlength="80" /><br /><label for="keywords"><a href="keywords.htm">Keywords:</a></label><input tabindex="3" name="keywords" id="keywords" type="text" maxlength="80" /><br /><label for="file">Upload your file here:</label><input tabindex="4" name="file" id="file" type="file" /><br /><input tabindex="5" name="submit" id="submit" type="submit" value="Do It!" /></form></div><div id="middlediv"><p>OR</p></div><div id="rightdiv"><h3>Search For Something Funny:</h3><form name="searchform" id="searchform" action="something.php" method="get"><label for="searchfield">What would you like to search for?</label><br /><input tabindex="6" name="searchfield" id="searchfield" type="text" size="33" maxlength="80" /><br /><input tabindex="7" name="search" id="search" type="submit" value="Do It!" /></form></div></div><!-- End middle area --><!-- begin lower areas, This areas list links to other areas of the site, that contain the newest additions to the database --><div id="wrapmiddle"><h3 id="directory">Directory of Listings:</h3><div id="upperleft"><h3 class="specialheader">VIDEOS</h3><ul><li>Link Number one will go here</li><li>Link Number two will go here</li><li>Link Number three will go here</li></ul></div><div id="uppermid"><h3 class="specialheader">PICTURES</h3><ul><li>Link Number one will go here</li><li>Link Number two will go here</li><li>Link Number three will go here</li></ul></div><div id="upperright"><h3 class="specialheader">JOKES</h3><ul><li>Link Number one will go here</li><li>Link Number two will go here</li><li>Link Number three will go here</li></ul></div><div id="lowerleft"><h3 class="specialheader">SONG</h3><ul><li>Link Number one will go here</li><li>Link Number two will go here</li><li>Link Number three will go here</li></ul></div><div id="lowermid"><h3 class="specialheader">POEM</h3><ul><li>Link Number one will go here</li><li>Link Number two will go here</li><li>Link Number three will go here</li></ul></div><div id="lowerright"><h3 class="specialheader">STORY</h3><ul><li>Link Number one will go here</li><li>Link Number two will go here</li><li>Link Number three will go here</li></ul></div></div><!-- end area near bottom --><!-- Bottom area, this area at the bottom contains copyright information and teh link list, I set it up in a list and ran it sideways, and did some adjusting to margin/padding, so it should work perfectly in teh future if new links need to be added, they should all fall into place quite easily --><div id="bottomwrap"><ul id="bottomnav"><li><a href="aboutfunnyemails.htm" tabindex="8" title="The About Page">About FunnyEmailForwards.com</a></li><li><a href="signup.php" tabindex="9" title="Sign up for the newsletter">Sign Up</a></li><li><a href="contactus.php" tabindex="10" title="Contact Us">Contact Us</a></li></ul><p>Copyright 2000-2006 FunnyEmailFowards.com a service of YellowPages Online.  All Rights Reserved.</p></div><!-- End bottom area --></body></html>

The form I am currently focusing on is the one accepting files. What I need to find out, what is the average recommended maximum file size. I also need to know a few things.When I first start this I know how to accept the form, I need to figure out, what php functions should I use to validate file types, the extensions. And what kind of file types should I accept into the database, and not accept into the database, I need to figure this out,Ok as for the databaseI was thinking for the table to have these fields, do you think this will cover everything I was wanting, this is hard for me, because I have to allow the owner(ceo) of the company to recieve an email and be able to approve/deny any material inserted into the database. I don't know how to work all of this yet.So I create a table I would havefilenamekeywordsumm file I guessHow do I set the table(I know how to create one and everything now) is there anything I should take into consideration, like that. Do I need to worry about viruses, or find a way to validate for them, so far I know what i need to do,validate the fields as always, validate and screen out specific unwanted file types(extensions), I need it to enter it into the database, under a specific field, and have the email be sent with a link to another page allowing him to approve or deny, what do I do with the database to allow it to not show up until he approves it, and I will have to do it with all of these fields. Another thing I know I have to take into account is the keywords, are going to have to be something I use later when creating the query in the other form to search the information, is there anything special I need to take into account for that. The other question now was I have to do this right, I already know I will end up rewriting the script probably 4-5 times before it's done, I did with the other one, but now I have a broader deeper understanding of php/mysql because of it. The last question I wanted to ask, with my subscribe unsubscribe one I was doing earlier, I had to do 2 scripts one for subscribe and one for unsubscribe, 1 to handle each part. With this do I need 6 different script sections one to handle each file type field like1 for isset($_POST['joke']and all the 5 others, one for each type of field they can choose, I am just looking for guidance advice, direction or anything, thanks.

Link to comment
Share on other sites

The form I am currently focusing on is the one accepting files.  What I need to find out, what is the average recommended maximum file size.
There's not really one, it depends on you. If you are accepting videos and things, they might get to be a couple megabytes. I guess it depends how much space you have available. The value in the hidden input is the number of bytes, 1 megabyte = 2^20 = 1048576 bytes.
When I first start this I know how to accept the form, I need to figure out, what php functions should I use to validate file types, the extensions.
You can use explode to split the filename up around the dot. Explode produces an array.
explode(".", "somefile.txt") = Array{  [0] => "somefile"  [1] => "txt"}

The last element in the array will be the extension.http://www.php.net/manual/en/function.explode.php

And what kind of file types should I accept into the database, and not accept into the database, I need to figure this out,
That is up to you, it's whatever you want to accept. Here is a huge list of file extensions:http://filext.com/
How do I set the table(I know how to create one and everything now) is there anything I should take into consideration, like that.
I'm not sure what you're asking.
Do I need to worry about viruses
You might need to worry about viruses, you can have a virus scanner monitor the upload folder and do real-time scans on everything that goes in there.
what do I do with the database to allow it to not show up until he approves it,
You can have a binary field, or integer of size 1, to specify if the file has been approved.
Another thing I know I have to take into account is the keywords, are going to have to be something I use later when creating the query in the other form to search the information, is there anything special I need to take into account for that.
Not as far as I know. You can make the keywords field a fulltext index if you are going to be searching on it, it might make the searches a little faster, but you can always change that later.
With this do I need 6 different script sections one to handle each file type field like1 for isset($_POST['joke']and all the 5 others, one for each type of field they can choose
I'm not sure what you're asking. But you don't *need* anything, you just need to decide how you want your application to work, and figure out what you have to do to make it happen.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...