image gallery tut not working

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
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

image gallery tut not working

Post by dru_nasty »

Howdy all,

I can't seem to get this tut to work for me. http://www.php-mysql-tutorial.com/image-gallery/
Even when I download the source files at the end of the tutorial here http://www.php-mysql-tutorial.com/image ... e-list.php (at the bottom). I've got gd library installed, and my config file is properly set up. The script doesn't seem to have an issue with db connection, but everything else is buggy. Could someone possible give these source files a shot to see if they work for them? And or if you can see if some of the code may be deprecated or something. I can't see any reason why this wouldn't work.

Thanks for you time
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Define "buggy"...

Also, the code that was posted in the tutorial is FULL of SQL INJECTION vulnerabilities.

for example:

Code: Select all

if (isset($_GET['image'])) {
            $image = $_GET['image'];
            $sql  = "SELECT im_title
                     FROM tbl_image
                     WHERE im_id = $image";
Input from the user SHOULD NEVER BE TRUSTED... (highly recommend searching google for explanations of the various attacks available to malicious hackers.)

I'd recommend taking a look at the Gallery software here: http://gallery.menalto.com
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

Post by dru_nasty »

while in the admin section, I go to upload a jpg but it doesn't send it to a directory. And in the browser it just shows a broken link. then it seems like the server times out once in a while while poking around in the admin pages.
Once in a while I'll see this error:
HTTP/1.1 200 OK Date: Sun, 03 Dec 2006 02:13:42 GMT Server: Apache/1.3.33 (Darwin) PHP/5.1.6 X-Powered-By: PHP/5.1.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=15, max=96 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html c17

I'm running this locally trying to debug. (kinda hard cuz im a newb). But i did upload it on a few different servers but to no avail.
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Are the directory(ies) that the images get uploaded to writable?

Code: Select all

HTTP/1.1 200 OK Date: Sun, 03 Dec 2006 02:13:42 GMT Server: Apache/1.3.33 (Darwin) PHP/5.1.6 X-Powered-By: PHP/5.1.6 Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 Pragma: no-cache Keep-Alive: timeout=15, max=96 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html
Is not an error, it's actually the server telling you that the REQUEST was handled properly (notice i said request, that doesn't mean the php file did what was intended)
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

Post by dru_nasty »

yes they are writable, i was thinking that maybe my path to the directories was wrong, but i checked over and over and tried different path possibilities. What i assume it should be is /Users/user/Sites/image-gallery/images/album/ (on mac)
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post by nickvd »

Is that where the document root of your webserver is?

At the top of the main index file add: error_reporting(E_ALL);

Then try the upload again...
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

Post by dru_nasty »

that didn't show me anything. and yes that is the root of my localhost. I'm at a loss myself as to what to look for.
Post Reply