Okay here's the code:
Code:
<?php
/*-------------------------------------------------------+
| ArcSite with PHP-Fusion CMS Core
| Copyright (C) 2010
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: ./Player Tools/unstuck.php
| Author: The Red
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "../maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."playertools.php";
if ($emulator == 0) { redirect("news.php"); }
// Database Connection -------------------------------------------------------------
// You should not need to change these three, unless you know what you are doing and know you need to.
$logcon = mysqli_connect($ldb_host, $ldb_user, $ldb_pass, $ldb_name);
$webcon = mysqli_connect($web_host, $web_user, $web_pass, $web_name);
$charcon = mysqli_connect($cdb_host, $cdb_user, $cdb_pass, $cdb_name);
//Pull info into arrays
if($emulator == 1) {
$acct_info = mysqli_fetch_assoc(mysqli_query($logcon, "SELECT * FROM accounts WHERE login='".$userdata['game_acc']."'"));
$char_query = mysqli_query($charcon, "SELECT * FROM characters WHERE acct='".$acct_info['acct']."'");
$char_list = mysqli_fetch_assoc($char_query);
} elseif($emulator == 2) {
$acct_info = mysqli_fetch_assoc(mysqli_query($logcon, "SELECT * FROM account WHERE username='".$userdata['game_acc']."'"));
$char_query = mysqli_query($charcon, "SELECT * FROM character WHERE account='".$acct_info['id']."'");
$charcon->use_result();
$char_list = mysqli_fetch_array($char_query);
echo $char_list['name'];
}
if (isset($_POST['register'])) {
$error = ""; $db_fields = ""; $db_values = "";
$character = stripinput(trim(preg_replace("/ +/i", " ", $_POST['character'])));
if ($character == "") {
$error .= $locale['pt003']."<br />\n";
}
if ($error == "") {
opentable($locale['pt001']);
echo "<div style='text-align:center'><br />\n".$locale['pt004']."<br /><br />\n".$locale['pt005']."<br /><br />\n</div>\n";
closetable();
} else {
opentable($locale['pt0002']);
echo "<div style='text-align:center'><br />\n".$locale['pt006']."<br /><br />\n$error<br />\n<a href='".FUSION_SELF."'>".$locale['pt007']."</a></div></br>\n";
closetable();
}
} else {
?>
<style type="text/css">
.pltb {
position:absolute;
width:400px;
height:auto;
text-align:center;
font-family:verdana;
font-size:12px;
z-index:10;
left: 50%;
margin-left: -200px;
}
fieldset {
padding:8px;
border:1px solid #ccc;
}
</style>
<?php opentable($locale['pt001']); ?>
<p></p><p></p>
<div class="pltb">
<fieldset>
<?php
echo "<form name='inputform' method='post' action='".FUSION_SELF."' onsubmit='return ValidateForm(this)'>\n";
echo "<table cellpadding='0' cellspacing='0' class='center'>\n<tr>\n";
echo "<td class='tbl'>".$locale['pt008']."<span style='color:#ff0000'>*</span></td>\n";
echo "<td class='tbl'><select name='character'>";
//for ($l = 2;$l <= mysqli_num_rows($char_query); $l++) echo "<option>".$char_list[$l]."</option>";
echo "</td>\n</tr>\n";
closetable();
?>
</fieldset>
</div>
<?php
echo "<script type='text/javascript'>
function ValidateForm(frm) {
if (frm.character.value==\"\") {
alert(\"".$locale['pt003']."\");
return false;
}
}
</script>\n";
}
require_once THEMES."templates/footer.php";
?>
When viewing the page I get the following errors:
Notice: Undefined index: game_acc in C:\xampplite\htdocs\mycms\Player Tools\unstuck.php on line 36
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\xampplite\htdocs\mycms\Player Tools\unstuck.php on line 39
The $userdata array is established in the maincore by a basic mysql connection. I am using MySQLi in my tool so i have better functionality connecting to three databases simultaneously. I've tryed establishing the userdata array with MySQLi to no avail. The main problem i'm having is it keeps telling me its boolean and won't spit out the data i'm trying to pull.
The connection variables are pulled from the maincore which pulls all the variables from a Configuration class. This is a super global system i've implemented into the code.
Any suggestions? This is one major road block in the way of finishing my ArcSite CMS website.