1
Mods & Plugins (Requests & Discussions) / Re: Random pictures
« on: June 26, 2008, 08:01:58 AM »
hi how are u i hope u fine and good can u help me plz iam put random images to index but it is working when iam refresh it then next iamges is come how can i stop it to one iamge i thing in new iamges this is my site
www.hakeemwafa.com/card
and this is mail index.php file code
........................................................................
and this is my home.html file code cun u help me plz
..........................................................................................
www.hakeemwafa.com/card
and this is mail index.php file code
........................................................................
Code: [Select]
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: index.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.6 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (Lizenz.txt) für weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (Licence.txt) for further information. *
* *
*************************************************************************/
$templates_used = 'home,category_bit,whos_online,thumbnail_bit';
$main_template = 'home';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
define('GET_USER_ONLINE', 1);
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
if (isset($HTTP_GET_VARS['template']) || isset($HTTP_POST_VARS['template'])) {
$template = (isset($HTTP_GET_VARS['template'])) ? get_basefile(stripslashes($HTTP_GET_VARS['template'])) : get_basefile(stripslashes($HTTP_POST_VARS['template']));
if (!file_exists(TEMPLATE_PATH."/".$template.".".$site_template->template_extension)) {
$template = "";
}
else {
$main_template = $template;
}
}
else {
$template = "";
}
include(ROOT_PATH.'includes/page_header.php');
if (!empty($template)) {
$clickstream = "<a href=\"".$site_sess->url(ROOT_PATH."index.php")."\">".$lang['home']."</a>".$config['category_separator'].str_replace("_", " ", ucfirst($template));
$site_template->register_vars("clickstream", $clickstream);
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
}
$cache_id = create_cache_id(
'page.index',
array(
$user_info[$user_table_fields['user_id']],
isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
$config['template_dir'],
$config['language_dir']
)
);
if (!$cache_page_index || !$content = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_index) {
$old_session_mode = $site_sess->mode;
$site_sess->mode = 'get';
}
ob_start();
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------
$categories = get_categories(0);
if (!$categories) {
$categories = $lang['no_categories'];
}
$site_template->register_vars("categories", $categories);
unset($categories);
//-----------------------------------------------------
//--- Show New Images ---------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"has_rss" => true,
"rss_title" => "RSS Feed: ".format_text($config['site_name'], 2)." (".str_replace(':', '', $lang['new_images']).")",
"rss_url" => $script_url."/rss.php?action=images"
));
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
if ((substr($config['image_table_width'], -1)) == "%") {
$imgtable_width .= "%";
}
$additional_sql = "";
if (!empty($additional_image_fields)) {
foreach ($additional_image_fields as $key => $val) {
$additional_sql .= ", i.".$key;
}
}
$num_new_images = $config['image_cells'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
ORDER BY i.image_date DESC
LIMIT $num_new_images";
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
$new_images .= $lang['no_new_images'];
$new_images .= "</td></tr></table>";
}
else {
$new_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$new_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$new_images .= $site_template->parse_template("thumbnail_bit");
$new_images .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$new_images .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$new_images .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$new_images .= "</tr>\n";
}
}
$new_images .= "</table>\n";
} // end else
$site_template->register_vars("new_images", $new_images);
unset($new_images);
//------------------------------------
//------- Random Images --------------
//------------------------------------
$num_new_images = $config['image_cells'];
$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")."
FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c)
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND (i.cat_id NOT IN (".get_auth_cat_sql("auth_viewimage", "NOTIN").", ".get_auth_cat_sql("auth_viewcat", "NOTIN")."))
ORDER BY RAND()
LIMIT $num_new_images";
// end new
$result = $site_db->query($sql);
$num_rows = $site_db->get_numrows($result);
if (!$num_rows) {
$random_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>";
// $random_images .= $lang['no_new_images'];
$random_images .= "</td></tr></table>";
}
else {
$random_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)){
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$random_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$random_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row);
$random_images .= $site_template->parse_template("thumbnail_bit");
$random_images .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$random_images .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($f = 0; $f < $leftover; $f++) {
$random_images .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$random_images .= "</tr>\n";
}
}
$random_images .= "</table>\n";
} // end else
$site_template->register_vars("random_images", $random_images);
unset($random_images);
//----- End Random Images---------
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"msg" => $msg,
"clickstream" => $clickstream
));
$site_template->print_template($site_template->parse_template($main_template));
$content = ob_get_contents();
ob_end_clean();
if ($cache_page_index) {
// Reset session mode
$site_sess->mode = $old_session_mode;
save_cache_file($cache_id, $content);
}
} // end if get_cache_file()
echo $content;
include(ROOT_PATH.'includes/page_footer.php');
?>
...................................................................................and this is my home.html file code cun u help me plz
..........................................................................................
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>PanjshirTv Greeting Card</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="container">
<div id="head">
<div id="menu">
<ul>
<li><a href="http://www.panjshirtv.com"> Home </a></li>
<li><a href="http://www.panjshirtv.com/history/HISTORY.html"> History </a><a href="http://www.panjshirtv.com/Articles/articles.htm.HTML"> Article </a><a href="http://www.panjshirtv.com/sheer/sheer.htm" target="_self"> Poetry </a><a href="http://64.38.18.6/v11/index.asp?Site=eimstalk_kohsaar"> Voice Chat </a><a href="http://www.hakeemwafa.com/card"> Greeting Card </a><a href="http://www.panjshirtv.com/panjshirtv 04-2008/video.htm"> Video </a><a href="http://www.panjshirtv.com/Jokes/Joke.HTML"> Jokes </a><a href="http://www.panjshirtv.com/panjshirtv 04-2008/khabar.htm"> News </a><a href="#"></a></li>
<li><a href="#"></a></li>
<li></li>
</ul>
</div>
</div>
<div id="main">
<div id="content">
<div class="left">
<table width="710" height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
<td align="right"><a href="{url_top_images}"><b>{lang_top_images}</b></a> <a href="{url_new_images}"><b>{lang_new_images}</b></a> </td>
</tr>
</table>
<div class="blogitem">
<table width="678" height="317" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="692" class="bordercolor"><table width="678" border="0" cellspacing="1" cellpadding="0">
<tr>
<td width="676" class="tablebgcolor"><table width="675" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" height="265" valign="top" class="row2"><table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1">{user_box}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{if random_image}
<table width="150" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
<tr>
<td align="center" class="row1"><br />
{random_image} <br />
<br />
</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
{endif random_image} </td>
<td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
<td width="450" valign="top"><br />
<span class="title">{site_name}</span> <br />
<hr size="1" />
{if categories}
<table width="507" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="head1"><table width="109%" height="43" border="0" cellpadding="3" cellspacing="0">
<tr>
<td class="head1" valign="top">{lang_categories}</td>
</tr>
<tr>
<td class="row2" valign="top">{categories}</td>
</tr>
</table></td>
</tr>
</table>
<br />
{endif categories}{lang_site_stats}<br />
<br />
{if msg}<b>{msg}</b><br />
<br />
{endif msg} <br />
<br />
<br />
<br />
<br />
<table width="515" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="head1"><table width="102%" border="0" cellspacing="0" cellpadding="4">
<tr>
{random_images}
<td class="head1" valign="top">{lang_new_images}</td>
</tr>
</table></td>
</tr>
<tr>
<td class="head1">{new_images}</td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<p><br />
<br />
<br />
<br />
</p>
<div class="clearer">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>{category_dropdown_form}</td>
<td align="right">{setperpage_dropdown_form}</td>
</tr>
</table>
<br />
<br />
</div>
</div>
</div>
<div class="clearer"><span></span></div>
</div>
</div>
</div>
<div class="foot">
<p>© Panjshirtv.com | Designed by <a rel="nofollow" target="_blank" href="#">MObeenwafa</a></p>
</div>
</body>
</html>
.........................................................................