Log in

View Full Version : Where would I start to code a php site that I want to create?



bouncer
02-07-2011, 12:33 AM
Hi all,

K so I have been for a while looking to create a site where (for now) students are able to post their pictures of their artwork online.

For now it would have some basic features:

1. Registration for multiple users
2. Upload images
3. Let users comment on images (with notifications)

Where would I start? I know some html pretty well and some css. and I understand a tiny bit of php. I understand that the common answer to my question would go read some tutorials about php. But that's not why I'm here. I need a direction to go to really.

Here is an example: http://www.shaischechter.com/art/gallery/

Any advice?
Thanks.

azoomer
02-07-2011, 12:44 AM
Maybe the simplest way to get something like that up and running would be to use a cms, drupal or joomla could certainly be used, and you may even be able to do it with wordpress ( which is the easiest to get started with).

djr33
02-07-2011, 01:36 AM
If you want to code this yourself, then the first thing to understand about PHP is that it's a set of tools with which you must create a website. This means that if you break it down to simple steps (upload an image, for example) then you can work through these individually. After a while, the big picture will start to come together, but if you try to approach the big picture in the first place, it will probably be too overwhelming. Honestly, it's best to start with some small projects, though a big project like this can be great motivation to learn as well.

The good news is that PHP is widely documented on the internet and the official website is helpful. php.net has a full list of all functions available and how to use them.

For the basics use a tutorial. Then start, slowly, trying to put together some components for what you want to use.


Secondly, the other thing to understand about PHP is that there are two aspects to a dynamically generated site: the code base and the content. Keep them separate as much as possible and you will in the end find everything much easier. Once you start mixing content (html, text passages, etc.) and PHP code (if statements, database functions, etc.) things get messy fast.


Now if you just want the fastest way to get your project done (potentially with less control) then look at a CMS like azoomer suggested. If your goal is to learn PHP, follow the advice here.

james438
02-07-2011, 11:20 PM
Although this might sound like a bit much at this point in your understanding of web design, I feel I should recommend learning a small amount of MySQL coding. There is not much that you need to learn about MySQL except that it is much like a glorified spreadsheet used for storage and retrieval of data such as user comments. MySQL allows you to sort data in many different ways, which in your case would be something along the lines of

"Display all of the posts relating to image 'X' and order them by date the comment was submitted to the MySQL database."

Uploading the images is a php based script. Presentation of the retrieved content is CSS/HTML. Storage of lots of text like posts is MySQL. I would put the images themselves in your file system however as images can quickly fill up a database.

djr33
02-08-2011, 12:44 AM
Yes, a database would be required if you want to build this yourself. If you do use a CMS, though, that will handle the database interactions for you. But you will still need to learn the basics of using databases, such as how to set one up and connect the CMS to it.

james438
02-08-2011, 02:32 AM
I don't think I have any experience with cms, so that is good to know that cms does that. I may use cms one day, but I have always preferred typing out the code and then saving the file.

bouncer
02-08-2011, 03:41 AM
Thanks for the advice.
Yes I know how MYSQLs work and how to set them up. I also understand php a bit. Just reading , not coding, but barely.

I need to learn how to code php and how to make it work with mysql. Any good tutorials to start with user registration?

Username:
Name:
Email:
Password:

I read a bit about the user registration. I know now that php5 i believe it is? uses rasterize and validate strings. I read a tutorial how to create a registration here: http://net.tutsplus.com/tutorials/php/user-membership-with-php/ but haven't started making it yet.

The good thing about that tutorial is it has php code to escape string, which is to prevent mysql injections if im right? but it doesnt have validation for email, user, pass etc.

and maybe some other important stuff that I can't think of right now?

But yeah my first step is to get a successful user registration (with email activation link hopefully!!!!) and use captcha for anti-spam or something similiar. this is gonna be hard lol.

djr33
02-08-2011, 03:51 AM
Take it slowly and you'll get there.

While user registration may seem simple, making it secure (and protecting it against bots) can become difficult. So it might not be your best first project-- at least read a lot about hashing passwords, and look into CAPTCHAs, though you can find those for free and they're easy to implement-- try reCaptcha.

Here's a tutorial that I recommend-- but don't be afraid by the strange layout it's currently using-- the content is good. Start at the earliest [last] post and work toward the more advanced things.
http://php-mysql-tutorial.com