Jump to content

[SOLVED] MYSQLi help


brianjw

Recommended Posts

Hi,

 

I am not sure if this is the right place to post this - if it isn't - bare with me please.

I have a PHP Script, that I bought so I cannot include the whole script. I am having trouble installing it.

 

First of all, my host doesn't have mysqli installed/configured or whatever.

 

I receive this error:

Fatal error: Class 'mysqli' not found in /home/***/public_html/***/inc.aaostats.php on line 26

 

Here is the install file which was going to create a table in a database set in inc.aaostats.php.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<style>
html, body	{ overflow:auto; margin:5% 5%; padding:0px; background:#FFFFFF repeat fixed top left; color:#000000; direction:ltr; line-height:normal; letter-spacing:normal; text-align:center; text-decoration:none; text-indent:0px; text-transform:none; white-space:normal; word-spacing:normal; font:normal normal normal 10pt arial,helvetica; }
#content { display:block; top:0px; width:476px; margin:0px auto; padding:0px; border-left:#666666 1px solid; border-right:#666666 1px solid; text-align:left; }
fieldset { width:476px; }
td { padding:1px; text-align:center; }
th.left { padding:1px; text-align:left; }
td.left { padding:1px; text-align:left; }
a { text-decoration:underline; }
a:hover { text-decoration:underline; }
</style>

<title>
America's Army - Player Statistics Collector [install]
</title>
</head>

<body onload="status='America\'s Army - Player Statistics Collector';return true;" onmouseout="status='America\'s Army - Player Statistics Collector';return true;" onmouseover="status='America\'s Army - Player Statistics Collector';return true;" oncontextmenu="return false;" ondragstart="return false;" onmovestart="return false;" onselectstart="return false;" onresizestart="return false;" >

<div class="content"><fieldset><table><tr><td>
<?php
// America's Army - Player Statistics Collector & Signature Image Creator
// © 2007-2008 FBI-TEAM.org
// Author: [FBI]_Inque187
// Created: Oct 31, 2007
// Updated: Jan 1, 2008
// 
// Please do not distrubute this file or other files that accompany this script
// unless you have obtained specific authorization and or permission only from
// the author and or subsidiary company providing this internet tool.
// 
// Use of these files and tool is at your own risk and the author and or subsidiary
// company providing these files cannot and will not be held responsible for any
// damages to any equipment and or data lost resulting from the misuse or
// misconfiguration of any of these included file.<br>
// 
// You alone assume all respnsibility for any problems that arise of any sort if you
// so choose to use these files in any manner not intended by original design.

require ('/home/***/public_html/***/inc.aaostats.php'); // Change to same secure path location inside the named file!

$seed_go = time(true);
$date_go = date('Y.m.d');
$time_go = date('H:i:s T');

echo '<img src="http://www.fbi-team.org/_pub/banner_aao_468x60_2.png" width="468" height="60" border="0" alt="America\'s Army - Player Statistics Collector"><p /><b>Start:</b> '.$time_go.' - <b>Date:</b> '.$date_go.'<p />';

echo '[Creating Main Table In Database]<br />';
$createTBL = $mysqli->query("CREATE TABLE IF NOT EXISTS ".$db_prefix."_stats (".$db_prefix."_id TINYINT(3) NOT NULL auto_increment primary key, ".$db_prefix."_nick VARCHAR(32) DEFAULT NULL, ".$db_prefix."_year YEAR(4) NOT NULL DEFAULT '0000', ".$db_prefix."_honor TINYINT(3) NOT NULL DEFAULT '0', ".$db_prefix."_marksman TINYINT(2) NOT NULL DEFAULT '0', ".$db_prefix."_map VARCHAR(128) DEFAULT NULL, ".$db_prefix."_match INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_objects INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_points INT( NOT NULL DEFAULT '0', ".$db_prefix."_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_deaths INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_roe INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_healed INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_applied INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_mg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_sr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_tg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_lr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_mg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_sr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_tg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_lr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', INDEX (".$db_prefix."_map), INDEX (".$db_prefix."_year,".$db_prefix."_honor,".$db_prefix."_marksman,".$db_prefix."_match,".$db_prefix."_objects), INDEX (".$db_prefix."_points,".$db_prefix."_kills,".$db_prefix."_deaths,".$db_prefix."_roe,".$db_prefix."_healed,".$db_prefix."_applied), INDEX (".$db_prefix."_ar_kills,".$db_prefix."_mg_kills,".$db_prefix."_sr_kills,".$db_prefix."_tg_kills,".$db_prefix."_lr_kills), INDEX (".$db_prefix."_ar_accur,".$db_prefix."_mg_accur,".$db_prefix."_sr_accur,".$db_prefix."_tg_accur,".$db_prefix."_lr_accur), UNIQUE (".$db_prefix."_nick)) ENGINE = MyISAM");
echo '<b>'.$db_prefix.'_stats</b> created successfully!<p />[Adding Example To Database]<br />';
$createPLY = $mysqli->query("INSERT IGNORE INTO ".$db_prefix."_stats (aao_id, aao_nick, aao_year, aao_honor, aao_marksman, aao_map, aao_match, aao_objects, aao_points, aao_kills, aao_deaths, aao_roe, aao_healed, aao_applied, aao_ar_kills, aao_mg_kills, aao_sr_kills, aao_tg_kills, aao_lr_kills, aao_ar_accur, aao_mg_accur, aao_sr_accur, aao_tg_accur, aao_lr_accur) VALUES (NULL, 'Player_Example', '2008', '10', '36', 'MOUT McKenna', '10', '14', '5000', '52', '48', '253', '1', '7', '19', '11', '1', '16', '5', '4.21', '2.17', '0.05', '8.89', '1.22')");
echo '<b>Player</b> added successfully!<p /><font style="font-weight:bold; color:#DD0000;">REMEMBER, TO IMMEDIATELY <u>DELETE THIS FILE</u><br />FROM YOUR FTP ON YOUR WEB HOST ACCOUNT!</font><p /><a href="viewlist.php" title="View Player List in Database" target="_top"><font><b>View Player List in Database</b></font></a><p />';

mysqli_close($mysqli);

$seed_no = time(true);
$seed_up = $seed_no - $seed_go;

if ($seed_up != '1') { $seed_up .=' Seconds'; } else { $seed_up .=' Second'; }
$time_no = date('H:i:s T');

echo '<b>End:</b> '.$time_no.' - <b>Run:</b> '.$seed_up.'<br />Copyright © 2007-'.gmdate('Y').' <a href="http://www.fbi-team.org" title="FBI-TEAM.org - Web Site" target="_blank">FBI-TEAM.org</a><p /><a href="http://www.fbi-team.org" title="FBI-TEAM.org - Web Site" target="_blank"><img src="http://www.fbi-team.org/_pub/banner_fbi_468x60.png" width="468" height="60" border="0" alt="FBI-TEAM.org - Web Site"></a>';

clearstatcache();
exit;
?>
</td></tr></table></fieldset></div>

</body></html>

Then, inc.aaostats.php is the file with all the configuration and I will give you that:

<?php
// America's Army - Player Statistics Collector & Signature Image Creator
// © 2007-2008 FBI-TEAM.org
// Author: [FBI]_Inque187
// Created: Oct 31, 2007
// Updated: Jan 1, 2008
// 
// Please do not distrubute this file or other files that accompany this script
// unless you have obtained specific authorization and or permission only from
// the author and or subsidiary company providing this internet tool.
// 
// Use of these files and tool is at your own risk and the author and or subsidiary
// company providing these files cannot and will not be held responsible for any
// damages to any equipment and or data lost resulting from the misuse or
// misconfiguration of any of these included file.<br>
// 
// You alone assume all respnsibility for any problems that arise of any sort if you
// so choose to use these files in any manner not intended by original design.

$db_host = "localhost"; // Change if your mySQL hostname is different.
$db_user = "***"; // Change to your current mySQL username.
$db_pass = "***"; // Change to your current mySQL password.
$db_name = "***"; // Change to the mySQL dtabase you want to use.
$db_prefix = "aao";

$mysqli = new mysqli("$db_host", "$db_user", "$db_pass", "$db_name");
if (mysqli_connect_errno()) { echo "Database Connection Error.\n\n"; exit(); }

// Make sure you correctly enter the paths where you will FTP upload the files to your web host.
$path_secure = "/home/***/public_html/***/"; // Change to a private path where this file will be uploaded!
$path_public = "/home/***/public_html/"; // Change to a public path where the other files will be uploaded!
?>

 

Okay, now for what my questions are:

 

1.) Does this support php5?

2.) Is it possible to convert the mysqli into standard mysql, if so how? My host told me I could do this, but I really am a noob when it comes to php.

Most likely, you could just change the mysqli functions to the standard mysql functions.

But again, I have no idea how lol. The reason I bought the script was because I couldn't code it.

3.) Does this support php4?

 

Thank you very much,

Brian

Link to comment
Share on other sites

1. Based on fragments you've posted it should

2. Probably. Most mysqli methods/functions have their counterparts in mysql. If your script isn't using some 'advanced' techniques like stored procedures, then changing to mysql should be possible.

3. Based on fragments you've posted it should

Link to comment
Share on other sites

I'm not sure really...

The best thing would be to force your hosting company to enable mysqli support. It's been kind of a standard for some time now. It's more secure. And a server can run with both mysql and mysqli extensions enabled at same time (they even can both be used within one script). I can so no reason, why they wouldn't do it, except for laziness.

 

The worse options, is to look for all mysqli functions within script, and to change them to their mysql counterparts.

 

An example:

$result = $mysqli->query("SELECT * FROM table WHERE 1");

 

is equal to:

 

$result = mysql_query("SELECT * FROM table WHERE 1");

 

In most cases it will be as simple as this, but in others there will be more changes. See for example connecting to database in both cases.

 

 

Link to comment
Share on other sites

Well, thank you. :) I actually got my host talked into supporting mysqli. They are going to recompile apache tonight to set it up.

 

I am not going to mark this solved yet, because you never know. Maybe, I still need to convert mysqli to mysql.

 

Thanks,

Brian

Link to comment
Share on other sites

Hi,

 

It appears my host has not done this yet... So I am going to continue asking for help:

 

How would I convert the following codes to mysql?

$mysqli = new mysqli("$db_host", "$db_user", "$db_pass", "$db_name");
if (mysqli_connect_errno()) { echo "Database Connection Error.\n\n"; exit(); }

$searchTBL = $mysqli->query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick = 'Player_Example'");
if (!$searchTBL) { echo "DB Error - Player List!<p />"; return; mysqli_close($mysqli); }
if (mysqli_num_rows($searchTBL) == 0) {
echo '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><th>Player List</th></tr><tr><td>There are no example players listed in the database!<br />Please run the <b>install.php</b> file first before viewing this page.</td></tr></table><p />';
} else {
while ($showPLY = mysqli_fetch_array($searchTBL)) {
echo '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><th class="left">Name</th><th width="13%">Honor</th><th width="13%">Points</th><th width="13%">Kills</th><th width="13%">Deaths</th><th width="13%">ROE</th></tr><tr><td class="left">'.$showPLY["".$db_prefix."_nick"].'</td><td>'.$showPLY["".$db_prefix."_honor"].'</td><td>'.$showPLY["".$db_prefix."_points"].'</td><td>'.$showPLY["".$db_prefix."_kills"].'</td><td>'.$showPLY["".$db_prefix."_deaths"].'</td><td>'.$showPLY["".$db_prefix."_roe"].'</td></tr></table><p />';
}
}

mysqli_close($mysqli);

$createTBL = $mysqli->query("CREATE TABLE IF NOT EXISTS ".$db_prefix."_stats (".$db_prefix."_id TINYINT(3) NOT NULL auto_increment primary key, ".$db_prefix."_nick VARCHAR(32) DEFAULT NULL, ".$db_prefix."_year YEAR(4) NOT NULL DEFAULT '0000', ".$db_prefix."_honor TINYINT(3) NOT NULL DEFAULT '0', ".$db_prefix."_marksman TINYINT(2) NOT NULL DEFAULT '0', ".$db_prefix."_map VARCHAR(128) DEFAULT NULL, ".$db_prefix."_match INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_objects INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_points INT( NOT NULL DEFAULT '0', ".$db_prefix."_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_deaths INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_roe INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_healed INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_applied INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_mg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_sr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_tg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_lr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_mg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_sr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_tg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_lr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', INDEX (".$db_prefix."_map), INDEX (".$db_prefix."_year,".$db_prefix."_honor,".$db_prefix."_marksman,".$db_prefix."_match,".$db_prefix."_objects), INDEX (".$db_prefix."_points,".$db_prefix."_kills,".$db_prefix."_deaths,".$db_prefix."_roe,".$db_prefix."_healed,".$db_prefix."_applied), INDEX (".$db_prefix."_ar_kills,".$db_prefix."_mg_kills,".$db_prefix."_sr_kills,".$db_prefix."_tg_kills,".$db_prefix."_lr_kills), INDEX (".$db_prefix."_ar_accur,".$db_prefix."_mg_accur,".$db_prefix."_sr_accur,".$db_prefix."_tg_accur,".$db_prefix."_lr_accur), UNIQUE (".$db_prefix."_nick)) ENGINE = MyISAM");
echo '<b>'.$db_prefix.'_stats</b> created successfully!<p />[Adding Example To Database]<br />';
$createPLY = $mysqli->query("INSERT IGNORE INTO ".$db_prefix."_stats (aao_id, aao_nick, aao_year, aao_honor, aao_marksman, aao_map, aao_match, aao_objects, aao_points, aao_kills, aao_deaths, aao_roe, aao_healed, aao_applied, aao_ar_kills, aao_mg_kills, aao_sr_kills, aao_tg_kills, aao_lr_kills, aao_ar_accur, aao_mg_accur, aao_sr_accur, aao_tg_accur, aao_lr_accur) VALUES (NULL, 'Player_Example', '2008', '10', '36', 'MOUT McKenna', '10', '14', '5000', '52', '48', '253', '1', '7', '19', '11', '1', '16', '5', '4.21', '2.17', '0.05', '8.89', '1.22')");
echo '<b>Player</b> added successfully!<p /><font style="font-weight:bold; color:#DD0000;">REMEMBER, TO IMMEDIATELY <u>DELETE THIS FILE</u><br />FROM YOUR FTP ON YOUR WEB HOST ACCOUNT!</font><p /><a href="viewlist.php" title="View Player List in Database" target="_top"><font><b>View Player List in Database</b></font></a><p />';

mysqli_close($mysqli);

$remove = array(",", "%", "-");
$p_year = mysqli_real_escape_string($mysqli, $p_year);
$p_honor = mysqli_real_escape_string($mysqli, $p_honor);
$p_marksman=mysqli_real_escape_string($mysqli, $p_marksman);
$p_map=mysqli_real_escape_string($mysqli, $p_map);
$p_match=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_match));
$p_objects=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_objects));
$p_points=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_points));
$p_kills=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_kills));
$p_deaths=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_deaths));
$p_roe=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_roe));
$p_healed=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_healed));
$p_applied=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_applied));
$p_ar_kills=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_ar_kills));
$p_mg_kills=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_mg_kills));
$p_sr_kills=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_sr_kills));
$p_tg_kills=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_tg_kills));
$p_lr_kills=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_lr_kills));
$p_ar_accur=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_ar_accur));
$p_mg_accur=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_mg_accur));
$p_sr_accur=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_sr_accur));
$p_tg_accur=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_tg_accur));
$p_lr_accur=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_lr_accur));

$searchPLY = $mysqli->query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick = '".$gn_gps."'");
if (!$searchPLY) { echo "DB Error - Player Search!<p />"; return; mysqli_close($mysqli); }

if (mysqli_num_rows($searchPLY) != 0) {

echo '[Player Name Found]<br /><b>'.$gn_gps.'</b> - already is in database!<br />';
$updatePLY = $mysqli->query("UPDATE ".$db_prefix."_stats SET ".$db_prefix."_year = '".$p_year."', ".$db_prefix."_honor = '".$p_honor."', ".$db_prefix."_marksman = '".$p_marksman."', ".$db_prefix."_map = '".$p_map."', ".$db_prefix."_match = '".$p_match."', ".$db_prefix."_objects = '".$p_objects."', ".$db_prefix."_points = '".$p_points."', ".$db_prefix."_kills = '".$p_kills."', ".$db_prefix."_deaths = '".$p_deaths."', ".$db_prefix."_roe = '".$p_roe."', ".$db_prefix."_healed = '".$p_healed."', ".$db_prefix."_applied = '".$p_applied."', ".$db_prefix."_ar_kills = '".$p_ar_kills."', ".$db_prefix."_mg_kills = '".$p_mg_kills."', ".$db_prefix."_sr_kills = '".$p_sr_kills."', ".$db_prefix."_tg_kills = '".$p_tg_kills."', ".$db_prefix."_lr_kills = '".$p_lr_kills."', ".$db_prefix."_ar_accur = '".$p_ar_accur."', ".$db_prefix."_mg_accur = '".$p_mg_accur."', ".$db_prefix."_sr_accur = '".$p_sr_accur."', ".$db_prefix."_tg_accur = '".$p_tg_accur."', ".$db_prefix."_lr_accur = '".$p_lr_accur."' WHERE ".$db_prefix."_nick='".$gn_gps."'");
if (!$updatePLY) { echo "DB Error - Player Update!<p />"; return; mysqli_close($mysqli); }
echo 'Player stats successfully updated!<p />';

} else {

echo '[Player Name Unrecognized]<br /><b>'.$gn_gps.'</b> - is not in database!<br />';
$createPLY = $mysqli->query("INSERT IGNORE INTO ".$db_prefix."_stats (".$db_prefix."_id, ".$db_prefix."_nick, ".$db_prefix."_year, ".$db_prefix."_honor, ".$db_prefix."_marksman, ".$db_prefix."_map, ".$db_prefix."_match, ".$db_prefix."_objects, ".$db_prefix."_points, ".$db_prefix."_kills, ".$db_prefix."_deaths, ".$db_prefix."_roe, ".$db_prefix."_healed, ".$db_prefix."_applied, ".$db_prefix."_ar_kills, ".$db_prefix."_mg_kills, ".$db_prefix."_sr_kills, ".$db_prefix."_tg_kills, ".$db_prefix."_lr_kills, ".$db_prefix."_ar_accur, ".$db_prefix."_mg_accur, ".$db_prefix."_sr_accur, ".$db_prefix."_tg_accur, ".$db_prefix."_lr_accur) VALUES (NULL, '".$gn_gps."', '".$p_year."', '".$p_honor."', '".$p_marksman."', '".$p_map."', '".$p_match."', '".$p_objects."', '".$p_points."', '".$p_kills."', '".$p_deaths."', '".$p_roe."', '".$p_healed."', '".$p_applied."', '".$p_ar_kills."', '".$p_mg_kills."', '".$p_sr_kills."', '".$p_tg_kills."', '".$p_lr_kills."', '".$p_ar_accur."', '".$p_mg_accur."', '".$p_sr_accur."', '".$p_tg_accur."', '".$p_lr_accur."')");
if (!$createPLY) { echo "DB Error - Player Create!<p />"; return; mysqli_close($mysqli); }
echo 'Player and stats successfully added!<p />';

}

echo '[Player Signature Image]<br />Begin data collection and image creation!<p />';
$createSIG = $mysqli->query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick='".$gn_gps."'");
if (!$createSIG) { echo "DB Error - Signature Create!<p />"; return; mysqli_close($mysqli); }

$row1 = mysqli_fetch_array($createSIG, MYSQLI_ASSOC);

$w_id = $row1["".$db_prefix."_id"];
$w_name = $row1["".$db_prefix."_nick"];
$w_honor = $row1["".$db_prefix."_honor"];
$w_points = $row1["".$db_prefix."_points"];
$w_kills = $row1["".$db_prefix."_kills"];
$w_deaths = $row1["".$db_prefix."_deaths"];

$p_number = number_format($w_points);
$k_number = number_format($w_kills);
$d_number = number_format($w_deaths);

if ($w_honor != '100') { $n_honor = $w_honor + 1; } else { $n_honor = '0'; }
$i_honor = array ('1'=>'500','2'=>'1000','3'=>'1500','4'=>'2000','5'=>'2500','6'=>'3000','7'=>'3500','8'=>'4000','9'=>'4500','10'=>'5000','11'=>'6000','12'=>'7000','13'=>'8000','14'=>'9000','15'=>'10000','16'=>'11000','17'=>'12000','18'=>'13000','19'=>'14000','20'=>'15000','21'=>'17500','22'=>'20000','23'=>'22500','24'=>'25000','25'=>'27500','26'=>'30000','27'=>'32500','28'=>'35000','29'=>'37500','30'=>'40000','31'=>'44000','32'=>'48000','33'=>'52000','34'=>'56000','35'=>'60000','36'=>'64000','37'=>'68000','38'=>'72000','39'=>'76000','40'=>'80000','41'=>'86000','42'=>'92000','43'=>'98000','44'=>'104000','45'=>'110000','46'=>'116000','47'=>'122000','48'=>'128000','49'=>'134000','50'=>'140000','51'=>'149000','52'=>'158000','53'=>'167000','54'=>'176000','55'=>'185000','56'=>'194000','57'=>'203000','58'=>'212000','59'=>'221000','60'=>'230000','61'=>'243000','62'=>'256000','63'=>'269000','64'=>'282000','65'=>'295000','66'=>'308000','67'=>'321000','68'=>'334000','69'=>'347000','70'=>'360000','71'=>'383000','72'=>'406000','73'=>'429000','74'=>'452000','75'=>'475000','76'=>'498000','77'=>'521000','78'=>'544000','79'=>'567000','80'=>'590000','81'=>'633000','82'=>'676000','83'=>'719000','84'=>'762000','85'=>'805000','86'=>'848000','87'=>'891000','88'=>'934000','89'=>'977000','90'=>'1020000','91'=>'1103000','92'=>'1186000','93'=>'1269000','94'=>'1352000','95'=>'1435000','96'=>'1518000','97'=>'1601000','98'=>'1684000','99'=>'1767000','100'=>'1850000');
$n_points = ''.$i_honor["$n_honor"].'';
$togo = number_format($n_points - $w_points);

if ($w_deaths == '0') {
$f_count = $w_kills - $w_deaths;
} elseif ($w_kills == '0') {
$f_count = $w_kills - $w_deaths;
} else {
$f_count = $w_kills / $w_deaths;
}

$w_frate = number_format(round($f_count,2),2, '.', ','); 

$gsit = "".$path_public."gg_sig_temp1.png";
$csin = ImageCreateFromPNG($gsit);
$white = ImageColorAllocate($csin,255,255,255);

ImageString($csin,4,20,11,"$w_name",$white);
ImageString($csin,2,274,13,"Total Points:",$white);
ImageString($csin,2,364,15,"$p_number",$white);
ImageString($csin,2,280,31,"Total Kills:",$white);
ImageString($csin,2,364,33,"$k_number",$white);
ImageString($csin,2,286,49,"Frag Ratio:",$white);
ImageString($csin,2,364,51,"$w_frate%",$white);
ImageString($csin,2,286,67,"Next Honor:",$white);
ImageString($csin,2,364,69,"$togo",$white);

ImagePNG($csin,'',9);
ImagePNG($csin,''.$path_public.'gg_sig_'.$w_id.'.png',9);
ImageDestroy($csin);
echo '<p />Image successfully merged and saved!<p />';

mysqli_close($mysqli);
}

 

No, this is not all the code lol. Just a small database portion that was using mysqli.

Convert help would be GREATLY appreciated. ;D

Link to comment
Share on other sites

Like that. Hopefully I didn't miss anything. Note that I did anly two examples in the last part of the code, but you should be able to do the rest.

 

$mysql = mysql_connect("$db_host", "$db_user", "$db_pass");
if (!$mysql) { echo "Database Connection Error.\n\n".mysql_error(); exit(); }
mysql_select_db("$db_name",$mysql);

 

$searchTBL = $mysql_query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick = 'Player_Example'");
if (!$searchTBL) { echo "DB Error - Player List!<p />"; return; mysql_close($mysql); }
if (mysql_num_rows($searchTBL) == 0) {
echo '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><th>Player List</th></tr><tr><td>There are no example players listed in the database!<br />Please run the <b>install.php</b> file first before viewing this page.</td></tr></table><p />';
} else {
while ($showPLY = mysql_fetch_array($searchTBL)) {
echo '<table border="1" cellpadding="0" cellspacing="0" width="100%"><tr><th class="left">Name</th><th width="13%">Honor</th><th width="13%">Points</th><th width="13%">Kills</th><th width="13%">Deaths</th><th width="13%">ROE</th></tr><tr><td class="left">'.$showPLY["".$db_prefix."_nick"].'</td><td>'.$showPLY["".$db_prefix."_honor"].'</td><td>'.$showPLY["".$db_prefix."_points"].'</td><td>'.$showPLY["".$db_prefix."_kills"].'</td><td>'.$showPLY["".$db_prefix."_deaths"].'</td><td>'.$showPLY["".$db_prefix."_roe"].'</td></tr></table><p />';
}
}

mysql_close($mysql);

 

$createTBL = $mysql_query("CREATE TABLE IF NOT EXISTS ".$db_prefix."_stats (".$db_prefix."_id TINYINT(3) NOT NULL auto_increment primary key, ".$db_prefix."_nick VARCHAR(32) DEFAULT NULL, ".$db_prefix."_year YEAR(4) NOT NULL DEFAULT '0000', ".$db_prefix."_honor TINYINT(3) NOT NULL DEFAULT '0', ".$db_prefix."_marksman TINYINT(2) NOT NULL DEFAULT '0', ".$db_prefix."_map VARCHAR(128) DEFAULT NULL, ".$db_prefix."_match INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_objects INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_points INT( NOT NULL DEFAULT '0', ".$db_prefix."_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_deaths INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_roe INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_healed INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_applied INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_mg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_sr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_tg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_lr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_mg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_sr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_tg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_lr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', INDEX (".$db_prefix."_map), INDEX (".$db_prefix."_year,".$db_prefix."_honor,".$db_prefix."_marksman,".$db_prefix."_match,".$db_prefix."_objects), INDEX (".$db_prefix."_points,".$db_prefix."_kills,".$db_prefix."_deaths,".$db_prefix."_roe,".$db_prefix."_healed,".$db_prefix."_applied), INDEX (".$db_prefix."_ar_kills,".$db_prefix."_mg_kills,".$db_prefix."_sr_kills,".$db_prefix."_tg_kills,".$db_prefix."_lr_kills), INDEX (".$db_prefix."_ar_accur,".$db_prefix."_mg_accur,".$db_prefix."_sr_accur,".$db_prefix."_tg_accur,".$db_prefix."_lr_accur), UNIQUE (".$db_prefix."_nick)) ENGINE = MyISAM");
echo '<b>'.$db_prefix.'_stats</b> created successfully!<p />[Adding Example To Database]<br />';
$createPLY = $mysql_query("INSERT IGNORE INTO ".$db_prefix."_stats (aao_id, aao_nick, aao_year, aao_honor, aao_marksman, aao_map, aao_match, aao_objects, aao_points, aao_kills, aao_deaths, aao_roe, aao_healed, aao_applied, aao_ar_kills, aao_mg_kills, aao_sr_kills, aao_tg_kills, aao_lr_kills, aao_ar_accur, aao_mg_accur, aao_sr_accur, aao_tg_accur, aao_lr_accur) VALUES (NULL, 'Player_Example', '2008', '10', '36', 'MOUT McKenna', '10', '14', '5000', '52', '48', '253', '1', '7', '19', '11', '1', '16', '5', '4.21', '2.17', '0.05', '8.89', '1.22')");
echo '<b>Player</b> added successfully!<p /><font style="font-weight:bold; color:#DD0000;">REMEMBER, TO IMMEDIATELY <u>DELETE THIS FILE</u><br />FROM YOUR FTP ON YOUR WEB HOST ACCOUNT!</font><p /><a href="viewlist.php" title="View Player List in Database" target="_top"><font><b>View Player List in Database</b></font></a><p />';

mysql_close($mysql);

$remove = array(",", "%", "-");
$p_year = mysql_real_escape_string($p_year,$mysql);
$p_honor = mysql_real_escape_string($p_honor,$mysql);
/* etc */


$searchPLY = $mysql_query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick = '".$gn_gps."'");
if (!$searchPLY) { echo "DB Error - Player Search!<p />"; return; mysql_close($mysql); }

if (mysql_num_rows($searchPLY) != 0) {

echo '[Player Name Found]<br /><b>'.$gn_gps.'</b> - already is in database!<br />';
$updatePLY = $mysql_query("UPDATE ".$db_prefix."_stats SET ".$db_prefix."_year = '".$p_year."', ".$db_prefix."_honor = '".$p_honor."', ".$db_prefix."_marksman = '".$p_marksman."', ".$db_prefix."_map = '".$p_map."', ".$db_prefix."_match = '".$p_match."', ".$db_prefix."_objects = '".$p_objects."', ".$db_prefix."_points = '".$p_points."', ".$db_prefix."_kills = '".$p_kills."', ".$db_prefix."_deaths = '".$p_deaths."', ".$db_prefix."_roe = '".$p_roe."', ".$db_prefix."_healed = '".$p_healed."', ".$db_prefix."_applied = '".$p_applied."', ".$db_prefix."_ar_kills = '".$p_ar_kills."', ".$db_prefix."_mg_kills = '".$p_mg_kills."', ".$db_prefix."_sr_kills = '".$p_sr_kills."', ".$db_prefix."_tg_kills = '".$p_tg_kills."', ".$db_prefix."_lr_kills = '".$p_lr_kills."', ".$db_prefix."_ar_accur = '".$p_ar_accur."', ".$db_prefix."_mg_accur = '".$p_mg_accur."', ".$db_prefix."_sr_accur = '".$p_sr_accur."', ".$db_prefix."_tg_accur = '".$p_tg_accur."', ".$db_prefix."_lr_accur = '".$p_lr_accur."' WHERE ".$db_prefix."_nick='".$gn_gps."'");
if (!$updatePLY) { echo "DB Error - Player Update!<p />"; return; mysql_close($mysql); }
echo 'Player stats successfully updated!<p />';

} else {

echo '[Player Name Unrecognized]<br /><b>'.$gn_gps.'</b> - is not in database!<br />';
$createPLY = $mysql_query("INSERT IGNORE INTO ".$db_prefix."_stats (".$db_prefix."_id, ".$db_prefix."_nick, ".$db_prefix."_year, ".$db_prefix."_honor, ".$db_prefix."_marksman, ".$db_prefix."_map, ".$db_prefix."_match, ".$db_prefix."_objects, ".$db_prefix."_points, ".$db_prefix."_kills, ".$db_prefix."_deaths, ".$db_prefix."_roe, ".$db_prefix."_healed, ".$db_prefix."_applied, ".$db_prefix."_ar_kills, ".$db_prefix."_mg_kills, ".$db_prefix."_sr_kills, ".$db_prefix."_tg_kills, ".$db_prefix."_lr_kills, ".$db_prefix."_ar_accur, ".$db_prefix."_mg_accur, ".$db_prefix."_sr_accur, ".$db_prefix."_tg_accur, ".$db_prefix."_lr_accur) VALUES (NULL, '".$gn_gps."', '".$p_year."', '".$p_honor."', '".$p_marksman."', '".$p_map."', '".$p_match."', '".$p_objects."', '".$p_points."', '".$p_kills."', '".$p_deaths."', '".$p_roe."', '".$p_healed."', '".$p_applied."', '".$p_ar_kills."', '".$p_mg_kills."', '".$p_sr_kills."', '".$p_tg_kills."', '".$p_lr_kills."', '".$p_ar_accur."', '".$p_mg_accur."', '".$p_sr_accur."', '".$p_tg_accur."', '".$p_lr_accur."')");
if (!$createPLY) { echo "DB Error - Player Create!<p />"; return; mysql_close($mysql); }
echo 'Player and stats successfully added!<p />';

}

echo '[Player Signature Image]<br />Begin data collection and image creation!<p />';
$createSIG = $mysql_query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick='".$gn_gps."'");
if (!$createSIG) { echo "DB Error - Signature Create!<p />"; return; mysql_close($mysql); }

$row1 = mysql_fetch_array($createSIG, MYSQL_ASSOC);

$w_id = $row1["".$db_prefix."_id"];
$w_name = $row1["".$db_prefix."_nick"];
$w_honor = $row1["".$db_prefix."_honor"];
$w_points = $row1["".$db_prefix."_points"];
$w_kills = $row1["".$db_prefix."_kills"];
$w_deaths = $row1["".$db_prefix."_deaths"];

$p_number = number_format($w_points);
$k_number = number_format($w_kills);
$d_number = number_format($w_deaths);

if ($w_honor != '100') { $n_honor = $w_honor + 1; } else { $n_honor = '0'; }
$i_honor = array ('1'=>'500','2'=>'1000','3'=>'1500','4'=>'2000','5'=>'2500','6'=>'3000','7'=>'3500','8'=>'4000','9'=>'4500','10'=>'5000','11'=>'6000','12'=>'7000','13'=>'8000','14'=>'9000','15'=>'10000','16'=>'11000','17'=>'12000','18'=>'13000','19'=>'14000','20'=>'15000','21'=>'17500','22'=>'20000','23'=>'22500','24'=>'25000','25'=>'27500','26'=>'30000','27'=>'32500','28'=>'35000','29'=>'37500','30'=>'40000','31'=>'44000','32'=>'48000','33'=>'52000','34'=>'56000','35'=>'60000','36'=>'64000','37'=>'68000','38'=>'72000','39'=>'76000','40'=>'80000','41'=>'86000','42'=>'92000','43'=>'98000','44'=>'104000','45'=>'110000','46'=>'116000','47'=>'122000','48'=>'128000','49'=>'134000','50'=>'140000','51'=>'149000','52'=>'158000','53'=>'167000','54'=>'176000','55'=>'185000','56'=>'194000','57'=>'203000','58'=>'212000','59'=>'221000','60'=>'230000','61'=>'243000','62'=>'256000','63'=>'269000','64'=>'282000','65'=>'295000','66'=>'308000','67'=>'321000','68'=>'334000','69'=>'347000','70'=>'360000','71'=>'383000','72'=>'406000','73'=>'429000','74'=>'452000','75'=>'475000','76'=>'498000','77'=>'521000','78'=>'544000','79'=>'567000','80'=>'590000','81'=>'633000','82'=>'676000','83'=>'719000','84'=>'762000','85'=>'805000','86'=>'848000','87'=>'891000','88'=>'934000','89'=>'977000','90'=>'1020000','91'=>'1103000','92'=>'1186000','93'=>'1269000','94'=>'1352000','95'=>'1435000','96'=>'1518000','97'=>'1601000','98'=>'1684000','99'=>'1767000','100'=>'1850000');
$n_points = ''.$i_honor["$n_honor"].'';
$togo = number_format($n_points - $w_points);

if ($w_deaths == '0') {
$f_count = $w_kills - $w_deaths;
} elseif ($w_kills == '0') {
$f_count = $w_kills - $w_deaths;
} else {
$f_count = $w_kills / $w_deaths;
}

$w_frate = number_format(round($f_count,2),2, '.', ','); 

$gsit = "".$path_public."gg_sig_temp1.png";
$csin = ImageCreateFromPNG($gsit);
$white = ImageColorAllocate($csin,255,255,255);

ImageString($csin,4,20,11,"$w_name",$white);
ImageString($csin,2,274,13,"Total Points:",$white);
ImageString($csin,2,364,15,"$p_number",$white);
ImageString($csin,2,280,31,"Total Kills:",$white);
ImageString($csin,2,364,33,"$k_number",$white);
ImageString($csin,2,286,49,"Frag Ratio:",$white);
ImageString($csin,2,364,51,"$w_frate%",$white);
ImageString($csin,2,286,67,"Next Honor:",$white);
ImageString($csin,2,364,69,"$togo",$white);

ImagePNG($csin,'',9);
ImagePNG($csin,''.$path_public.'gg_sig_'.$w_id.'.png',9);
ImageDestroy($csin);
echo '<p />Image successfully merged and saved!<p />';

mysql_close($mysql);
}

 

 

Link to comment
Share on other sites

Thank you VERY VERY MUCH.

 

Just one thing- What should this line be converted?

$p_match=mysqli_real_escape_string($mysqli, str_replace($remove, "", $p_match));

It was on that long list that you did two and put etc except these are a little different.

Link to comment
Share on other sites

Thank you again very much. :)

 

I can see we are getting somewhere, because the page is loading some of the images that are supposed to be on the page.

But I get this error:

Fatal error: Function name must be a string in /home/**/public_html/install.php on line 52

 

Here is install.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<style>
html, body	{ overflow:auto; margin:5% 5%; padding:0px; background:#FFFFFF repeat fixed top left; color:#000000; direction:ltr; line-height:normal; letter-spacing:normal; text-align:center; text-decoration:none; text-indent:0px; text-transform:none; white-space:normal; word-spacing:normal; font:normal normal normal 10pt arial,helvetica; }
#content { display:block; top:0px; width:476px; margin:0px auto; padding:0px; border-left:#666666 1px solid; border-right:#666666 1px solid; text-align:left; }
fieldset { width:476px; }
td { padding:1px; text-align:center; }
th.left { padding:1px; text-align:left; }
td.left { padding:1px; text-align:left; }
a { text-decoration:underline; }
a:hover { text-decoration:underline; }
</style>

<title>
America's Army - Player Statistics Collector [install]
</title>
</head>

<body onload="status='America\'s Army - Player Statistics Collector';return true;" onmouseout="status='America\'s Army - Player Statistics Collector';return true;" onmouseover="status='America\'s Army - Player Statistics Collector';return true;" oncontextmenu="return false;" ondragstart="return false;" onmovestart="return false;" onselectstart="return false;" onresizestart="return false;" >

<div class="content"><fieldset><table><tr><td>
<?php
// America's Army - Player Statistics Collector & Signature Image Creator
// © 2007-2008 FBI-TEAM.org
// Author: [FBI]_Inque187
// Created: Oct 31, 2007
// Updated: Jan 1, 2008
// 
// Please do not distrubute this file or other files that accompany this script
// unless you have obtained specific authorization and or permission only from
// the author and or subsidiary company providing this internet tool.
// 
// Use of these files and tool is at your own risk and the author and or subsidiary
// company providing these files cannot and will not be held responsible for any
// damages to any equipment and or data lost resulting from the misuse or
// misconfiguration of any of these included file.<br>
// 
// You alone assume all respnsibility for any problems that arise of any sort if you
// so choose to use these files in any manner not intended by original design.

require ('/home/brianjw/public_html/aaosecure/inc.aaostats.php'); // Change to same secure path location inside the named file!

$seed_go = time(true);
$date_go = date('Y.m.d');
$time_go = date('H:i:s T');

echo '<img src="http://www.fbi-team.org/_pub/banner_aao_468x60_2.png" width="468" height="60" border="0" alt="America\'s Army - Player Statistics Collector"><p /><b>Start:</b> '.$time_go.' - <b>Date:</b> '.$date_go.'<p />';

echo '[Creating Main Table In Database]<br />';
$createTBL = $mysql_query("CREATE TABLE IF NOT EXISTS ".$db_prefix."_stats (".$db_prefix."_id TINYINT(3) NOT NULL auto_increment primary key, ".$db_prefix."_nick VARCHAR(32) DEFAULT NULL, ".$db_prefix."_year YEAR(4) NOT NULL DEFAULT '0000', ".$db_prefix."_honor TINYINT(3) NOT NULL DEFAULT '0', ".$db_prefix."_marksman TINYINT(2) NOT NULL DEFAULT '0', ".$db_prefix."_map VARCHAR(128) DEFAULT NULL, ".$db_prefix."_match INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_objects INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_points INT( NOT NULL DEFAULT '0', ".$db_prefix."_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_deaths INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_roe INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_healed INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_applied INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_mg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_sr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_tg_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_lr_kills INT(6) NOT NULL DEFAULT '0', ".$db_prefix."_ar_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_mg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_sr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_tg_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', ".$db_prefix."_lr_accur DECIMAL(10,2) NOT NULL DEFAULT '0.00', INDEX (".$db_prefix."_map), INDEX (".$db_prefix."_year,".$db_prefix."_honor,".$db_prefix."_marksman,".$db_prefix."_match,".$db_prefix."_objects), INDEX (".$db_prefix."_points,".$db_prefix."_kills,".$db_prefix."_deaths,".$db_prefix."_roe,".$db_prefix."_healed,".$db_prefix."_applied), INDEX (".$db_prefix."_ar_kills,".$db_prefix."_mg_kills,".$db_prefix."_sr_kills,".$db_prefix."_tg_kills,".$db_prefix."_lr_kills), INDEX (".$db_prefix."_ar_accur,".$db_prefix."_mg_accur,".$db_prefix."_sr_accur,".$db_prefix."_tg_accur,".$db_prefix."_lr_accur), UNIQUE (".$db_prefix."_nick)) ENGINE = MyISAM");
echo '<b>'.$db_prefix.'_stats</b> created successfully!<p />[Adding Example To Database]<br />';
$createPLY = $mysql_query("INSERT IGNORE INTO ".$db_prefix."_stats (aao_id, aao_nick, aao_year, aao_honor, aao_marksman, aao_map, aao_match, aao_objects, aao_points, aao_kills, aao_deaths, aao_roe, aao_healed, aao_applied, aao_ar_kills, aao_mg_kills, aao_sr_kills, aao_tg_kills, aao_lr_kills, aao_ar_accur, aao_mg_accur, aao_sr_accur, aao_tg_accur, aao_lr_accur) VALUES (NULL, 'Player_Example', '2008', '10', '36', 'MOUT McKenna', '10', '14', '5000', '52', '48', '253', '1', '7', '19', '11', '1', '16', '5', '4.21', '2.17', '0.05', '8.89', '1.22')");
echo '<b>Player</b> added successfully!<p /><font style="font-weight:bold; color:#DD0000;">REMEMBER, TO IMMEDIATELY <u>DELETE THIS FILE</u><br />FROM YOUR FTP ON YOUR WEB HOST ACCOUNT!</font><p /><a href="viewlist.php" title="View Player List in Database" target="_top"><font><b>View Player List in Database</b></font></a><p />';

mysql_close($mysql);

$seed_no = time(true);
$seed_up = $seed_no - $seed_go;

if ($seed_up != '1') { $seed_up .=' Seconds'; } else { $seed_up .=' Second'; }
$time_no = date('H:i:s T');

echo '<b>End:</b> '.$time_no.' - <b>Run:</b> '.$seed_up.'<br />Copyright © 2007-'.gmdate('Y').' <a href="http://www.fbi-team.org" title="FBI-TEAM.org - Web Site" target="_blank">FBI-TEAM.org</a><p /><a href="http://www.fbi-team.org" title="FBI-TEAM.org - Web Site" target="_blank"><img src="http://www.fbi-team.org/_pub/banner_fbi_468x60.png" width="468" height="60" border="0" alt="FBI-TEAM.org - Web Site"></a>';

clearstatcache();
exit;
?>
</td></tr></table></fieldset></div>

</body></html>

 

When this is done and working, you deserve something big ;D

Link to comment
Share on other sites

Ok, I changed that to mysql_query in all the edits you gave me is that okay? ^

 

Now the last few errors:

Warning: file_put_contents(/home/***/public_html/aaosecure/player_stats_***.htm) [function.file-put-contents]: failed to open stream: Permission denied in /home/***/public_html/aaosc.php on line 34

Warning: filemtime() [function.filemtime]: stat failed for /home/***/public_html/aaosecure/player_stats_***.htm in /home/***/public_html/aaosc.php on line 34

Warning: filesize() [function.filesize]: stat failed for /home/***/public_html/aaosecure/player_stats_***.htm in /home/****/public_html/aaosc.php on line 34

 

And here is aaosc.php: (I will remove the code below once this is solved)

<?php
// America's Army - Player Statistics Collector & Signature Image Creator
// © 2007-2008 FBI-TEAM.org
// Author: [FBI]_Inque187
// Created: Oct 31, 2007
// Updated: Jan 1, 2008
// 
// Please do not distrubute this file or other files that accompany this script
// unless you have obtained specific authorization and or permission only from
// the author and or subsidiary company providing this internet tool.
// 
// Use of these files and tool is at your own risk and the author and or subsidiary
// company providing these files cannot and will not be held responsible for any
// damages to any equipment and or data lost resulting from the misuse or
// misconfiguration of any of these included file.<br>
// 
// You alone assume all respnsibility for any problems that arise of any sort if you
// so choose to use these files in any manner not intended by original design.

require ('/home/brianjw/public_html/aaosecure/inc.aaostats.php'); // Change to same secure path location inside the named file!

$seed_go = time(true);
$date_go = date('Y.m.d');
$time_go = date('H:i:s T');

$gn_gps = 'brianjw';
$file0_gps = 'http://www.aa-mbs.com/playerlookup.php?aa_player_username='.$gn_gps.'';
$file1_gpn = ''.$path_secure.'player_stats_'.$gn_gps.'.htm';

echo '<b>America\'s Army Player Statistics Update - Process #01</b><br />';
echo '<b>Start:</b> '.$time_go.' - <b>Date:</b> '.$date_go.'<p />';

if (file_exists ($file1_gpn) != FALSE) { $time1a_gpn = date ("Y.m.d @ H:i:s",filemtime ($file1_gpn)); $size1a_gpn = filesize ($file1_gpn); } else { $time1a_gpn = 'Missing'; $size1a_gpn = '0'; }
if (($get_gpn = fopen ($file0_gps,'rb')) === FALSE) { echo '[Player File Not Found]<br />'; echo 'Check Network Connection or File Location!<p />'; } else { file_get_contents ($file0_gps,FALSE,NULL,0); stream_set_timeout ($get_gpn,30); file_put_contents ($file1_gpn, $get_gpn); fclose ($get_gpn); echo '[Player File Found]<br /><b>'.$gn_gps.'</b> - stats page downloaded!<br />'; echo '<b>Was:</b> '.$time1a_gpn.' - '.$size1a_gpn.' (bytes)<br />'; clearstatcache (); $time1b_gpn = date ('Y.m.d @ H:i:s',filemtime ($file1_gpn)); $size1b_gpn = filesize ($file1_gpn); echo '<b>Now:</b> '.$time1b_gpn.' - '.$size1b_gpn.' (bytes)<p />'; clearstatcache (); }
clearstatcache ();

if ($size1b_gpn <= '18448') {

echo '<b>Alert:</b> File Is Default Page, Stats Update Cancelled!<p />';
clearstatcache();

} else {
$data = file_get_contents(''.$file1_gpn.'');

$regex1 = '/<span class="A33fc0">(.*)<\/span>/';
preg_match_all($regex1, $data, $match1, PREG_SET_ORDER);
$p_year = $match1[0][1];

$regex2 = '/<span class="honor_value">(.*)<\/span>/';
preg_match_all($regex2, $data, $match2, PREG_SET_ORDER);
$p_honor=$match2[0][1];

$regex3 = '/<td class="A03b49">(.*)<\/td>/';
preg_match_all($regex3, $data, $match3, PREG_SET_ORDER);
$p_points=$match3[1][1];
$p_marksman=$match3[2][1];
$p_map=$match3[3][1];
$p_kills=$match3[4][1];
$p_deaths=$match3[5][1];
$p_match=$match3[7][1];
$p_objects=$match3[8][1];
$p_roe=$match3[9][1];
$p_ar_kills=$match3[11][1];
$p_mg_kills=$match3[12][1];
$p_sr_kills=$match3[13][1];
$p_lr_kills=$match3[14][1];
$p_tg_kills=$match3[15][1];
$p_healed=$match3[16][1];
$p_applied=$match3[17][1];

$regex4 = '/<td class="A03b49"><span class="A9b914">(.*)<\/span>/';
preg_match_all($regex4, $data, $match4, PREG_SET_ORDER);
$p_ar_accur=$match4[0][1];
$p_mg_accur=$match4[1][1];
$p_sr_accur=$match4[2][1];
$p_lr_accur=$match4[3][1];
$p_tg_accur=$match4[4][1];

$remove = array(",", "%", "-");
//$p_year = mysqli_real_escape_string($mysqli, $p_year);
$p_year = mysql_real_escape_string($p_year,$mysql);
$p_honor = mysql_real_escape_string($p_honor,$mysql);
$p_marksman=mysql_real_escape_string($p_marksman,$mysql);
$p_map=mysql_real_escape_string($p_map,$mysql);
$p_match=mysql_real_escape_string(str_replace($remove, "", $p_match));
$p_objects=mysql_real_escape_string(str_replace($remove, "", $p_objects));
$p_points=mysql_real_escape_string(str_replace($remove, "", $p_points));
$p_kills=mysql_real_escape_string(str_replace($remove, "", $p_kills));
$p_deaths=mysql_real_escape_string(str_replace($remove, "", $p_deaths));
$p_roe=mysql_real_escape_string(str_replace($remove, "", $p_roe));
$p_healed=mysql_real_escape_string(str_replace($remove, "", $p_healed));
$p_applied=mysql_real_escape_string(str_replace($remove, "", $p_applied));
$p_ar_kills=mysql_real_escape_string(str_replace($remove, "", $p_ar_kills));
$p_mg_kills=mysql_real_escape_string(str_replace($remove, "", $p_mg_kills));
$p_sr_kills=mysql_real_escape_string(str_replace($remove, "", $p_sr_kills));
$p_tg_kills=mysql_real_escape_string(str_replace($remove, "", $p_tg_kills));
$p_lr_kills=mysql_real_escape_string(str_replace($remove, "", $p_lr_kills));
$p_ar_accur=mysql_real_escape_string(str_replace($remove, "", $p_ar_accur));
$p_mg_accur=mysql_real_escape_string(str_replace($remove, "", $p_mg_accur));
$p_sr_accur=mysql_real_escape_string(str_replace($remove, "", $p_sr_accur));
$p_tg_accur=mysql_real_escape_string(str_replace($remove, "", $p_tg_accur));
$p_lr_accur=mysql_real_escape_string(str_replace($remove, "", $p_lr_accur));

$searchPLY = mysql_query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick = '".$gn_gps."'");
if (!$searchPLY) { echo "DB Error - Player Search!<p />"; return; mysql_close($mysql); }

if (mysql_num_rows($searchPLY) != 0) {

echo '[Player Name Found]<br /><b>'.$gn_gps.'</b> - already is in database!<br />';
$updatePLY = mysql_query("UPDATE ".$db_prefix."_stats SET ".$db_prefix."_year = '".$p_year."', ".$db_prefix."_honor = '".$p_honor."', ".$db_prefix."_marksman = '".$p_marksman."', ".$db_prefix."_map = '".$p_map."', ".$db_prefix."_match = '".$p_match."', ".$db_prefix."_objects = '".$p_objects."', ".$db_prefix."_points = '".$p_points."', ".$db_prefix."_kills = '".$p_kills."', ".$db_prefix."_deaths = '".$p_deaths."', ".$db_prefix."_roe = '".$p_roe."', ".$db_prefix."_healed = '".$p_healed."', ".$db_prefix."_applied = '".$p_applied."', ".$db_prefix."_ar_kills = '".$p_ar_kills."', ".$db_prefix."_mg_kills = '".$p_mg_kills."', ".$db_prefix."_sr_kills = '".$p_sr_kills."', ".$db_prefix."_tg_kills = '".$p_tg_kills."', ".$db_prefix."_lr_kills = '".$p_lr_kills."', ".$db_prefix."_ar_accur = '".$p_ar_accur."', ".$db_prefix."_mg_accur = '".$p_mg_accur."', ".$db_prefix."_sr_accur = '".$p_sr_accur."', ".$db_prefix."_tg_accur = '".$p_tg_accur."', ".$db_prefix."_lr_accur = '".$p_lr_accur."' WHERE ".$db_prefix."_nick='".$gn_gps."'");
if (!$updatePLY) { echo "DB Error - Player Update!<p />"; return; mysql_close($mysql); }
echo 'Player stats successfully updated!<p />';

} else {

echo '[Player Name Unrecognized]<br /><b>'.$gn_gps.'</b> - is not in database!<br />';
$createPLY = mysql_query("INSERT IGNORE INTO ".$db_prefix."_stats (".$db_prefix."_id, ".$db_prefix."_nick, ".$db_prefix."_year, ".$db_prefix."_honor, ".$db_prefix."_marksman, ".$db_prefix."_map, ".$db_prefix."_match, ".$db_prefix."_objects, ".$db_prefix."_points, ".$db_prefix."_kills, ".$db_prefix."_deaths, ".$db_prefix."_roe, ".$db_prefix."_healed, ".$db_prefix."_applied, ".$db_prefix."_ar_kills, ".$db_prefix."_mg_kills, ".$db_prefix."_sr_kills, ".$db_prefix."_tg_kills, ".$db_prefix."_lr_kills, ".$db_prefix."_ar_accur, ".$db_prefix."_mg_accur, ".$db_prefix."_sr_accur, ".$db_prefix."_tg_accur, ".$db_prefix."_lr_accur) VALUES (NULL, '".$gn_gps."', '".$p_year."', '".$p_honor."', '".$p_marksman."', '".$p_map."', '".$p_match."', '".$p_objects."', '".$p_points."', '".$p_kills."', '".$p_deaths."', '".$p_roe."', '".$p_healed."', '".$p_applied."', '".$p_ar_kills."', '".$p_mg_kills."', '".$p_sr_kills."', '".$p_tg_kills."', '".$p_lr_kills."', '".$p_ar_accur."', '".$p_mg_accur."', '".$p_sr_accur."', '".$p_tg_accur."', '".$p_lr_accur."')");
if (!$createPLY) { echo "DB Error - Player Create!<p />"; return; mysql_close($mysql); }
echo 'Player and stats successfully added!<p />';

}

echo '[Player Signature Image]<br />Begin data collection and image creation!<p />';
$createSIG = mysql_query("SELECT * FROM ".$db_prefix."_stats WHERE ".$db_prefix."_nick='".$gn_gps."'");
if (!$createSIG) { echo "DB Error - Signature Create!<p />"; return; mysql_close($mysql); }

$row1 = mysql_fetch_array($createSIG, MYSQL_ASSOC);

$w_id = $row1["".$db_prefix."_id"];
$w_name = $row1["".$db_prefix."_nick"];
$w_honor = $row1["".$db_prefix."_honor"];
$w_points = $row1["".$db_prefix."_points"];
$w_kills = $row1["".$db_prefix."_kills"];
$w_deaths = $row1["".$db_prefix."_deaths"];

$p_number = number_format($w_points);
$k_number = number_format($w_kills);
$d_number = number_format($w_deaths);

if ($w_honor != '100') { $n_honor = $w_honor + 1; } else { $n_honor = '0'; }
$i_honor = array ('1'=>'500','2'=>'1000','3'=>'1500','4'=>'2000','5'=>'2500','6'=>'3000','7'=>'3500','8'=>'4000','9'=>'4500','10'=>'5000','11'=>'6000','12'=>'7000','13'=>'8000','14'=>'9000','15'=>'10000','16'=>'11000','17'=>'12000','18'=>'13000','19'=>'14000','20'=>'15000','21'=>'17500','22'=>'20000','23'=>'22500','24'=>'25000','25'=>'27500','26'=>'30000','27'=>'32500','28'=>'35000','29'=>'37500','30'=>'40000','31'=>'44000','32'=>'48000','33'=>'52000','34'=>'56000','35'=>'60000','36'=>'64000','37'=>'68000','38'=>'72000','39'=>'76000','40'=>'80000','41'=>'86000','42'=>'92000','43'=>'98000','44'=>'104000','45'=>'110000','46'=>'116000','47'=>'122000','48'=>'128000','49'=>'134000','50'=>'140000','51'=>'149000','52'=>'158000','53'=>'167000','54'=>'176000','55'=>'185000','56'=>'194000','57'=>'203000','58'=>'212000','59'=>'221000','60'=>'230000','61'=>'243000','62'=>'256000','63'=>'269000','64'=>'282000','65'=>'295000','66'=>'308000','67'=>'321000','68'=>'334000','69'=>'347000','70'=>'360000','71'=>'383000','72'=>'406000','73'=>'429000','74'=>'452000','75'=>'475000','76'=>'498000','77'=>'521000','78'=>'544000','79'=>'567000','80'=>'590000','81'=>'633000','82'=>'676000','83'=>'719000','84'=>'762000','85'=>'805000','86'=>'848000','87'=>'891000','88'=>'934000','89'=>'977000','90'=>'1020000','91'=>'1103000','92'=>'1186000','93'=>'1269000','94'=>'1352000','95'=>'1435000','96'=>'1518000','97'=>'1601000','98'=>'1684000','99'=>'1767000','100'=>'1850000');
$n_points = ''.$i_honor["$n_honor"].'';
$togo = number_format($n_points - $w_points);

if ($w_deaths == '0') {
$f_count = $w_kills - $w_deaths;
} elseif ($w_kills == '0') {
$f_count = $w_kills - $w_deaths;
} else {
$f_count = $w_kills / $w_deaths;
}

$w_frate = number_format(round($f_count,2),2, '.', ','); 

$gsit = "".$path_public."gg_sig_temp1.png";
$csin = ImageCreateFromPNG($gsit);
$white = ImageColorAllocate($csin,255,255,255);

ImageString($csin,4,20,11,"$w_name",$white);
ImageString($csin,2,274,13,"Total Points:",$white);
ImageString($csin,2,364,15,"$p_number",$white);
ImageString($csin,2,280,31,"Total Kills:",$white);
ImageString($csin,2,364,33,"$k_number",$white);
ImageString($csin,2,286,49,"Frag Ratio:",$white);
ImageString($csin,2,364,51,"$w_frate%",$white);
ImageString($csin,2,286,67,"Next Honor:",$white);
ImageString($csin,2,364,69,"$togo",$white);

ImagePNG($csin,'',9);
ImagePNG($csin,''.$path_public.'gg_sig_'.$w_id.'.png',9);
ImageDestroy($csin);
echo '<p />Image successfully merged and saved!<p />';

mysql_close($mysql);
}

$seed_no = time(true);
$seed_up = $seed_no - $seed_go;
if ($seed_up != '1') { $seed_up .=' Seconds'; } else { $seed_up .=' Second'; }
$time_no = date('H:i:s T');
echo '<b>End:</b> '.$time_no.' - <b>Run:</b> '.$seed_up.'<br />';
echo 'Copyright © 2001-'.gmdate('Y').' FBI-TEAM.org<br />';
clearstatcache();
exit;
?>

 

Thanks again! :)

Link to comment
Share on other sites

That's not database related warning. You need to set up proper file access permissions to the files given. Ask script authors what they should be.

 

 

You make me want to go and download AA again...

Link to comment
Share on other sites

Nice ;)

 

Yeah, I've played a little. Let me look up my stats...

I've 18465 exp and 21 honor. You can look me up as 'Mchlpl'

 

I had really laggy internet connection at that time, and playing was an ordeal for most of the time... Maybe it's time to check how my new connection works... ;)

Link to comment
Share on other sites

Generated one for you: gg_Mchlpl.png

 

Also, I am thinking about setting up aaosc.php on a cronjob because that is what automatically updates the sigs...

$gn_gps = 'Mchlpl';

is the place where I enter the AAO Username. How can I make this for multiple players?

Link to comment
Share on other sites

Heh... Thanks... Not really impressive stats, are they? ;)

 

You could make it applicable for multiple players in many ways...

For example if you do:

 

$gn_gps = $_GET['player'];

 

you can then enter url such as

http://www.gamersgarage.com/siggenerator.php?player=brianjw

 

Try to understand how your script actually works, and you'll probably manage to come up with some interesting modifications to it.

Link to comment
Share on other sites

Nice. :) You're good at this stuff lol. I applied your ?player= code thing. That's awesome.

 

And one last thing before I go lol..

Using the aaosc.php file posted above or a page ago or something lol, how would I add "- honor level" right after the username so my image would be like:

 

brianjw - 24 Honor

Link to comment
Share on other sites

Seriously, that's nothing you couldn't do after a week or two of toying with php

 

I think something like this would work:

 

find this:

ImageString($csin,4,20,11,"$w_name",$white);

 

change to:

 

 

ImageString($csin,4,20,11,$w_name."-honor: ".$p_honor,$white);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.