Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8342457
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:46:44+00:00 2026-06-09T05:46:44+00:00

I am wondering if it is possible to get the to pull out just

  • 0

I am wondering if it is possible to get the to pull out just the username.

Here is an example path that I am working with:

/home/UserName/public_html/index.php

The same username is used in the IP link to the folder. Here is an example of what I am using.
http://xxx.xxx.xxx.xxx/~UserName/index.php

I am wondering if I can somehow use php to get this path from my server and then parse out everything but the usrername. I would then like to take that username and make it a variable that I can use else where on the page.

$username = UserName

Does this make sense?

The root issue I am having is that I am using a lot of php includes and I am having an issue with absolute/relative paths. I am thinking that by getting the username, I can make everything an absolute path instead. Maybe I am going about this all wrong.

Any advise would be awesome. Thank you all for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T05:46:46+00:00Added an answer on June 9, 2026 at 5:46 am

    Got it! Here is the code:

    <?php
    $full = dirname(__FILE__);
    $folder = basename(dirname(__FILE__));
    $trim = strtr($full, array('/home/'=>''));
    $trim2 = strtr($trim, array('/public_html/'=>''));
    $userid = strtr($trim2, array($folder=>''));
    ?>
    

    In this example if

     dirname(__FILE__) = /home/USERNAME/public_html/blog/
    

    Then $userid would = USERNAME

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, I'm just wondering if it is possible to get the name of
I was wondering if it's possible to get the index value of the underlying
I am wondering if it is possible to get all bindings that have a
I was just wondering is it possible to get rid of all this ruby
Just wondering if its possible to get the x/y location of the mouse from
Hi Guys [and girls] :) Just wondering whether it's possible to get the absolute
just wondering if it is possible to get the top 10 COUNT results and
I am wondering if its possible to get $(this).scrollTop() value after an anchor jump.
I am wondering if it´s possible to get the IP address of the airplay
I was wondering if it is possible to get the places of interest in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.