• Private URL to members profile 1 0 5 1
Currently:  

Author Topic: Private URL to members profile  (Read 147963 times)

0 Members and 1 Guest are viewing this topic.

Offline ascanio

  • Hero Member
  • *****
  • Posts: 569
    • View Profile
    • http://www.surfourspace.net
Re: Private URL to members profile
« Reply #15 on: May 20, 2005, 07:44:37 PM »
ok thank you so much :) now it does work ;)

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: Private URL to members profile
« Reply #16 on: May 20, 2005, 07:49:46 PM »
it`s not dificult to help ;)
Again this addres?!
http://www.funny.lt

Offline vietdragon

  • Newbie
  • *
  • Posts: 26
    • View Profile

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: Private URL to members profile
« Reply #18 on: May 21, 2005, 01:44:06 PM »
Are you talking about username.yourdomain.com? And if so, do you now something about subdomains? :)
Again this addres?!
http://www.funny.lt

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: Private URL to members profile
« Reply #19 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
  }
}
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 www.72px.de

  • Newbie
  • *
  • Posts: 35
    • View Profile
Error: 404 when the short url is entered
« Reply #20 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=
www.72px.de - free digital images

Offline universal

  • Full Member
  • ***
  • Posts: 213
    • View Profile
    • http://www.funny.lt
Re: Private URL to members profile
« Reply #21 on: August 13, 2005, 10:41:02 AM »
looks like .htaccess now working...
Again this addres?!
http://www.funny.lt

Offline www.72px.de

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Private URL to members profile
« Reply #22 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. ;)
www.72px.de - free digital images

TheOracle

  • Guest
Re: Private URL to members profile
« Reply #23 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. ;)

Offline www.72px.de

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Private URL to members profile
« Reply #24 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?
www.72px.de - free digital images

TheOracle

  • Guest
Re: Private URL to members profile
« Reply #25 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. ;)

Offline www.72px.de

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Private URL to members profile
« Reply #26 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
www.72px.de - free digital images

TheOracle

  • Guest
Re: Private URL to members profile
« Reply #27 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.

Offline www.72px.de

  • Newbie
  • *
  • Posts: 35
    • View Profile
Re: Private URL to members profile
« Reply #28 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>
www.72px.de - free digital images

TheOracle

  • Guest
Re: Private URL to members profile
« Reply #29 on: August 13, 2005, 03:31:34 PM »
I have just modified my post above regarding the parse error message.