You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 372 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - What is the acceptable MySQL max_questions supported? [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
desa80
Nuke Soldier
Nuke Soldier


Joined: Oct 17, 2003
Posts: 23


PostPosted: Wed Nov 17, 2004 9:35 am Reply with quoteBack to top

Thanks but my host dont allow me to have 2 or 3 users per database Ican have 20 databases but only one user(i am on shared hosing)...
If you have any other suggestions or ideas please write...
Donovan wrote:
I get this error whenever I get around 30 on the board at one time. My host has their limit set to 50,000 and they said "change your code to be more efficient". Here is the fix for this but I havn't been able to get it to work yet.
Find all posts by desa80View user's profileSend private message
Datamisc
Nuke Soldier
Nuke Soldier


Joined: Nov 16, 2003
Posts: 10


PostPosted: Tue Nov 23, 2004 11:07 am Reply with quoteBack to top

Well i had this problem with ipowerweb... activated permanent connections and still had this problem... so i found a solution.

Im not a good coder but i discovered that if i created another account that directed to the same database then that account will start with 0 queries.

With that on mind i modified the includes/sql_layer.php so that if it encounters any database acces error it would instantly changed the user accesing the database.

this is the code : (sorry but its not well depured, i know many changes wil help making it better Wink )

Code:

function sql_query($query, $id)
{

global $dbtype;
global $sql_debug;
$sql_debug = 0;
$incrementa = 0;
$i = 1;
$archivito="incrementa .php"; // NOTICE how there is a blank space after incrementa and before the dot
if($sql_debug) echo "SQL query: ".str_replace(",",", ",$query)."<BR>";
switch ($dbtype) {

    case "MySQL":
        $res=@mysql_query($query, $id);

   //************************** prueba! ****************
     if( (mysql_errno() || $res == NULL ) &&  mysql_errno() != 1054 ) /* Database error? */
     {
       echo mysql_errno();
      while($i)
      {
         // The users are keept in a directory in root called cfg
         // there are 7 diferent users... incrementa1... incrementa7
         // one of them is always renamed to cfg.php
         // we search the file missing (the one renamed to config2.php), then we rename it to the original name.
         // example : we have in the cfg directory: incrementa1.php, incrementa3.php, ... incrementa 7.php
         //           so incrementa2.php is missing... we rename config2.php to incrementa2.php.
            
         $archivito[9] = chr( $incrementa+49);
             if ( !file_exists("cfg/$archivito") )
         {
            break;
         }
         $incrementa ++ ;
         if( $incrementa == 7)
             $i=0;      
      }
         // now we will rename the next incrementa file to config2.php (the next user of the database)
         // if we are at the end of the files (incrementa7) we start from 1
      if($incrementa != 7 )
      {
         if( rename( "cfg/config2.php", "cfg/$archivito") ) {
             if($incrementa == 6 )
           {
                  $incrementa = 0;
           }
           else
           {
            $incrementa++;
           }
           $archivito[9] = chr( $incrementa + 49 );
           rename ( "cfg/$archivito", "cfg/config2.php" );
                  
           // Nos reconectamos

           require_once("db/db.php");

           require_once("includes/sql_layer.php");
           $dbi = sql_connect($dbhost, $dbuname, $dbpass, $dbname);

              $res=@mysql_query($query, $id);
         }
      }
        }    

   //************************** fin the end... now the new user will have 50000 queryes available again! *********

        return $res;
    break;;

    case "mSQL":
        $res=@msql_query($query, $id);
        return $res;
    break;;

    case "postgres":
    case "postgres_local":
   $res=pg_exec($id,$query);
   $result_set = new ResultSet;
   $result_set->set_result( $res );
   $result_set->set_total_rows( sql_num_rows( $result_set ) );
   $result_set->set_fetched_rows( 0 );
        return $result_set;
    break;;

    case "ODBC":
    case "ODBC_Adabas":
        $res=@odbc_exec($id,$query);
        return $res;
    break;;

    case "Interbase":
        $res=@ibase_query($id,$query);
        return $res;
    break;;

    case "Sybase":
        $res=@sybase_query($query, $id);
        return $res;
    break;;

    default:
    break;;

    }
}



Ok now you need to modify your config.php so that it will load the user stored in cfg/config2.php

Code:

require_once("cfg/config2.php");  // include the file config2.php so that the username can be changed.

$dbhost = "localhost";
$dbpass = "username";
$dbname = "databasename";
$prefix = "nuke";
$user_prefix = "nuke";
$dbtype = "MySQL";
$sitekey = "SddddddddddddddddddddddddddddddddddddddddddddddfDS+e9";
$gfx_chk = 7;
$subscription_url = "";


Note that we deleted the "$dbuname" variable

now you will have to create a directory called "cfg" in root.
and inside that directory you will have to put the following files:

config2.php
incrementa2.php
incrementa3.php
incrementa4.php
incrementa5.php
incrementa6.php
incrementa7.php

NO incrementa1 is not missing... its config2... when the user in config2 reaches 50000queries then it will be renamed to incrementa1.php... and then incrementa2.php will be renamed to config2.php

each of the past files will contain the following code.


Code:

<?php
$dbuname = "database user";
?>


Remember to create diferent users for the same database (7) and put a diferent user in each file... keep the password the same in all users so it will be easier to change them.


It worked for me..
Stills needs lots of work... hope it works for you.
Find all posts by DatamiscView user's profileSend private message
dannyb
Nuke Cadet
Nuke Cadet


Joined: Mar 08, 2005
Posts: 1


PostPosted: Tue Mar 08, 2005 12:44 pm Reply with quoteBack to top

I had this problem. There is a simple hack around it. If you are using a program simular to phpNuke.

First create a few different username/passwords for the db.
Then locate the db information file for that program.
Add a random module to set the db username and password randomly.
Instead of random you could do it by time, day,etc...
This will avoid the overload in querys by single user.

Problem persist then you should consult the make of the program if the hits do not match the query max out. For this would be a software problem.
Find all posts by dannybView user's profileSend private message
DROPER
Nuke Soldier
Nuke Soldier


Joined: Jan 16, 2005
Posts: 13


PostPosted: Mon May 02, 2005 4:28 am Reply with quoteBack to top

Hello. I have a BIG problem.
I get this error: #1226 - User 'DRoPeR' has exceeded the 'max_questions' resource (current value: 90000)

A have read solution for this problem, but i can't create more that one username for one data base.

I don't know how to get out of this bug. Onyone who can help me. Please!!! I am running on PHP-NUKE 7.5

Sorry for my bad English.
Find all posts by DROPERView user's profileSend private messageVisit poster's website
DROPER
Nuke Soldier
Nuke Soldier


Joined: Jan 16, 2005
Posts: 13


PostPosted: Mon May 02, 2005 9:22 am Reply with quoteBack to top

People! Please help me. My site will go down every moment. Help me!
Find all posts by DROPERView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.051 Seconds - 279 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::