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 6252987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T13:54:30+00:00 2026-05-24T13:54:30+00:00

The system I’m using doesn’t have an option to view other users’ profiles (Only

  • 0

The system I’m using doesn’t have an option to view other users’ profiles (Only your own) (By other users’ profiles I mean something like http://domain.com/profile.php?user=USERNAME). However, the original one, has it.
I want to implant it in the new system so I created a new php file for the profile.

I downloaded this login system:
http://tympanus.net/codrops/2009/09/16/php-login-system-reloaded-v1-1/

It is a custom version of this system:
http://jpmaster77forum.conceptbb.com/t1-php-login-system-with-admin-features-download

Here is the original userinfo.php code:

<?
include("include/session.php");
?>

<html>
<title>Jpmaster77's Login Script</title>
<body>

<?
/* Requested Username error checking */
$req_user = trim($_GET['user']);
if(!$req_user || strlen($req_user) == 0 ||
   !eregi("^([0-9a-z])+$", $req_user) ||
   !$database->usernameTaken($req_user)){
   die("Username not registered");
}

/* Logged in user viewing own account */
if(strcmp($session->username,$req_user) == 0){
   echo "<h1>My Account</h1>";
}
/* Visitor not viewing own account */
else{
   echo "<h1>User Info</h1>";
}

/* Display requested user information */
$req_user_info = $database->getUserInfo($req_user);

/* Username */
echo "<b>Username: ".$req_user_info['username']."</b><br>";

/* Email */
echo "<b>Email:</b> ".$req_user_info['email']."<br>";

/**
 * Note: when you add your own fields to the users table
 * to hold more information, like homepage, location, etc.
 * they can be easily accessed by the user info array.
 *
 * $session->user_info['location']; (for logged in users)
 *
 * ..and for this page,
 *
 * $req_user_info['location']; (for any user)
 */

/* If logged in user viewing own account, give link to edit */
if(strcmp($session->username,$req_user) == 0){
   echo "<br><a href=\"useredit.php\">Edit Account Information</a><br>";
}

/* Link back to main */
echo "<br>Back To [<a href=\"main.php\">Main</a>]<br>";

?>

</body>
</html>

And this is my new profile.php:

<?php
include('config/db_con.php');
include('config/config.php');
$page = 'profile';
include('header.php');
require_once("php/core.php");

$objCore = new Core();

$objCore->initSessionInfo();
$objCore->initFormController();

    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");
$get_email = $objCore->getSessionInfo()->getUserInfo('email');
$get_flname = "SELECT * FROM `users` WHERE email = '$get_email'";
$res = mysql_query($get_flname) or die(mysql_error());
$rows = mysql_fetch_array($res);
$gemail_hash = md5( strtolower( trim( "$get_email" ) ) );
$req_user = trim(strtolower(str_replace(" ", "", $rows['flname'])));
?> 
<div class="content">
    <div class="left">
        <div class="top_box" style="margin-top:0px;">
            <p><h90>Profile: <?php echo $rows['flname']; ?></h90><?php echo $req_user; ?></p>
        </div>
        <div class="box_pad">
            <div class="box" style="border-bottom:1px solid #dbdbdd;">  
                <?php if($objCore->getSessionInfo()->isLoggedIn()){ ?>
                        <img class="gravatar" src="http://www.gravatar.com/avatar/<?php echo $gemail_hash; ?>?d=mm" />
                        <h1><?php echo $rows['flname']; ?></h1><br />
                        <a href="editaccount.php">[Edit Account]</a>
                        <? if($objCore->isAdmin()) ?>
                            <a href="admin.php">[admin]</a>
                        <a href="php/corecontroller.php?logoutaction=1">[Logout]</a>
                        <? }else{ ?> 
                        blabla test
                        <? } ?>

       <?php unset($objCore); ?>
            </div>
        </div>
    </div>
    <div class="right">
        <? include('ad.php'); ?> 
    </div> 
</div>
<?include('footer.php');?>
</body>

It doesn’t work ’cause when trying to access other users’ profiles, I see mine again.
How is the file.php?user=USERNAME url pattern is defined?

Thank you so much!
I really need this and I couldn’t find anything on Google, since I didn’t really know what to search for.
Sorry if there’s information lacking, I tried to be as descriptive as possible.

  • 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-05-24T13:54:31+00:00Added an answer on May 24, 2026 at 1:54 pm

    that is some bad programming in a long time.

    1. Short tags are evil, and like all big communities advice DO NOT USE THEM. Using a script written by someone using shorttags is even worse.
    2. trim(strtolower(str_replace(….. if the username is in the database with spaces/capital letters, why strip it here ?? and not before it gets INTO the datase.

    I could go on but wouldn’t solve your problem….

    anyway :

    $get_email = $objCore->getSessionInfo()->getUserInfo('email');
    $get_flname = "SELECT * FROM `users` WHERE email = '$get_email'";
    

    in your code, means that you are fetching the data based on the users session. thus not the one in the url part.

    in the original :

    $req_user = trim($_GET['user']);
    if(!$req_user || strlen($req_user) == 0 ||
       !eregi("^([0-9a-z])+$", $req_user) ||
       !$database->usernameTaken($req_user)){
       die("Username not registered");
    }
    

    will get the user info from the URL.

    Though, one question, why are you complicating life ? why use profile.php for something it is not intended to ? if you are trying to do what i am thinking, you should rename
    profile.php => myaccount.php
    AND
    userinfo.php => profile.php

    would un-complicate your life for sure. also remember to rename the references.

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

Sidebar

Related Questions

System.setProperty(java.library.path, pathToLibs); doesn't work because it seems either java.library.path is read only or JVM
The system I'm working on is using something like a dynamic router + dep.injection
System.IO.BinaryReader reads values in a little-endian format. I have a C# application connecting to
The system I work on here was written before .net 2.0 and didn't have
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GenericCount { class Program {
System.Console.WriteLine(int.MaxValue); This line gives me the answer of 2,147,483,647 as I have a 32-bit
System: Windows7 Pro, Visual Studio 2010, C# I have a textbox: textBox1 I set
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml.Linq; namespace ConsoleApplication2 { class
Using System.Move() to insert/delete item(s) from an array of string is not as easy
If I write a python script using only python standard libraries, using Python 2.6

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.