Re: *Unlock All Weapons* in server patch 1.02
Hama,
The problem was not the asp folder at all. Everything works. But the issue was the displaying of the information.
In the web browser the information returned should look like this:
O
H pid nick asof
D 12345678 UNLOCKED 1122957313
H enlisted officer
D 0 0
H id state
D 11 s
D 22 s
D 33 s
D 44 s
D 55 s
D 66 s
D 77 s
$ 103 $
But, the return is like this in the web page:
O H pid nick asof D 12345678 UNLOCKED 1122957313 H enlisted officer
D 0 0 H id state D 11 s D 22 s D 33 s D 44 s D 55 s D 66 s D 77 s $ 103 $
The information should go up and down the web page ... not across it. Also, remember that I stated that the file was written in php with the aspx extension. The information that we can copy and past on this topic is written in perl with an aspx extension. I think it is the way the file was written. Here's the coding of the file written in php...I got this from BF2statistics....Look at what is highlighted...I am wondering if those needed to be changed:
<?php
/*
Copyright (C) 2006 BF2Statistics
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/********************************************
* 11/14/05 v0.0.1 - ALPHA build *
* 11/14/05 v0.0.2 - Removed name parameter *
* 11/15/05 v0.0.3 - Added redundancy check *
* 11/26/05 v0.0.4 - Updated for SF *
* 01/03/06 v0.1 - BETA release *
* 01/25/06 v0.1.1 - Added allunlocks *
* 02/14/06 v0.1.2 - Updated for EF *
* - Fixed unlocks *
********************************************/
$pid = $_GET['pid'] ? $_GET['pid'] : false;
if ((!$pid) || (!is_numeric($pid))) {print 'Invalid syntax!';}
else
{
require('config.php');
$connection = @mysql_connect($dbhost, $dbuser, $dbpass);
@mysql_select_db($dbname);
if ($allunlocks) {$query = "SELECT name FROM player WHERE id = {$pid}";}
else {$query = "SELECT name, score, usedunlocks FROM player WHERE id = {$pid}";}
$result = mysql_query($query) or die(mysql_error());
if (!mysql_num_rows($result)) {print 'Player not found!';}
else
{
$row = mysql_fetch_array($result);
$nick = $row['name'];
$earned = 0;
if (!$allunlocks)
{
$score = $row['score'];
$used = $row['usedunlocks'];
$query = "SELECT COUNT(id) AS count FROM unlocks WHERE (id = {$pid}) AND (state = 's')";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result))
{
$row = mysql_fetch_array($result);
$unlocks = $row['count'];
if ($unlocks < 7)
{
if ($score >= 50000) {$earned = 7;}
elseif ($score >= 20000) {$earned = 6;}
elseif ($score >= 8000) {$earned = 5;}
elseif ($score >= 5000) {$earned = 4;}
elseif ($score >= 2500) {$earned = 3;}
elseif ($score >= 800) {$earned = 2;}
elseif ($score >= 500) {$earned = 1;}
$earned -= $used;
}
$query = "UPDATE player SET availunlocks = {$earned} WHERE id = {$pid}";
mysql_query($query) or die (mysql_error());
}
}
print "O\n" .
"H\tpid\tnick\tasof\n" .
"D\t$pid\t$nick\t" . time() . "\n" .
"H\tenlisted\tofficer\n" .
"D\t$earned\t0\n" .
"H\tid\tstate\n";
$num = strlen($pid) + strlen($nick) + 51;
if (!$allunlocks)
{
$query = "SELECT kit, state FROM unlocks WHERE (id = {$pid}) AND (kit < 78)";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
print "D\t$row[kit]\t$row[state]\n";
}
checkUnlock(88, 22);
checkUnlock(99, 33);
checkUnlock(111, 44);
checkUnlock(222, 55);
checkUnlock(333, 66);
checkUnlock(444, 11);
checkUnlock(555, 77);
$num += 0;
}
else
{
for ($i = 11; $i < 100; $i += 11) {print "D\t$i\ts\n";}
for ($i = 111; $i < 556; $i += 111) {print "D\t$i\ts\n";}
$num += 61;
}
print "$\t$num\t$";
}
@mysql_close($connection);
}
function checkUnlock($want, $need)
{
global $pid;
$query = "SELECT state FROM unlocks WHERE (id = {$pid}) AND (state = 's') AND (kit = {$need})";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result))
{
$query = "SELECT state, kit FROM unlocks WHERE (id = {$pid}) AND (kit = {$want})";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
print "D\t$row[kit]\t$row[state]\n";
}
else {print "D\t$want\tn\n";}
}
?>
Thanks,
Pvtnoob
Hama,
The problem was not the asp folder at all. Everything works. But the issue was the displaying of the information.
In the web browser the information returned should look like this:
O
H pid nick asof
D 12345678 UNLOCKED 1122957313
H enlisted officer
D 0 0
H id state
D 11 s
D 22 s
D 33 s
D 44 s
D 55 s
D 66 s
D 77 s
$ 103 $
But, the return is like this in the web page:
O H pid nick asof D 12345678 UNLOCKED 1122957313 H enlisted officer
D 0 0 H id state D 11 s D 22 s D 33 s D 44 s D 55 s D 66 s D 77 s $ 103 $
The information should go up and down the web page ... not across it. Also, remember that I stated that the file was written in php with the aspx extension. The information that we can copy and past on this topic is written in perl with an aspx extension. I think it is the way the file was written. Here's the coding of the file written in php...I got this from BF2statistics....Look at what is highlighted...I am wondering if those needed to be changed:
<?php
/*
Copyright (C) 2006 BF2Statistics
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/********************************************
* 11/14/05 v0.0.1 - ALPHA build *
* 11/14/05 v0.0.2 - Removed name parameter *
* 11/15/05 v0.0.3 - Added redundancy check *
* 11/26/05 v0.0.4 - Updated for SF *
* 01/03/06 v0.1 - BETA release *
* 01/25/06 v0.1.1 - Added allunlocks *
* 02/14/06 v0.1.2 - Updated for EF *
* - Fixed unlocks *
********************************************/
$pid = $_GET['pid'] ? $_GET['pid'] : false;
if ((!$pid) || (!is_numeric($pid))) {print 'Invalid syntax!';}
else
{
require('config.php');
$connection = @mysql_connect($dbhost, $dbuser, $dbpass);
@mysql_select_db($dbname);
if ($allunlocks) {$query = "SELECT name FROM player WHERE id = {$pid}";}
else {$query = "SELECT name, score, usedunlocks FROM player WHERE id = {$pid}";}
$result = mysql_query($query) or die(mysql_error());
if (!mysql_num_rows($result)) {print 'Player not found!';}
else
{
$row = mysql_fetch_array($result);
$nick = $row['name'];
$earned = 0;
if (!$allunlocks)
{
$score = $row['score'];
$used = $row['usedunlocks'];
$query = "SELECT COUNT(id) AS count FROM unlocks WHERE (id = {$pid}) AND (state = 's')";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result))
{
$row = mysql_fetch_array($result);
$unlocks = $row['count'];
if ($unlocks < 7)
{
if ($score >= 50000) {$earned = 7;}
elseif ($score >= 20000) {$earned = 6;}
elseif ($score >= 8000) {$earned = 5;}
elseif ($score >= 5000) {$earned = 4;}
elseif ($score >= 2500) {$earned = 3;}
elseif ($score >= 800) {$earned = 2;}
elseif ($score >= 500) {$earned = 1;}
$earned -= $used;
}
$query = "UPDATE player SET availunlocks = {$earned} WHERE id = {$pid}";
mysql_query($query) or die (mysql_error());
}
}
print "O\n" .
"H\tpid\tnick\tasof\n" .
"D\t$pid\t$nick\t" . time() . "\n" .
"H\tenlisted\tofficer\n" .
"D\t$earned\t0\n" .
"H\tid\tstate\n";
$num = strlen($pid) + strlen($nick) + 51;
if (!$allunlocks)
{
$query = "SELECT kit, state FROM unlocks WHERE (id = {$pid}) AND (kit < 78)";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
print "D\t$row[kit]\t$row[state]\n";
}
checkUnlock(88, 22);
checkUnlock(99, 33);
checkUnlock(111, 44);
checkUnlock(222, 55);
checkUnlock(333, 66);
checkUnlock(444, 11);
checkUnlock(555, 77);
$num += 0;
}
else
{
for ($i = 11; $i < 100; $i += 11) {print "D\t$i\ts\n";}
for ($i = 111; $i < 556; $i += 111) {print "D\t$i\ts\n";}
$num += 61;
}
print "$\t$num\t$";
}
@mysql_close($connection);
}
function checkUnlock($want, $need)
{
global $pid;
$query = "SELECT state FROM unlocks WHERE (id = {$pid}) AND (state = 's') AND (kit = {$need})";
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result))
{
$query = "SELECT state, kit FROM unlocks WHERE (id = {$pid}) AND (kit = {$want})";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result);
print "D\t$row[kit]\t$row[state]\n";
}
else {print "D\t$want\tn\n";}
}
?>
Thanks,
Pvtnoob


I can see that you're having us comment out a couple lines and change the indents, but I don't understand the warnings at the bottom and Google's translation doesn't make much sense. Thanks :)
Comment