Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 03-16-2005, 08:33 AM   #1 (permalink)
 
Super Techie

Join Date: Aug 2004

Posts: 435

chrisgill369

Default Need help with PHP

I want to create a dynamic image gallery so i dont have to keep editing the page to add new images. I want to be able to add a file name to a database and 6 images will be shown per page.

any help on how to do this, or links ?

thanks
chrisgill369 is offline  
Old 03-16-2005, 10:13 AM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

I don't know if you want to code it yourself or not, but there are many free versions of picture galleries out there.

I used this one a while back and loved it.
http://gallery.menalto.com/
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 03-16-2005, 11:25 AM   #3 (permalink)
 
True Techie

Join Date: Sep 2004

Posts: 110

Terencentanio

Send a message via AIM to Terencentanio Send a message via Yahoo to Terencentanio
Default

*sigh* I've never done this on open forums:

all.php
PHP Code:
<?php

$dbhost 
"localhost";
$dbname "name";
$dbpass "pass";
$dbuser "user";

mysql_connect("$dbhost""$dbuser""$dbpass");
mysql_select_db("$dbname");

?>
index.php
PHP Code:
<?php

include("all.php");

$lralg "SELECT * FROM images";
$res mysql_query($lralg);
$hu mysql_numrows($res);
$i=0;
while (
$i $hu) {
$hysa mysql_result($res,$i,"location");
?>
<TABLE>
<TR>
<TD>
[img]<?php echo $locaton?>[/img]
</TD>
</TR>
</TABLE>


<?
$i
++;
}

?>
/admin/index.php
PHP Code:
<?php

include("../all.php");

if(isset(
$_POST['submit']))
{

$location $_POST['location'];

$add "INSERT INTO images VALUES ('', '$location')";
if(
mysql_query($add))
{
echo 
"Image added";
} else {
echo 
"Could not add image";
}

} else {
?>
<form method="POST" action="index.php">
Image location: <input type="text" name="location" value="/">


<input type="submit" name="submit" value="Add Image">
</form>
<?
}
?>
This is _VERY_ basic. You'll have to mod the HTML yourself. And /admin/ should be protected. And, you need to actually upload the image - the script doesn't do it for you.
__________________
* Your high priced security consultant\'s plane ticket: $1500
* Your high priced security consultant\'s time: $200/hour
* RealSecure nodes all over your company: $200,000
* Getting owned by 0day: Priceless
Terencentanio is offline  
Old 03-16-2005, 02:25 PM   #4 (permalink)
 
Super Techie

Join Date: Aug 2004

Posts: 435

chrisgill369

Default

cool thanks, i will give it a go when i got some free time
chrisgill369 is offline  
Old 03-16-2005, 02:39 PM   #5 (permalink)
 
True Techie

Join Date: Sep 2004

Posts: 110

Terencentanio

Send a message via AIM to Terencentanio Send a message via Yahoo to Terencentanio
Default

Good luck. Just ask if there're any errors
__________________
* Your high priced security consultant\'s plane ticket: $1500
* Your high priced security consultant\'s time: $200/hour
* RealSecure nodes all over your company: $200,000
* Getting owned by 0day: Priceless
Terencentanio is offline  
Old 03-16-2005, 02:50 PM   #6 (permalink)
 
Super Techie

Join Date: Mar 2005

Posts: 259

C.Ingram

Send a message via AIM to C.Ingram Send a message via Yahoo to C.Ingram
Default

You may want to check out some of my software at http://soukengroup.com/software/photogallery/ . To be breif, its light weight photo gallery software that generates thumbnails automatically. Everything is based on files, and there is no use of a database. At the very least, it can give you some ideas.
__________________
Christopher Ingram
Principal Consultant, Souken Group, LLC.
C.Ingram@SoukenGroup.com
(856) 392 5244 -- (866) Go Souken
C.Ingram is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On