Jump to content

Recommended Posts

<?php
//Start session
session_start();
ini_set('display_errors', 'on');
error_reporting(E_ALL);
//Include database connection details
require_once('../config.php');

//Array to store validation errors
$errmsg_arr = array();

//Validation error flag
$errflag = false;

        //Set Action
        $action = $_GET['action'];
//Connect to mysql server
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link) {
	die('Failed to connect to server: ' . mysql_error());
}

//Select database
$db = mysql_select_db(b6_3883123_arcade);
if(!$db) {
	die("Unable to select database");
}

//Function to sanitize values received from the form. Prevents SQL injection
function clean($str) {
	$str = @trim($str);
	if(get_magic_quotes_gpc()) {
		$str = stripslashes($str);
	}
	return mysql_real_escape_string($str);
}


?>
<?php
if ($action = 'players') {
echo "<center><h2><b>Member List</b></h2></center>";
echo "<table border="1" cellspacing="2" cellpadding="2" class='tableborder'>";
echo "<tr> ";
echo "<th><font face="Arial, Helvetica, sans-serif">Player ID</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Login</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Password</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Email</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">IP</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Avatar</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Group</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Skin</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Settings</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Tournaments</font></th>";
echo "</tr>";

$qry="SELECT * FROM phpqa_accounts";
$result=mysql_query($qry)  or trigger_error('Query error! Query: <pre>'.$qry.'</pre>Reason: ' . mysql_error());
$num=mysql_numrows($result);
        mysql_close();

$i=0;
while ($i < $num) {
$id=mysql_result($result,$i,"id");
$name=mysql_result($result,$i,"name");
$pass=mysql_result($result,$i,"pass");
$email=mysql_result($result,$i,"email");
$ipaddress=mysql_result($result,$1,"ipaddress");
$avatar=mysql_result($result,$i,"avatar");
$group=mysql_result($result,$i,"group");
$skin=mysql_result($result,$i,"skin");
$settings=mysql_result($result,$i,"settings");
$tournaments=mysql_result($result,$i,"tournaments");
?>
<tr> 
<td><font face="Arial, Helvetica, sans-serif"><? echo "$id" ;?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$name" ;?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$pass" ;?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$email"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$ipaddress"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$avatar"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$group"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$skin"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$settings"; ?></font></td>
<td><font face="Arial, Helvetica, sans-serif"><? echo "$tournaments"; ?></font></td>

</tr>
<?php
++$i;
} 
echo "</table>";

}

?>

 

This is literally just turning out a blank page which usually happens with a syntax error but i cant seem to find it. It is meant to access the database, return all info a present in a table if the url is website.com/arcadeadmin.php?action=players

Link to comment
https://forums.phpfreaks.com/topic/187059-admin-page-help/
Share on other sites

One item:

 

if ($action = 'players') {

is incorrect as that is the assignment operator. You want the comparison:

 

if ($action == 'players') {

 

As for the error, you get the syntax error after you turned on the error display or not? If not put it above the session_start call.  Also make sure that your <?php is at the very top of the page and no spaces before it, as it will cause an issue with session_start.

 

If you do receive the error, please post it and highlight the line it is occurring on.

Link to comment
https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987847
Share on other sites

Fatal parse errors are not displayed unless the error_reporting/display_errors settings are in effect before your script is parsed. When they are set in your script they only display runtime errors, warnings, and notices.

 

Your script has the following fatal parse errors -

 

Parse error: syntax error, unexpected T_LNUMBER, expecting ',' or ';' in .... because of double-quotes contained within a double-quoted string in all the following lines of code  -

 

echo "<table border="1" cellspacing="2" cellpadding="2" class='tableborder'>";

echo "<th><font face="Arial, Helvetica, sans-serif">Player ID</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Login</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Password</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Email</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">IP</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Avatar</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Group</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Skin</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Settings</font></th>";
echo "<th><font face="Arial, Helvetica, sans-serif">Tournaments</font></th>";

 

You also have a typo in the following line (the $1 should be $i) -

$ipaddress=mysql_result($result,$1,"ipaddress");

 

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/187059-admin-page-help/#findComment-987860
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.