Author Topic: HELP! Which Part of this RANDOM.TXT file gets edited Please?  (Read 11398 times)

0 Members and 1 Guest are viewing this topic.

Offline 1Newbie

  • Newbie
  • *
  • Posts: 27
    • View Profile
HELP! Which Part of this RANDOM.TXT file gets edited Please?
« on: January 05, 2007, 01:38:43 AM »
Hi.
First off, sorry I don't know to much about editing scripts but I'm trying to learn more and more everyday.
I'm trying to create the random.php file to display a random image on another page.

What part of the random.txt file gets edited with my information?

Quote
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random.php                                           *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.0 for 4images 1.6.1                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './4images/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_host, $db_user, $db_password, $db_name);
function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

$sql = "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        ";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";
?>


***************************************************************

So Please,... could someone help me with this and maybe just copy and paste the sections of this script that I need to edit?
I've done so many searches on this topic and everyone who ever answers to a thread about topic seems to always tell that person to read the F.A.Q's or is directed to this thread in the MOD area: http://www.4homepages.de/forum/index.php?topic=1020.0  Which believe me I've read all 24 pages and only a few are in english.

I've attached the Original random.txt file to this thread incase someone else wanted it.


Please and TIA.
1Newbie.


Offline 1Newbie

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #1 on: January 05, 2007, 09:34:15 AM »
Anyone??  :?

Offline Acidgod

  • Moderator
  • 4images Guru
  • *****
  • Posts: 2.421
  • It's me?
    • View Profile
    • Flash-Webdesign
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #2 on: January 05, 2007, 09:57:33 AM »
where is the problem?

copy it on your webspace and edit the following line:

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './4images/');

there is nothing more to do...

Offline 1Newbie

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #3 on: January 05, 2007, 11:12:44 PM »
Well I just love when a thread gets locked for no reason.
locked thread at http://www.4homepages.de/forum/index.php?topic=16058.new#new

I edited to read this.

Quote
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './gallery/');

And now I get:


Quote
Warning: main(./gallery/config.php) [function.main]: failed to open stream: No such file or directory in /home/MYNAME/public_html/gallery/random.php on line 30

Warning: main(./gallery/config.php) [function.main]: failed to open stream: No such file or directory in /home/MYNAME/public_html/gallery/random.php on line 30

Warning: main() [function.include]: Failed opening './gallery/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/MYNAME/public_html/gallery/random.php on line 30

Warning: main(./gallery/includes/db_mysql.php) [function.main]: failed to open stream: No such file or directory in /home/MYNAME/public_html/gallery/random.php on line 31

Warning: main(./gallery/includes/db_mysql.php) [function.main]: failed to open stream: No such file or directory in /home/MYNAME/public_html/gallery/random.php on line 31

Warning: main() [function.include]: Failed opening './gallery/includes/db_mysql.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/MYNAME/public_html/gallery/random.php on line 31

Warning: main(./gallery/includes/constants.php) [function.main]: failed to open stream: No such file or directory in /home/MYNAME/public_html/gallery/random.php on line 32

Warning: main(./gallery/includes/constants.php) [function.main]: failed to open stream: No such file or directory in /home/MYNAME/public_html/gallery/random.php on line 32

Warning: main() [function.include]: Failed opening './gallery/includes/constants.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/MYNAME/public_html/gallery/random.php on line 32

Fatal error: Cannot instantiate non-existent class: db in /home/MYNAME/public_html/gallery/random.php on line 34



Anyone have any ideas?

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #4 on: January 06, 2007, 12:13:46 AM »
I assume you added the random.php file to your "gallery" directory?

If that is the case that is why you get those errors as I did the same.

Upload random.php to your main directory (out of the 4images directory) and then try to load it to see if it works.
Should look like so: http://www.YOURSITE.COM/random.php

Offline 1Newbie

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #5 on: January 06, 2007, 12:20:23 AM »
I assume you added the random.php file to your "gallery" directory?

If that is the case that is why you get those errors as I did the same.

Upload random.php to your main directory (out of the 4images directory) and then try to load it to see if it works.
Should look like so: http://www.YOURSITE.COM/random.php

DUDE!!!
You Are Da Man.

It Works.  Thank You For Your Help.
Strange it only works in the main root directory.

Again Thank You.  :D

Offline 1Newbie

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #6 on: January 06, 2007, 12:21:49 AM »
Hmm,.. How come Video Files Thumbnails dont show up?

Offline 1Newbie

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #7 on: January 06, 2007, 01:06:25 AM »
CeJay

Do you happen to know where in that random.php file I can edit it so that when a picture is clicked on it opens up in a new window instead of the same?

1Newbie

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #8 on: January 06, 2007, 02:05:32 AM »
Quote
Strange it only works in the main root directory.

I think I found the way it is suppose to work if you put it in your gallery directory.
In random.php should look like this:
Quote
define('ROOT_PATH', './');


Quote
Hmm,.. How come Video Files Thumbnails dont show up?
That one I cant answer as mine do show up.

Quote
Do you happen to know where in that random.php file I can edit it so that when a picture is clicked on it opens up in a new window instead of the same?
I am looking to figure this out. As soon as I get it I will post it.
I have tried what I thought would work, but all I get is an error so give me some time since I am not good with php to begin with  :oops:.
Unless someone else has the answer??

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #9 on: January 06, 2007, 02:14:11 AM »
CeJay

Do you happen to know where in that random.php file I can edit it so that when a picture is clicked on it opens up in a new window instead of the same?

1Newbie

Find:
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
Replace with:
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target='blank'><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
This should make a new window open when you click on the thumbnail.

manurom

  • Guest
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #10 on: January 06, 2007, 03:34:02 AM »
Hello;
shouldn't it be:
Code: [Select]
target=\"_blank\"instead of:
Code: [Select]
target='blank'

Offline CeJay

  • Sr. Member
  • ****
  • Posts: 425
    • View Profile
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #11 on: January 06, 2007, 08:39:36 AM »
Hello;
shouldn't it be:
Code: [Select]
target=\"_blank\"instead of:
Code: [Select]
target='blank'

That is what I thought, however everytime I did it that way (which I did seveal times because i thought I was screwing something up) it would give me an error on that line.
As soon as I made it "target='blank'" it worked.
Got me as I am far from any expert and from an average designer, but that is what worked.

manurom

  • Guest
Re: HELP! Which Part of this RANDOM.TXT file gets edited Please?
« Reply #12 on: January 08, 2007, 02:37:27 AM »
Yep;
I will try it in an IFRAME. Thanks.