Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1] 2 3 4   Go Down

Author Topic: short url to user albums  (Read 113925 times)

0 Members and 1 Guest are viewing this topic.

Kfmook

  • Contributor
  • Coppermine newbie
  • ***
  • Offline Offline
  • Posts: 1
    • http://photos.ya1.ru
short url to user albums
« on: November 17, 2003, 09:40:02 am »

I cant post in 'Modifications/Add-Ons/Hacks' and i post my hack here

With this hack your registered users can access to her albuma with short url:
http://www.domain.com/gallery/?UserName
where http://www.domain.com/gallery/ - url to your gallery
UserName - registered user name (if UserName not contain '=')

hack:
add this code:
Code: [Select]
$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
  $sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_name = '". mysql_escape_string($qq) . "'";
  $result1 = db_query($sql);
  if (mysql_num_rows($result1)>0) {
    $u = mysql_fetch_array($result1);
    $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
  mysql_free_result($result1);
}
before:
Code: [Select]
/**
 * Main code
 */

if (isset($HTTP_GET_VARS['page'])) {
    $PAGE = max((int)$HTTP_GET_VARS['page'], 1);
    $USER['lap'] = $PAGE;
} elseif (isset($USER['lap'])) {
    $PAGE = max((int)$USER['lap'], 1);
} else {
    $PAGE = 1;
}
in index.php
« Last Edit: January 29, 2006, 12:41:05 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
HACK: short url to user albums
« Reply #1 on: November 17, 2003, 08:27:12 pm »

moved to Modifications/Add-Ons/Hacks/

Thanks for your contribution

GauGau
Logged

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
HACK: short url to user albums
« Reply #2 on: November 19, 2003, 10:36:56 pm »

great! can this be included in a feature version of Coppermine? (1.2.1 or maybe even 1.3?)
Logged

jdbaranger

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 169
    • Accro-Photo
HACK: short url to user albums
« Reply #3 on: November 21, 2003, 10:58:14 pm »

To accept names with a space, modify the script :

Code: [Select]
$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
  $qq = eregi_replace ( '%20', ' ', $qq);
  $sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_name = '". mysql_escape_string($qq) . "'";
  $result1 = db_query($sql);
  if (mysql_num_rows($result1)>0) {
    $u = mysql_fetch_array($result1);
    $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
  mysql_free_result($result1);
}  


Jean-Denis Baranger
Logged
Jean-Denis

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
HACK: short url to user albums
« Reply #4 on: November 22, 2003, 09:37:13 pm »

and this replaces all weird characters by its URL code :)

**removed**
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
HACK: short url to user albums
« Reply #5 on: November 23, 2003, 02:17:04 am »

above code is a nice try, but not recommended: there are very simple php commands that accomplish the very same with only two lines of code and a fraction of script load (read: much faster).
Instead, the usage of "Characters forbidden in filenames" from the coppermine config screen is advisable or rawurlencode...

GauGau
Logged

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
HACK: short url to user albums
« Reply #6 on: November 23, 2003, 12:21:36 pm »

woops!

as you all know i'm a beginner at php :?

can anyone code this then?
Logged

FishnReef

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
    • http://www.fishandreef.com
HACK: short url to user albums
« Reply #7 on: December 18, 2003, 03:49:36 am »

I can't make this mod work  :?   I just keep getting a critical error.

Thanks in advance.
Logged

FishnReef

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
    • http://www.fishandreef.com
HACK: short url to user albums
« Reply #8 on: December 18, 2003, 03:54:16 am »

Maybe it is because Im using the gallery with phpbb. Is there a way to make it work?

Thanks ind advance ;)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
HACK: short url to user albums
« Reply #9 on: December 18, 2003, 12:47:33 pm »

please post your actual error message, might help solving this. I guess this is not related to the question "bbs-integration yes/no".

GauGau
Logged

FishnReef

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
    • http://www.fishandreef.com
HACK: short url to user albums
« Reply #10 on: December 19, 2003, 07:35:01 pm »

Error crítico
There was an error while processing a database query
 


The integration works perfectly, this is the only problem I have had.

 :D
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
HACK: short url to user albums
« Reply #11 on: December 20, 2003, 07:38:56 am »

you'll have to switch on debug_mode (and it'd be nice if you could switch to english momentarily as well) - copy and paste the debug output into this thread.

GauGau
Logged

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
HACK: short url to user albums
« Reply #12 on: December 30, 2003, 06:38:29 pm »

Code: [Select]
$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
if (!strstr($qq,'=') and !empty($qq)) {
  $qq = urlencode($qq)
  $sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_name = '". mysql_escape_string($qq) . "'";
  $result1 = db_query($sql);
  if (mysql_num_rows($result1)>0) {
    $u = mysql_fetch_array($result1);
    $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
  }
  mysql_free_result($result1);
}


/m_aTh!bUs
Logged

achtungbaby

  • Coppermine newbie
  • Offline Offline
  • Posts: 8
    • http://yellowworld.org
HACK: short url to user albums
« Reply #13 on: January 07, 2004, 03:47:25 am »

Hello, will this hack work with subdomains?
Logged

ferlo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
HACK: short url to user albums
« Reply #14 on: January 08, 2004, 01:53:45 pm »

I've tried this mod, and seems working smooth (the one from MaThIbUs)
however, if someone posts a wrong name this error appears:

Code: [Select]
Parse error: parse error in /home/virtual/site15/fst/var/www/html/index.php on line 505
Logged

MaThIbUs

  • Contributor
  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • I rock.
    • http://mathibus.com/
HACK: short url to user albums
« Reply #15 on: January 09, 2004, 07:33:41 pm »

achtungbaby > why don't you just try and let us know if it worked ;)?

ferlo > I think it won't be easy to add a error handling feature... Just make sure that everyone uses the right names ;)
Logged

ferlo

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
HACK: short url to user albums
« Reply #16 on: January 09, 2004, 07:44:01 pm »

I see.
However if something does not works I just hope users will try to access my site by the main page )
Logged

gmarik

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 34
HACK: short url to user albums
« Reply #17 on: January 17, 2004, 02:26:38 pm »

great - so this works on the lates version as well?
will try to get it with vbulletin as well ...
Logged
webmaxtor.com

SlammedDime

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
HACK: short url to user albums
« Reply #18 on: February 18, 2004, 02:02:43 am »

Error checking code -

Code: [Select]
$qq=$HTTP_SERVER_VARS["QUERY_STRING"];
 if (!strstr($qq,'=') and !empty($qq)) {
   $qq = urlencode($qq);
   $sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_name = '". mysql_escape_string($qq) . "'";
   $result1 = db_query($sql);
   if (mysql_num_rows($result1)>0) {
     $u = mysql_fetch_array($result1);
     $HTTP_GET_VARS['cat'] = sprintf("1%04d",$u[0]);
   }
   else {
     cpg_die(ERROR, '"' . $qq . '" is an invalid username.  Please try again.', __FILE__, __LINE__);
   }
   mysql_free_result($result1);
}
Logged

WreckRman2

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
    • http://www.indywebdesign.com
HACK: short url to user albums
« Reply #19 on: February 23, 2004, 04:26:28 am »

Anyone have the code to do this if intergrated with vb?
Logged
David Smith
Indy Web Design - http://www.indywebdesign.com
317-573-2486

We offer web hosting that includes easy installation for Coppermine Photo Gallery, phpBB2, PHP-Nuke, and a lot more...
Pages: [1] 2 3 4   Go Up
 

Page created in 0.027 seconds with 19 queries.