PDA

View Full Version : convert this vb2 mysql code to work in vb3


webrats
02-16-2005, 12:44 AM
#!/usr/bin/perl -w
#
# vBulletin MRTG grapher by discore (tyler@xmission.com)
#

use strict;
use DBI;

################################################## ##############################
## CHANGE this stuff ##
################################################## ##############################

# MySQL info
my $sqluser = "USERNAME";
my $sqlpass = "PASSWORD";
my $sqlhost = "localhost"; # host of your database
my $database = "DATABASE";

# Your board's name
my $name = "Your Board Name";

# Your 'Timeout for Cookie'
#
# Set this to 300 if you want truely accurate graphs. This will report
# considerably less users online than vB does.
# Or, set this to whatever you "Timeout for Cookie" setting from your vB
# Options is to report online users the same way "Who's Online" does.
my $cookie_expire = "300";

# Location of 'uptime' program
my $uptime_bin = "/usr/bin/uptime";

################################################## ##############################
## Logically won't need to touch anything after here ##
################################################## ##############################

# connect to the database
my $dba = "DBI:mysql:database=$database;host=$sqlhost";
my $dbh = DBI->connect("$dba","$sqluser", "$sqlpass",{'RaiseError' => 1})
|| die "Could not connect to database: $!\n";

my $data; # output

# get number of posts in the last 5 minutes
if($ARGV[0] eq "posts") {
my $time = time()-300;
my $query = $dbh->selectrow_hashref("SELECT COUNT(*) AS count FROM post WHERE dateline>=$time");
my $totalnewposts = $query->{'count'};

$data = $totalnewposts;
}

# get number of online users
elsif($ARGV[0] eq "users") {
my $time = time()-$cookie_expire;
my $query = $dbh->selectrow_hashref("SELECT COUNT(*) AS sessions FROM session WHERE lastactivity>$time");
my $totalonline = $query->{'sessions'};

$data = $totalonline;
}

$dbh->disconnect();

# get uptime
my $uptime = `$uptime_bin`;
$uptime =~ /up (.*?),/;
$uptime = $1;
chomp($uptime);

# print out info for MRTG
print <<EOF;
$data
$data
$uptime
$name
EOF

filburt1
02-16-2005, 01:03 AM
Respectfully, at least say "please" or take an effort to convert the (Perl) script yourself and ask specific questions when you have problems. Some might view your post as audacious when you make a demand in the subject, put forth no effort in converting the script yourself, nor even wrap the code in a [code] tag. :)

webrats
02-17-2005, 05:58 AM
Respectfully, at least say "please" or take an effort to convert the (Perl) script yourself and ask specific questions when you have problems. Some might view your post as audacious when you make a demand in the subject, put forth no effort in converting the script yourself, nor even wrap the code in a [code] tag. :)
that was assadine (sp) do a search for my user name i already converted it to php
but i want it in sh/perl

and if people get all offended by the subject, they need to take breather, and step away from the computer

im not here &uck around, i have a production servers that pay the bills.
i pay for this software, its not gpl so i dont have to be nice. fyi i didnt mean to come off as an ass in my first post

SO PLEASE PLEASE if anyone can help out it would be great


ps if it should be special bbcode im sorry as a mod since you saw it and havnt changed im guessing it is fine

Marco van Herwaarden
02-17-2005, 06:27 AM
i pay for this software, its not gpl so i dont have to be nice.Just to clear 1 thing up. You might have payed for your license, and expect support for that, that is valid. But the members responding on vBorg are NOT payed by Jelsoft, people offer their own free time to help other members, so you can't make any demands in here.

For demands you can open an official support ticket at jelsoft (vBcom) or member area.

cinq
02-17-2005, 07:12 AM
im not here &uck around, i have a production servers that pay the bills.
i pay for this software, its not gpl so i dont have to be nice.


I'm sorry, but this code you want converted, it's not default vBulletin code right ?