Error In Syntax
Posted on
16th Feb 2014 07:03 pm by
admin
I got this error:
Code: Parse error: syntax error, unexpected '>' in /home/bucket/public_html/inc/func.ban.php on line 56
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
// func.ban.php
// checks the ip to see if it is banned
function checkban($ip)
{
// querys database
$q = mysql_query("SELECT * FROM `banned` WHERE `ip` = '$ip' LIMIT 1");
$get = mysql_num_rows($q);
// if found
if ($get == "1")
{
// deny user access
$r=mysql_fetch_array($q);
die("You have been banned from this website for $r[reason].");
}
}
// places a ban in the database
function addban($ip,$reason,$legnth)
{
// get current time
$time = time();
// inserts code into database
$insert = mysql_query("INSERT INTO `banned` (`ip`,`time`,`long`,`reason`) VALUES ('$ip', '$time', '$legnth', '$reason')") or die("Could not add ban.<br />".mysql.error()."");
echo "The ip address, $ip, has been added to the ban list.";
}
// deletes a ban from the database
function delban($id)
{
// runs a delete query
$delete = mysql_query("DELETE FROM `banned` WHERE `id` = '$id' LIMIT 1") or die("Could not remove ban.<br />".mysql.error()."");
echo "The ip address has been removed from the ban list.";
}
// lists the bans in the ban admin
function listbans()
{
// link to add ban
echo "<a href='accounts-banned.php?x=add'>Add Ban</a><p>";
echo "<table class="gridtable">
<thead>
<tr>
<th scope="col" align="center">IP Address</th>
<th scope="col" align="center">Reason</th>
<th scope="col" align="center">Legnth</th>
</tr>
</thead><tbody>";
// loop to show all band
$query = mysql_query("SELECT * FROM `banned` ORDER BY time DESC");
$num = mysql_num_rows($query);
if ($num)
{
while ($r=mysql_fetch_array($query))
{
echo "<tr align="center">;
echo "<td>$r[ip]</td>";
echo "<td>$r[reason]</td>";
echo "<td><a href='accounts-banned.php?x=delete&id=$r[id]'>Delete</a></td>";
echo "</tr>;
}
}
echo "</tbody></table>";
}
?>
Line 56 is:
echo "<td>$r[ip]</td>";
Whats the problem?
No comments posted yet
Your Answer:
Login to answer
96
45
Other forums
Show specific day of the week
I have been racking my brain trying to get this function to work properly and it is doing so for eve
Multiple Options for a Single Page
For this example I want to use the Handlers option which is under Fed Admin and all the related codi
how do i make new line after *
First check this page here. and you see my report. Im pulling form a mysql db. I want to beable to m
help with database debug pls
Parse error: syntax error, unexpected T_ELSE in /home/content/m/e/s/mesick/html/students/05/php/chec
php automatically escaping single quotes
I'm trying to test out my security a bit and I've noticed that php is escaping my single quotes. For
Basic Question Regarding PHP Includes
Hi
Just starting out with PHP.
Working on a site that uses some basic includes, these
Auto fill in input value based on User_ID
Hello,
I'm looking form some input on the following problem.
User loads page ->
PHP Form to Variable.
Hi! I have written a HTML-form code in DreamWeaver CS3 (in a PHP doc) and I really need it to work s
MySql timezone
Code: $sql = "SELECT *, date_format(date, '%m/%d/%Y at %I:%i %p' )as date FROM comments WHERE t
query based on 2 conditions
I want to select if the doc_type is either s OR f but this doesn't work:
Code: [Select]$query