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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:44:30+00:00 2026-05-28T06:44:30+00:00

Sup! We have core class with mysql connection, than we include plugin and we

  • 0

Sup! We have core class with mysql connection, than we include plugin and we need that plugin cant access to our DB without core class methods.

index.php

<?php
    class Core
    {
        function connect()
        {
            $db = @mysql_connect($host, $user, $pass);
            @mysql_select_db($base, $db);
        }

        function query($sql)
        {
            return mysql_query($sql);
        }
    }

    global $c;
    $c = new Core();

    include('plugin.php');
    $p = new Plugin();
    echo $p->not_work_connection();
    echo $p->work_connection();
?>

plugin.php

<?php
    class Plugin
    {
        function not_work_connection()
        {
            $sql = 'SELECT * FROM `net_country` LIMIT 0 , 1';
            $result = mysql_query($sql); 
            while($row = mysql_fetch_array($result, MYSQL_ASSOC)) 
            {
                return print_r($row, 1);
            }
        }

        function work_connection()
        {
        global $c;
            $result =$c->query('SELECT * FROM `net_country` LIMIT 0 , 1'); 
            while($row = mysql_fetch_array($result, MYSQL_ASSOC)) 
            {
                return print_r($row, 1); 
            }
        }
    }
?>

I need restrict access from included scripts, but thay can use core methods to make queries. How i can make it?

  • 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-28T06:44:31+00:00Added an answer on May 28, 2026 at 6:44 am

    mysql_query without the second param uses the last link used by mysql_connect, so you could create a dummy connection after the real one :

    <?php
    class Core
    {
        private $db;
        function connect()
        {
            $this->db = @mysql_connect($host, $user, $pass);
            @mysql_select_db($base, $db);
    
            //dummy 
            @mysql_connect();
        }
    
        function query($sql)
        {
            //notice second param
            return mysql_query($sql, $this->db);
        }
    }
    
    global $c;
    $c = new Core();
    
    include('plugin.php');
    $p = new Plugin();
    echo $p->not_work_connection(); //doing a mysql_query will use the dummy resource and fail
    echo $p->work_connection();
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sup Guys, I Have a Function on my frmMain Class wich will update my
I have a text in the database that looks like that: 69&lt;sup&gt;something&lt;/sup&gt; And when
In versions of opera greater than 9.0, I have found a bug that fails
I have a mysql database with questions and answers that are displayed in HTML
I have the following text: txtAddressSup.Text I want the Sup to be replaced by
Suppose you have a Django view that has two functions: The first function renders
I am new to extension development, I have a requirement wherein I need to
I have a few HTML pages in which I use <sup></sup> tags. I want
I currently have this regex: $text = preg_replace(#<sup>(?:(?!</?sup).)*$key(?:(?!</?sup).)*<\/sup>#is, '<sup>'.$val.'</sup>', $text); The objective of the
If I have <p id=target> <span><sup>$</sup>50</span> </p> var $p = $(p#target); How do I

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.