PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Tue Nov 17, 2009 12:03 pm Reply with quote Back to top

I have problems when adding the Swedish National Characters ÅÄÖ in the alphabet of the Reviews module, but it works on my local site on my PC with Xampp, but it does not work on the webb hotel with the identical index.php.

This is from the index.php of Reviews module:
Code:

$alphabet = array ("A","B","C","D","E","F","G","H","I","J","K","L","M",
                       "N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Å","Ä","Ö","1","2","3","4","5","6","7","8","9","0");


The letters looks OK, when I am in Reviews:

When I click on Ä in the local site, I can see the books that starts with this letter.
When I click on Ä on the web hotel, I just can see the index-page again. Nothing happens, but the other letters like V works normally and displays books that starts with V.

I have checked the database query and it works for the web hotell and displays books for letter Ä.

It seems that it must be the php-code that are triggered by clicking on Ä that is not working because it is a non-english letter.

I think it must be this code:
Code:

function reviews($letter, $field, $order) {
    global $bgcolor4, $sitename, $prefix, $multilingual, $currentlang, $db, $module_name;
    include('header.php');
    $letter = substr("$letter", 0,1);
    if ($multilingual == 1) {
    $querylang = "AND rlanguage='$currentlang'";
    } else {
    $querylang = "";
    }
    OpenTable();
    echo "<center><b>$sitename "._REVIEWS."</b><br>";
    echo "<i>"._REVIEWSLETTER." \"$letter\"</i><br><br>";
    switch ($field) {

   case "reviewer":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by reviewer $order");
   break;

   case "score":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by score $order");
   break;

   case "hits":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by hits $order");
   break;

   default:
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
   break;

    }
    $numresults = $db->sql_numrows($result);
    if ($numresults == 0) {
   echo "<i><b>"._NOREVIEWS." \"$letter\"</b></i><br><br>";
    } elseif ($numresults > 0) {
   echo "<TABLE BORDER=\"0\" width=\"100%\" CELLPADDING=\"2\" CELLSPACING=\"4\">
      <tr>
      <td width=\"50%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"LEFT\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._PRODUCTTITLE." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      <td width=\"18%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._REVIEWER." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=desc\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      <td width=\"18%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._SCORE." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      <td width=\"14%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTASC."\"></a><B> "._HITS." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
      </td>
      </tr>";


PHP 5.2.4 on my local site
PHP 5.2.10 on my web hotel

Has anyone any idea here?
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Tue Nov 17, 2009 1:16 pm Reply with quote Back to top

The most obvious, possible difference that I can think of between the two is the database character set. Are the both using LATIN-1 or ...........
View user's profile Send private message Send e-mail Visit poster's website
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Tue Nov 17, 2009 1:21 pm Reply with quote Back to top

The database is latin-1 and identical. The database query for the letter Ä worked very well in both cases. I think it must be a php issue and the step prior the database is not working OK.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Tue Nov 17, 2009 3:20 pm Reply with quote Back to top

And the actual character can be seen in the page source, not a htmlentity?
Weird.
View user's profile Send private message Send e-mail Visit poster's website
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Tue Nov 17, 2009 3:39 pm Reply with quote Back to top

Thanks! In the page source it is the actual character Ä and not the htmlentity.
View user's profile Send private message
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Wed Nov 18, 2009 12:16 am Reply with quote Back to top

index.php from Ravennuke 2.30 gave also the identical problem on the web hotel.

I have also tested a local site on Mandriva 2010 with PHP 5.3 with identical problems as the web hotel.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Wed Nov 18, 2009 5:08 am Reply with quote Back to top

In that case, I don't know the answer. I'm actually building a test site at the moment to use strictly utf-8 in order to research these sorts of problems but it seems to me that the character your using isn't in the latin-1 or iso character set but don't have a clue as to if it's mySQL that has a problem with the character or PHP.
View user's profile Send private message Send e-mail Visit poster's website
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Wed Nov 18, 2009 11:28 pm Reply with quote Back to top

It seems to be a difficult problem to solve, but your help is highly appreciated. When I click on Ä at the web hotel I can see Ä in the URL all right, but the page with the book starting with Ä does not show up, but instead the index page.

I have tried to use utf8_decode like this:

default:
$letter = utf8_decode($letter);
$result = $db->sql_query("SELECT id, title, hits, reviewer, score, email FROM ".$prefix."_reviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
break;

This would have change the letter from utf8 to iso8859, but this does not change anything. It must be letter Ä that is disturbing some how, because normal letters works OK.
View user's profile Send private message
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 6373
Location: Vsetin, Czech Republic

PostPosted: Thu Nov 19, 2009 5:09 am Reply with quote Back to top

So this character is in a book title.
It would be worth checking to see if the character is seen as it really is or an htmlentity when you look at the page source for that review and also, see what is stored in the DB.
It seems to me that the reason the search fails is because the character doesn't match what is being searched for, so somewhere, there is a mis-match, it just a question of finding it.
View user's profile Send private message Send e-mail Visit poster's website
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Fri Nov 20, 2009 12:39 am Reply with quote Back to top

I have looked in the database and the characters are correct and Ä. Also if I make the database query it will find the correct book that starts with Ä.

I think it must be a php issue with Ä and possible alternative is $letter or $title in index.php.

On top of index.php I have:

<?php header("Content-Type: text/html; charset=iso-8859-1");

Unfortunately, this did not make any difference.
View user's profile Send private message
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Sat Nov 28, 2009 11:54 pm Reply with quote Back to top

I could not get it working, but instead I had to use Reviews Plus module
Only registered users can see links on this board!
Get registered or login to the forums!

I have a small problem with this module and the rights block are showing up, despite I have changed in index.php to:
Code:

$index = 0;   //Turn Right Blocks On (1) or Off (0) / Bloques Derechos Activos (1) o Inactivos (0); For 7.7 patched 3.1 or earlier version.
define('INDEX_FILE', false);   // Turn Right Blocks On (true) or Off (false) / Bloques Derechos Activos (true) o Inactivos (false); For 7.8 Patched 3.1 or newer version
define('IN_RPM', false);
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Sun Nov 29, 2009 8:51 am Reply with quote Back to top

slackervaara, comment out the 'define' line.
View user's profile Send private message Visit poster's website
slackervaara
Worker
Worker


Joined: Aug 26, 2007
Posts: 234

PostPosted: Sun Nov 29, 2009 9:51 am Reply with quote Back to top

Many thanks! It worked perfectly!
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9136
Location: Arizona

PostPosted: Sun Nov 29, 2009 2:59 pm Reply with quote Back to top

RavensScripts
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum