Parse error: parse error, unexpected $ in /var/www/html/findyourdesire/admin.php on line 1611
major parse error
Moderator: General Moderators
major parse error
this one leaves me clueless. i've checked. all functions are closed yada-yada... i can't find ANY $ with nothing immediately following...note, the error is on the line with the closing ?> for the page.
might be an unbalanced bracket or similar
Code: Select all
<?php
function func()
{
?>PHP Parse error: parse error, unexpected $end in test.php on line 5
Code: Select all
<?php
print("something
?>PHP Parse error: parse error, unexpected $end in test.php on line 3
ok. riddle me this. riddle me that. why the hell is tha acces not printing out? the $sa i have is contained in BOTH arrays, and the testing printout proves it's in the first one, yet the echo for $sa yeilds nothing while it's sucessfully picing up the last three if statements
Code: Select all
function choice($db){ # main admin page
include("/home/joshua/includes/fyd.altincs.php"); # includes file (precautionary measure)
$un=$_COOKIE['un']; $options='';
/* find access level in db. set appropriately */
$accessret=mysql_query("SELECT site_access FROM users WHERE username='$un' AND password='$pw'", $db);
$access=mysql_fetch_array($accessret);
$sa=$access['site_access'];
echo $sa;
echo "<br />";
foreach($approvers as $apps){ echo "$apps, "; }
if(contains($sa, $approvers)){ # add the approver options
echo "adding approve";
$options.=" <option value="appbio">Approve Bios</option>\n <option value="appmain">Approve Main Pictures</o
ption>\n <option value="appt1">Approve 1st Thumb</option>\n <option value="appt2">Approve 2nd Thumb</option>
\n <option value="appt3">Approve 3rd Thumb</option>\n <option value="appt4">Approve 4th Thumb</option>\n <o
ption value="appsalute">Approve Salute Picture</option>\n"; }
if(contains($sa, $suspenders)){ # add the suspend options
echo "adding suspend";
$options.=" <option value="susus">Suspend User</option>\n"; }
if(($sa==$jra)||($sa==$adm)||($sa==$web)){ # add things for jr/full admins
$options=$options." <option value="susrev">Review Suspended Users</option>\n <option value="access">Adjust Us
er Access</option>\n"; }
if(($sa==$adm)||($sa==$web)){ # full admin options
$options.=" <option value="delu">Delete User</option>\n <option value="adjfor">Adjust Forums</option>\n"; }
if($sa==$web){ # only the webmaster, since the full admins might not have the db knowledge
$options.=" <option value="misc">Misc Commands</option>"; }
echo <<<END
<h3>Welcome to the Admin Choice Page. If you link a non-admin to any admin page, they will see nothing, except for the
an error message letting them to know to report it. (security)</h3>
<p>
<!-- php checks access level in form creation & makes select choices based on it -->
<form action="$_SERVER[PHP_SELF]" target="_blank" method="POST" >
<select name="fn" size="1">
$options
</select>
<input type="submit" value="Administrate!">
</form>
</p>
</center>
</body>
</html>
END;
}- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Where do variables such as $web and $adm come from? Is your error reporting set to E_ALL? Please, please, please, format and space your code so that it's easy to follow and avoid putting two statements on one line. If you're using heredoc format in one place, why not use it on all those <option> tags so that you get all the line breaks and tabbing without worrying about \n and having to escape double quotes.
Mac
Code: Select all
<?php
# main admin page
function choice($db)
{
# includes file (precautionary measure)
include('/home/joshua/includes/fyd.altincs.php');
$un = $_COOKIE['un'];
$options = '';
/* find access level in db. set appropriately */
$sql = "SELECT site_access FROM users WHERE username='$un' AND password='$pw'";
$accessret = mysql_query($sql, $db) or die(mysql_error().'<p>'.$sql.'</p>');
// are you sure that there will be a record returned?
$access = mysql_fetch_array($accessret);
$sa = $access['site_access'];
echo $sa;
echo '<br />';
foreach ($approvers as $apps) {
echo $apps.', ';
}
# add the approver options
if (contains($sa, $approvers)) {
echo 'adding approve';
$options =<<<END
<option value="appbio">Approve Bios</option>
<option value="appmain">Approve Main Pictures</option>
<option value="appt1">Approve 1st Thumb</option>
<option value="appt2">Approve 2nd Thumb</option>
<option value="appt3">Approve 3rd Thumb</option>
<option value="appt4">Approve 4th Thumb</option>
<option value="appsalute">Approve Salute Picture</option>
END;
}
# add the suspend options
if (contains($sa, $suspenders)) {
echo 'adding suspend';
$options .=<<<END
<option value="susus">Suspend User</option>
END;
}
# add things for jr/full admins
if (($sa == $jra) || ($sa == $adm) || ($sa == $web)) {
$options .= <<<END
<option value="susrev">Review Suspended Users</option>
<option value="access">Adjust User Access</option>
END;
}
# full admin options
if (($sa == $adm) || ($sa == $web)) {
$options .=<<<END
<option value="delu">Delete User</option>
<option value="adjfor">Adjust Forums</option>
END;
}
# only the webmaster, since the full admins might not have the db knowledge
if ($sa == $web) {
$options .= <<<END
<option value="misc">Misc Commands</option>
END;
}
echo <<<END
<h3>Welcome to the Admin Choice Page. If you link a non-admin to any admin page, they will see nothing, except for the
an error message letting them to know to report it. (security)</h3>
<!-- php checks access level in form creation & makes select choices based on it -->
<form action="$_SERVER[PHP_SELF]" target="_blank" method="POST" style="margin: 15px 0;">
<select name="fn" size="1">
$options
</select>
<input type="submit" value="Administrate!" />
</form>
</center>
</body>
</html>
END;
}
?>- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
It really does help us to debug if we know these things.m3rajk wrote:any variable not explicitly defined in that function is in the includes
But when you dom3rajk wrote:and there has to be a record that will be returned... because otherwise they wouldn't have been able to get the page
Code: Select all
echo $sa;Mac
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
If $pw is supposed to be coming from a cookie, then you need to add a line similar to:
to retrieve that data. Do you have error_reporting set to E_ALL? If not put
at the top of the script to help you debug. You'll then get undefined variable warnings if you don't set a variable and try and access it.
Mac
Code: Select all
$un = $_COOKIE['un'];Code: Select all
error_reporting(E_ALL);Mac