Can someone help me with PHP script?

Discussion in 'Web Design and Development (archive)' started by coopdog, Jan 24, 2004.

  1. coopdog macrumors 6502a

    Oct 5, 2002
    The Great Midwest
    Hi, I'm trying to make a site that is kind of like I know my way around dreamweaver MX pretty well and with the Adobe apps. The HTML part of the site I have already built part of and can do fine...

    But the only thing I'm stuck on is how to allow people to UL their images to the site, then add a watermark to the image, then have the images displayed and allow other users to vote on the image. Then I would also like to have a link by the image to report a bad image (porn, gore ect.) And thats about it.

    I downloaded some free PHP scripts, one that adds a watermark to images, a randomizer for the images displayed, then a demo of a $50 script that is a voting system that is pretty close to the one on just a lot more basic.

    How do I encorporte the PHP into my HTML site? I was looking at the code for sites that I knew that used PHP and I couldn't really get anything from the code..

    I also found free forum software that I would also like to put on my site.

    Oh and one more thing. I'm also trying to add a page where people can enter their city, post a review and a few other feilds. Kind of like

    I think this site will be pretty popular. It's not a personal site. And I know a lot of people that would use it and find it to be fun.

    I'm sorry for asking how to do so much, it's just this PHP code that I'm stuck on.
    Well it is the most important part of the site :p.

    If any of you have PHP coding experence and would like to make some of the things for me, I don't have much money to pay you but I will leave a link on the site to your web design page and it would be a good starter/example of your work kind of site. :D

    If it does start making money off donations for hosting and an ad or too no doubt ill send some of that off to you.

    My friend knows PHP well, I asked him if he could help me and he offered his huge learn PHP books to me. :rolleyes: :p

    Oh yeah I'm being vauge because I have not bought the URL yet and I would hate for someone macrumors guest to buy the URL out from under me. I plan on buying it today so I'll post the html I have so far a bit later.

    Thanks again!
  2. mrjamin macrumors 65816


    Feb 6, 2003
    Ok, firstly - when you do "view source" on a PHP file, it will look like HTML. Why? because it is HTML. Unlike javascript, php is a server side language - that means that the server interprets whats been coded and sends the result of the code to user.

    Here's an example:

    The second is what the raw PHP file actually looks like before the PHP engine parses it, and sends it to your browser.

    Clever stuff, isn't it?

    PHP Files are essential applications. Applications need a platform to run on, so to run PHP applications for the web, you need a webserver of some description and the PHP processor. HTML files are simply just lines of markup that instruct a browser how to display stuff. PHP can be used to "generate" HTML, amongst a million and one other things. I'm currently writing a script that creates adobe PageMaker files using content from a database, coded in PHP - its not just for the web :)

    I run a "Rate my..." website and coded it myself in PHP/MySQL.

    Your query isn't exactly a simple one - the script that i wrote is very robust, very secure and very easy to configure and comes close to 10,000 lines of code - to a potential client I would sell that for several thousand $$$. Sure, you could do a simple one for less, BUT security ESPECIALLY when dealing with file uploads is very important and should add a lot more to your code. To ask someone to code some stuff for you is like asking someone to give you $2000 - it ain't gonna happen! I (and presumably the rest of us) will happily help you out where I can and point you in the right direction when i/we cant!

    Uploading images is a doddle:
    <form action="apage.php" method="post" enctype="multipart/form-data" name="form1">
    <input type="file" name="image" />
    there's your form.

    To deal with the upload, just have a look through and that'll tell you everything you need to know on that front.

    It probably all looks like garble to you at the moment, which is why you need to learn the basic structure, syntax and other bits before you make a start.

    Resizing and watermarking the image is a little more complex and will require the GDLib and a few other bits and pieces (have a read through

    Once you've got a grasp of PHP, make sure you code everything assuming that register_globals is set to OFF as people can and will try to hack your code if they spot a vulnerability. If your webhost still has register_globals set to ON then turn it off using and htaccess file in your public_html directory:
    <IfModule mod_php4.c>
            php_flag register_globals off
    The thing with php (and most, if not all programming languages) is that you don't need to know every single function and how to use it. All you need is a good idea of structure, syntax and how to use various features of a language, then the documentation will tell you the rest. the documentation on will teach you a hell of a lot more than people on a forum, its always worth having a look through the user comments on functions etc too.

    Hope that helps.


    edits: clarifying myself!
  3. redkore macrumors member

    Oct 4, 2003

    Have you considered using a CMS?

    Check out and see if any of those will do what you need.

    There are some very nice packages there. And they're free! :)
  4. coopdog thread starter macrumors 6502a

    Oct 5, 2002
    The Great Midwest
    Thanks for your replies guys.

    The site is up now. I'm working on the PHP this weekend with a friend that knows a lot about it. Hopefuly we can get the very basics up by monday atleast.

    Ill let my friend know about CMS and thenks for all the PHP info mrjamin!

    Here's the URL

Share This Page