• [Mod] Search Engine Friendly URLs aka Short URLs 3 0 5 1
Currently:  

Author Topic: [Mod] Search Engine Friendly URLs aka Short URLs  (Read 727046 times)

0 Members and 3 Guests are viewing this topic.

Offline bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #165 on: November 20, 2005, 03:44:19 PM »
@ V@no

Quote
its very easy
here is a specific for privacy.html:
Code:
RewriteRule ^privacy\.html$ index.php?template=privacy&%{QUERY_STRING}and here is "general" that would translate every .html file into index.php?template=<name>
add it at the very end of .htaccess:

Code:
RewriteRule ^([a-zA-Z0-9_-]+)\.html$ index.php?template=$1&%{QUERY_STRING}so it should "translate" blah.html into index.php?template=blah

sorry i am confused. :?

i would like to "translate"  index.php?template=blah into blah.html for all of my menu links you can see on my url .

How must the code look for these?
And also for contact.php, board.php, sitemap.php???

Another strange problem i have still with my category dropdown selection.
It is working in nearley every category except for example the "Skalen", "Formenbau" and "Schilder" category on my URL.
That is strange isn't it?
Could someone help me with this.
I still changed the line like matthias in the global.php. But the mistake still exists.

Offline salimiali

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #166 on: November 21, 2005, 09:43:32 PM »
i have on my gallery root file:

.htaccess
.htaccess.txt

wich is true? (on this files i added this code:)

Code: [Select]
# 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

and save wtih 2 names, .htaccess and .htaccess.txt (wich is true?) and copy on site.com/gallery/

note: i join from new version of 4images

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #167 on: November 21, 2005, 09:45:36 PM »
Quote
I have on my gallery root file:

.htaccess
.htaccess.txt

wich is true? (on this files i added this code:)

Use only .htaccess

Matthias

Offline salimiali

  • Newbie
  • *
  • Posts: 11
    • View Profile
[Mod] Search Engine Friendly URLs aka Short URLs
« Reply #168 on: November 21, 2005, 09:47:31 PM »
but nex question:

i not found this source on my sessions.php

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
on my file is this source and i can not replace it, found this!!

Code: [Select]
    if ($this->mode == "get" && strpos($url, $this->session_id) === false) {
how i can made replace this code?

Offline bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #169 on: November 21, 2005, 10:34:51 PM »
Please could someone help me with my category dropdown problem i have explained in a few postings above.

Quote
Another strange problem i have still with my category dropdown selection.
It is working in nearly every category/subcategory page except for example the "Skalen", "Formenbau" and "Schilder" category on my URL.
That is strange isn't it? On some pages it is working on some it isn't!
Could someone help me with this.
I still changed the line like matthias in the global.php. But the mistake still exists.
Please test it on my site.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #170 on: November 22, 2005, 01:05:38 AM »
i not found this source on my sessions.php

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
what is it you are trying to do? there is no such line in the original topic in the first place.

@bibabobu:
"On some pages it is working on some it isn't" - not very usefull to even start looking at the problem ;) And I see no problem on your site with dropdown for the categories mentioned.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline bibabobu

  • Sr. Member
  • ****
  • Posts: 311
  • Technische und künstlerische Gravuren
    • View Profile
    • Technische und künstlerische Gravuren für die gesamte Metall-, Kunststoff- und Papierindustrie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #171 on: November 22, 2005, 01:41:56 AM »
Dear V@no,

i think since i have installed the new code for search engine friendly URLs and language select my category dropdown field does not work correctly.
Please have a look on my site and test the field in different categories.
Sorry for my bad english i don't find the right words for explaining right at the moment.
For example:
If i go to the main category "Skalen" my category selection field works well. If i want to go to another category right out of this "Skalen" category by using the dropdown category selection field nothing will happen.  :(
...so in some categories the field is working and in some won't.
I have no idea where is the mistake :?:

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #172 on: November 22, 2005, 02:18:28 AM »
I dont think the problem is related to this mod. You have JavaScript errors on your site and since the dropdown menu is using javascript to auto jump to the sellected category it also producing error...The form with category select dropdown on "working" pages and "non working" are identical, but for unknown to me reason this JS error acure:
Quote
Error: forms.jumpbox has no properties
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline TXtaholic

  • Jr. Member
  • **
  • Posts: 67
  • life is ours we live it our way!
    • View Profile
    • i MMS u
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #173 on: November 22, 2005, 12:31:35 PM »
Dear V@no,

i think since i have installed the new code for search engine friendly URLs and language select my category dropdown field does not work correctly.
Please have a look on my site and test the field in different categories.
Sorry for my bad english i don't find the right words for explaining right at the moment.
For example:
If i go to the main category "Skalen" my category selection field works well. If i want to go to another category right out of this "Skalen" category by using the dropdown category selection field nothing will happen.  :(
...so in some categories the field is working and in some won't.
I have no idea where is the mistake :?:

well i have the same problem, when  i choose any category and click go it simply goes to the index page!!! when i resorted the orginal code it works like charm? so it seems that maybe i've missed something in code??
note: i use 4images 1.7.1 and i added } as recommend in previous post in order to make it work with 1.7.1 version!!!!!!
the code that i have can be found here!!!

http://www.immsu.com/sessions.phps

please advise!!!

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #174 on: November 22, 2005, 05:36:42 PM »
@ textaholic
I had the same problem!
try this fix
http://www.4homepages.de/forum/index.php?topic=6729.msg50928#msg50928

@ V@no
Back to another problem in this mod
Do you have a solution on this
This is my .htacces file
Quote
# Begin search engine friendly links code
RewriteEngine On
#RewriteBase /
RewriteRule ^lightbox(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ lightbox.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^search(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ search.php?page=$2&l=$4&%{QUERY_STRING}

RewriteRule ^cat([0-9]+)?(\.([0-9]+))?(_([a-zA-Z]+))?\.htm$ categories.php?cat_id=$1&page=$3&l=$5&%{QUERY_STRING}

RewriteRule ^img([0-9]+)(\.([a-zA-Z0-9]+))?(_([a-zA-Z]+))?\.htm$ details.php?image_id=$1&mode=$3&l=$5&%{QUERY_STRING}

RewriteRule ^postcard([a-zA-Z0-9]+)(_([a-zA-Z]+))?\.htm$ postcards.php?postcard_id=$1&l=$3&%{QUERY_STRING}
RewriteRule ^postcard\.img([0-9]+)(_([a-zA-Z]+))?\.htm$ postcards.php?image_id=$1&l=$3&%{QUERY_STRING}

# End search engine friendly links code

What do I need to change to rewrite
http://www.gpaed.de/bildergalerie/cat35_deutsch.htm?page=2
to something like this
http://www.gpaed.de/bildergalerie/cat35_2_deutsch.htm

and on the home page to rewrite
http://www.gpaed.de/bildergalerie/?l=deutsch
to something like this
http://www.gpaed.de/bildergalerie/index_deutsch.htm

Matthias


Offline salimiali

  • Newbie
  • *
  • Posts: 11
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #175 on: November 23, 2005, 07:38:47 AM »
this is my sessions.php file on includes:

Code: [Select]
<?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.1                                                *
 *                                                                        *
 *    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_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 
$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();

    
// Stop adding SID to URLs
    
@ini_set('session.use_trans_sid'0);

    
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_expireCOOKIE_PATHCOOKIE_DOMAINCOOKIE_SECURE);
  }

  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";
    }

    
$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
              ('
$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 = '
$this->session_id'";
        
$site_db->query($sql);
        if (
$set_auto_login) {
          
$this->set_cookie_data("userpass", ($auto_login) ? $user_password "");
        }
        
$this->start_session($user_id1);
        return 
true;
      }
    }
    return 
false;
  }

  function 
logout($user_id) {
    global 
$site_db;
    
$sql "DELETE FROM ".SESSIONS_TABLE."
            WHERE session_id = '
$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 "UPDATE ".SESSIONS_TABLE."
            SET session_lastaction = 
$this->current_time, session_location = '$this->user_location'
            WHERE session_id = '
$this->session_id'";
    
$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 
generate_session_id() {
    return 
session_id();
  }

  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('__session');

      if (!isset(
$GLOBALS['__session'])) {
        
$GLOBALS['__session'] = array();
      }

      
$this->session_info = &$GLOBALS['__session'];

    } else {
      if (isset(
$_SESSION)) {
        if (!isset(
$_SESSION['__session'])) {
          
$_SESSION['__session'] = array();
        }

        
$this->session_info = &$_SESSION['__session'];

      } else {
        if (!isset(
$GLOBALS['HTTP_SESSION_VARS']['__session'])) {
          
$GLOBALS['HTTP_SESSION_VARS']['__session'] = array();
        }

        
$this->session_info = &$GLOBALS['HTTP_SESSION_VARS']['__session'];
      }
    }

    if (!isset(
$this->session_info['session_user_id'])) {
        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($ip050);
  }

  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 "&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;
  }
//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'] == || $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_id']) && $row['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) ? 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&amp;".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);
}
?>

i can not find this line on my sessions.php for replace with new source (why?):

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #176 on: November 23, 2005, 07:48:35 AM »
i can not find this line on my sessions.php for replace with new source (why?):

Code: [Select]
if ($this->mode == "get" && !preg_match("/".SESSION_NAME."=/i", $url)) {
for what? see, the original code has no such line in the instructions, yet you are keep asking same question over and over again without any references to what code you are trying to install/change.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline abdoh2010

  • Jr. Member
  • **
  • Posts: 96
    • View Profile
    • Racing 4 Education
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #177 on: November 24, 2005, 07:08:00 AM »
how to insert search.php?search_keywords in the url friendly ?

Offline Maweryk

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #178 on: November 24, 2005, 07:30:22 AM »

Offline Maweryk

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: [Mod] Search Engine Friendly URLs aka Short URLs
« Reply #179 on: November 24, 2005, 08:08:26 PM »
Hi, i would like to add the image name in the URL like this : www.mydomain.com/img,IMAGE-NAME,id.html

i can do it if i add an argument in the url function like this
Code: [Select]
function url($url, $amp = "&", $name ) {
...
$url   = str_replace('details.php', 'img,'.$name.','.$matches[1].'.html', $url);

}


then in details.php, i put this code for previous image link :
Code: [Select]
$prev_image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$prev_image_id.((!empty($mode)) ? "&mode=".$mode : ""),0,$prev_image_name);

but, honnestly, its very boring to change every "$site_sess->url()" to add the third argument, so does anyone have an idea please ?
i would like to do the same for categories and search

thanks for help



Do you have finished it for categories?
I have no success. :(
I get only category-,,223.htm.

Cheers,

Markus