RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
//Mod_bmollet
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
/* ORIGINAL CODE
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
*/
function url($url, $amp = "&") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
elseif (strstr($url, 'categories.php')) {
if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
preg_match('#page=([0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('categories.php', 'cat'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('cat_id='.$matches1[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches1[1], '', $query);
$query = str_replace('cat_id='.$matches1[1], '', $query);
$query = str_replace('page='.$matches2[1].'&', '', $query);
$query = str_replace('&page='.$matches2[1], '', $query);
$query = str_replace('page='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
elseif (strstr($url, 'cat_id=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$cat_url = get_category_url($matches[1]);
$url = str_replace('categories.php', 'cat'.$cat_url.'.htm', $url);
$query = str_replace('cat_id='.$matches[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches[1], '', $query);
$query = str_replace('cat_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('categories.php', 'cat.htm', $url);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.get_image_url($matches[1]).'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: search.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.4 *
* *
* 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. *
* *
*************************************************************************/
$main_template = 'search';
define('GET_CACHES', 1);
define('ROOT_PATH', './');
include(ROOT_PATH.'global.php');
require(ROOT_PATH.'includes/sessions.php');
$user_access = get_permission();
include(ROOT_PATH.'includes/search_utils.php');
error_reporting(E_ALL);
$org_search_keywords = $search_keywords;
$org_search_user = $search_user;
if (isset($HTTP_GET_VARS['search_terms']) || isset($HTTP_POST_VARS['search_terms'])) {
$search_terms = isset($HTTP_POST_VARS['search_terms']) ? $HTTP_POST_VARS['search_terms'] : $HTTP_GET_VARS['search_terms'];
$search_terms = $search_terms == "all" ? 1 : 0;
}
else {
$search_terms = 0;
}
if (isset($HTTP_GET_VARS['search_fields']) || isset($HTTP_POST_VARS['search_fields'])) {
$search_fields = isset($HTTP_POST_VARS['search_fields']) ? trim($HTTP_POST_VARS['search_fields']) : trim($HTTP_GET_VARS['search_fields']);
}
else {
$search_fields = "all";
}
$search_cat = $cat_id;
$search_id = array();
if ($search_user != "" && $show_result == 1) {
$search_user = str_replace('*', '%', trim($search_user));
$sql = "SELECT ".get_user_table_field("", "user_id")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_name")." LIKE '$search_user'";
$result = $site_db->query($sql);
$search_id['user_ids'] = "";
if ($result) {
while ($row = $site_db->fetch_array($result)) {
$search_id['user_ids'] .= (($search_id['user_ids'] != "") ? ", " : "").$row[$user_table_fields['user_id']];
}
$site_db->free_result($result);
}
}
if ($search_keywords != "" && $show_result == 1) {
$split_words = prepare_searchwords($search_keywords, true);
$match_field_sql = ($search_fields != "all" && isset($search_match_fields[$search_fields])) ? "AND m.".$search_match_fields[$search_fields]." = 1" : "";
$search_word_cache = array();
for ($i = 0; $i < sizeof($split_words); $i++) {
if ($split_words[$i] == "and" || $split_words[$i] == "und" || $split_words[$i] == "or" || $split_words[$i] == "oder" || $split_words[$i] == "not") {
$search_word_cache[$i] = ($search_terms) ? "and" : $split_words[$i];
}
else {
$sql = "SELECT m.image_id
FROM (".WORDLIST_TABLE." w, ".WORDMATCH_TABLE." m)
WHERE w.word_text LIKE '".addslashes(str_replace("*", "%", $split_words[$i]))."'
AND m.word_id = w.word_id
$match_field_sql";
$result = $site_db->query($sql);
$search_word_cache[$i] = array();
while ($row = $site_db->fetch_array($result)) {
$search_word_cache[$i][$row['image_id']] = 1;
}
$site_db->free_result();
}
}
$is_first_word = 1;
$operator = "or";
$image_id_list = array();
for ($i = 0; $i < sizeof($search_word_cache); $i++) {
if ($search_word_cache[$i] == "and" || $search_word_cache[$i] == "und" || $search_word_cache[$i] == "or" || $search_word_cache[$i] == "oder" || $search_word_cache[$i] == "not") {
if (!$is_first_word) {
$operator = $search_word_cache[$i];
}
}
elseif (is_array($search_word_cache[$i])) {
if ($search_terms) {
$operator = "and";
}
foreach ($search_word_cache[$i] as $key => $val) {
if ($is_first_word || $operator == "or" || $operator == "oder") {
$image_id_list[$key] = 1;
}
elseif ($operator == "not") {
unset($image_id_list[$key]);
}
}
if (($operator == "and" || $operator == "und") && !$is_first_word) {
foreach ($image_id_list as $key => $val) {
if (!isset($search_word_cache[$i][$key])) {
unset($image_id_list[$key]);
}
}
}
}
$is_first_word = 0;
}
$search_id['image_ids'] = "";
foreach ($image_id_list as $key => $val) {
$search_id['image_ids'] .= (($search_id['image_ids'] != "") ? ", " : "").$key;
}
unset($image_id_list);
}
if ($search_new_images && $show_result == 1) {
$search_id['search_new_images'] = 1;
}
if ($search_cat && $show_result == 1) {
$search_id['search_cat'] = $search_cat;
}
if (!empty($search_id)) {
$site_sess->set_session_var("search_id", serialize($search_id));
}
include(ROOT_PATH.'includes/page_header.php');
$num_rows_all = 0;
if ($show_result == 1) {
if (empty($search_id)) {
if (!empty($session_info['search_id'])) {
$search_id = unserialize($session_info['search_id']);
} else {
$search_id = unserialize($site_sess->get_session_var("search_id"));
}
}
$sql_where_query = "";
if (!empty($search_id['image_ids'])) {
$sql_where_query .= "AND i.image_id IN (".$search_id['image_ids'].") ";
}
if (!empty($search_id['user_ids'])) {
$sql_where_query .= "AND i.user_id IN (".$search_id['user_ids'].") ";
}
if (!empty($search_id['search_new_images']) && $search_id['search_new_images'] == 1) {
$new_cutoff = time() - 60 * 60 * 24 * $config['new_cutoff'];
$sql_where_query .= "AND i.image_date >= $new_cutoff ";
}
if (!empty($search_id['search_cat']) && $search_id['search_cat'] != 0) {
$cat_id_sql = 0;
if (check_permission("auth_viewcat", $search_id['search_cat'])) {
$sub_cat_ids = get_subcat_ids($search_id['search_cat'], $search_id['search_cat'], $cat_parent_cache);
$cat_id_sql .= ", ".$search_id['search_cat'];
if (!empty($sub_cat_ids[$search_id['search_cat']])) {
foreach ($sub_cat_ids[$search_id['search_cat']] as $val) {
if (check_permission("auth_viewcat", $val)) {
$cat_id_sql .= ", ".$val;
}
}
}
}
$cat_id_sql = $cat_id_sql !== 0 ? "AND i.cat_id IN ($cat_id_sql)" : "";
}
else {
$cat_id_sql = get_auth_cat_sql("auth_viewcat", "NOTIN");
$cat_id_sql = $cat_id_sql !== 0 ? "AND i.cat_id NOT IN (".$cat_id_sql.")" : "";
}
if (!empty($sql_where_query)) {
$sql = "SELECT COUNT(*) AS num_rows_all
FROM ".IMAGES_TABLE." i
WHERE i.image_active = 1 $sql_where_query
$cat_id_sql";
$row = $site_db->query_firstrow($sql);
$num_rows_all = $row['num_rows_all'];
}
}
if (!$num_rows_all && $show_result == 1) {
$msg = preg_replace("/".$site_template->start."search_keywords".$site_template->end."/", $search_keywords, $lang['search_no_results']);
}
//-----------------------------------------------------
//--- Show Search Results -----------------------------
//-----------------------------------------------------
if ($num_rows_all && $show_result == 1) {
$link_arg = $site_sess->url(ROOT_PATH."search.php?show_result=1");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $perpage, $num_rows_all, $link_arg);
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $getpaging->get_paging_stats()
));
$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;
}
}
$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
$sql_where_query
AND c.cat_id = i.cat_id $cat_id_sql
ORDER BY ".$config['image_order']." ".$config['image_sort'].", image_id ".$config['image_sort']."
LIMIT $offset, $perpage";
$result = $site_db->query($sql);
$thumbnails = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">\n";
$count = 0;
$bgcounter = 0;
while ($image_row = $site_db->fetch_array($result)) {
if ($count == 0) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$thumbnails .= "<tr class=\"imagerow".$row_bg_number."\">\n";
}
$thumbnails .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n";
show_image($image_row, "search");
$thumbnails .= $site_template->parse_template("thumbnail_bit");
$thumbnails .= "\n</td>\n";
$count++;
if ($count == $config['image_cells']) {
$thumbnails .= "</tr>\n";
$count = 0;
}
} // end while
if ($count > 0) {
$leftover = ($config['image_cells'] - $count);
if ($leftover >= 1) {
for ($i = 0; $i < $leftover; $i++) {
$thumbnails .= "<td width=\"".$imgtable_width."\">\n \n</td>\n";
}
$thumbnails .= "</tr>\n";
}
}
$thumbnails .= "</table>\n";
$content = $thumbnails;
unset($thumbnails);
} // end if
else {
$site_template->register_vars(array(
"search_keywords" => format_text(stripslashes($org_search_keywords), 2),
"search_user" => format_text(stripslashes($org_search_user), 2),
"lang_search_by_keyword" => $lang['search_by_keyword'],
"lang_search_by_username" => $lang['search_by_username'],
"lang_new_images_only" => $lang['new_images_only'],
"lang_search_terms" => $lang['search_terms'],
"lang_or" => $lang['or'],
"lang_and" => $lang['and'],
"lang_category" => $lang['category'],
"lang_search_fields" => $lang['search_fields'],
"lang_all_fields" => $lang['all_fields'],
"lang_name_only" => $lang['name_only'],
"lang_description_only" => $lang['description_only'],
"lang_keywords_only" => $lang['keywords_only'],
"category_dropdown" => get_category_dropdown($cat_id)
));
if (!empty($additional_image_fields)) {
$additional_field_array = array();
foreach ($additional_image_fields as $key => $val) {
if (isset($lang[$key.'_only'])) {
$additional_field_array['lang_'.$key.'_only'] = $lang[$key.'_only'];
}
}
if (!empty($additional_field_array)) {
$site_template->register_vars($additional_field_array);
}
}
$content = $site_template->parse_template("search_form");
}
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
// $clickstream = "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].$lang['search']."</span>"; // Original code
// MOD: Dynamic page title BLOCK BEGIN
if (!empty($search_id['search_new_images'])) {
if( $search_id['search_new_images'] == 1 )
$txt_clickstream = $lang['new_images'];
else
$txt_clickstream = $lang['new_images_since'];
}
else {
$txt_clickstream = $lang['search'];
}
$clickstream = "<span class=\"clickstream\"><a title=\"".$lang['home']."\" href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'].(($search_keywords) ? "<a href=\"".$site_sess->url(ROOT_PATH."search.php")."\" class=\"clickstream\">".$lang['search']."</a>".$config['category_separator'].$search_keywords : $txt_clickstream)."</span>"; // Show search keywords
$page_title = $config['category_separator'].$txt_clickstream;
// MOD: Dynamic page title BLOCK END
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"content" => $content,
"msg" => $msg,
"clickstream" => $clickstream,
"page_title" => $page_title, // MOD: Dynamic page title
"lang_search" => $lang['search']
));
$site_template->print_template($site_template->parse_template($main_template));
include(ROOT_PATH.'includes/page_footer.php');
?>
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
great mod.. works perfectly.
I did find a problem with the search results
The link in thumb images after search is img[image_number].search.htm ex: img123.search.htm
Just add this to your .htaccess and it should work perfectCode: [Select]RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
Sorry it is cat.htm
eg error message
The requested URL /cat.htm was not found on this server.
I am using the pre modded files
Aaron
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
Don't work. Get "Internal Server Error 500"
what shall i do?
Greetz! Martin
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /4images/
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
</IfModule>
RewriteBase
Well, is it possible to have categories link without the prefix of 'k' like k-category-name-5.htm becomes 'category-name-5.htm'.. i think iam asking for too much but you guys are pros..
RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
yes it is.
look at this thread --> http://www.4homepages.de/forum/index.php?topic=6729.0
there is somewhere a post from somebody, who asks the same and solves it. i cant remember who it was, but it was somebody from the netherlands
open /include/sessions.php before the last line ?> add the following codeCode: [Select]//Mod_bmollet
/**
"éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
"éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
Turkish Character Problem ( Türkçe Karakterde Sorun var ) ( es hat türkische karekter fehle )
It is becoming such ( böyle oluyor) ( so geht das )
http://www.xxx.com/cat-%FEiirler-31.htm
but i such becom, want ( ben böyle olmasını istiyorum) ( ich wil das so ist )
http://www.xxx.com/cat-şiirler-31.htm
or ( veya böyle) ( oder )
http://www.xxx/cat-siirler-31.htm
anlamayan kimse kalmaz sanırım :mrgreen:
then it would like this
http://www.turkiye-resimleri.com/
also i have upload the pre-edited files for 1.7.4 http://rapidshare.com/files/33076491/seo.rar.html
this seo.rar file contains .htaccess file and /include/sessions.php file you can use it withour modifying
$row['image_name'] = strtr($row['image_name']
$row['image_name'] = strtr(format_text(trim($row['image_name']), 2)
on search / new images - is there any way to display the actual url rather than the img15434.search.htm is display img-jamie-cook---9-15426.htm
any chance of this
James
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /4images/
#Mod_bmollet : Cat name in URL
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^postcard([a-zA-Z0-9]+)\.htm$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
</IfModule>
//Mod_bmollet bitissss
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$trans = array(","=>"","\\"=>"",";"=>"",":"=>"","/"=>"","İ"=>"i","ı"=>"i","ñ"=>"ñ","Ñ"=>"Ñ","ş"=>"s","ğ"=>"g","ö"=>"ö","Ö"=>"O","ü"=>"u","Ü"=>"U","ç"=>"c","Ç"=>"C","?"=>"");
$row['cat_name']=strtr($row['cat_name'],$trans);
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNÑOPQRSTUVWXYZsSiIÝIÇçöÖGgüÜýþÞðÐ","eeeaeauoiaabcdefghijklmnñopqrstuvwxyzssiiiiccoogguuissgg");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
//return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$trans = array(","=>"","\\"=>"",";"=>"",":"=>"","/"=>"","İ"=>"i","ı"=>"i","ñ"=>"ñ","Ñ"=>"Ñ","ş"=>"s","ğ"=>"g","ö"=>"ö","Ö"=>"O","ü"=>"u","Ü"=>"U","ç"=>"c","Ç"=>"C","?"=>"");
$row['image_name']=strtr($row['image_name'],$trans);
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNÑOPQRSTUVWXYZsSiIÝIÇçöÖGgüÜýþÞðÐ","eeeaeauoiaabcdefghijklmnñopqrstuvwxyzssiiiiccoogguuissgg");
// if you want comlpete path to image in url, remove comment from following line
return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
1)open the .htaccess file and add the lines to the .htaccessCode: [Select]RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
2.) open /include/sessions.php before the last line ?> add the following codeCode: [Select]//Mod_bmollet
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
3.)open /include/sessions.php find this codeCode: [Select]function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
4.)Replace with this oneCode: [Select]/* ORIGINAL CODE
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
*/
function url($url, $amp = "&") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
elseif (strstr($url, 'categories.php')) {
if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
preg_match('#page=([0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('categories.php', 'cat'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('cat_id='.$matches1[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches1[1], '', $query);
$query = str_replace('cat_id='.$matches1[1], '', $query);
$query = str_replace('page='.$matches2[1].'&', '', $query);
$query = str_replace('&page='.$matches2[1], '', $query);
$query = str_replace('page='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
elseif (strstr($url, 'cat_id=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$cat_url = get_category_url($matches[1]);
$url = str_replace('categories.php', 'cat'.$cat_url.'.htm', $url);
$query = str_replace('cat_id='.$matches[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches[1], '', $query);
$query = str_replace('cat_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('categories.php', 'cat.htm', $url);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.get_image_url($matches[1]).'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}
then it would like this
http://www.turkiye-resimleri.com/
also i have upload the pre-edited files for 1.7.4 http://rapidshare.com/files/33076491/seo.rar.html
this seo.rar file contains .htaccess file and /include/sessions.php file you can use it withour modifying
I can't get my dropdown menu to function with that particular mod
(and also it's not great for Google SEO as it has no category or image name in the URL)
//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------
if (!$cache_enable) {
$category_dropdown_selfjump = get_category_dropdown($cat_id, 1);
} else {
$cache_id = create_cache_id(
'data.dropdown_selfjump',
array(
$user_info[$user_table_fields['user_id']],
$config['template_dir'],
$config['language_dir']
)
);
Well, I have 1.7.4 and tried everything, but it won't work. :( I get HTTP 404 problem - the webpage cannot be found.
Anyone else who got the same problem? :roll:
RewriteEngine On
RewriteBase /demo3/
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
Hello,
I place a "/" in a category, and he no find page !
This mod :
[MOD] Google Friendly Urls For 4images Best Seo Mod
http://www.4homepages.de/forum/index.php?topic=17598.0
Page :
http://www.wallpaper-gratuit.net/cat-film-%2F-series-tv-6.htm
Thanks :D
hi,
i would like to fix the category dropdown bug, but i have a few questions:
in sessions.php the url for the category is prozessed, right?
and in page_header.php the url is put into a category dropdown form, right?
so in :Code: [Select]//-----------------------------------------------------
//--- Category Dropdown -------------------------------
//-----------------------------------------------------
if (!$cache_enable) {
$category_dropdown_selfjump = get_category_dropdown($cat_id, 1);
} else {
$cache_id = create_cache_id(
'data.dropdown_selfjump',
array(
$user_info[$user_table_fields['user_id']],
$config['template_dir'],
$config['language_dir']
)
);
i would have to change the category url?
RewriteEngine On
RewriteBase /php/bilder/4images/
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /error404.php
ErrorDocument 404 /error404.php
ErrorDocument 403 /error403.php
ErrorDocument 500 /error500.php
ErrorDocument 400 /error400.php
ErrorDocument 401 /error401.php
RewriteBase /
RewriteEngine on
RewriteRule ^php/bilder/4images/lightbox\.htm$ lphp/bilder/4images/ightbox.php?%{QUERY_STRING}
RewriteRule ^php/bilder/4images/lightbox\.([0-9]+)\.htm$ php/bilder/4images/lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^php/bilder/4images/search\.htm$ php/bilder/4images/search.php?%{QUERY_STRING}
RewriteRule ^php/bilder/4images/search\.([0-9]+)\.htm$ php/bilder/4images/search.php?page=$1&%{QUERY_STRING}
RewriteRule ^php/bilder/4images/postcard([a-zA-Z0-9]+)\.htm$ php/bilder/4images/postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^php/bilder/4images/postcard\.img([0-9]+)\.htm$ php/bilder/4images/postcards.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^php/bilder/4images/k-(.*)-([0-9]+).htm php/bilder/4images/categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^php/bilder/4images/r-(.*)-([0-9]+).htm php/bilder/4images/details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^php/bilder/4images/r([0-9]+).search.htm php/bilder/4images/details.php?image_id=$1&%{QUERY_STRING}
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZsSiIÝIÇçöÖGgüÜýþÞðÐ","eeeaeauoiaabcdefghijklmnopqrstuvwxyzssiiiiccoogguuissgg");
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZsSiIÝIÇçGgýþÞðÐ","eeeaeauoiaabcdefghijklmnopqrstuvwxyzssiiiiccggissgg");
$row['cat_name'] = strtr($row['cat_name'],Array("ä"=>"ae","ö"=>"oe","ü"=>"ue", "Ä"=>"Ae","Ö"=>"Oe","Ü"=>"Ue"));
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZsSiIÝIÇçöÖGgüÜýþÞðÐ","eeeaeauoiaabcdefghijklmnopqrstuvwxyzssiiiiccoogguuissgg");
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZsSiIÝIÇçGgýþÞðÐ","eeeaeauoiaabcdefghijklmnopqrstuvwxyzssiiiiccggissgg");
$row['image_name'] = strtr($row['image_name'],Array("ä"=>"ae","ö"=>"oe","ü"=>"ue", "Ä"=>"Ae","Ö"=>"Oe","Ü"=>"Ue"));
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
Does this MOD work with version 1.7.6? If NO.. Then Is there any SEO mod out there for 1.7.6 version?
I'm very confused because even for 1.7.4 version nobody has replied with positive result, everyone was having a problem when they install this mod.. Can someone please give me link to a working SEO mod without any problems? or can someone please create one.. It will be very convenient for the users and I will really appreciate it. Thanks :)
Does this MOD work with version 1.7.6? If NO.. Then Is there any SEO mod out there for 1.7.6 version?
I'm very confused because even for 1.7.4 version nobody has replied with positive result, everyone was having a problem when they install this mod.. Can someone please give me link to a working SEO mod without any problems? or can someone please create one.. It will be very convenient for the users and I will really appreciate it. Thanks :)
works great with 1.7.4, 1.7.5 and 1.7.6 too, look here http://www.myanimalsworld.com
@om6acw
i checked your site and the search results working great. how did you do that? i followed the instruction in the mod but mine just got error but the main page and details page works fine, only the search result links messed up?
any help and sugestions
im using 1.7.6.
thank you..
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
i already did that, but not working how about the sessions.php? care to share your file?
like below and try to search link form search results are not working
http://filipinooverseas.org/search.htm
thanks
RewriteEngine On
RewriteBase /galeria/
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
As i see my categories are renamed to name.htm but when i click on the category, i get a 404 error.
I read all the posts here and nothing... :roll:
My site is http://www.estampafotos.com/galeria/
I used the sessions.php that i downloaded in the first post and my htaccess is:
As i see my categories are renamed to name.htm but when i click on the category, i get a 404 error.
I read all the posts here and nothing... :roll:
My site is http://www.estampafotos.com/galeria/
I used the sessions.php that i downloaded in the first post and my htaccess is:Code: [Select]RewriteEngine On
RewriteBase /galeria/
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
/* ORIGINAL CODE
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
*/
function url($url, $amp = "&") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
elseif (strstr($url, 'categories.php')) {
if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
preg_match('#page=([0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('categories.php', 'cat'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('cat_id='.$matches1[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches1[1], '', $query);
$query = str_replace('cat_id='.$matches1[1], '', $query);
$query = str_replace('page='.$matches2[1].'&', '', $query);
$query = str_replace('&page='.$matches2[1], '', $query);
$query = str_replace('page='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
elseif (strstr($url, 'cat_id=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$cat_url = get_category_url($matches[1]);
$url = str_replace('categories.php', 'http://'.$cat_url.'.tepkigosterelim.com', $url);
$query = str_replace('cat_id='.$matches[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches[1], '', $query);
$query = str_replace('cat_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('categories.php', 'cat.htm', $url);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'img'.get_image_url($matches[1]).'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}
} //end of class
$url = str_replace('categories.php', 'http://'.$cat_url.'.tepkigosterelim.com', $url);
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
1)open the .htaccess file and add the lines to the .htaccessCode: [Select]RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
Ich check das wirklich nicht!
Wo ist denn in 4images eine htacces vorhanden bzw. welche wird gebraucht für diesen Mod oder muss im Root eine erstellt werden?
Ich frage mich täglich was Du da machst :wink:
Du installierst dir alles was es hier gibt, aber infomationen in den Mods übergehst Du einfach.QuoteIch check das wirklich nicht!
Wo ist denn in 4images eine htacces vorhanden bzw. welche wird gebraucht für diesen Mod oder muss im Root eine erstellt werden?
Hast Du überhaubt das erste Posting gelesen, und Dir die seo.rar runter geladen ??
da ist eine session.php und auch deine .htaccess enthalten.
Also was soll die Frage :?:
<!-- you wish detail page in a small javascript open window, use .... -->Remove it and you'll be alright.
I don't have a .htaccess file. Do I need to create one?Yes
Ok the install went well and I think it's working. Only one problem... When I select to open the image in a new window on my details page, it opens at the bottom of the page. It use to open right over the top of the old one. I will pay to have someone help me fix this.I highly doubt that has anything to do with this mod...
http://www.wallewallpaper.com/img-fast-rope-training-492.htm
Ok the install went well and I think it's working. Only one problem... When I select to open the image in a new window on my details page, it opens at the bottom of the page. It use to open right over the top of the old one. I will pay to have someone help me fix this.I highly doubt that has anything to do with this mod...
http://www.wallewallpaper.com/img-fast-rope-training-492.htm
I can remove the mod and it works just fine.Your problem is somewhere in javascript and/or html templates, this mod has nothing to do with either...
The problems you have has nothing to do with this mod, you have HTML comment in template that being premature terminated by <img> tag.Quote<!-- you wish detail page in a small javascript open window, use .... -->Remove it and you'll be alright.
$cat_url = '-'.str_replace('+','-',urlencode(multilang($row['cat_name']))).'-'.$cat_id.$cat_url;
\http://www.misite.com/4images/cat-[CATEGORY_NAME]-[CATEGORY_ID].htm
http://www.misite.com/4images/img-[IMAGE_NAME]-[IMAGE_ID].htm
http://www.misite.com/4images/cat[CATEGORY_ID]..htm
http://www.misite.com/4images/img[IMAGE_ID].htm
The author of this mod went an "easy" way by adding additional database query requests for each link to an image or category. It made the mod more universal with less changes in the code, but which creates more server load.
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '5683'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '5683'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '5683'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '5683'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '5683'
Querytime: 0
SELECT sessionvars_value FROM 4images_sessionvars WHERE sessionvars_name = 'download_token' AND session_id = '0132b7f63b60ad312cd8afb82d69e221'
Querytime: 0.002
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Querytime: 0
SELECT cat_name,cat_parent_id FROM 4images_categories WHERE cat_id = '148'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Querytime: 0
SELECT cat_id,image_name FROM 4images_images WHERE image_id = '6813'
Page generated in 0.739813 seconds with 23 queries, spending 0.427000 seconds doing MySQL queries and 0.312813 doing PHP things. GZIP compression disabled
Page generated in 1.061930 seconds with 134 queries, spending 0.715000 seconds doing MySQL queries and 0.346930 doing PHP things. GZIP compression disabled
Page generated in 0.665015 seconds with 15 queries, spending 0.368000 seconds doing MySQL queries and 0.297015 doing PHP things. GZIP compression disabled
Page generated in 0.713163 seconds with 39 queries, spending 0.393000 seconds doing MySQL queries and 0.320163 doing PHP things. GZIP compression disabled
Page generated in 0.392127 seconds with 120 queries, spending 0.228000 seconds doing MySQL queries and 0.164127 doing PHP things. GZIP compression enabled
Page generated in 0.690441 seconds with 1183 queries, spending 0.052000 seconds doing MySQL queries and 0.638441 doing PHP things. GZIP compression enabled
Page generated in 0.152386 seconds with 21 queries, spending 0.054000 seconds doing MySQL queries and 0.098386 doing PHP things. GZIP compression enabled
Page generated in 1.061930 seconds with 134 queries, spending 0.715000 seconds doing MySQL queries and 0.346930 doing PHP things. GZIP compression disabled
Page generated in 0.697700 seconds with 38 queries, spending 0.362000 seconds doing MySQL queries and 0.335700 doing PHP things. GZIP compression disabled
Page generated in 0.713163 seconds with 39 queries, spending 0.393000 seconds doing MySQL queries and 0.320163 doing PHP things. GZIP compression disabled
Page generated in 0.654014 seconds with 22 queries, spending 0.349000 seconds doing MySQL queries and 0.305014 doing PHP things. GZIP compression disabled
//Mod_bmollet
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
//Mod_bmollet && improve by nic_bck v0.1
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
$categoria_anterior;
$url_categoria_anterior;
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
global $categoria_anterior;
global $url_categoria_anterior;
if ($categoria_anterior == $cat_id)
{
return $url_categoria_anterior;
}
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
$categoria_anterior = $cat_id;
$url_categoria_anterior = $cat_url;
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet && improve by nic_bck v0.1
/**
* Get the image url
* @param int $image_id The id of the image
*/
$imagen_anterior;
$url_imagen_anterior;
function get_image_url($image_id)
{
global $site_db;
global $imagen_anterior;
global $url_imagen_anterior;
//echo "imagen: " . $imagen_anterior;
if ($imagen_anterior == $image_id)
{
return $url_imagen_anterior;
}
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
$imagen_anterior = $image_id;
$url_imagen_anterior = '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
Page generated in 0.395708 seconds with 76 queries, spending 0.232000 seconds doing MySQL queries and 0.163708 doing PHP things. GZIP compression enabled
Page generated in 0.680518 seconds with 596 queries, spending 0.055000 seconds doing MySQL queries and 0.625518 doing PHP things. GZIP compression enabled
Page generated in 0.158879 seconds with 16 queries, spending 0.054000 seconds doing MySQL queries and 0.104879 doing PHP things. GZIP compression enabled
okay,
here we go
index siteCode: [Select]Page generated in 0.395708 seconds with 76 queries, spending 0.232000 seconds doing MySQL queries and 0.163708 doing PHP things. GZIP compression enabled
category site (most subs)Code: [Select]Page generated in 0.680518 seconds with 596 queries, spending 0.055000 seconds doing MySQL queries and 0.625518 doing PHP things. GZIP compression enabled
details siteCode: [Select]Page generated in 0.158879 seconds with 16 queries, spending 0.054000 seconds doing MySQL queries and 0.104879 doing PHP things. GZIP compression enabled
yep..
index and categories queries are down up to 50%
GREAT! Thank you 4 that!
function fixname($text)
{
return strtolower(strtr(
$text,
array(
"é" => "e",
"è" => "e",
"ê" => "e",
"à" => "a",
"ë" => "e",
"â" => "a",
"ú" => "a",
"ó" => "o",
"í" => "i",
"á" => "a",
//russian UTF8 encoded alphabet (lower and upper cases)
"А" => "a",
"а" => "a",
"Б" => "b",
"б" => "b",
"В" => "v",
"в" => "v",
"Г" => "g",
"г" => "g",
"Д" => "d",
"д" => "d",
"Е" => "e",
"е" => "e",
"Ё" => "yo",
"ё" => "yo",
"Ж" => "zh",
"ж" => "zh",
"З" => "z",
"з" => "z",
"И" => "i",
"и" => "i",
"Й" => "j",
"й" => "j",
"К" => "k",
"к" => "k",
"Л" => "l",
"л" => "l",
"М" => "m",
"м" => "m",
"Н" => "n",
"н" => "n",
"О" => "o",
"о" => "o",
"П" => "p",
"п" => "p",
"Р" => "r",
"р" => "r",
"С" => "s",
"с" => "s",
"Т" => "t",
"т" => "t",
"У" => "u",
"у" => "u",
"Ф" => "f",
"ф" => "f",
"Х" => "h",
"х" => "h",
"Ц" => "c",
"ц" => "c",
"Ч" => "ch",
"ч" => "ch",
"Ш" => "sh",
"ш" => "sh",
"Щ" => "sch",
"щ" => "sch",
"Ъ" => "",
"ъ" => "",
"Ы" => "i",
"ы" => "i",
"Ь" => "'",
"ь" => "'",
"Э" => "e",
"э" => "e",
"Ю" => "yu",
"ю" => "yu",
"Я" => "ya",
"я" => "ya",
)));
}
function get_category_url($cat_id,$cat_url = '')
{
global $site_db, $cat_cache;
static $urlname = array(); //cache names in this array
if (isset($urlname[$cat_id]))
return $urlname[$cat_id];
if (!empty($cat_cache))
{
$row['cat_name'] = @$cat_cache[$cat_id]['cat_name'];
$row['cat_parent_id'] = @$cat_cache[$cat_id]['cat_parent_id'];
}
else
{
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$row = $site_db->query_firstrow($sql);
}
$row['cat_name'] = fixname($row['cat_name']);
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
$row['cat_parent_id'] = 0;
if($row['cat_parent_id'] != 0)
{
$urlname[$cat_id] = get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
$urlname[$cat_id] = $cat_url;
}
return $urlname[$cat_id];
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
static $urlname = array(); //cache names in this array
if (isset($urlname[$image_id]))
return $urlname[$image_id];
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$row = $site_db->query_firstrow($sql);
$row['image_name'] = fixname($row['image_name']);
// if you want comlpete path to image in url, remove comment from following line
//$urlname[$image_id] = get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
$urlname[$image_id] = '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return $urlname[$image_id];
}
Page generated in 0.109686 seconds with 36 queries, spending 0.059000 seconds doing MySQL queries and 0.050686 doing PHP things. GZIP compression disabled
OptimizedPage generated in 0.095068 seconds with 11 queries, spending 0.059000 seconds doing MySQL queries and 0.036068 doing PHP things. GZIP compression disabled
Page generated in 0.227558 seconds with 195 queries, spending 0.051000 seconds doing MySQL queries and 0.176558 doing PHP things. GZIP compression disabled
Optimized:Page generated in 0.179981 seconds with 37 queries, spending 0.050000 seconds doing MySQL queries and 0.129981 doing PHP things. GZIP compression disabled
Page generated in 0.219341 seconds with 22 queries, spending 0.110000 seconds doing MySQL queries and 0.109341 doing PHP things. GZIP compression disabled
OptimizedPage generated in 0.060998 seconds with 14 queries, spending 0.028000 seconds doing MySQL queries and 0.032998 doing PHP things. GZIP compression disabled
Page generated in 0.194642 seconds with 27 queries, spending 0.044000 seconds doing MySQL queries and 0.150642 doing PHP things. GZIP compression enabled
Page generated in 0.607308 seconds with 8 queries, spending 0.045000 seconds doing MySQL queries and 0.562308 doing PHP things. GZIP compression enabled
Page generated in 0.263828 seconds with 98 queries, spending 0.046000 seconds doing MySQL queries and 0.217828 doing PHP things. GZIP compression enabled
Page generated in 0.209541 seconds with 15 queries, spending 0.112000 seconds doing MySQL queries and 0.097541 doing PHP things. GZIP compression enabled
Page generated in 0.466600 seconds with 67 queries, spending 0.215000 seconds doing MySQL queries and 0.251600 doing PHP things. GZIP compression disabled
Page generated in 0.409851 seconds with 67 queries, spending 0.222000 seconds doing MySQL queries and 0.187851 doing PHP things. GZIP compression disabled
Page generated in 0.459074 seconds with 67 queries, spending 0.215000 seconds doing MySQL queries and 0.244074 doing PHP things. GZIP compression disabled
Page generated in 0.468307 seconds with 70 queries, spending 0.225000 seconds doing MySQL queries and 0.243307 doing PHP things. GZIP compression disabled
Page generated in 0.462290 seconds with 67 queries, spending 0.215000 seconds doing MySQL queries and 0.247290 doing PHP things. GZIP compression disabled
Page generated in 0.481106 seconds with 67 queries, spending 0.223000 seconds doing MySQL queries and 0.258106 doing PHP things. GZIP compression disabled
Page generated in 0.450743 seconds with 67 queries, spending 0.212000 seconds doing MySQL queries and 0.238743 doing PHP things. GZIP compression disabled
Page generated in 0.461674 seconds with 67 queries, spending 0.220000 seconds doing MySQL queries and 0.241674 doing PHP things. GZIP compression disabled
Page generated in 0.493634 seconds with 22 queries, spending 0.272000 seconds doing MySQL queries and 0.221634 doing PHP things. GZIP compression disabled
Page generated in 0.449397 seconds with 19 queries, spending 0.214000 seconds doing MySQL queries and 0.235397 doing PHP things. GZIP compression disabled
Page generated in 0.445229 seconds with 19 queries, spending 0.217000 seconds doing MySQL queries and 0.228229 doing PHP things. GZIP compression disabled
Page generated in 0.445182 seconds with 19 queries, spending 0.215000 seconds doing MySQL queries and 0.230182 doing PHP things. GZIP compression disabled
Page generated in 0.461345 seconds with 19 queries, spending 0.224000 seconds doing MySQL queries and 0.237345 doing PHP things. GZIP compression disabled
Page generated in 0.445921 seconds with 19 queries, spending 0.216000 seconds doing MySQL queries and 0.229921 doing PHP things. GZIP compression disabled
Page generated in 0.468698 seconds with 22 queries, spending 0.221000 seconds doing MySQL queries and 0.247698 doing PHP things. GZIP compression disabled
yes, english names don't need any conversion, they will be used as they are
<!-- you wish detail page in a small javascript open window, use {thumbnail_openwindow} -->
// if you want full path of category in url, put next line in comment
in the original code it has this:Code: [Select]// if you want full path of category in url, put next line in comment
in the original code it has this:Code: [Select]// if you want full path of category in url, put next line in comment
Dear your reply always put me in trouble, plz explain it... Thanks
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
replace it with return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
if you use unmodified code from the original tutorial on first page of this topic, you should not see all the parent categories in the links, only current category name.
as of links to image details, in includes/sessions.php findCode: [Select]//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
replace it withCode: [Select]return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
// if you want comlpete path to image in url, remove comment from following line
return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;but it only bypass the category link from image link but k and r like words are still there with start of category link and image link
RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
@ashfaq:
at the moment I can't look at your site and ot sure what is your "r" is, but I can tell you right now, you cannot remove the image/category id from url (the last number in url). The names in the url is absolutely irrelevant, it's only cosmetic feature.
[EDIT]
Your "k" and "r" are the "markers" to identify what kind of link this is: image details or categories. you cannot create links without such markers, however you can replace these markers with something else (a word or similar)
Plz tell me how to change markers for categories and image details ?
I will be very very thankfull.
just reinstall the mod.
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz-");
try re-do step 1, I've fixed it in the original topic.
LoadModule rewrite_module modules/mod_rewrite.so
and .htaccess is allowedError 404 - Not found
Die angegebene Seite konnte nicht gefunden werden.
Ich denke das liegt bei mir an der .htaccess. Meine hp habe ich bei 1und1 gehostet.RewriteBase /
RewriteEngine on
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^postcard([a-zA-Z0-9]+)\.htm$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^k-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^r-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^r([0-9]+).search.htm details.php?image_id=$1&%{QUERY_STRING}
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: sessions.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.7.4 *
* *
* 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. *
* *
*************************************************************************/
if (!defined('ROOT_PATH')) {
die("Security violation");
}
//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------
define('SESSION_NAME', 'sessionid');
$user_table_fields = array(
"user_id" => "user_id",
"user_level" => "user_level",
"user_name" => "user_name",
"user_password" => "user_password",
"user_email" => "user_email",
"user_showemail" => "user_showemail",
"user_allowemails" => "user_allowemails",
"user_invisible" => "user_invisible",
"user_joindate" => "user_joindate",
"user_activationkey" => "user_activationkey",
"user_lastaction" => "user_lastaction",
"user_location" => "user_location",
"user_lastvisit" => "user_lastvisit",
"user_comments" => "user_comments",
"user_homepage" => "user_homepage",
"user_icq" => "user_icq"
);
//-----------------------------------------------------
//--- End Configuration -------------------------------
//-----------------------------------------------------
function get_category_id($path,$parent_id = 0)
{
$cat_name = array_shift($path);
global $site_db;
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $parent_id AND cat_name = '".mysql_real_escape_string($cat_name)."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
if( count($path) != 0)
{
return get_category_id($path,$row['cat_id']);
}
else
{
return $row['cat_id'];
}
}
//Mod_bmollet
/**
* Get the image id
* @param array $path An array with the path of the image
*/
function get_image_id($path)
{
global $site_db;
$image_name = array_pop($path);
$cat_id = get_category_id($path);
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE image_name = '".mysql_real_escape_string($image_name)."' AND cat_id = $cat_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
return $row['image_id'];
}
function get_user_table_field($add, $user_field) {
global $user_table_fields;
return (!empty($user_table_fields[$user_field])) ? $add.$user_table_fields[$user_field] : "";
}
class Session {
var $session_id;
var $session_key;
var $user_ip;
var $user_location;
var $current_time;
var $session_timeout;
var $mode = "get";
var $session_info = array();
var $user_info = array();
function Session() {
global $config;
$this->session_timeout = $config['session_timeout'] * 60;
$this->user_ip = $this->get_user_ip();
$this->user_location = $this->get_user_location();
$this->current_time = time();
if (defined('SESSION_KEY') && SESSION_KEY != '') {
$this->session_key = SESSION_KEY;
} else {
$this->session_key = md5('4images' . realpath(ROOT_PATH));
}
// Stop adding SID to URLs
@ini_set('session.use_trans_sid', 0);
//@ini_set('session.cookie_lifetime', $this->session_timeout);
session_name(urlencode(SESSION_NAME));
@session_start();
$this->demand_session();
}
function set_cookie_data($name, $value, $permanent = 1) {
$cookie_expire = ($permanent) ? $this->current_time + 60 * 60 * 24 * 365 : 0;
$cookie_name = COOKIE_NAME.$name;
setcookie($cookie_name, $value, $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
$HTTP_COOKIE_VARS[$cookie_name] = $value;
}
function read_cookie_data($name) {
global $HTTP_COOKIE_VARS;
$cookie_name = COOKIE_NAME.$name;
return (isset($HTTP_COOKIE_VARS[$cookie_name])) ? $HTTP_COOKIE_VARS[$cookie_name] : false;
}
function get_session_id() {
if (SID == '') {
$this->mode = "cookie";
}
if (preg_match('/[^a-z0-9]+/i', session_id())) {
@session_regenerate_id();
}
$this->session_id = session_id();
}
function demand_session() {
$this->get_session_id();
if (!$this->load_session_info()) {
$this->delete_old_sessions();
$user_id = ($this->read_cookie_data("userid")) ? intval($this->read_cookie_data("userid")) : GUEST;
$this->start_session($user_id);
}
else {
$this->user_info = $this->load_user_info($this->session_info['session_user_id']);
$update_cutoff = ($this->user_info['user_id'] != GUEST) ? $this->current_time - $this->user_info['user_lastaction'] : $this->current_time - $this->session_info['session_lastaction'];
if ($update_cutoff > 60) {
$this->update_session();
$this->delete_old_sessions();
}
}
}
function start_session($user_id = GUEST, $login_process = 0) {
global $site_db;
$this->user_info = $this->load_user_info($user_id);
if ($this->user_info['user_id'] != GUEST && !$login_process) {
if ($this->read_cookie_data("userpass") == $this->user_info['user_password'] && $this->user_info['user_level'] > USER_AWAITING) {
$this->set_cookie_data("userpass", $this->user_info['user_password']);
}
else {
$this->set_cookie_data("userpass", "", 0);
$this->user_info = $this->load_user_info(GUEST);
}
}
//if (!$login_process) {
$sql = "REPLACE INTO ".SESSIONS_TABLE."
(session_id, session_user_id, session_lastaction, session_location, session_ip)
VALUES
('".addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
$site_db->query($sql);
//}
$this->session_info['session_user_id'] = $this->user_info['user_id'];
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;
if ($this->user_info['user_id'] != GUEST) {
$this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location', ".get_user_table_field("", "user_lastvisit")." = ".$this->user_info['user_lastvisit']."
WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
$site_db->query($sql);
}
$this->set_cookie_data("lastvisit", $this->user_info['user_lastvisit']);
$this->set_cookie_data("userid", $this->user_info['user_id']);
return true;
}
function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
global $site_db, $user_table_fields;
if (empty($user_name) || empty($user_password)) {
return false;
}
$sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
$row = $site_db->query_firstrow($sql);
$user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
$user_password = md5($user_password);
if ($user_id != GUEST) {
if ($row[$user_table_fields['user_password']] == $user_password) {
$sql = "UPDATE ".SESSIONS_TABLE."
SET session_user_id = $user_id
WHERE session_id = '".addslashes($this->session_id)."'";
$site_db->query($sql);
if ($set_auto_login) {
$this->set_cookie_data("userpass", ($auto_login) ? $user_password : "");
}
$this->start_session($user_id, 1);
return true;
}
}
return false;
}
function logout($user_id) {
global $site_db;
$sql = "DELETE FROM ".SESSIONS_TABLE."
WHERE session_id = '".addslashes($this->session_id)."' OR session_user_id = $user_id";
$site_db->query($sql);
$this->set_cookie_data("userpass", "", 0);
$this->set_cookie_data("userid", GUEST);
$this->session_info = array();
return true;
}
function delete_old_sessions() {
global $site_db;
$expiry_time = $this->current_time - $this->session_timeout;
$sql = "DELETE FROM ".SESSIONS_TABLE."
WHERE session_lastaction < $expiry_time";
$site_db->query($sql);
return true;
}
function update_session() {
global $site_db;
$sql = "REPLACE INTO ".SESSIONS_TABLE."
(session_id, session_user_id, session_lastaction, session_location, session_ip)
VALUES
('".addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
$site_db->query($sql);
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;
if ($this->user_info['user_id'] != GUEST) {
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
$site_db->query($sql);
}
return;
}
function return_session_info() {
return $this->session_info;
}
function return_user_info() {
return $this->user_info;
}
function freeze() {
return;
}
function load_session_info() {
if (@ini_get('register_globals')) {
session_register($this->session_key);
if (!isset($GLOBALS[$this->session_key])) {
$GLOBALS[$this->session_key] = array();
}
$this->session_info = &$GLOBALS[$this->session_key];
} else {
if (isset($_SESSION)) {
if (!isset($_SESSION[$this->session_key])) {
$_SESSION[$this->session_key] = array();
}
$this->session_info = &$_SESSION[$this->session_key];
} else {
if (!isset($GLOBALS['HTTP_SESSION_VARS'][$this->session_key])) {
$GLOBALS['HTTP_SESSION_VARS'][$this->session_key] = array();
}
$this->session_info = &$GLOBALS['HTTP_SESSION_VARS'][$this->session_key];
}
}
if (!isset($this->session_info['session_ip'])) {
$this->session_info = array();
return false;
}
if ($this->mode == "get" && $this->session_info['session_ip'] != $this->user_ip) {
if (function_exists('session_regenerate_id')) {
@session_regenerate_id();
}
$this->get_session_id();
$this->session_info = array();
return false;
}
return $this->session_info;
}
function load_user_info($user_id = GUEST) {
global $site_db, $user_table_fields;
if ($user_id != GUEST) {
$sql = "SELECT u.*, l.*
FROM ".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
WHERE ".get_user_table_field("u.", "user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.", "user_id");
$user_info = $site_db->query_firstrow($sql);
if (!$user_info) {
$sql = "SELECT *
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_id")." = $user_id";
$user_info = $site_db->query_firstrow($sql);
if ($user_info) {
$lightbox_id = get_random_key(LIGHTBOXES_TABLE, "lightbox_id");
$sql = "INSERT INTO ".LIGHTBOXES_TABLE."
(lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
VALUES
('$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
$site_db->query($sql);
$user_info['lightbox_lastaction'] = $this->current_time;
$user_info['lightbox_image_ids'] = "";
}
}
}
if (empty($user_info[$user_table_fields['user_id']])) {
$user_info = array();
$user_info['user_id'] = GUEST;
$user_info['user_level'] = GUEST;
$user_info['user_lastaction'] = $this->current_time;
$user_info['user_lastvisit'] = ($this->read_cookie_data("lastvisit")) ? $this->read_cookie_data("lastvisit") : $this->current_time;
}
foreach ($user_table_fields as $key => $val) {
if (isset($user_info[$val])) {
$user_info[$key] = $user_info[$val];
}
elseif (!isset($user_info[$key])) {
$user_info[$key] = "";
}
}
return $user_info;
}
function set_session_var($var_name, $value) {
$this->session_info[$var_name] = $value;
return true;
}
function get_session_var($var_name) {
if (isset($this->session_info[$var_name])) {
return $this->session_info[$var_name];
}
return '';
}
function drop_session_var($var_name) {
unset($this->session_info[$var_name]);
}
function get_user_ip() {
global $HTTP_SERVER_VARS, $HTTP_ENV_VARS;
$ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv("REMOTE_ADDR"));
$ip = preg_replace("/[^\.0-9]+/", "", $ip);
return substr($ip, 0, 50);
}
function get_user_location() {
global $self_url;
return (defined("IN_CP")) ? "Control Panel" : preg_replace(array("/([?|&])action=[^?|&]*/", "/([?|&])mode=[^?|&]*/", "/([?|&])phpinfo=[^?|&]*/", "/([?|&])printstats=[^?|&]*/", "/[?|&]".URL_ID."=[^?|&]*/", "/[?|&]l=[^?|&]*/", "/[&?]+$/"), array("", "", "", "", "", "", ""), addslashes($self_url));
}
/* ORIGINAL CODE
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
*/
function url($url, $amp = "&") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
elseif (strstr($url, 'categories.php')) {
if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
preg_match('#page=([0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('categories.php','k'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('cat_id='.$matches1[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches1[1], '', $query);
$query = str_replace('cat_id='.$matches1[1], '', $query);
$query = str_replace('page='.$matches2[1].'&', '', $query);
$query = str_replace('&page='.$matches2[1], '', $query);
$query = str_replace('page='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
elseif (strstr($url, 'cat_id=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$cat_url = get_category_url($matches[1]);
$url = str_replace('categories.php','k'.$cat_url.'.htm', $url);
$query = str_replace('cat_id='.$matches[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches[1], '', $query);
$query = str_replace('cat_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('categories.php', 'cat.htm', $url);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php','r'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php','r'.get_image_url($matches[1]).'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
}
} //end of class bassss
//Mod_bmollet bitissss
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$trans = array(","=>"","\\"=>"",";"=>"",":"=>"","/"=>"","&#304;"=>"i","&#305;"=>"i","&#351;"=>"s","&#287;"=>"g","&#246;"=>"ö","Ö"=>"O","&#252;"=>"u","&#220;"=>"U","&#231;"=>"c","&#199;"=>"C","?"=>"");
$row['cat_name']=strtr($row['cat_name'],$trans);
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZsSiIÝIÇçGgýþÞðÐ","eeeaeauoiaabcdefghijklmnopqrstuvwxyzssiiiiccggissgg");
$row['cat_name'] = strtr($row['cat_name'],Array("ä"=>"ae","ö"=>"oe","ü"=>"ue", "Ä"=>"Ae","Ö"=>"Oe","Ü"=>"Ue"));
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
//return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$trans = array(","=>"","\\"=>"",";"=>"",":"=>"","/"=>"","&#304;"=>"i","&#305;"=>"i","&#351;"=>"s","&#287;"=>"g","&#246;"=>"ö","Ö"=>"O","&#252;"=>"u","&#220;"=>"U","&#231;"=>"c","&#199;"=>"C","?"=>"");
$row['image_name']=strtr($row['image_name'],$trans);
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZsSiIÝIÇçGgýþÞðÐ","eeeaeauoiaabcdefghijklmnopqrstuvwxyzssiiiiccggissgg");
$row['image_name'] = strtr($row['image_name'],Array("ä"=>"ae","ö"=>"oe","ü"=>"ue", "Ä"=>"Ae","Ö"=>"Oe","Ü"=>"Ue"));
// if you want comlpete path to image in url, remove comment from following line
return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
//-----------------------------------------------------
//--- Start Session -----------------------------------
//-----------------------------------------------------
define('COOKIE_NAME', '4images_');
define('COOKIE_PATH', '');
define('COOKIE_DOMAIN', '');
define('COOKIE_SECURE', '0');
$site_sess = new Session();
// Get Userinfo
$session_info = $site_sess->return_session_info();
$user_info = $site_sess->return_user_info();
//-----------------------------------------------------
//--- Get User Caches ---------------------------------
//-----------------------------------------------------
$num_total_online = 0;
$num_visible_online = 0;
$num_invisible_online = 0;
$num_registered_online = 0;
$num_guests_online = 0;
$user_online_list = "";
$prev_user_ids = array();
$prev_session_ips = array();
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
if ($row['session_user_id'] != GUEST && (isset($row[$user_table_fields['user_id']]) && $row[$user_table_fields['user_id']] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? ", " : "";
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".$username."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"user_online_list" => $user_online_list,
"lang_user_online" => str_replace('{num_total_online}', $num_total_online, $lang['user_online']),
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
?>
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
Hi, I have an old 4images site which uses an OLD SEO MOD
The OLD SEO has urls like this: http://mysite.com/4images/cat87.htm
I want to use the NEW SEO MOD(the one on this thread) but I want to have my OLD SEO urls redirect to the new URLs so that I don't get penalized by google.
So basically, how would I be able to do this...
OLD URL: http://mysite.com/4images/cat87.htm ---AUTO REDIRECT TO NEW URL:--->http://mysite.com/4images/cat-yellow-cars-87.html
If you can help me out in anyway, even some hints of what I should do, thanks.
Hi, I have an old 4images site which uses an OLD SEO MOD
The OLD SEO has urls like this: http://mysite.com/4images/cat87.htm
I want to use the NEW SEO MOD(the one on this thread) but I want to have my OLD SEO urls redirect to the new URLs so that I don't get penalized by google.
So basically, how would I be able to do this...
OLD URL: http://mysite.com/4images/cat87.htm ---AUTO REDIRECT TO NEW URL:--->http://mysite.com/4images/cat-yellow-cars-87.html
If you can help me out in anyway, even some hints of what I should do, thanks.
just install this new mode and disallow your old addresses in robots.txt
<meta name="description" content="{image_description}">
and {image_description} contains HTML.
then it would like this
http://www.turkiye-resimleri.com/
also i have upload the pre-edited files for 1.7.4 http://rapidshare.com/files/33076491/seo.rar.html
this seo.rar file contains .htaccess file and /include/sessions.php file you can use it withour modifying
True... but look at almost any webpage ( this forum too ). Link to the search result is the same with the normal link.
The problem is that both pages use the same template. One option is to make img78555.search.htm to use different template, ( named detailsearch.htm) but i guess it's more difficult.
Disallow: /search.php
Disallow: /search.htm
Disallow: /*.search.*
Disallow: /*?mode=search
First 2 lines are already in my htaccess and still google show search pages.. well, i will try the 3rd and 4th line.
Sorry, i meant robots, which i have from a long time...
tats ok
is there any way to display category path in the image url
for ex : if a site has hollywood-actress as a category it should say
http://test.com/cat-hollywood-actress-1/img-vanessa-21.htm
i searched whole topic but not able to locate
can u just send me the exact post
i'll be very thankful to you
:)
The one thing stopping me from using 4images on my live site is the problem with the URL
After spending several weeks fine tuning and adding lots of great mods to my site on a localhost WAMP test area I just can't get the URLs the way I want them
I've been thru the 27 pages of this MOD:
[Mod] Search Engine Friendly URLs aka Short URLs
http://www.4homepages.de/forum/index.php?topic=6729.0
and whilst I quite like the effect
eg.
www.mysite.com/cat-12
www.mysite.com/images-321
I can't get my dropdown menu to function with that particular mod
(and also it's not great for Google SEO as it has no category or image name in the URL)
I've also tried the mod on this current thread - [MOD] Google Friendly Urls For 4images Best Seo Mod - but can't manipulate the URL the way I want because I am struggling with REGEX and the .htaccess, and my own understanding of php coding
I appreciate that you have to have the cat ID and image ID in every URL using this mod but can I split up the long URL with a forward slash? (And remove the .htm extension)
eg. I want:
www.mysite.com/categoryname-12/imagename-43
I've also managed to remove the .htm / .html / .php ending successfully but would like to split up the category and the image with a forward slash (/)
because I have sub-categories, the URL currently looks ridiculous and would help if I could have forward slashes like this - category / subcat / image
any suggestions/advice?
if you use unmodified code from the original tutorial on first page of this topic, you should not see all the parent categories in the links, only current category name.
as of links to image details, in includes/sessions.php findCode: [Select]//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
replace it withCode: [Select]return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
I am using your given sessions.php file which didnt have the code which you tell to replace.
I have attached your given sessions.php file which i am currently using plz plz edit it for better seo and also tell can i use it with 4images 1.6.7 for better seo and user flags?
if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
I can't get my dropdown menu to function with that particular modExactly what is the problem? On my test site dropdown works fine. You can try replacing POST with GET in category_dropdown_form.html template.
(and also it's not great for Google SEO as it has no category or image name in the URL)
I appreciate that you have to have the cat ID and image ID in every URL using this mod but can I split up the long URL with a forward slash? (And remove the .htm extension)the splitting path with slashes is more complicated then it looks, due to 4images using relative paths ./ and ../
eg. I want:
www.mysite.com/categoryname-12/imagename-43
I've also managed to remove the .htm / .html / .php ending successfully but would like to split up the category and the image with a forward slash (/)
because I have sub-categories, the URL currently looks ridiculous and would help if I could have forward slashes like this - category / subcat / image
any suggestions/advice?
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= preg_match("/\?/", $url) ? "$amp" : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
function url($url, $amp = "&") {
global $l;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
$url .= strpos($url, '?') !== false ? $amp : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') !== false ? $amp : "?";
$url .= "l=".$l;
}
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
if ($this->mode == "get" && strstr($url, $this->session_id)) {
$url .= strpos($url, '?') !== false ? '&' : '?';
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') ? '&' : '?';
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= isset($dummy_array[1]) ? "#".$dummy_array[1] : "";
return $url;
if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
$url .= strpos($url, '?') !== false ? $amp : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') !== false ? $amp : "?";
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
hi fixyou,
there is no such MOD like you wish.
True... but look at almost any webpage ( this forum too ). Link to the search result is the same with the normal link.
The problem is that both pages use the same template. One option is to make img78555.search.htm to use different template, ( named detailsearch.htm) but i guess it's more difficult.
its easy to fix, just exclude your search results from google indexing in your robots.txt
like this:Code: [Select]Disallow: /search.php
Disallow: /search.htm
Disallow: /*.search.*
Disallow: /*?mode=search
no more double content ;)
$result = $site_db->query('select cat_id,cat_name from 4images_categories where cat_id <> 60 and cat_id <> 61 order by cat_order');
$tab_head="<TABLE STYLE='width:auto;border:0px solid gray'>";
$tab_tail="</TABLE>";
$tab_body='';
$tdx=1;
$trs='<TR>';
$tre='</TR>';
$goo=0;
$cat_link='./categories.php?cat_id=';
//$row['cat_name']
$gscript='<script type="text/javascript"><!--
google_ad_client = "xxxx";
/* 336x280, created 5/13/09 */
google_ad_slot = "xxxx";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
$cat_thum_img_border_color='#F5F5DC';
while ($row = mysql_fetch_assoc($result))
{
if($tdx==1)
{
$rlt = $site_db->query('select count(*) from 4images_images where cat_id='.$row['cat_id']);
$rw=mysql_fetch_row($rlt);
$rfolder=$row['cat_id'].'/';
$rfile=RandomFile($folder='./data/thumbnails/'.$rfolder, $extensions='jpg');
$img="<img onmouseover='zload(this)' onmouseout='bye()' style='border:1px solid ".$cat_thum_img_border_color."' alt='".$row['cat_name']."' src='".$rfile."'>";
if($goo==0)
{
//$tab_body=$tab_body.$trs."<td class='catAds' rowspan='3'><img style='border:1px dotted #CCCCCC' src='./data/farm_336x280.jpg'></td><td class='catthumb'><div class='cathead'><a href='".$cat_link.$row['cat_id']."' >".$row['cat_name'].' ['.$rw[0].']'."</a></div><a href='".$cat_link.$row['cat_id']."'>".$img."</a></td>";
$tab_body=$tab_body.$trs."<td class='catAds' rowspan='3'>".$gscript."<td class='catthumb'><div class='cathead'><a href='".$cat_link.$row['cat_id']."' >".$row['cat_name'].' ['.$rw[0].']'."</a></div><a href='".$cat_link.$row['cat_id']."'>".$img."</a></td>";
$goo=1;
}
else
{
$tab_body=$tab_body."<td class='catthumb'><div class='cathead'><a href='".$cat_link.$row['cat_id']."' >".$row['cat_name'].' ['.$rw[0].']'."</a></div><a href='".$cat_link.$row['cat_id']."'>".$img."</a></td>";
}
}
if($tdx<4 && $tdx>1)
{
$rfolder=$row['cat_id'].'/';
$rfile=RandomFile($folder='./data/thumbnails/'.$rfolder, $extensions='jpg');
$img="<img onmouseover='zload(this)' onmouseout='bye()' style='border:1px solid ".$cat_thum_img_border_color."' alt='".$row['cat_name']."' src='".$rfile."'>";
$tab_body=$tab_body."<td class='catthumb'><div class='cathead'><a href='".$cat_link.$row['cat_id']."' >".$row['cat_name'].' ['.$rw[0].']'."</a></div><a href='".$cat_link.$row['cat_id']."'>".$img."</a></td>";
}
if($tdx==4)
{
$rfolder=$row['cat_id'].'/';
$rfile=RandomFile($folder='./data/thumbnails/'.$rfolder, $extensions='jpg');
$img="<img onmouseover='zload(this)' onmouseout='bye()' style='border:1px solid ".$cat_thum_img_border_color."' alt='".$row['cat_name']."' src='".$rfile."'>";
/*
if($goo==0)
{
$tab_body=$tab_body."<td class='catthumb'><div class='cathead'><a href='".$cat_link.$row['cat_id']."' >".$row['cat_name'].' ['.$rw[0].']'."</a></div><a href='".$cat_link.$row['cat_id']."'>".$img."</a></td><td class='catthumb' rowspan='3'><img style='border:1px dotted #CCCCCC' src='./data/farm_336x280.jpg'></td>".$tre;
$goo=1;
}
else*/
{
$tab_body=$tab_body."<td class='catthumb'><div class='cathead'><a href='".$cat_link.$row['cat_id']."' >".$row['cat_name'].' ['.$rw[0].']'."</a></div><a href='".$cat_link.$row['cat_id']."'>".$img."</a></td>".$tre;
}
$tdx=0;
}
$tdx=$tdx+1;
}
$cat_link='./categories.php?cat_id='.$row['cat_id'];
$cat_link=$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID.'='.$row['cat_id']);
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@tram-und-bahnbilder.de and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
member.php?action=showprofile&user_id=1
nickname/profile/
elseif (strstr($url, 'postcards.php?image_id=')) {
elseif (strstr($url, 'member.php?action=showprofile&user_id=')) {
preg_match('#user_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$url = str_replace('member.php', 'profile'.$matches[1].'.htm', $url);
}
return $url;
}
Now short urls for profiles works and looks likehttp://localhost/4images/profile49
http://localhost/4images/nick/profile
later planing http://localhost/4images/search.htm?search_user=nick
change in to http://localhost/4images/nick/gallery
Hallo,Hatte dieses Problem beim Zusammenspiel mit der MOD TOP100. Hast Du die?
habe das jetz mal durchgeführt, Die URL http://www.tram-und-bahnbilder.de/img-tw-8012-augsburg-m8c-1094.htm allerdings kommt "Die Webseite konnte nicht angezeigt werden!" 404
wer kann helfen ?? hab die Änderung erstmal rausgenommen wieder
grüße Tobias
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
}
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
and $row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
Schnick und Schnack,
there is no bug..
you can control all extra chars withinCode: [Select]$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
andCode: [Select]$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
to $row['image_name'] = strtr($row['image_name'], "/éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","-eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
or $row['image_name'] = strtr($row['image_name'], "/éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","_eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
try this for image name
changeCode: [Select]$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
toCode: [Select]$row['image_name'] = strtr($row['image_name'], "/éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","-eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
orCode: [Select]$row['image_name'] = strtr($row['image_name'], "/éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","_eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
Not Found
The requested URL /4i/img-bafta-2647.htm was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
Thanks @Benny
i added your seo mod codes
but turkish characters can not be seen in links?
My site: www.resimtr.net help me pls.
http://www.resimtr.net/cat-%DDstanbul-1.htm
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$row['cat_name'] = strtr($row['cat_name'], "İéèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","ieeeaeauoiaabcdefghijklmnopqrstuvwxyz");
and maybe to $row['cat_name'] = strtr($row['cat_name'], "'İéèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","_ieeeaeauoiaabcdefghijklmnopqrstuvwxyz");
and to $row['image_name'] = strtr($row['image_name'], "'İéèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","_ieeeaeauoiaabcdefghijklmnopqrstuvwxyz");
hi benny, ich habe auch mich genau nach deiner anleitung gehalten und bekomme beim aufruf meiner existierenden (test)gallerie und der bilder:
Diese Seite ist leider nicht verfügbar.
(startseite funktioniert - bloss in die kategoreien und detail-bilder komme ich nicht mehr, da dort die obige fehlermeldung kommt,.,.)
(Top100 ist nicht installiert)
[Edit: kann es evtl. daran liegen dass mein testserver unter funpic läuft und dort kein mod-rewrite [RewriteEngine On
] unterstützt wird??? ]
Hallo,
habe das jetz mal durchgeführt, Die URL http://www.tram-und-bahnbilder.de/img-tw-8012-augsburg-m8c-1094.htm allerdings kommt "Die Webseite konnte nicht angezeigt werden!" 404
wer kann helfen ?? hab die Änderung erstmal rausgenommen wieder
grüße Tobias
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
I think we need a professional guy to make a good mod rewrite, since all the people here including me want a clear root like example.com/category/image.htm vano says he cant, there is a lot of CMS with a similar structure than 4images that can do it. i am not an expert in rewrite URL but am pretty sure it can be done we ll have to wait I supose.Main problem is not make "good mod rewrite", because mod rewrite only few rules. Most difficult is - make engine understand and generate FURLs and save ability to use old-style urls for compatibility. Of course, we may done this with a lots of if(...), but it is a indian-style and will slow down not fast 4img.
$row['image_name'] = strtr($row['image_name'], "/éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","-eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
http://max-pix.com/cat-%D5%E0%EC%E0%F2%EE%E2%E0-%D7%F3%EB%EF%E0%ED-66.htm?l=russian
А возможно ли сделать так чтобы URL брался из английской версии?Ну, смотря что вы имеете ввиду под английской версией...возможно проще просто перекодировать кирилицу в транслит:
RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}&mode=search
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}&mode=lightbox
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
and $row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$row['cat_name'] = strtr($row['cat_name'], "ąéèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","aeeeaeauoiaabcdefghijklmnopqrstuvwxyz");
and $row['image_name'] = strtr($row['image_name'], "ąéèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","aeeeaeauoiaabcdefghijklmnopqrstuvwxyz");
http://site.com/details.php?image_id=5734
но ссылки-то нормально отображаютсяhttp://site.com/img-severine-bremond-photo-5-5734.htm
http://max-pix.com/details.php?image_id=1425
http://max-pix.com/img-nicole-kidman-photo-7-1425.htm
hi wonder and welcome to the 4images forum:
you can controll all special chars within this post: http://www.4homepages.de/forum/index.php?topic=17598.msg137905#msg137905
file includes/sessions.php
example with char ą :
search forCode: [Select]$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
andCode: [Select]$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
change toCode: [Select]$row['cat_name'] = strtr($row['cat_name'], "ąéèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","aeeeaeauoiaabcdefghijklmnopqrstuvwxyz");
andCode: [Select]$row['image_name'] = strtr($row['image_name'], "ąéèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","aeeeaeauoiaabcdefghijklmnopqrstuvwxyz");
function get_category_url($cat_id,$cat_url = '')
function normalize ($string) {
$table = array(
'Š'=>'S', 'š'=>'s', 'Đ'=>'Dj', 'đ'=>'dj', 'Ž'=>'Z', 'ž'=>'z', 'Č'=>'C', 'č'=>'c', 'Ć'=>'C', 'ć'=>'c',
'À'=>'A', 'Á'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Ä'=>'A', 'Å'=>'A', 'Æ'=>'A', 'Ç'=>'C', 'È'=>'E', 'É'=>'E',
'Ê'=>'E', 'Ë'=>'E', 'Ì'=>'I', 'Í'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ñ'=>'N', 'Ò'=>'O', 'Ó'=>'O', 'Ô'=>'O',
'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O', 'Ù'=>'U', 'Ú'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y', 'Þ'=>'B', 'ß'=>'Ss',
'à'=>'a', 'á'=>'a', 'â'=>'a', 'ã'=>'a', 'ä'=>'a', 'å'=>'a', 'æ'=>'a', 'ç'=>'c', 'è'=>'e', 'é'=>'e',
'ê'=>'e', 'ë'=>'e', 'ì'=>'i', 'í'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'o', 'ñ'=>'n', 'ò'=>'o', 'ó'=>'o',
'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o', 'ù'=>'u', 'ú'=>'u', 'û'=>'u', 'ý'=>'y', 'ý'=>'y', 'þ'=>'b',
'ÿ'=>'y', 'Ŕ'=>'R', 'ŕ'=>'r',
);
return strtr($string, $table);
}
$row['cat_name'] = normalize($row['cat_name']);
$row['image_name'] = normalize($row['image_name']);
$row['cat_name'] = strtolower($row['cat_name']);
$row['image_name'] = strtolower($row['image_name']);
RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
humm, FYI if you have "/" in your images names ex : "CD / DVDs" you'll get an error.
So :Code: [Select]$row['image_name'] = strtr($row['image_name'], "/éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","-eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
the mod works really good with 1.7.7
http://polatliforum.com/resim/Polatli-macun-koyu-resimleri-59.html
http://polatliforum.com/resim/Polatli-macun-koyu-resimleri.html
$url = str_replace('categories.php', 'cat'.$matches1[1].'.'.$matches2[1].'.htm', $url);
Hello :)
Thank you for this wonderful mod, everything works beautiful! But there is a problem with lightboxes... When viewing the album, being on the front page - all photos are added to the lightbox without problems, but on the other album pages (2, 3, etc.) gives an error:
Not Found
The requested URL /cat20.2.html was not found on this server.
.... By the way, working links to the lightbox on the first album pages look like: /cat-{cat_name}-{image_id}.htm?action=addtolightbox&id={image_id}, on the other album pages (2, 3, etc.) they have the form: /cat20.2.htm?action=addtolightbox&id={image_id}, therefore, gives an error "Not found" :( How fix it? Please help.
my .htaccess (sessions.php, the same as in the first post of this topic):Code: [Select]RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
P.S. - sorry for my english :oops:
That is normal and supposed to be like that. the "search" keyword in the url tells 4images to show previous/next images from search result, not from category of the current viewing image.
http://www.bhwallpapers.com/download.php?action=resize&image_id=15982&multi_download_select=2
http://www.bhwallpapers.com/d-image-name-1600x1200-15982.htm
RewriteRule ^d-(.*)-([0-9]+)-([0-9]+)-[0-9]+x[0-9]+\.htm$ download.php?action=resize&image_id=$2&multi_download_select=$3&%{QUERY_STRING}
http://www.bhwallpapers.com/d-image-name-15982-2-1600x1200.htm
if (!defined('IN_CP'))
line of code in url function.. $multi_download_group .="<td align='center'><a href='".ROOT_PATH."download.php?action=resize&image_id=".$image_row['image_id']."&multi_download_select=".$var."'".$multi_download_var['target'].">".$download_multi_sizes[$var][0]."</a></td>";
$multi_download_group .= "<td align='center'><a href=\"".$site_sess->url(ROOT_PATH."download.php?action=resize&image_id=".$image_row['image_id']."&multi_download_select=$var"). "\" >".$download_multi_sizes[$var][0]."</a></td>";
$split = explode('?', $url);
to $split = explode('&', $url);
and it worked .. !! :) since used the same function as for details.php to generate url, the final url should be the in this format:Code: [Select]http://www.bhwallpapers.com/d-image-name-15982-2-1600x1200.htm
Because multidownload mod uses array indexes, the 1600x1200 in the example will only be used as decoration, you can manually change the numbers, but it will not change image size.
It changed the link to look like : http://www.bhwallpapers.com/download-diya-mirza-14272-30-Original%20Size.htm This is what I am expecting, but when clicking on this link.. it doesn't work . It link remains same on the page but actually it displays the homepage for me.. ( the reason of displaying the home page for me is due to my .htaccess code. As per my .htaccess if a not found encountered then it redirects to my home page ). |
It changed the original size link to ==> http://www.bhwallpapers.com/d-diya-mirza-14272-30-1024x768.htm The number 1024x768 changes to different number for different images.. Final result : Original size link not working and this change also affects other download link and non of download link works.. |
That's because you altered my "original" code to produce download-imagename-imageid-downloadsize-widthxheight.htm and forgot to do the same in new version ;)
the orginal sar file at the start of the thread does not have this line in the htaccess fileUnless you are using 4images v1.7.4, you should restore original sessions.php and install this mod manually, including code in .htaccess ;)
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
which i needed to add to make the cagegory drop down box work, i dont know if it is worth mentioning somewhere on the first post?
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^(.*) http://www.%{HTTP_HOST}/$1 [R=301]
RewriteRule ^index\.(php|html)$ http://www.xxxxx.com/ [R=301,L]
ErrorDocument 400 /index.html
ErrorDocument 401 /index.html
ErrorDocument 403 /index.html
ErrorDocument 404 /index.html
ErrorDocument 500 /index.html
RewriteEngine On
#RewriteBase /
RewriteRule ^kategorie-(.*)-([0-9]+)\.php$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^kategorie\.html$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^bild-(.*)-([0-9]+)\.php$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^bild([0-9]+)\.search.php$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^bild([0-9]+)\.lightbox.php$ details.php?image_id=$1&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^suche\.php$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.php$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.php$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.php$ lightbox.php?page=$1&%{QUERY_STRING}
Disallow: /*.search.*
Disallow: /*?page=
Disallow: /*&mode=search
Disallow: /*&sessionid=
if (strpos($text, "@")) {
$text = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)?[\w]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $text);
}
add below:if (strpos($text, "%20")) {
$text = str_replace("%20", "_", $text);
}
if (strpos($text, "%26")) {
$text = str_replace("%26", "_", $text);
}
if (strpos($text, "%24")) {
$text = str_replace("%24", "_", $text);
}
" " => "_", //space
"," => "_", //comma
"$" => "_", //dollar sign
"," => "",
"/" => "",
":" => "",
"ö" => "oe",
"ä" => "ae",
"ü" => "ue",
"(" => "",
")" => "",
"!" => "",
"*" => "",
"ß" => "ss",
"?" => "",
"&" => "and",
"=" => "is",
"+" => " and ",
"[" => "",
"]" => "",
"%" => "",
"#" => "",
"@" => "",
str_replace('details.php', 'img
str_replace('categories.php', 'cat
any solution for the not-working drop down list?
hmm, rescue911,No, it is not good working in you site. I explain it with example:
check my site.. is it working?
RewriteEngine On
# If no-www domain requested, externally redirect to www domain
RewriteCond %{HTTP_HOST} ^fotodvor\.com
RewriteRule (.*) http://www.fotodvor.com/$1 [R=301,L]
RewriteRule ^sitemap.xml$ google.php
# If www+subdomain domain requested, externally redirect to subdomain without "www"
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.fotodvor\.com
RewriteRule (.*) http://%1.fotodvor.com/$1 [R=301,L]
# If subdomain+www domain requested, externally redirect to subdomain without "www"
RewriteCond %{HTTP_HOST} ^([^.]+)\.www\.fotodvor\.com
RewriteRule (.*) http://%1.fotodvor.com/$1 [R=301,L]
# If subdomain requested, rewrite home page requests to index.php with query string user=subdomain & page="home"
RewriteCond %{REQUEST_URI} !^/search\.php
RewriteCond %{HTTP_HOST} !^www\.fotodvor\.com
RewriteCond %{HTTP_HOST} ^([^.]+)\.fotodvor\.com
RewriteRule ^$ /search.php?search_user=%1 [L]
#signature mod
RewriteRule ^signature\.png$ signature.php?%{QUERY_STRING}
RewriteRule ^go$ signature.php?go=1&%{QUERY_STRING}
#correcting a weird phpBB intergation bug...
#RewriteRule ^viewtopic.php?([^/\.]+)$ /forum/viewtopic.php?$1
RewriteRule ^viewtopic.php?$ http://www.fotodvor.com [R=301,L]
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^postcard([a-zA-Z0-9]+)\.htm$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
Please help.
Need input from SEO and 4images gurus...
I can not identify when this started to happen. I have many MODs installed. All seems to be working fine.
BUT Google stopped indexing my 4images pages altogether...
I started digging and found that only Googlebot does not see the pages served by 4images... all other search engines seem to be unaffected.
Analyzing the server response, I found a weird thing:
http://web-sniffer.net/
for URL like http://www.fotodvor.com/
with user agent: Googlebot
I get "Status: HTTP/1.1 302 Moved Temporarily"
any other user agent shows a good page.
renaming (thus disabling) .htaccess did not make any difference (it seems)...
Any ideas would be really appreciated!
I think that all work, but just now i found error with [MOD] Language select (russian - main).
Before this mod url with english has '&l=english' at the end. Now urls have '?l=english' or '&l=english'. Url with '&' didn't work (url, for example: member.php?action=showprofile&user_id=1&l=english). How to change '&'?
function fixname($text)
{
return strtolower(strtr(
$text,
array(
"é" => "e",
"è" => "e",
"ê" => "e",
"à" => "a",
"ë" => "e",
"â" => "a",
"ú" => "a",
"ó" => "o",
"í" => "i",
"á" => "a",
"ä" => "a", //new line
//russian UTF8 encoded alphabet (lower and upper cases)
"А" => "a",
"а" => "a",
"Б" => "b",
"б" => "b",
"В" => "v",
"в" => "v",
"Г" => "g",
"г" => "g",
"Д" => "d",
"д" => "d",
"Е" => "e",
"е" => "e",
"Ё" => "yo",
"ё" => "yo",
"Ж" => "zh",
"ж" => "zh",
"З" => "z",
"з" => "z",
"И" => "i",
"и" => "i",
"Й" => "j",
"й" => "j",
"К" => "k",
"к" => "k",
"Л" => "l",
"л" => "l",
"М" => "m",
"м" => "m",
"Н" => "n",
"н" => "n",
"О" => "o",
"о" => "o",
"П" => "p",
"п" => "p",
"Р" => "r",
"р" => "r",
"С" => "s",
"с" => "s",
"Т" => "t",
"т" => "t",
"У" => "u",
"у" => "u",
"Ф" => "f",
"ф" => "f",
"Х" => "h",
"х" => "h",
"Ц" => "c",
"ц" => "c",
"Ч" => "ch",
"ч" => "ch",
"Ш" => "sh",
"ш" => "sh",
"Щ" => "sch",
"щ" => "sch",
"Ъ" => "",
"ъ" => "",
"Ы" => "i",
"і" => "i", //ukranian i
"ы" => "i",
"Ь" => "'",
"ь" => "'",
"Э" => "e",
"э" => "e",
"Ю" => "yu",
"ю" => "yu",
"Я" => "ya",
"я" => "ya",
//russian 1251 encoded alphabet (lower and upper cases)
"а" => "a",
"А" => "a",
"б" => "b",
"Б" => "b",
"в" => "v",
"В" => "v",
"г" => "g",
"Г" => "g",
"д" => "d",
"Д" => "d",
"е" => "e",
"Е" => "e",
"ё" => "yo",
"Ё" => "yo",
"ж" => "zh",
"Ж" => "zh",
"з" => "z",
"З" => "z",
"и" => "i",
"И" => "i",
"й" => "j",
"Й" => "j",
"к" => "k",
"К" => "k",
"л" => "l",
"Л" => "l",
"м" => "m",
"М" => "m",
"н" => "n",
"Н" => "n",
"о" => "o",
"О" => "o",
"п" => "p",
"П" => "p",
"р" => "r",
"Р" => "r",
"с" => "s",
"С" => "s",
"т" => "t",
"Т" => "t",
"у" => "u",
"У" => "u",
"ф" => "f",
"Ф" => "f",
"х" => "h",
"Х" => "h",
"ц" => "c",
"Ц" => "c",
"ч" => "ch",
"Ч" => "ch",
"ш" => "sh",
"Ш" => "sh",
"щ" => "sch",
"Щ" => "sch",
"ъ" => "",
"Ъ" => "",
"ы" => "i",
"Ы" => "i",
"ь" => "'",
"Ь" => "'",
"э" => "e",
"Э" => "e",
"ю" => "yu",
"Ю" => "yu",
"я" => "ya",
"Я" => "ya",
"/" => "",
"&" => "-",
"№" => "",
"," => "-",
"°" => "",
"\"" => "",
"і" => "i", //ukranian i
"ї" => "i", //ukranian ї
"є" => "e", //ukranian є
"«" => "",
"»" => "",
)));
}
RewriteEngine On
#Mod_bmollet : Cat name in URL
RewriteRule ^araba-resimleri\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^araba-resimleri-(.*)-([0-9]+).htm categories.php?cat_id=$2&%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^arabalar-(.*)-([0-9]+).htm details.php?image_id=$2&%{QUERY_STRING}
#Mod_bmollet : This is to make search function work ( redirect links from search arabaults )
RewriteRule ^modifiyeli-arabalar\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^modifiyeli-arabalar\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^arabalar([0-9]+).modifiyeli-arabalar.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^arabalar([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^postcard([a-zA-Z0-9]+)\.htm$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^sitemap.xml$ sitemap.php
RewriteRule ^en_iyi_araba_resimleri.html$ top.php
# End search engine friendly links code
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:comments href="http://example.com" num_posts="2" width="500"></fb:comments>
@ V@no,
i used your optimized code for session.php and im extremely glad that with that help i reduced my server load to half. now i want to modify the permalink structure in .htaccess, i changed the structure on a demo site and it worked but i need help in one thing n that is Redirection of old permalink structure to the new one
right now i have this structure in .htaccess
RewriteRule ^img-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
so when i change it to
RewriteRule ^Wallpaper-(.*)-([0-9]+)\.html$ details.php?image_id=$2&%{QUERY_STRING}
how do i redirect the old one to the new structure for Search engine bots and backlinks ? so if someone come from google's search result they go through the new structure instead of a finding a 404 error
regards
Yousaf
Sathish Thank you, i have done this already in Sessions.php but i need to redirect my indexed links to the new Permalink structure. so if someone is following the old link structure from search engines may ends up in the new one.
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$row['image_name'] = strtr($row['image_name'], "ABCDEFGHIJKLMNOPQRSTUVWXYZéèêàëâúóíá","abcdefghijklmnopqrstuvwxyzeeeaeauoia");
Sathish Thank you, i have done this already in Sessions.php but i need to redirect my indexed links to the new Permalink structure. so if someone is following the old link structure from search engines may ends up in the new one.
hi redirect to permalink structure is possible but there is loads of manual work we have to do.for each dynamic link have redirect.
Google and other major search engines has introduced canonical tag to overcome the duplicate links.
i have done little modification for details page alone and i hope it will help you.
i am a newbie to 4images and novice to PHP[i am just learning here]
copy the below code into session.php before ?>
if($image_id>0)
{
$site_template->register_vars(array(
"has_imageid" => true,
"domain" =>"<link rel=\"canonical\" href=\"".$script_url."/wallpaper".get_image_url($image_id).".htm\">"
));
}
goto templates/yourtemplates/header.html and paste the below code between <head> </head>
{if has_imageid}
{domain}
{endif has_imageid}
Above changes will give you a URL Like <link rel="canonical" href= "http://www.yourdomain.com/wallpaper-someting-1.html">
Voll 1.7.10 funktionstüchtigHast du alles nur aus dem ersten Post?
LG und frohes neues Jahr
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: sessions.php *
* Copyright: (C) 2002-2011 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: xxx: xxx: 4homepages. de *
* Scriptversion: 1.7.10 *
* *
* Never released without support from: Nicky (xxx: xxx: 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. *
* *
*************************************************************************/
if (!defined('ROOT_PATH')) {
die("Security violation");
}
//-----------------------------------------------------
//--- Start Configuration -----------------------------
//-----------------------------------------------------
define('SESSION_NAME', 'sessionid');
$user_table_fields = array(
"user_id" => "user_id",
"user_level" => "user_level",
"user_name" => "user_name",
"user_password" => "user_password",
"user_email" => "user_email",
"user_showemail" => "user_showemail",
"user_allowemails" => "user_allowemails",
"user_invisible" => "user_invisible",
"user_joindate" => "user_joindate",
"user_activationkey" => "user_activationkey",
"user_lastaction" => "user_lastaction",
"user_location" => "user_location",
"user_lastvisit" => "user_lastvisit",
"user_comments" => "user_comments",
"user_homepage" => "user_homepage",
"user_icq" => "user_icq"
);
//-----------------------------------------------------
//--- End Configuration -------------------------------
//-----------------------------------------------------
function get_user_table_field($add, $user_field) {
global $user_table_fields;
return (!empty($user_table_fields[$user_field])) ? $add.$user_table_fields[$user_field] : "";
}
class Session {
var $session_id;
var $session_key;
var $user_ip;
var $user_location;
var $current_time;
var $session_timeout;
var $mode = "get";
var $session_info = array();
var $user_info = array();
function Session() {
global $config;
$this->session_timeout = $config['session_timeout'] * 60;
$this->user_ip = $this->get_user_ip();
$this->user_location = $this->get_user_location();
$this->current_time = time();
if (defined('SESSION_KEY') && SESSION_KEY != '') {
$this->session_key = SESSION_KEY;
} else {
$this->session_key = md5('4images' . realpath(ROOT_PATH));
}
// Stop adding SID to URLs
@ini_set('session.use_trans_sid', 0);
//@ini_set('session.cookie_lifetime', $this->session_timeout);
session_name(urlencode(SESSION_NAME));
@session_start();
$this->demand_session();
}
function set_cookie_data($name, $value, $permanent = 1) {
$cookie_expire = ($permanent) ? $this->current_time + 60 * 60 * 24 * 365 : 0;
$cookie_name = COOKIE_NAME.$name;
setcookie($cookie_name, $value, $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
$HTTP_COOKIE_VARS[$cookie_name] = $value;
}
function read_cookie_data($name) {
global $HTTP_COOKIE_VARS;
$cookie_name = COOKIE_NAME.$name;
return (isset($HTTP_COOKIE_VARS[$cookie_name])) ? $HTTP_COOKIE_VARS[$cookie_name] : false;
}
function get_session_id() {
if (SID == '') {
$this->mode = "cookie";
}
if (preg_match('/[^a-z0-9]+/i', session_id())) {
@session_regenerate_id();
}
$this->session_id = session_id();
}
function demand_session() {
$this->get_session_id();
if (!$this->load_session_info()) {
$this->delete_old_sessions();
$user_id = ($this->read_cookie_data("userid")) ? intval($this->read_cookie_data("userid")) : GUEST;
$this->start_session($user_id);
}
else {
$this->user_info = $this->load_user_info($this->session_info['session_user_id']);
$update_cutoff = ($this->user_info['user_id'] != GUEST) ? $this->current_time - $this->user_info['user_lastaction'] : $this->current_time - $this->session_info['session_lastaction'];
if ($update_cutoff > 60) {
$this->update_session();
$this->delete_old_sessions();
}
}
}
function start_session($user_id = GUEST, $login_process = 0) {
global $site_db;
$this->user_info = $this->load_user_info($user_id);
if ($this->user_info['user_id'] != GUEST && !$login_process) {
if (secure_compare($this->read_cookie_data("userpass"), md5($this->user_info['user_password'])) && $this->user_info['user_level'] > USER_AWAITING) {
$this->set_cookie_data("userpass", $this->user_info['user_password']);
}
else {
$this->set_cookie_data("userpass", "", 0);
$this->user_info = $this->load_user_info(GUEST);
}
}
//if (!$login_process) {
$sql = "REPLACE INTO ".SESSIONS_TABLE."
(session_id, session_user_id, session_lastaction, session_location, session_ip)
VALUES
('".addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
$site_db->query($sql);
//}
$this->session_info['session_user_id'] = $this->user_info['user_id'];
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;
if ($this->user_info['user_id'] != GUEST) {
$this->user_info['user_lastvisit'] = (!empty($this->user_info['user_lastaction'])) ? $this->user_info['user_lastaction'] : $this->current_time;
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location', ".get_user_table_field("", "user_lastvisit")." = ".$this->user_info['user_lastvisit']."
WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
$site_db->query($sql);
}
$this->set_cookie_data("lastvisit", $this->user_info['user_lastvisit']);
$this->set_cookie_data("userid", $this->user_info['user_id']);
return true;
}
function login($user_name = "", $user_password = "", $auto_login = 0, $set_auto_login = 1) {
global $site_db, $user_table_fields;
if (empty($user_name) || empty($user_password)) {
return false;
}
$sql = "SELECT ".get_user_table_field("", "user_id").get_user_table_field(", ", "user_password")."
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_name")." = '$user_name' AND ".get_user_table_field("", "user_level")." <> ".USER_AWAITING;
$row = $site_db->query_firstrow($sql);
$user_id = (isset($row[$user_table_fields['user_id']])) ? $row[$user_table_fields['user_id']] : GUEST;
if ($user_id != GUEST) {
if (compare_passwords($user_password, $row[$user_table_fields['user_password']])) {
$sql = "UPDATE ".SESSIONS_TABLE."
SET session_user_id = $user_id
WHERE session_id = '".addslashes($this->session_id)."'";
$site_db->query($sql);
if ($set_auto_login) {
$this->set_cookie_data("userpass", ($auto_login) ? md5($row[$user_table_fields['user_password']]) : "");
}
$this->start_session($user_id, 1);
return true;
}
}
return false;
}
function logout($user_id) {
global $site_db;
$sql = "DELETE FROM ".SESSIONS_TABLE."
WHERE session_id = '".addslashes($this->session_id)."' OR session_user_id = $user_id";
$site_db->query($sql);
$this->set_cookie_data("userpass", "", 0);
$this->set_cookie_data("userid", GUEST);
$this->session_info = array();
return true;
}
function delete_old_sessions() {
global $site_db;
$expiry_time = $this->current_time - $this->session_timeout;
$sql = "DELETE FROM ".SESSIONS_TABLE."
WHERE session_lastaction < $expiry_time";
$site_db->query($sql);
return true;
}
function update_session() {
global $site_db;
$sql = "REPLACE INTO ".SESSIONS_TABLE."
(session_id, session_user_id, session_lastaction, session_location, session_ip)
VALUES
('".addslashes($this->session_id)."', ".$this->user_info['user_id'].", $this->current_time, '$this->user_location', '$this->user_ip')";
$site_db->query($sql);
$this->session_info['session_lastaction'] = $this->current_time;
$this->session_info['session_location'] = $this->user_location;
$this->session_info['session_ip'] = $this->user_ip;
if ($this->user_info['user_id'] != GUEST) {
$sql = "UPDATE ".USERS_TABLE."
SET ".get_user_table_field("", "user_lastaction")." = $this->current_time, ".get_user_table_field("", "user_location")." = '$this->user_location'
WHERE ".get_user_table_field("", "user_id")." = ".$this->user_info['user_id'];
$site_db->query($sql);
}
return;
}
function return_session_info() {
return $this->session_info;
}
function return_user_info() {
return $this->user_info;
}
function freeze() {
return;
}
function load_session_info() {
$register_globals = strtolower(@ini_get('register_globals'));
if ($register_globals && $register_globals != "off" && $register_globals != "false") {
session_register($this->session_key);
if (!isset($GLOBALS[$this->session_key])) {
$GLOBALS[$this->session_key] = array();
}
$this->session_info = &$GLOBALS[$this->session_key];
} else {
if (isset($_SESSION)) {
if (!isset($_SESSION[$this->session_key])) {
$_SESSION[$this->session_key] = array();
}
$this->session_info = &$_SESSION[$this->session_key];
} else {
if (!isset($GLOBALS['HTTP_SESSION_VARS'][$this->session_key])) {
$GLOBALS['HTTP_SESSION_VARS'][$this->session_key] = array();
}
$this->session_info = &$GLOBALS['HTTP_SESSION_VARS'][$this->session_key];
}
}
if (!isset($this->session_info['session_ip'])) {
$this->session_info = array();
return false;
}
if ($this->mode == "get" && $this->session_info['session_ip'] != $this->user_ip) {
if (function_exists('session_regenerate_id')) {
@session_regenerate_id();
}
$this->get_session_id();
$this->session_info = array();
return false;
}
return $this->session_info;
}
function load_user_info($user_id = GUEST) {
global $site_db, $user_table_fields, $additional_user_fields;
if ($user_id != GUEST) {
$sql = "SELECT u.*, l.*
FROM ".USERS_TABLE." u, ".LIGHTBOXES_TABLE." l
WHERE ".get_user_table_field("u.", "user_id")." = $user_id AND l.user_id = ".get_user_table_field("u.", "user_id");
$user_info = $site_db->query_firstrow($sql);
if (!$user_info) {
$sql = "SELECT *
FROM ".USERS_TABLE."
WHERE ".get_user_table_field("", "user_id")." = $user_id";
$user_info = $site_db->query_firstrow($sql);
if ($user_info) {
$lightbox_id = get_random_key(LIGHTBOXES_TABLE, "lightbox_id");
$sql = "INSERT INTO ".LIGHTBOXES_TABLE."
(lightbox_id, user_id, lightbox_lastaction, lightbox_image_ids)
VALUES
('$lightbox_id', ".$user_info[$user_table_fields['user_id']].", $this->current_time, '')";
$site_db->query($sql);
$user_info['lightbox_lastaction'] = $this->current_time;
$user_info['lightbox_image_ids'] = "";
}
}
}
if (empty($user_info[$user_table_fields['user_id']])) {
$user_info = array();
$user_info['user_id'] = GUEST;
$user_info['user_level'] = GUEST;
$user_info['user_lastaction'] = $this->current_time;
$user_info['user_lastvisit'] = ($this->read_cookie_data("lastvisit")) ? $this->read_cookie_data("lastvisit") : $this->current_time;
}
foreach ($user_table_fields as $key => $val) {
if (isset($user_info[$val])) {
$user_info[$key] = $user_info[$val];
}
elseif (!isset($user_info[$key])) {
$user_info[$key] = "";
}
}
foreach ($additional_user_fields as $key => $val)
{
if (!isset($user_info[$key]))
{
$user_info[$key] = "";
}
}
return $user_info;
}
function set_session_var($var_name, $value) {
$this->session_info[$var_name] = $value;
return true;
}
function get_session_var($var_name) {
if (isset($this->session_info[$var_name])) {
return $this->session_info[$var_name];
}
return '';
}
function drop_session_var($var_name) {
unset($this->session_info[$var_name]);
}
function get_user_ip() {
global $HTTP_SERVER_VARS, $HTTP_ENV_VARS;
$ip = (!empty($HTTP_SERVER_VARS['REMOTE_ADDR'])) ? $HTTP_SERVER_VARS['REMOTE_ADDR'] : ((!empty($HTTP_ENV_VARS['REMOTE_ADDR'])) ? $HTTP_ENV_VARS['REMOTE_ADDR'] : getenv("REMOTE_ADDR"));
$ip = preg_replace("/[^\.0-9]+/", "", $ip);
return substr($ip, 0, 50);
}
function get_user_location() {
global $self_url;
return (defined("IN_CP")) ? "Control Panel" : preg_replace(array("/([?|&])action=[^?|&]*/", "/([?|&])mode=[^?|&]*/", "/([?|&])phpinfo=[^?|&]*/", "/([?|&])printstats=[^?|&]*/", "/[?|&]".URL_ID."=[^?|&]*/", "/[?|&]l=[^?|&]*/", "/[&?]+$/"), array("", "", "", "", "", "", ""), addslashes($self_url));
}
function url($url, $amp = "&") {
global $l, $user_info;
$dummy_array = explode("#", $url);
$url = $dummy_array[0];
$url = str_replace('&', '&', $url);
if (!defined('IN_CP')) {
if (strstr($url, 'index.php')) {
$url = str_replace('index.php', '', $url);
}
elseif (strstr($url, 'search.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('search.php', 'search.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('search.php', 'search.htm', $url);
}
}
elseif (strstr($url, 'lightbox.php')) {
if (strstr($url, 'page=')) {
preg_match('#page=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('lightbox.php', 'lightbox.'.$matches[1].'.htm', $url);
$query = str_replace('page='.$matches[1].'&', '', $query);
$query = str_replace('&page='.$matches[1], '', $query);
$query = str_replace('page='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('lightbox.php', 'lightbox.htm', $url);
}
}
elseif (strstr($url, 'categories.php')) {
if (strstr($url, 'cat_id=') && strstr($url, 'page=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches1);
preg_match('#page=([0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('categories.php', 'cat'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('cat_id='.$matches1[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches1[1], '', $query);
$query = str_replace('cat_id='.$matches1[1], '', $query);
$query = str_replace('page='.$matches2[1].'&', '', $query);
$query = str_replace('&page='.$matches2[1], '', $query);
$query = str_replace('page='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
elseif (strstr($url, 'cat_id=')) {
preg_match('#cat_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$cat_url = get_category_url($matches[1]);
$url = str_replace('categories.php', 'cat'.$cat_url.'.htm', $url);
$query = str_replace('cat_id='.$matches[1].'&', '', $query);
$query = str_replace('&cat_id='.$matches[1], '', $query);
$query = str_replace('cat_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
$url = str_replace('categories.php', 'cat.htm', $url);
}
}
elseif (strstr($url, 'details.php?image_id=')) {
if (strstr($url, 'image_id=') && strstr($url, 'mode=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches1);
preg_match('#mode=([a-zA-Z0-9]+)&?#', $url, $matches2);
if (isset($matches1[1]) && isset($matches2[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'ringtone'.$matches1[1].'.'.$matches2[1].'.htm', $url);
$query = str_replace('image_id='.$matches1[1].'&', '', $query);
$query = str_replace('&image_id='.$matches1[1], '', $query);
$query = str_replace('image_id='.$matches1[1], '', $query);
$query = str_replace('mode='.$matches2[1].'&', '', $query);
$query = str_replace('&mode='.$matches2[1], '', $query);
$query = str_replace('mode='.$matches2[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
else {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('details.php', 'ringtone'.get_image_url($matches[1]).'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
elseif (strstr($url, 'postcards.php?image_id=')) {
preg_match('#image_id=([0-9]+)&?#', $url, $matches);
if (isset($matches[1])) {
$split = explode('?', $url);
$url = $split[0];
$query = @$split[1];
$url = str_replace('postcards.php', 'postcard.img'.$matches[1].'.htm', $url);
$query = str_replace('image_id='.$matches[1].'&', '', $query);
$query = str_replace('&image_id='.$matches[1], '', $query);
$query = str_replace('image_id='.$matches[1], '', $query);
if (!empty($query)) {
$url .= '?' . $query;
}
}
}
}
if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
$url .= strpos($url, '?') !== false ? $amp : "?";
$url .= SESSION_NAME."=".$this->session_id;
}
if (!empty($l)) {
$url .= strpos($url, '?') !== false ? $amp : "?";
$url .= "l=".$l;
}
$url = str_replace('&', $amp, $url);
$url .= (isset($dummy_array[1])) ? "#".$dummy_array[1] : "";
return $url;
}
//Mod_bmollet
/**
* Get the category id
* @param array $path An array with the path of the category
* @param int $parent_id The parent id of the first item in the $path
*/
function get_category_id($path,$parent_id = 0)
{
$cat_name = array_shift($path);
global $site_db;
$sql = "SELECT cat_id FROM ".CATEGORIES_TABLE." WHERE cat_parent_id = $parent_id AND cat_name = '".mysql_real_escape_string($cat_name)."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
if( count($path) != 0)
{
return get_category_id($path,$row['cat_id']);
}
else
{
return $row['cat_id'];
}
}
//Mod_bmollet
/**
* Get the image id
* @param array $path An array with the path of the image
*/
function get_image_id($path)
{
global $site_db;
$image_name = array_pop($path);
$cat_id = get_category_id($path);
$sql = "SELECT image_id FROM ".IMAGES_TABLE." WHERE image_name = '".mysql_real_escape_string($image_name)."' AND cat_id = $cat_id";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
return $row['image_id'];
}
} //end of class
//-----------------------------------------------------
//--- Start Session -----------------------------------
//-----------------------------------------------------
define('COOKIE_NAME', '4images_');
define('COOKIE_PATH', '');
define('COOKIE_DOMAIN', '');
define('COOKIE_SECURE', '0');
$site_sess = new Session();
// Get Userinfo
$session_info = $site_sess->return_session_info();
$user_info = $site_sess->return_user_info();
//-----------------------------------------------------
//--- Get User Caches ---------------------------------
//-----------------------------------------------------
$num_total_online = 0;
$num_visible_online = 0;
$num_invisible_online = 0;
$num_registered_online = 0;
$num_guests_online = 0;
$user_online_list = "";
$prev_user_ids = array();
$prev_session_ips = array();
if (defined("GET_USER_ONLINE") && ($config['display_whosonline'] == 1 || $user_info['user_level'] == ADMIN)) {
$time_out = time() - 300;
$sql = "SELECT s.session_user_id, s.session_lastaction, s.session_ip".get_user_table_field(", u.", "user_id").get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_invisible")."
FROM ".SESSIONS_TABLE." s
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = s.session_user_id)
WHERE s.session_lastaction >= $time_out
ORDER BY ".get_user_table_field("u.", "user_id")." ASC, s.session_ip ASC";
$result = $site_db->query($sql);
while ($row = $site_db->fetch_array($result)) {
if ($row['session_user_id'] != GUEST && (isset($row[$user_table_fields['user_id']]) && $row[$user_table_fields['user_id']] != GUEST)) {
if (!isset($prev_user_ids[$row['session_user_id']])) {
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 1 : 0;
$invisibleuser = ($is_invisible) ? "*" : "";
$username = (isset($row[$user_table_fields['user_level']]) && $row[$user_table_fields['user_level']] == ADMIN && $config['highlight_admin'] == 1) ? sprintf("<b>%s</b>", $row[$user_table_fields['user_name']]) : $row[$user_table_fields['user_name']];
if (!$is_invisible || $user_info['user_level'] == ADMIN) {
$user_online_list .= ($user_online_list != "") ? ", " : "";
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/", $row['session_user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$row['session_user_id'];
$user_online_list .= "<a href=\"".$site_sess->url($user_profile_link)."\">".str_replace(array("{", "}"), array("{", "}"), $username)."</a>".$invisibleuser;
}
(!$is_invisible) ? $num_visible_online++ : $num_invisible_online++;
$num_registered_online++;
}
$prev_user_ids[$row['session_user_id']] = 1;
}
else {
if (!isset($prev_session_ips[$row['session_ip']])) {
$num_guests_online++;
}
}
$prev_session_ips[$row['session_ip']] = 1;
}
$num_total_online = $num_registered_online + $num_guests_online;
//$num_invisible_online = $num_registered_online - $num_visible_online;
$site_template->register_vars(array(
"num_total_online" => $num_total_online,
"num_invisible_online" => $num_invisible_online,
"num_registered_online" => $num_registered_online,
"num_guests_online" => $num_guests_online,
"user_online_list" => $user_online_list,
"lang_user_online" => str_replace('{num_total_online}', $num_total_online, $lang['user_online']),
"lang_user_online_detail" => str_replace(array('{num_registered_online}','{num_invisible_online}','{num_guests_online}'), array($num_registered_online,$num_invisible_online,$num_guests_online), $lang['user_online_detail']),
));
$whos_online = $site_template->parse_template("whos_online");
$site_template->register_vars("whos_online", $whos_online);
unset($whos_online);
unset($prev_user_ids);
unset($prev_session_ips);
}
//Mod_bmollet
/**
* Get the category url
* @param int $cat_id The id of the category
* @param string $cat_url The current status of the URL
*/
function get_category_url($cat_id,$cat_url = '')
{
global $site_db;
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['cat_name'] = strtr($row['cat_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
return $cat_url;
if( $row['cat_parent_id'] != 0)
{
return get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
return $cat_url;
}
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$result = $site_db->query($sql);
$row = $site_db->fetch_array($result);
$row['image_name'] = strtr($row['image_name'], "éèêàëâúóíáABCDEFGHIJKLMNOPQRSTUVWXYZ","eeeaeauoiaabcdefghijklmnopqrstuvwxyz");
// if you want comlpete path to image in url, remove comment from following line
//return get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
}
?>
RewriteEngine On
#RewriteBase /
RewriteRule ^cat-(.*)-([0-9]+)\.htm$ categories.php?cat_id=$2&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
#Mod_bmollet : Image name in URL
RewriteRule ^ringtone-(.*)-([0-9]+)\.htm$ details.php?image_id=$2&%{QUERY_STRING}
RewriteRule ^ringtone([0-9]+)\.search.htm$ details.php?image_id=$1&%{QUERY_STRING}&mode=search
RewriteRule ^ringtone([0-9]+)\.lightbox.htm$ details.php?image_id=$1&%{QUERY_STRING}&mode=lightbox
#Mod_bmollet : This is to make search function work ( redirect links from search results )
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox\.htm$ lightbox.php?%{QUERY_STRING}
RewriteRule ^lightbox\.([0-9]+)\.htm$ lightbox.php?page=$1&%{QUERY_STRING}
RewriteRule ^search\.htm$ search.php?%{QUERY_STRING}
RewriteRule ^search\.([0-9]+)\.htm$ search.php?page=$1&%{QUERY_STRING}
RewriteRule ^cat\.htm$ categories.php?%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.([0-9]+)\.htm$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
RewriteRule ^cat([0-9]+)\.htm$ categories.php?cat_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.htm$ details.php?image_id=$1&%{QUERY_STRING}
RewriteRule ^img([0-9]+)\.([a-zA-Z0-9]+)\.htm$ details.php?image_id=$1&mode=$2&%{QUERY_STRING}
RewriteRule ^postcard([a-zA-Z0-9]+)\.htm$ postcards.php?postcard_id=$1&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)\.htm$ postcards.php?image_id=$1&%{QUERY_STRING}
# End search engine friendly links code
RewriteRule ^cat([0-9]+)\.([0-9]+)\.htm$ categories.php?cat_id=$1&page=$2&%{QUERY_STRING}
Since we are on optimizing rage today, little more optimized nic_bck's version:Code: [Select]function fixname($text)
{
return strtolower(strtr(
$text,
array(
"é" => "e",
"è" => "e",
"ê" => "e",
"à" => "a",
"ë" => "e",
"â" => "a",
"ú" => "a",
"ó" => "o",
"í" => "i",
"á" => "a",
//russian UTF8 encoded alphabet (lower and upper cases)
"А" => "a",
"а" => "a",
"Б" => "b",
"б" => "b",
"В" => "v",
"в" => "v",
"Г" => "g",
"г" => "g",
"Д" => "d",
"д" => "d",
"Е" => "e",
"е" => "e",
"Ё" => "yo",
"ё" => "yo",
"Ж" => "zh",
"ж" => "zh",
"З" => "z",
"з" => "z",
"И" => "i",
"и" => "i",
"Й" => "j",
"й" => "j",
"К" => "k",
"к" => "k",
"Л" => "l",
"л" => "l",
"М" => "m",
"м" => "m",
"Н" => "n",
"н" => "n",
"О" => "o",
"о" => "o",
"П" => "p",
"п" => "p",
"Р" => "r",
"р" => "r",
"С" => "s",
"с" => "s",
"Т" => "t",
"т" => "t",
"У" => "u",
"у" => "u",
"Ф" => "f",
"ф" => "f",
"Х" => "h",
"х" => "h",
"Ц" => "c",
"ц" => "c",
"Ч" => "ch",
"ч" => "ch",
"Ш" => "sh",
"ш" => "sh",
"Щ" => "sch",
"щ" => "sch",
"Ъ" => "",
"ъ" => "",
"Ы" => "i",
"ы" => "i",
"Ь" => "'",
"ь" => "'",
"Э" => "e",
"э" => "e",
"Ю" => "yu",
"ю" => "yu",
"Я" => "ya",
"я" => "ya",
)));
}
function get_category_url($cat_id,$cat_url = '')
{
global $site_db, $cat_cache;
static $urlname = array(); //cache names in this array
if (isset($urlname[$cat_id]))
return $urlname[$cat_id];
if (!empty($cat_cache))
{
$row['cat_name'] = @$cat_cache[$cat_id]['cat_name'];
$row['cat_parent_id'] = @$cat_cache[$cat_id]['cat_parent_id'];
}
else
{
$sql = "SELECT cat_name,cat_parent_id FROM ".CATEGORIES_TABLE." WHERE cat_id = '".$cat_id."'";
$row = $site_db->query_firstrow($sql);
}
$row['cat_name'] = fixname($row['cat_name']);
$cat_url = '-'.str_replace('+','-',urlencode($row['cat_name'])).'-'.$cat_id.$cat_url;
// if you want full path of category in url, put next line in comment
$row['cat_parent_id'] = 0;
if($row['cat_parent_id'] != 0)
{
$urlname[$cat_id] = get_category_url($row['cat_parent_id'],$cat_url);
}
else
{
$urlname[$cat_id] = $cat_url;
}
return $urlname[$cat_id];
}
//Mod_bmollet
/**
* Get the image url
* @param int $image_id The id of the image
*/
function get_image_url($image_id)
{
global $site_db;
static $urlname = array(); //cache names in this array
if (isset($urlname[$image_id]))
return $urlname[$image_id];
$sql = "SELECT cat_id,image_name FROM ".IMAGES_TABLE." WHERE image_id = '".$image_id."'";
$row = $site_db->query_firstrow($sql);
$row['image_name'] = fixname($row['image_name']);
// if you want comlpete path to image in url, remove comment from following line
//$urlname[$image_id] = get_category_url($row['cat_id']).'-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
$urlname[$image_id] = '-'.str_replace('+','-',urlencode($row['image_name'])).'-'.$image_id;
return $urlname[$image_id];
}
Results:
index.php
OriginalCode: [Select]Page generated in 0.109686 seconds with 36 queries, spending 0.059000 seconds doing MySQL queries and 0.050686 doing PHP things. GZIP compression disabled
OptimizedCode: [Select]Page generated in 0.095068 seconds with 11 queries, spending 0.059000 seconds doing MySQL queries and 0.036068 doing PHP things. GZIP compression disabled
categories.php (30 images per page)
Original:Code: [Select]Page generated in 0.227558 seconds with 195 queries, spending 0.051000 seconds doing MySQL queries and 0.176558 doing PHP things. GZIP compression disabled
Optimized:Code: [Select]Page generated in 0.179981 seconds with 37 queries, spending 0.050000 seconds doing MySQL queries and 0.129981 doing PHP things. GZIP compression disabled
details.php
OriginalCode: [Select]Page generated in 0.219341 seconds with 22 queries, spending 0.110000 seconds doing MySQL queries and 0.109341 doing PHP things. GZIP compression disabled
OptimizedCode: [Select]Page generated in 0.060998 seconds with 14 queries, spending 0.028000 seconds doing MySQL queries and 0.032998 doing PHP things. GZIP compression disabled