TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 207
  • Total: 207

PHP Article does not work with 1.0.5. Beta 1?

Started by trench, July 07, 2008, 11:52:44 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

trench

Link to my site: http://www.671bullyclub.com
SMF version: 1.1.5
TP version: 1.0.5 Beta 1
Theme name and version: Custom Theme
Mods installed:

1.    SMF Gallery Lite    1.8.2    
2.    FlashChat Integration    1.0    
3.    Member Color Link    2.0.5    
4.    SMF 1.0.12 / 1.1.4 / 2.0 b1.1 Update 1.0    
5.    SMF 1.0.13 / 1.1.5 / 2.0 b3.1 Update 1.0    
6.    SMF 1.0.11 / 1.1.3 Update    1.1
7.    Stars And Badges    2.0    
8.    TinyPortal    1.052    
9.    Ultimate Profile    0.7    
10.    Users Online Today Mod    1.4.0    
11.    vReportBoard Mod    0.97    
12.    Wrap Text Around Image    1.0    
13.    YouTube BBC Tag (XHTML Compliant)    1.0

Related Error messages:

I've tried quite a few php snippets around the site here and all of them give me similar errors which involve the Load.php script.  This happened after trying to use the ROSTER MOD which worked when I was using .098.  I wanted to adjust it so I used a test article (fortunately) and the script gave me this error. Over and over.

QuoteWarning: Unexpected character in input: '\' (ASCII=92) state=1 in D:\hosting\member\******\forum\Sources\Load.php(1772) : eval()'d code(1331) : eval()'d code on line 9

Parse error: parse error, unexpected $end in D:\hosting\member\*******\forum\Sources\Load.php(1772) : eval()'d code(1331) : eval()'d code on line 83

G6Cad

The errors you posted, they seem to come from some code your trying to use in a PHP Article ?

What is the code your trying to use ?

trench

Quote from: G6 on July 07, 2008, 11:58:41 AM
The errors you posted, they seem to come from some code your trying to use in a PHP Article ?

What is the code your trying to use ?

global $db_prefix, $scripturl, $txt, $settings, $options;


// These must be in the order you wish them to print out on your roster.
// VERY IMPORTANT!!!! -- they must be exactly the same as the group names in the database, including
// capitalization and spaces.
$rankorder = array(
  'Administrator',
  'Vice Commodore',
  'Fleet Captain',
  'Board Member',
  'Racing Fleet Member',
);

$groups = '';
//Does all the real work here for showing groups.
$query = db_query("SELECT ID_GROUP, groupName, onlineColor, stars
  FROM {$db_prefix}membergroups", __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($query))
{
  $groups[$row['groupName']]  = array(
    'id' => $row['ID_GROUP'],
  );
}
mysql_free_result($query);

foreach ($rankorder as $rank)
{
//Now get all the users
   $query2 = db_query("
    SELECT mem.ID_GROUP, mem.ID_MEMBER, mem.realName, mem.usertitle,
          mem.emailAddress, mem.hideEmail, mem.lastLogin, mem.location, mem.personaltext,
          mem.totalTimeLoggedIn, mem.dateRegistered, mem.ICQ, mem.AIM,
          mem.YIM, mem.MSN, thm.value as sail, thm2.value as country
   FROM {$db_prefix}members AS mem
          LEFT JOIN {$db_prefix}themes AS thm ON (thm.ID_MEMBER = mem.ID_MEMBER AND thm.ID_THEME = 1 AND thm.variable = 'sail')
          LEFT JOIN {$db_prefix}themes AS thm2 ON (thm2.ID_MEMBER = mem.ID_MEMBER AND thm2.ID_THEME = 1 AND thm2.variable = 'country')
       WHERE mem.ID_GROUP = " . $groups[$rank]['id'] . "
   ORDER BY mem.realName", __FILE__, __LINE__);
  if(db_affected_rows() != 0)
  {
    echo '<table border="0" cellspacing="1" cellpadding="1" align="center" class="bordercolor">
      <tr><td colspan="0" class="catbg"><font size="2" face="verdana"><b>' . $rank . '</b></font></td></tr>
      <tr><td rowspan="100" width="10" class="profilebg" valign="top">
</td>';
      echo '<td class="catinfo" width="270"><b>MEMBER NAME</b></td>';
      echo '<td class="catinfo" width="130"><b>SAIL NUMBER</b></td>';
      echo '<td class="catinfo" width="170"><b>LAST ONLINE</b></td>';
      echo '<td class="catinfo" width="100"><b>LOCATION</b></td>';
      echo '<td class="catinfo" width="175"><b>CONTACT</b></td></tr><tr>';
      while ($row2 = mysql_fetch_assoc($query2))
      {
echo '<td class="windowbg" height="20"><a href="' . $scripturl . '?action=profile;u=' . $row2['ID_MEMBER'] . '"><b><font color="' . $groups[$rank]['color'] . '" size="2" face="verdana">' . $row2['realName'] . '</b>';
echo '</font></font></a><br><font size="1"> ' . $row2['personaltext'] . '</font></a></td><td class="windowbg">' . $row2['sail'] . '</td>';
        echo '<td class="windowbg">' . timeformat($row2['lastLogin']) . '</td>';
        echo '<td class="windowbg2" align="center">';
        echo '</font></font></a><br><font size="2"> ' . '<img src="'.$settings['default_images_url'].'/flags/'.$row2['country'].'.png" />';
        echo '</td><td class="windowbg">';

//Send email row
        if($row2['hideEmail'] == 0)
          echo '<a href="mailto:', $row2['emailAddress'], '"><img src="' . $settings['images_url'] . '/email_sm.gif" alt="email" /></a> ';

        if($row2['ICQ'] != '')
          echo '<a href="http://www.icq.com/whitepages/about_me.php?uin=' . $row2['ICQ'] . '" target="_blank"><img src="http://status.icq.com/online.gif?img=5&icq=' . $row2['ICQ'] . '" alt="' . $row2['ICQ'] . '" width="18" height="18" border="0" /></a> ';
        if($row2['AIM'] != '')
          echo '<a href="aim:goim?screenname=' . urlencode(strtr($row2['AIM'], array(' ' => '%20'))) . '&message=' . $txt['aim_default_message'] . '"><img src="' . $settings['images_url'] . '/aim.gif" alt="' . $row2['AIM'] . '" border="0" /></a> ';
        if($row2['YIM'] != '')
          echo '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row2['YIM']) . '"><img src="http://opi.yahoo.com/online?u=' . urlencode($row2['YIM']) . '&m=g&t=0" alt="' . $row2['YIM'] . '" border="0" /></a> ';
        if($row2['MSN'] != '')
          echo '<a href="http://members.msn.com/' . $row2['MSN'] . '" target="_blank"><img src="' . $settings['images_url'] . '/msntalk.gif" alt="' . $row2['MSN'] . '" border="0" /></a> ';

//Send PM row
        echo '<a href="' . $scripturl . '?action=pm;sa=send;u=' . $row2['ID_MEMBER'] . '"><img src="' . $settings['images_url'] . '/im_on.gif" alt="email" /></a></a>';
        echo '</td>';
        echo '</tr>';
      }
    echo '</table><br>';
  }
}


Thanks G6 for looking into this.. This was the one I used, but I've tried other snippets all with similar results.

G6Cad

Warning: Unexpected character in input: '\' (ASCII=92) state=1

What is your default site language set to ?

G6Cad

ascii 92 is a "\" character, which has special meaning in php. Remember that to actually display a "\" character, you need to type "\\".

trench

Quote from: G6 on July 07, 2008, 12:16:57 PM
Warning: Unexpected character in input: '\' (ASCII=92) state=1

What is your default site language set to ?

English.
Quote from: G6 on July 07, 2008, 12:18:47 PM
ascii 92 is a "\" character, which has special meaning in php. Remember that to actually display a "\" character, you need to type "\\".

So what do i need to change in that code? I just basically copied and pasted.


trench

hmm. it doesn't look like Im missing any // in that coding?

trench

Got it to work! Thanks G6. Damn all those / in the coding! WHy would they do that? LOL

G6Cad

Great :)   :up:  Can you post up the working code in the block code and snippets board for others to use ?

This website is proudly hosted on Crocweb Cloud Website Hosting.