Jump to content

Keep getting parsing errors


halfpint

Recommended Posts

Hi I have been trying to fix this for about a week now but I keep getting silly parse errors after I have fixed one it gives me another parse error on a different line. Could somebody please be so kind and go through it and fix the parse errors I now have a parse error on line 58. I am at my wits end with this now lol

 

Thanks

 

        <h1>Member List</h1> 
<table class="text01" border="0" cellspacing="0" cellpadding="0" width=100%> 
  <tr> 
    <th>Status</th> 
    <th>Name</th> 
    <th>Date Joined </th> 
    <th>Plays </th> 
    <th>PM</th> 
  </tr> 
  <br> 
  <?php
$limit = 50;
$q = mysql_query("SELECT username FROM users WHERE gameplays > 0");
$total_items = mysql_num_rows($q);
$total_pages 	= ceil($total_items / $limit);
$page = $_REQUEST['p'];
if((!$page) || (is_numeric($page) == false) || ($page < 0) || ($page > $total_items)) {
      $page = 1; //default
}
$set_limit 	= $page * $limit - ($limit);

$timestamp = time();
$timeout = $timestamp-300;
// Fix members online
$delete = mysql_query("UPDATE users SET status='0' WHERE timestamp<$timeout");

$getinfo = mysql_query("SELECT username,joined,gameplays,status FROM users WHERE gameplays > 0 LIMIT $set_limit, $limit") or die(mysql_error());
while($row = mysql_fetch_array($getinfo)) {
?> 
  <tr> 
    <th  ><strong> 
      <?php if($row[status] == '0') {
  print "<font color=red>Offline</font>";
}elseif($row[status] == '1'){
  print "<font color=green>Online</font>";
}
?> 
      </strong></th> 
    <th  ><a href="profile-<?=$row[username]?>.html"> 
      <?=$row[username]?> 
      </a></th> 
    <th  ><?=$row[joined]?></th> 
    <th  ><?=$row[gameplays]?></th> 
    <th ><a href="page.php?page=pms&compose=1&to=<?=$row[username]?>">PM Me</a><br></th> 
  </tr> 
  <tr> 
    <th colspan="5"> <?php
}
$prev_page = $page - 1;
if($prev_page >= 1) {
echo "<a href=\"page.php?page=memberlist&p=$prev_page\">< Prev></a>";
}
for($a = 1; $a <= $total_pages; $a++)
{
   if($a == $page) {
      echo("<b> $a</b> | "); //no link
 } else {
  echo "<a href=\"page.php?page=memberlist&p=$a"> $a </a>";
     }
}
$next_page = $page + 1;
if($next_page <= $total_pages) {
   echo "<a href=\"page.php?page=memberlist&p=$next_page"><Next></a>";
}
?> 
</table> 
<br><br><br><br><br><br><br><br><br><br>                

Link to comment
Share on other sites

You're not escaping quotes within your strings, When you start a string with double quotes (") you must escape any double quotes within the string (\"), eg

echo "<a href=\"link.html\">Link</a>";

 

The same applies if you start a string with single quotes too, this time you escape any single quotes within the string.

echo '<a href=\'link.html\'>Link</a>';

Link to comment
Share on other sites

You're not escaping quotes within your strings, When you start a string with double quotes (") you must escape any double quotes within the string (\"), eg

echo "<a href=\"link.html\">Link</a>";

 

The same applies if you start a string with single quotes too, this time you escape any single quotes within the string.

echo '<a href=\'link.html\'>Link</a>';

 

Hi thanks so this

 

echo "<a href=\"page.php?page=memberlist&p=$a"> $a </a>";

 

should be

 

cho "<a href=\"page.php?page=memberlist&p=$a\"> $a </a>";

Link to comment
Share on other sites

Is this on another page? As I do not see <br /> on line 20 in the code above.

 

yes it is on another page which links to the top page which I posted above

 

    <div align=left><?php 

$getinfo = mysql_query("SELECT username,email,gameplays,avatar,comments,location,gender,favgame,joined,im,status,id FROM users WHERE username='$_REQUEST[user]'") or die(mysql_error());
$get = @mysql_fetch_array($getinfo);
if(@mysql_num_rows($getinfo) == '0') {
?> 
<h1>No User To View Profile</h1> 
<br> 
<br> 
<?php
}else{
?> 
<?php echo"$top_games";?> <?php echo"$latest_games";?> <?php echo"$affiliates";?> <br> 
<h1> 
  <?=$_REQUEST[user]?> 
  's Profile</h1> 
<br> 
<br>
<?php if($get[avatar] == '') {
  print "<img src=http://$site_url/avatars/non.gif width="80" height="80">";
}else{ print "<img src=$get[avatar] width="80" height="80">"; } ?> 
<br> 
<br> 
<strong> 
<?php if($get[status] == '0') {
  print "<font color=red>I am currently offline</font>";
}elseif($get[status] == '1'){
  print "<font color=green>I am currently online</font>";
}
?> 
</strong><br> 
<strong>Total Plays:</strong> 
</h3> 
<?=$get[gameplays]?> 
<br> 
<br> 
<strong>Location:</strong> 
</h3> 
<?=$get[location]?> 
<br> 
<br> 
<strong>IM:</strong> 
</h3> 
<?=$get[im]?> 
<br> 
<br> 
<strong>Gender:</strong> 
</h3> 
<?=$get[gender]?> 
<br> 
<br> 
<strong>Favorite Game:</strong> 
</h3> 
<?=$get[favgame]?> 
<br> 
<br> 
<strong>Date Joined:</strong> 
<?=$get[joined]?> 
<br> 
<br> 
<strong>Comments:</strong> <?php 
$comments = stripslashes($get[comments]);
print wordwrap($comments); ?><br> 
<br> 
<a href="page.php?page=pms&compose=1&to=<?=$_REQUEST[user]?>">Send this user a PM</a><br> 
<br> 
<br> 
<br> 
<center> 
<?php if ($adult ==1 || $porn_setting==1){ include("cache/ad-1-468x60.php"); } else{ include("cache/ad-0-468x60.php"); } ?> 
</center> 
<?php 

$query4 = "SELECT gid,gname FROM favoritegames WHERE uid='$_REQUEST[user]'";
$result4 = mysql_query($query4) or die(mysql_error());

if(@mysql_num_rows($result4) == '0') {
}else{
?> 
<h1>My Favorite Games:</h1> 
<?php 
while (list ($id, $name) = mysql_fetch_row($result4)) {

echo "<br><a href=./play.php?action=play&id=$id>$name</a>";

} } ?> 
<?php } ?> <br><br><br><br><br><br><br><br><br><br>
</div>        

 

 

Link to comment
Share on other sites

Again its the same issue, you're not escaping your quotes within strings. You should go through your code and ensure you have escaped your quotes correctly.

 

Hi ok thanks for your help, I did not write this script I purchased it and when I try and get help from the person I bought it from they just dont reply. I am not a php coder I only know tiny bits which I have picked up over time.

 

Thanks again for your help I will go over it and look for the quotes within the  strings as you mentioned above.

 

:)

Link to comment
Share on other sites

No just escape all double quotes within the string except for the first and last quote, example

print "<img src=http://$site_url/avatars/non.gif width="80" height="80">";

Escape all the quotes highlighted in blue. Do not escape the quotes in red.

 

TO escape you place a backslash in front of the quote like so \" or \'

Link to comment
Share on other sites

No just escape all double quotes within the string except for the first and last quote, example

print "<img src=http://$site_url/avatars/non.gif width="80" height="80">";

Escape all the quotes highlighted in blue. Do not escape the quotes in red.

 

TO escape you place a backslash in front of the quote like so \" or \'

 

Ok thank you once again for your help

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.