phpTrafficA user forum
 
phpTrafficA Homepage
 
Please ask your questions in English or French! Support in other languages may be slow.
Russian speaking users can find Russian discussions on phpTrafficA at ru-board.com
 
Operations:  Thread list Thread list  New thread New thread  Reply in this thread Reply in this thread
Search 
Advanced search
Thread "Drupal and phpTrafficA" Started by vktRus on: 06/25/2007 1:36pm
Current page: 1 of 1 Go to page: 1
Drupal and phpTrafficA
Posted by: vktRus  on: 06/25/2007 1:36pm
Drupal - free CMS. Home page - drupal.org

Create new blok "phptraffica". Left, 10.
Format - PHP.

Code

<div></div>
<?php

function romanize ($string) {
$UTF8_ROMANIZATION = array(
//russian cyrillic
'а'=>'a', 'А'=>'A', 'б'=>'b', 'Б'=>'B', 'в'=>'v', 'В'=>'V', 'г'=>'g', 'Г'=>'G', 'д'=>'d', 'Д'=>'D', 'е'=>'e','Е'=>'E', 'ё'=>'jo', 'Ё'=>'Jo', 'ж'=>'zh', 'Ж'=>'Zh', 'з'=>'z', 'З'=>'Z', 'и'=>'i', 'И'=>'I', 'й'=>'j', 'Й'=>'J', 'к'=>'k', 'К'=>'K', 'л'=>'l', 'Л'=>'L', 'м'=>'m', 'М'=>'M', 'н'=>'n', 'Н'=>'N', 'о'=>'o', 'О'=>'O', 'п'=>'p', 'П'=>'P', 'р'=>'r', 'Р'=>'R', 'с'=>'s', 'С'=>'S', 'т'=>'t', 'Т'=>'T', 'у'=>'u', 'У'=>'U', 'ф'=>'f', 'Ф'=>'F', 'х'=>'x', 'Х'=>'X', 'ц'=>'c', 'Ц'=>'C', 'ч'=>'ch', 'Ч'=>'Ch', 'ш'=>'sh', 'Ш'=>'Sh', 'щ'=>'sch', 'Щ'=>'Sch', 'ъ'=>'', 'Ъ'=>'', 'ы'=>'y', 'Ы'=>'Y', 'ь'=>'', 'Ь'=>'', 'э'=>'eh', 'Э'=>'Eh', 'ю'=>'ju', 'Ю'=>'Ju', 'я'=>'ja', 'Я'=>'Ja',
);
return strtr($string,$UTF8_ROMANIZATION);
}

$phpTrafficA_referer = base64_encode($_SERVER["HTTP_REFERER"]);
$title = romanize (drupal_get_title());
$phpTrafficA_thispage = base64_encode($title);
//$phpTrafficA_thispage = base64_encode($_SERVER["REQUEST_URI"]);
$phpTrafficA_id = "xxxxxx"; // Site ID
$phpTrafficA_time = time();
echo "<img src=\"http://mysite.com/path-to-phptraffica/count.php?sid=$phpTrafficA_id&p=$phpTrafficA_thispag..." alt=\"\" />";
?>


P.S. Replace & to &амр; in code.
Ad
Re: Drupal and phpTrafficA
Posted by: Butchu  on: 06/26/2007 8:59am
Thanks. I added a link from the usage page.
Re: Drupal and phpTrafficA
Posted by: vktRus  on: 06/26/2007 3:18pm
How to insert the name of page in Russian into a database?
I have made so:

<?php
$phpTrafficA_referer = base64_encode($_SERVER["HTTP_REFERER"]);
$title = drupal_get_title();
$phpTrafficA_thispage = urlencode($title);
$phpTrafficA_id = "xxxxxx"; // Site ID
$phpTrafficA_time = time();
echo "<img src=\"http://mysite.com/path-to-phptraffica/count.php?sid=$phpTrafficA_id&p=$phpTrafficA_thispag..." alt=\"\" />";
?>

And in count.php
Find:
$to = base64_decode(rawurldecode($p));
if ($sites[$sid]['trim']) {
$to = backstr($to,'?');
}

Replace to:
//$to = base64_decode(rawurldecode($p));
$to = urldecode($p);
//if ($sites[$sid]['trim']) {
// $to = backstr($to,'?');
//}

Example:
$title = "Решения"

In database:
"Ре�?ения"

The problem is connected with the codepage of a database. It is possible to set compulsorily at installation of the program (install.php) the codepage of tables in a database - utf-8? How it to make? The codepage of my database - ru-win1251. MySQL 5.0.41

I have found such example:

db_query("CREATE TABLE {profile_values} (
fid int unsigned default '0',
uid int unsigned default '0',
value text,
KEY uid (uid),
KEY fid (fid)
) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");

Add a choice how to show pages in statistics - as url or as title of page. As addresses of all my pages look like:
node/1
node/2
node/3
...
and so on.
Re: Drupal and phpTrafficA
Posted by: Butchu  on: 06/27/2007 7:31am
That will be worked out with the next version... We have to convert phpTrafficA databases to UTF-8. It might take testing so, I do not want everyone to loose their stats with the conversion!
Re: Drupal and phpTrafficA
Posted by: vktRus  on: 06/27/2007 12:35pm
In my database of the table for phpTrafficA and for other programs. Tables on a prefix differ. It will be considered in the converter? I do not wish to lose data of other programs.
Re: Drupal and phpTrafficA
Posted by: Butchu  on: 07/05/2007 11:03pm
This won't be a problem. We will only affect the tables used by phpTrafficA
Re: Drupal and phpTrafficA
Posted by: vktRus  on: 02/15/2008 3:25pm
Drupal and phpTraffica 2.0
http://www.drupal.ru/node/6278#comment-72484 (Russian)
I get you a coffee!
Posted by: Butchu  on: 09/02/2010 5:48pm
Gee, I really liked this answer! I want to thank you and I buy you a coffee!
Current page: 1 of 1 Go to page: 1
Forum powered by FreeForum
© 2004-2010 ZoneO-soft
phpTrafficA homepage in: English - Français - Русский - Deutsch - Español - Nederlands - Romaneste - Svenska - Italiano
Also available at ZoneO: freeForum -- phpTrafficA -- Linux-tips -- Unixtime Online -- PageRank online
Page generation: 0.050 sec