For you to test (please) onepotcooking.com/davidbone/class07/3/
My toDo list since last post:
Get the home page working with galleryLimit the view to last 50(thanks JackP, who also alerted me to array_reverse)Design the layout + figure out thumbnails- Work on security which is non-existent at the moment.
Test the limit on file size upload. I don't believe it is working.I was able to restrict the size of file and type of file- Template the error messages onto one location like I saw Jonathan do... good idea.
- + Figure out true thumbnails. Creating and saving on the fly.
page_login.php
- Checks to see if you have a cookie that has you logged in. This cookie expires in 24hrs.
- Post form for entering in username and password.
- On form submit with values: reads the data txt file for username and password and if matched then sends user on to gallery page. If no match then there is an error message. Also sets two cookies. One for loggedin and one with the username.
- On form submit with no values: error message
- Checks to see if you have a cookie that has you logged in. If so, on to gallery page.
- Post form for entering in new usernames and passwords.
- On form submit with values: writes entries to a txt file in a comma delimited fashion. (no security on this yet). On success of writing to file, send user back to login page w/ message.
- There are other error messages (alerts) related to txt file but most likely will never be called unless there is an error on the server.
- On form submit with no values: error message
- Checks to see if you don't have the needed cookie. Send user to login if failed.
- Personal message to user from username cookie.
- Gallery of images. Showing only latest 50. Showing last entry first.
- Thumbnail size controlled by CSS.
- All images link to the full size.
- Alert message when successfully uploaded an image
- Checks to see if you don't have the needed cookie. Send user to login if failed.
- Post form data entry. Writes the file path, caption, username and date to a txt file for gallery page to read.
- File upload field is limiting file size to 2M by a hidden form field and php. The php also restricts file type to gif, jpeg, jpg or png. (The method from Amos, restricting the file size, didn't work for me)
- Only the image is required.
I feel like I'm in the Matrix movie where all those lines of "code" are on the screen and to the learned eye, you can visualize what's going on. Still at low resolution though.
File management was a desire for me with folders for includes, functions, style... Because of this I came across path issues. When a function writes to a file it would have a different path than the other function that would read.
Testing is where it's at! Many examples of me learning through testing but the last run through revealed I forgot to check for empty form fields when entering the site. This resulted in one of my cookies being set and letting the user in but it didn't set the second one. Because this second one wasn't 'on' I saw behavior from my code that I didn't realize was there.
I learned a ton, especially since I did just about everything repeatedly. I still see myself looking for answers out on the web but now it's more for reference than for stealing.
Syntax is still an issue for me... that is where practice comes in.
2 comments:
It works! I uploaded a file. The only thing I noticed is that it redirected me to the login page rather than the gallery after I did the signup.
Good job!
That's rather sweet and no small feat. Congrats. I uploaded a veggie rainbow photo to go with the dready pic.
BTW, I was redirected to the home page after upload. The polaroid style formatting on the image when you click it is a nice throwback touch...
Post a Comment