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

  • Home
  • SEARCH
  • 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 8221417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:55:05+00:00 2026-06-07T13:55:05+00:00

I have an index.php with the following content: include_once(‘includes/auth.php’); include_once(‘classes/class.DatabaseQuery.php’); include_once(‘classes/class.Project.php’); include_once(‘classes/class.User.php’); $project =

  • 0

I have an index.php with the following content:

include_once('includes/auth.php');
include_once('classes/class.DatabaseQuery.php');
include_once('classes/class.Project.php');
include_once('classes/class.User.php');

$project = new Project();
$user = new User();

// HTML, HEAD, BODY

$usergroup = $user->getUserGroup($_SESSION['user']);
// ...

So I include all needed classes in my index.php. I also create an instance of the classes in this file. Then I have my class files (e.g. class.Project):

class Project {

private $db;
private $evaluation;

public function __construct($id=null){
    $this->setPreferences();
}

private function setPreferences() {
    $this->db = new DatabaseQuery();
    $this->evaluation = new Evaluation();
}


public function getSomething(){
    if($this->evaluation->checkSomething(1)){
        echo "test";
    }
}
 // ...
}

In these files I declare my other classes as private variables. Than I access the methods of the other classes.

Are there any problems with the inclusion and the use of private variables with other classes?

Now I have a strange problem. If I write a value into $_SESSION['user'] my private variable user is overwritten. The session values are already filled before I write something in my session. Here is my login.php:

    include_once('classes/class.User.php');     
    session_start();

    $username = $_POST['username'];
    $password = $_POST['password'];

    $user = new User();
    if ($user->checkLoginData($username, $password)) {
        $_SESSION['userID'] = $user->getUserIDForName($username);
        // it is an object
        var_dump($user);
        $_SESSION['user'] = $username;
        // it is a string
        var_dump($user);
        // ...
    }

How can $_SESSION['user']=$username change the content of the local variable $user? Perhaps you have some ideas what I’m doing wrong.

  • 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-07T13:55:06+00:00Added an answer on June 7, 2026 at 1:55 pm

    Solution:

    Now I followed the advice from here, where register_globals should be turned of. E.g. with htaccess:

    php_value register_globals 0

    Seems to work.

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

Sidebar

Related Questions

i have following navigation, <ul class=content-nav> <li id=nav-liv class=tab><a href=index.php?p=recent page=recent>Recent</a></li> <li id=nav-liv><a href=index.php?p=friends
I have for example the following URL: index.php?q=Content/Uploads/Images/1.jpg I want so that page will
I have a a controller referral_medium_controller.php with the following content <?php class ReferralMediumsController extends
I have the following folder structure with files: index.php includes/header.php includes/conn.php contents/ad_list.php contents/ad_posting.php in
I have the following scenario. I have a index.php page with the following JQuery
In my Zend Framework app, I have following code: index.php $app_started_time = time(); layout.phtml
i have following .htaccess RewriteEngine On DirectoryIndex index.php RewriteRule ^([a-zA-Z0-9_-]{3,20})/([^/]+)/([^/]+)?$ index\.php?page=$1&s=$2&o=$3 [L] RewriteRule ^([a-zA-Z0-9_-]{3,20})/([^/]+)?$
Let's assume we have the following structure: index.php config.inc.php \ lib \ lib \
I currently have the following htaccess rewrite rule: RewriteRule (.*) index.php/$1 [L] How do
I have the following line: RewriteRule ^page.php?var1=([0-9]+)&var2=(.*)&var3=(.*)$ index.php?module=page&var1=$1 When I visit the directory with

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.