4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: universal on May 15, 2005, 07:59:37 AM

Title: Private URL to members profile
Post by: universal on May 15, 2005, 07:59:37 AM
version 1.1

Everything what is needed is:
config.php - from 4images
.htaccess file (must be in folder where who.php will be)
who.php (you can name it how you want)

now no test needed, just set your url and try it. I`ve tested it only on my server.
will work only with this link http://your_url/who/user name
not with http://your_url/who/user name/


.htaccess

Code: [Select]
<files *>
Options MultiViews
</files>

who.php

Code: [Select]
<?
// Settings
///////////////////////////////////////////

$url = "http://www.pramoga.net";
$table = "4images_users"; //do not edit if you have not changed table prefix

// Code
///////////////////////////////////////////

include "config.php";
$a_url = $_SERVER["REQUEST_URI"];
$i = explode("/", $a_url);
$b = count($i);
$b = $b-1;
$i = str_replace(array("%20"), " ", $i[$b]);
if (($i != "") and ($i != "guest"))
{
$db = mysql_connect("$db_host", "$db_user", "$db_password") or die ("Error");
@mysql_select_db("$db_name", $db) or die ("DB not found");
$result = mysql_query("SELECT user_id FROM `$table` WHERE user_name='$i'");
$row = mysql_fetch_array($result);
$id = $row['user_id'];
header("Location: ".$url."/member.php?action=showprofile&user_id=".$id."");
}
else
{
header("Location: ".$url."");
}
?>


version 1

Just a little script that I made for my site :)
A personal addres for users, to profile.

DEMO: http://www.pramoga.net/who/admin/ (admin is user name, existing in 4images gallery)

So, first I want to explain how it works :)
"who" is not a folder, it`s originaly a script called who.php, to use this script without extension .php you will need to put .htaccess file into the folder where who.php is. The code of .htaccess is:

Code: [Select]
<files *>
Options MultiViews
</files>

So the first thing is done :)
Second is very important for script who.php and it depends on your url, how many slashes "/" there is. I made a little test to find out what number for variables you will need.

test.php
Code: [Select]
<?
$url = "http://www.pramoga.net"; //your url
$url_extender = $_SERVER["REQUEST_URI"];
$all_url = $url.$url_extender;
print_r(explode("/", $all_url));
?>

Change url in this script and go to it like that
http://www.pramoga.net/test/admin (can be another user name)
or
http://www.pramoga.net/test.php/admin (can be another user name)

DEMO: http://www.pramoga.net/test/admin
We need a number of user name, So we take it from here
Array (
Title: Re: Private URL to members profile
Post by: universal on May 17, 2005, 08:04:17 PM
A little corection if somebody uses this plugin :)
A bug when user name contains spaces,
So add this code

Code: [Select]
$i = str_replace(array("%20"), " ", $i);
after this line

Code: [Select]
$i = $i[4]; // when I get array of symbols, I take fourth symbol (it depends on url)
more symbols can be added for replacing, by editing this array("%20","symbol","symbol","symbol")
Title: Re: Private URL to members profile
Post by: ascanio on May 18, 2005, 03:23:57 AM
who do i make the .htaccess file? with the Notepad?
Title: Re: Private URL to members profile
Post by: V@no on May 18, 2005, 03:31:12 AM
yes, any text editors.
Title: Re: Private URL to members profile
Post by: ascanio on May 18, 2005, 03:54:48 AM
ok i did it i create the .htaccess and i run the test and i got the number 5 but when I point to /who/admin it goes to my home page :S
Title: Re: Private URL to members profile
Post by: universal on May 18, 2005, 05:10:46 AM
This code shows your browser to go to the homepage
Code: [Select]
else //if no name was given
{
header("Location: ".$url.""); //setting header location to index page
}

This code is active only when this code is true

Code: [Select]
if (($i != "") and ($i != "guest")) //if url is with name and it`s not guest
if no name was given or name was "guest"
Title: Re: Private URL to members profile
Post by: ascanio on May 18, 2005, 03:46:41 PM
so do i have to modify someything?
Title: Re: Private URL to members profile
Post by: universal on May 18, 2005, 03:50:38 PM
can you give me a link?
Title: Re: Private URL to members profile
Post by: ascanio on May 18, 2005, 05:25:18 PM
sure : http://www.girlsandgirls.net/who/admin
Title: Re: Private URL to members profile
Post by: universal on May 18, 2005, 05:38:16 PM
If it is not dificult to you
comment line
Code: [Select]
header("Location: ".$url.""); //setting header location to index page and write a line after
Code: [Select]
echo $i,"<br>";
echo $all_url;

its strange... and i cant say what happened so i need to view these variables.
Title: Re: Private URL to members profile
Post by: V@no on May 19, 2005, 01:00:09 AM
actualy for best result in debugin mod_rewrite is use this:
Code: [Select]
if ($user_info['user_level'] == ADMIN)
{
  echo "<pre>GET:<br>";
  print_r($_GET);
  echo "<br><br>Query string:<br>";
  echo "<b>".$_SERVER["QUERY_STRING"]."</b>";
  echo "<br><br>Redirect query string:<br>";
  echo "<b>".$_SERVER["REDIRECT_QUERY_STRING"]."</b>";
  echo "</pre>";
}
Title: Re: Private URL to members profile
Post by: universal on May 19, 2005, 12:29:24 PM
try version 1.1 :) I`ve made some modifications, now you wont need any tests
Title: Re: Private URL to members profile
Post by: ascanio on May 20, 2005, 06:44:18 PM
I try the new version and it does not work :(:(
http://www.girlsandgirls.net/who/admin

Code: [Select]
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/bhfqyruw/public_html/who.php on line 21

Warning: Cannot modify header information - headers already sent by (output started at /home/bhfqyruw/public_html/who.php:21) in /home/bhfqyruw/public_html/who.php on line 23
Title: Re: Private URL to members profile
Post by: universal on May 20, 2005, 06:51:07 PM
maybe your table prefix is not "4images_" ?
Title: Re: Private URL to members profile
Post by: ascanio on May 20, 2005, 07:42:46 PM
yeah is girls_
Title: Re: Private URL to members profile
Post by: ascanio on May 20, 2005, 07:44:37 PM
ok thank you so much :) now it does work ;)
Title: Re: Private URL to members profile
Post by: universal on May 20, 2005, 07:49:46 PM
it`s not dificult to help ;)
Title: Re: Private URL to members profile
Post by: vietdragon on May 21, 2005, 11:20:07 AM
how can  i change http://www.vietnamphotos.net/member.php?action=showprofile&user_id=1 ( or other ) To  http://vietdragon.vietnamphotos.net ??

:) I don't like http://www.vietnamphotos.net/who/vietdragon

Thank!
Title: Re: Private URL to members profile
Post by: universal on May 21, 2005, 01:44:06 PM
Are you talking about username.yourdomain.com? And if so, do you now something about subdomains? :)
Title: Re: Private URL to members profile
Post by: V@no on July 20, 2005, 02:50:08 AM
a little addition to the code. It should automaticaly parse the url, without needed count how many slashes in the url of your server or such ;)

replace
Code: [Select]
$all_url = $url.$url_extender; // i dont know why, but i make all url...
$i = explode("/", $all_url); // then I delete all slashes
$i = $i[4]; // when I get array of symbols, I take fourth symbol (it depends on url)
$i = str_replace(array("%20"), " ", $i); // replaces %20 with simple space " "
with:
Code: [Select]
$array = explode("/", trim(str_replace(array("%20"), " ", $url_extender)));// replaces %20 with simple space " ", trim any trailing spaces and convert the url into an array
$total = count($array);
$start = false;
$add_slash = false;
$i = "";
for ($n=0; $n < $total; $n++)
{
  if ($start)
  {
    if ($add_slash && !empty($array[$n]))
    {
      $i .= "/"; //add a slash, but only if its not last character (avoid adding trailing slash)
    }
    $i .= $array[$n];
    if (!$add_slash)
    {
      $add_slash = true; //for next loop add a slash to the name (a fix for usernames that conteins slashes)
    }
  }
  if ($array[$n] == "who")
  {
    $start = true; //use next item as a username
  }
}
Title: Error: 404 when the short url is entered
Post by: www.72px.de on August 13, 2005, 10:17:15 AM
Hi, seems I've got a little problem with that one.

4images is located in www.72px.de/001/
so i placed the .htaccess and the who.php file into that directory. I used Version 1.1!
When I go to www.72px.de/001/who/christian it will only give me a 404 error.
I already changed the who.php code to the .../001 directory but it does not change anything.
Hope anyone of you has got an idea to solve that. Seems to be a very useful thing.
Thanks
Christian

P.S. Maybe this will help:
When I only enter http://www.72px.de/001/who.php it takes me to http://www.72px.de/001/member.php?action=showprofile&user_id=
Title: Re: Private URL to members profile
Post by: universal on August 13, 2005, 10:41:02 AM
looks like .htaccess now working...
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 11:13:50 AM
You mean NOW working or NOT working?
Not working would explain a lot of course.
Any Idea what could have went wrong with the .htaccess?
Thanks for your reply. ;)
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 01:13:40 PM
If I may assist you on this user_id tracking issue, here's what I got from who.php file :

replace this :

Quote

<?
/////////////////////////////////////////////
// Originaly made for http://www.pramoga.net
// If you made any modifications, feel free
// to contact with me and share your code ;)
/////////////////////////////////////////////

$url = "http://www.pramoga.net";

/////////////////////////////////////////////
include "config.php";
$url_extender = $_SERVER["REQUEST_URI"]; // gets url end
$all_url = $url.$url_extender; // i dont know why, but i make all url...
$i = explode("/", $all_url); // then I delete all slashes
$i = $i[4]; // when I get array of symbols, I take fourth symbol (it depends on url)
$i = str_replace(array("%20"), " ", $i); // replaces %20 with simple space " "
if (($i != "") and ($i != "guest")) //if url is with name and it`s not guest
{
$db = mysql_connect("$db_host", "$db_user", "$db_password") or die ("Error"); // connecting to db
@mysql_select_db("$db_name", $db) or die ("DB not found"); // selecting db
$result = mysql_query("SELECT user_id FROM `4images_users` WHERE user_name='$i'"); //querying mysql, and selecting users id from db
$row = mysql_fetch_array($result);
$id = $row['user_id']; //selected id seting to variable $id
//finally
header("Location: ".$url."/member.php?action=showprofile&user_id=".$id.""); //setting header location to members profile
}
else //if no name was given
{
header("Location: ".$url.""); //setting header location to index page
}
// thats all :)
?>


with :

Code: [Select]

<?php

/////////////////////////////////////////////
// Originaly made for http://www.pramoga.net
// If you made any modifications, feel free
// to contact with me and share your code ;)
/////////////////////////////////////////////

define('GET_CACHES'1);
define('ROOT_PATH''./');
define('GET_USER_ONLINE'1);
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();

$url SCRIPT_URL// Uncomment out your SCRIPT_URL from includes/constants.php file and type your URL in that quote instead of here.

/////////////////////////////////////////////

$url_extender $_SERVER["REQUEST_URI"]; // gets url end
$array explode("/"trim(str_replace(array("%20"), " "$url_extender)));// replaces %20 with simple space " ", trim any trailing spaces and convert the url into an array
$total count($array);
$start false;
$add_slash false;
$i "";
for (
$n=0$n $total$n++)
{
  if (
$start)
  {
    if (
$add_slash && !empty($array[$n]))
    {
      
$i .= "/"//add a slash, but only if its not last character (avoid adding trailing slash)
    
}
    
$i .= $array[$n];
    if (!
$add_slash)
    {
      
$add_slash true//for next loop add a slash to the name (a fix for usernames that conteins slashes)
    
}
  }
  if (
$array[$n] == "who")
  {
    
$start true//use next item as a username
  
}
}

if ((
$i != "") and ($i != "guest")) //if url is with name and it`s not guest
{

$sql "

SELECT user_id, user_name
FROM "
.USERS_TABLE."
WHERE user_name='
$i' AND user_level > '".GUEST."' AND user_invisible = 0

"
;

$result $site_db->query($sql);

$row $site_db->fetch_array($result);

//finally

header("Location: ".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id']).""); //setting header location to members profile
}
else 
//if no name was given
{
header("Location: ".$site_sess->url(ROOT_PATH."index.php""&")); //setting header location to index page
}
// thats all :)

?>



Well, hope this is it. ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 03:04:13 PM
Hey..
First of all, thanks for the info but I got some problems with understanding what you mean:

- "$url = SCRIPT_URL; // Comment out your SCRIPT_URL from includes/constants.php file and type your URL in that quote instead of here."

In the costants.php file the SCRIPT_URL is already commented out ("// define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash")

What do you suggest I should fill in here? (Okay.. Its quite clear but do you want me to fill in "http://www.72px.de/001/" (cause thats the script Url.) And if so.. where exactly? ^^
;)
Thanks for your help!

PS. Did it without changes to your code but still gives me a 404: Try yourself: http://www.72px.de/001/who/christian
Maybe universal was right and it is a .htaccess-problem?
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 03:08:33 PM
Thanks for posting this. I have just corrected my note on my post above. As for your URL, if : http://www.72px.de/001 points to your root path of 4images, then it's the right place. Remember though, do not add the trailing slash at the end of your URL. ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 03:17:25 PM
Okay, I did it.. but anyway.. gives me a 404! :(
Additionally.. by entering this "http://www.72px.de/001/who.php" it tells me: Parse error: parse error, unexpected ';' in /home/www/ncf61/html/001/who.php on line 63
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 03:20:19 PM
Quote

Okay, I did it


Please post the precise steps that you did in order to achieve a 404 error page.
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 03:27:53 PM
I did everything that was explained in the first post of this thread: Create a .htaccess in the directory that contains the who.php file, create the who.php file.
Guess thats it. Now I put YOUR code in the who.php file instead of universal's . But it doesn't change anything. So I consider the problem is not inside the who.php file but in the .htaccess file because the browser doesn't find the who.php file if it is entered without .php (http://www.72px.de/001/who/christian)
My .htaccess file looks like this:

<files *>
Options MultiViews
</files>
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 03:31:34 PM
I have just modified my post above regarding the parse error message.
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 03:35:27 PM
Thanks ;) But still gives me the exact same parse Error! ;)

But I guess the main problem is the 404 error because if this can be solved I can use universal's who.php as well...
It obviously worked well for other people!
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 03:38:14 PM
Are you sure you replaced it with this line :

Quote

header("Location: ".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id']).""); //setting header location to members profile


and not :

Code: [Select]

header("Location: ".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id']."")); //setting header location to members profile


as I re-updated it 2 secs after I posted my update message. ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 03:42:15 PM
Hehe ;)
Okay the parse error is gone.. now "http://www.72px.de/001/who.php" takes me to my 4images homepage.
But the 404 is still there! :P
("http://www.72px.de/001/who/christian")
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 03:48:06 PM
Then, ' now ' it is a .htaccess forwarding issue. ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 03:51:44 PM
;) I guess it already was such an issiue when I was still using universal's who.php file!  :wink:
Mhm now.. any idea what could be the problem?
Thanks anyway! :)
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 03:55:16 PM
Quote

I guess it already was such an issiue when I was still using universal's who.php file!


Since my method is more reliable to 4images's modules, I would deeply recommend to maintain my version of this MOD (especially for security & sessions issues).

Quote

Mhm now.. any idea what could be the problem?


Well, I believe, this part, you already know - it's an .htaccess redirection problem. ;)

Would you mind showing your .htaccess readings regarding this action ?
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 03:58:49 PM
Yeah but this knowledge unfortunatly doesn't take me anywhere, cause I know as much about .htaccess-files as I know about building airplanes! ;)
Hehe okay lets modify posts! ;)
As postet before.. thats my .htaccess.. which is exactly what universal posted in the beginning :(

<files *>
Options MultiViews
</files>
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:00:30 PM
Quote

as I know about building airplanes!


No offense there but there are airplanes who faces accidents - even if they're built from the best engineers in the world. Meaning, your .htaccess could have some errors too. ;)

If you could just post your results, I will take a look at them.
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 04:04:23 PM
Maybe we have just a communication problem.. ;)

What exactly do you mean by "results"?
I guess I understood you wanted to see the .htaccess file but i guess i was wrong ! *sorry* ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 04:05:18 PM
And I should ban the word "guess" from my vocabulary.. ^^
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:10:32 PM
Quote

I guess I understood you wanted to see the .htaccess file but i guess i was wrong ! *sorry*


No, you understood correctly. ;)

I just don't see how these simple tags :

Quote

<files *>
Options MultiViews
</files>


could forward to your private member page . . .
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 04:15:00 PM
Mhm.. yeah I don't see either! ;)
Have a look at post 1 of this thread from universal. Thats what he postet. And it seems, this worket for some guys here...
Don't ask me, I'm a tourist :P
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:25:51 PM
Well ... I'm not the .htaccess file specialist but, by looking at these readings ... if it does forward to the member's private page and works for some users ... I don't know what you tell you.
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 04:28:02 PM
So how does your version work on your Site?  :?: Guess you didn't just write this who.php file down in a minute, right? ;)

How ever it would be very nice of universal to explain, how his .htaccess works.. :|
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:29:51 PM
Quote

So how does your version work on your Site?


I did not installed this MOD. I simply re-coded it. ;)

Quote

Guess you didn't just write this who.php file down in a minute, right? ;)


Actually, it really did took this short to re-code it.  :mrgreen:
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 04:34:01 PM
Mhm okay I'm impressed ^^

Anyway thanks a million for your help! :) Would be interesting to know how this works on other people's sites..  :?

Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:36:03 PM
Quote

Would be interesting to know how this works on other people's sites..


This reminds me, I actually have a place I could test this MOD on with .htaccess file. ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 04:42:26 PM
You definitely would be my hero of the day! ;)
Thanks in advance...
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:45:08 PM
Quote

my hero of the day!


Like the song : "They're off to find the hero of the day".   :mrgreen:

Posting the results in a couple of mins . . .
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 04:49:02 PM
Metallica? ^^ Think I got it somewhere...
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:53:23 PM
I play the intro often on my guitar personally. ;)

Anyway, let's focus on the issue for now.
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 04:56:47 PM
Update :

I have just tested this with the .htaccess file. No 404 error message appears. Seems it is the case for you, it would seems there might be an apache configuration error from your end. Perhaps you should contact your ISP to take a look at this problem. ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 05:01:30 PM
Funny thing...isn't it...
Any idea WHAT config error? Just to have something to search for.. :(
Thanks for trying!
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 05:03:00 PM
There are many documentations you could find on Google on this subject actually. ;)
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 05:05:29 PM
Wonderful.. :(
So do you think there is another way of shortening the URL to the member profile significantly?
I thought about something like virtual subdomains but this seems to be a hundred times more difficult.. :(
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 05:13:52 PM
Hum ... not sure but

change :

Quote

<Files *>


to :

Code: [Select]

<Files who.php>


in your .htaccess file. Will this work ?
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 05:18:27 PM
Nope... no change. Sorry ;)
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 05:22:50 PM
In that case, this is definitely a server issue. Sorry.
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 05:24:59 PM
Seems you are correct. Anyway thanks for testing. If you have any idea of shortening the URLs in a different way... let me know! ;)
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 05:29:30 PM
Quote

If you have any idea of shortening the URLs in a different way


I'm not quite sure what you mean by shortening the URL ... could you elaborate that ? Like - an example ? ;)

P.S : The URL structure has nothing to do with the error you're currently facing with your .htaccess file . . .
Title: Re: Private URL to members profile
Post by: www.72px.de on August 13, 2005, 06:46:31 PM
In this case the short URL would have been: "http://www.72px.de/001/who/christian"
And the original URL is: "http://www.72px.de/001/member.php?action=showprofile&user_id=1" which is much more difficult to remember of course.
Even better would be a subdomain like http://user.72px.de but i can't setup a subdomain for every member manually.
Title: Re: Private URL to members profile
Post by: TheOracle on August 13, 2005, 06:50:30 PM
I'm starting to wonder if there aren't missing statements for <directory> from your .htaccess file since you stated that it should point to your sub-folder :

- who/christian
Title: Re: Private URL to members profile
Post by: www.72px.de on August 14, 2005, 08:22:33 AM
Hey;)
No, I think you got this wrong, as WHO is no subfolder but the who.php file without the .php ending! As I see it the only thing thats done by the .htaccess file is to make the browser recognize the who.php file without an ending!
Anyway its all in the same folder..  :|
Title: Re: Private URL to members profile
Post by: TheOracle on August 14, 2005, 12:34:20 PM
Yes, I know. ;)

It's a routine that converts the file into a path, without the extension, and the username as a subfolder - ReWriteRule from .htaccess.
Title: Re: Private URL to members profile
Post by: www.72px.de on August 14, 2005, 03:16:37 PM
Mh yeah. I guess one could do this with mod_rewrite or so.. but until now I haven't found out how! ;)
I tried a different way:

If s.o. enters http://user.72px.de -which does not exist- this produces a 404 and I uploaded a 404.html which reads the referrer (in this case user.72px.de) and then redirects the user depending on the referer... but it seems I cannot change the 404 Error page of the root directory..
Title: Re: Private URL to members profile
Post by: TheOracle on August 14, 2005, 03:19:34 PM
Quote

but it seems I cannot change the 404 Error page of the root directory..


Then, please, as stated above - contact your hosting party about this.
Title: Re: Private URL to members profile
Post by: www.72px.de on August 14, 2005, 03:34:16 PM
Yes.. ;) I just wanted to inform you...  ^^
Title: Re: Private URL to members profile
Post by: daniel_74 on August 30, 2005, 11:47:44 PM
Hello,

just a little mod-mod...

I want to provide my users with a short URL for "Display all images added by ..." instead of the "members profile" URL.

I would like to have something like this to see all i,ages added be "username":

http://www.mysite.com/username/

Anyone who can help out with a little mod-rewirte ?

Thanks in advance
Daniel
Title: Re: Private URL to members profile
Post by: marius26 on November 07, 2005, 01:04:18 AM
Quote
<files *>
Options MultiViews
</files>
note this htaccess does not work well,

this url works with that htaccess file:
4images/profile.php/username [redirects to profile]

but this does not
4images/profile/username [shows error page]

according to my knowledge it is a htaccess fault it has wrong info i'm new to htaccess but i know that you need some other code in htaccess, i have no idea what tho.
Title: Re: Private URL to members profile
Post by: universal on November 07, 2005, 06:04:48 AM
Or maybe server config overides htaccess?
Title: Re: Private URL to members profile
Post by: Stoleti on July 07, 2006, 10:47:20 PM
i've wondering about had some like it but on this way :

http://username.yoursite.com/

 :?:
Title: Re: Private URL to members profile
Post by: ccsakuweb on August 13, 2006, 03:33:14 PM
Quote
<files *>
Options MultiViews
</files>
note this htaccess does not work well,

this url works with that htaccess file:
4images/profile.php/username [redirects to profile]

but this does not
4images/profile/username [shows error page]

according to my knowledge it is a htaccess fault it has wrong info i'm new to htaccess but i know that you need some other code in htaccess, i have no idea what tho.

yes... i have problems with htaccess too... if i upload this file.. all my websites from my host are down  :cry:

I have contacted with my server support and they said me...
Some apache commands are no longer supported in .htaccess or .htconfig due to security concerns:

Action
AddCharSet
AddEncoding
AddLanguage
AddType
BrowserMatch
BrowserMatchNoCase
CookieTracking
DefaultLanguage
DefaultType
ErrorDocument
ErrorHeader
Header
LanguagePriority

Options

PassEnv
Redirect
RedirectMatch
RedirectPermanent
RedirectTemporary
SetEnv
SetEnvIf
SetEnvIfNoCase
UnsetEnv


Is there another sentence to do the same that multiviews?
Title: Re: Private URL to members profile
Post by: Smoothice on July 01, 2007, 08:29:39 PM
I know his is an old topi but looking to see if anyone has gotten this or something similar to work. 

Smoothice
Title: Re: Private URL to members profile
Post by: VonHerzen on July 26, 2008, 04:39:31 PM
Hi.. I  have tried this MOD but does not work... it says: "No input file specified. " what i can do?  thanks!
Title: Re: Private URL to members profile
Post by: CanonInk on July 30, 2008, 01:47:09 PM
Hi.. I  have tried this MOD but does not work... it says: "No input file specified. " what i can do?  thanks!

It's works fine with...

1. Open .httaccess

Insert:
Code: [Select]
RewriteRule ^who/ who.php?%{QUERY_STRING}
RewriteRule ^go$ who.php?%{QUERY_STRING}

2. Create a folder {root}/who

From first topic in the MOD:
3. Create test.php, upload and run www.yourdomain.con/test.php and remember the last array. Delete on your webspace after run.

4. Create who.php from first topic in the MOD and do modification as written (Version 1.1) .

Works fine, see http://www.ruebenberger-bilder.de/who/hikkamonster (sorry only German)

Enjoy,
CanonInk
Title: Re: Private URL to members profile
Post by: VonHerzen on July 30, 2008, 05:26:35 PM

Hi CanonInk! Vielen dank!
Greetings from very sunny Madrid.

It works now perfectly with some modifications:
1.- On the .htaccess file I needed to insert this code before
Code: [Select]
RewriteEngine On.
2.- It works without creating a folder called who.
3.- As I have used who.php version 1.1 I did not do the array test.php file and it works.

Hey, your website is nice! Thank you once again!!    :)
Title: Re: Private URL to members profile
Post by: CanonInk on July 30, 2008, 10:20:24 PM

Hi CanonInk! Vielen dank!
Greetings from very sunny Madrid.

It works now perfectly with some modifications:
1.- On the .htaccess file I needed to insert this code before
Code: [Select]
RewriteEngine On.
2.- It works without creating a folder called who.
3.- As I have used who.php version 1.1 I did not do the array test.php file and it works.

Hey, your website is nice! Thank you once again!!    :)

- You are right with step 1 :thumbup:
- who needs at my server
- this is possible, but is dependent on server (Apache,...)

Thank you very much for the flowers  :lol:

CanonInk
Title: Re: Private URL to members profile
Post by: crs on May 01, 2009, 01:43:28 AM
Hello

Maybe i click on a User on a page, the following link appears in my browsers url input bar: http://mypage.de/member.php?action=showprofile&user_id=5

Is it possible to show only the private URL in the browsers input-bar?
Im asking for that, because the users didnīt see, that they got a short-url to her own profile and they are using the long links -.-

Thanks for help
Title: Re: Private URL to members profile
Post by: Sunny C. on May 29, 2009, 10:05:22 AM
Da ich Google Friendly URLs installiert habe, habe ich die who.php so abgewandelt:

<?
// Settings
///////////////////////////////////////////

$url = "http://www.meineseite.de";
$table = "4images_users"; //do not edit if you have not changed table prefix

// Code
///////////////////////////////////////////

include "config.php";
$a_url = $_SERVER["REQUEST_URI"];
$i = explode("/", $a_url);
$b = count($i);
$b = $b-1;
$i = str_replace(array("%20"), " ", $i[$b]);
if (($i != "") and ($i != "guest"))
{
$db = mysql_connect("$db_host", "$db_user", "$db_password") or die ("Error");
@mysql_select_db("$db_name", $db) or die ("DB not found");
$result = mysql_query("SELECT user_id FROM `$table` WHERE user_name='$i'");
$row = mysql_fetch_array($result);
$id = $row['user_id'];
header("Location: ".$url."/profile".$id.".htm");
}
else
{
header("Location: ".$url."");
}
?>

Das klappt wunderbar. Jetzt wollte ich eine weitere Datei erstellen, namens Image:

image.php
<?
// Settings
///////////////////////////////////////////

$url = "http://www.meineseite.de";
$table = "4images_images"; //do not edit if you have not changed table prefix

// Code
///////////////////////////////////////////

include "config.php";
$a_url = $_SERVER["REQUEST_URI"];
$i = explode("/", $a_url);
$b = count($i);
$b = $b-1;
$i = str_replace(array("%20"), " ", $i[$b]);
if (($i != "") and ($i != "guest"))
{
$db = mysql_connect("$db_host", "$db_user", "$db_password") or die ("Error");
@mysql_select_db("$db_name", $db) or die ("DB not found");
$result = mysql_query("SELECT image_id FROM `$table` WHERE image_name='$i'");
$row = mysql_fetch_array($result);
$id = $row['image_id'];
header("Location: ".$url."/video".$id.".htm");
}
else
{
header("Location: ".$url."");
}
?>

Die URL zu dem Bild sieht so aus: image-fggf-3.htm

Aber wie mache ich das, dass er die Image_id und den image_name ausgibt?

Ich habe das so versucht:

<?
// Settings
///////////////////////////////////////////

$url = "http://www.anitube.de";
$table = "4images_images"; //do not edit if you have not changed table prefix

// Code
///////////////////////////////////////////

include "config.php";
$a_url = $_SERVER["REQUEST_URI"];
$i = explode("/", $a_url);
$b = count($i);
$b = $b-1;
$i = str_replace(array("%20"), " ", $i[$b]);
if (($i != "") and ($i != "guest"))
{
$db = mysql_connect("$db_host", "$db_user", "$db_password") or die ("Error");
@mysql_select_db("$db_name", $db) or die ("DB not found");
$result = mysql_query("SELECT image_id FROM `$table` WHERE image_name='$i'");
$resultname = mysql_query("SELECT image_name FROM `$table` WHERE image_id='$i'");
$row = mysql_fetch_array($result);
$id = $row['image_id'];
$name = $row['image_name'];
header("Location: ".$url."/video-".$name."-".$id.".htm");
}
else
{
header("Location: ".$url."");
}
?>

Das scheint aber nicht richtig zu sein, da es dann nun so aufgerufen wird: image--3.htm
Der name zwischen - und - fehlt, dennoch wird es aufgerufen, aber wie klappt das richtig?