PDA

View Full Version : Simple Request... Yet Seems Difficult


Mistah Roth
05-16-2006, 11:37 PM
I've been struggling for months now in trying to basically excluse the pieces of code that do the following on a non-vb page:

a) Keeps the user logged in (so it can say Welcome Whoever)
b) Gets all of the user table information (so I can check if they are a certain usergroup id)

Thats all I want... and I cant find any way of doing this without including global, which runs tons of un-neccessary queries. Can anyone help me out here? I want to be efficient, I tried just doing global.php but now there are so many queries being run my host is starting to complain lol.

Abe1
05-16-2006, 11:47 PM
I've been struggling for months now in trying to basically excluse the pieces of code that do the following on a non-vb page:

a) Keeps the user logged in (so it can say Welcome Whoever)
b) Gets all of the user table information (so I can check if they are a certain usergroup id)

Thats all I want... and I cant find any way of doing this without including global, which runs tons of un-neccessary queries. Can anyone help me out here? I want to be efficient, I tried just doing global.php but now there are so many queries being run my host is starting to complain lol.
Global.php is realy thr only normal way and the easiest. You can add some defines that will stop global from running some queies.

Paul M
05-17-2006, 12:04 AM
Looking at the output of a typical "explain", global.php seems to run six queries, at least half of which I would say are necessary to do what you want (one is for templates, you may not need them, two more are style info and calendar permissions - again, you may not want them). However, it would be very hard to pick out the bits of code you need (from config.php, functions.php, class_core.php, init.php etc etc) - not really worth the effort.

Also, global.php is called on every vb page, so adding it to an external page should not cause a dramatic rise in queries, unless most members are not actually in your forums, but in the external pages. Any host that moans about the number of queries here is being a bit petty - possibly you should be looking for a better host, not trying to re-invent the wheel. :)

Mistah Roth
05-17-2006, 10:03 AM
Well right now I get about 15 queries a second, which is pretty high. Also 90% of my visitors are for the non-vb pages, my forum makes up about 10% of my hits.

I also have a lot of non-vb pages, upwards of 1000, so if you're browsing my site you're running a lot of queries. Ill try stopping those three queries and see if it makes a big difference, thank you.

stonyarc
05-17-2006, 07:38 PM
Well right now I get about 15 queries a second, which is pretty high. Also 90% of my visitors are for the non-vb pages, my forum makes up about 10% of my hits.

I also have a lot of non-vb pages, upwards of 1000, so if you're browsing my site you're running a lot of queries. Ill try stopping those three queries and see if it makes a big difference, thank you.

What is the platform of your non vb pages is it homebrew php? or a CMS or plain HTML or .....

Mistah Roth
05-17-2006, 11:09 PM
its a PHP structure of my own creation. I use PHP, CSS, and HTML to make up the main site, the database only comes in for the user session and for downloading things (checks to see if they're logged in).

Also the news script, which is a blog script basically, uses the database as well.

Hellcat
05-17-2006, 11:35 PM
You could read the cookie yourself and then run your own quries to fetch the user data you need....

Mistah Roth
05-18-2006, 12:15 AM
Alright then, I know nothing about cookies lol, so my request is for a script that reads the cookies vbulletin makes >.> hahaa.

And writing a query to get the usergroup isnt difficult, I can manage that on my own, the cookie part is the only real tricky part.