Virtual Skipper Forum Index Virtual Skipper
Virtual Skipper - Official Forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Checking accounts
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Virtual Skipper Forum Index -> Main Forum
View previous topic :: View next topic  
Author Message
diades
Matelot


Joined: 22 Dec 2008
Posts: 130
Location: Scotland

PostPosted: 26 Oct 2011 14:11    Post subject: Reply with quote

Hi Pino

The password and username were sent almost immediately when I requested them but things have changed at Nadeo since then so I cannot say how long it may take.
_________________
Cheers,

Keith

Web Development help form WebXpertz
Back to top
View user's profile Send private message
Lupin
mousse


Joined: 24 Jul 2007
Posts: 45
Location: Italy

PostPosted: 01 Nov 2011 0:20    Post subject: Reply with quote

I hope I haven't to wait for much time Clin d'oeil

Pino
_________________
Lupin ( Pino - Skyppyno )
... gente che va , gente che viene , tutto senza senso ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Lupin
mousse


Joined: 24 Jul 2007
Posts: 45
Location: Italy

PostPosted: 21 Nov 2011 16:23    Post subject: Reply with quote

No password arrived ...

Please , anyone can help me ?

I have to re-send the request ?

Thanks

Pino
_________________
Lupin ( Pino - Skyppyno )
... gente che va , gente che viene , tutto senza senso ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
CANKnot
Moderator


Joined: 09 Nov 2005
Posts: 1321

PostPosted: 22 Nov 2011 17:27    Post subject: Reply with quote

Resend the request. You should receive a response in minutes not days.

Make sure the response isn't being filtered by a spam filter (does your mail server do spam filtering?). If you don't get a response try emailing support.
_________________
In theory there is no difference between theory and practice, but in practice there is.
Back to top
View user's profile Send private message
Lupin
mousse


Joined: 24 Jul 2007
Posts: 45
Location: Italy

PostPosted: 30 Nov 2011 19:52    Post subject: Reply with quote

Ok,

I will re-try.

Tkx

Pino
_________________
Lupin ( Pino - Skyppyno )
... gente che va , gente che viene , tutto senza senso ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Lupin
mousse


Joined: 24 Jul 2007
Posts: 45
Location: Italy

PostPosted: 02 Dec 2011 10:20    Post subject: Reply with quote

Still no answers ...

Quote:
No answer arrived.

Now I try with a different account.

Pino

--------------------------------------------------------------------------------

Da: Skyppyno [mailto:admin@vsksailing.it]
Inviato: sabato 22 ottobre 2011 18.47
A: 'request@nadeo.com'
Oggetto: Password request

Hi mates ,

Im Pino ( Skyppyno Lupin )

www.vskitalia.com , www.vsksailing.it , www.velavirtuale.it webmaster.

I ask for a password to use VSK XML files as in this topic : http://www.virtualskipper.com/forum/viewtopic.php?t=6342&sid=6b9ac20d1c044f95762c84e24976889f

Thanks

Pino

P.S. Some suggestions about my problem is welcome Clin d'oeil


Second try was made with different account.

There is a "special formula" to write in ther message ? Sourire

I used the correct mailbox ?

Could an admin help me?

Thanks

Pino
_________________
Lupin ( Pino - Skyppyno )
... gente che va , gente che viene , tutto senza senso ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
Camster
Moderator


Joined: 09 Dec 2005
Posts: 1502
Location: Scotland

PostPosted: 02 Dec 2011 19:09    Post subject: Reply with quote

Hi Pino

Try a PM to Hyalis on this forum
_________________
Sandy
Back to top
View user's profile Send private message Visit poster's website
Lupin
mousse


Joined: 24 Jul 2007
Posts: 45
Location: Italy

PostPosted: 13 Dec 2011 11:50    Post subject: Reply with quote

Already done, Sandy ...

Now I tried again ...

I hope in a X'mas gift ..

Mort de rire

Pino
_________________
Lupin ( Pino - Skyppyno )
... gente che va , gente che viene , tutto senza senso ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
diades
Matelot


Joined: 22 Dec 2008
Posts: 130
Location: Scotland

PostPosted: 13 Dec 2011 13:48    Post subject: Reply with quote

Hi Pino

Check your PM's, I have written you a message, I hope it helps.
_________________
Cheers,

Keith

Web Development help form WebXpertz
Back to top
View user's profile Send private message
Lupin
mousse


Joined: 24 Jul 2007
Posts: 45
Location: Italy

PostPosted: 07 Jan 2012 15:12    Post subject: Reply with quote

Ok my user/pass account arrived ( tkx cerovan ).

Direct connection is correctly working, but I have some questions.

1) if I use getRankings xml request, I am able to see all skippers 500 by 500 but not only for first 500 skippers.

with "...getRankings.php" , I obtain WELL FORMED the xml list of first 100 skippers ( default options ? )

with "...getRankings.php?start=0&size=500" I obtain the correct list , but NOT WELL FORMED ( error : Errore interpretazione XML: non well-formed
Indirizzo: http://scripts.ac32.virtualskipper.com/getRankings.php?start=0&size=500 Linea numero 2, colonna 64519: ....)

If : ."...getRankings.php?start=>500&size=500" everything run well ... strange, isn'tit?

2) This is most important ... I tried to use simplyXML method to import XML file, as follows :

Code:
$myurl = 'http://[account]:[password]@.scripts.ac32.virtualskipper.com/getRanking.php' ;
$myxml= simpleXML_load_file($myurl,"SimpleXMLElement",LIBXML_NOCDATA);
if($myxml ===  FALSE)
{
echo 'NO XML FILE' ;
}
else print_r($myxml);


But I cannot obtain a valid XML file Triste

Any suggestions ?

Ciao

Pino
_________________
Lupin ( Pino - Skyppyno )
... gente che va , gente che viene , tutto senza senso ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
diades
Matelot


Joined: 22 Dec 2008
Posts: 130
Location: Scotland

PostPosted: 08 Jan 2012 12:59    Post subject: Reply with quote

Hi Pino

This needs improving but this is the php that I use to display the xml on my site, it puts a query to the server for each page of data as requested:
Code:
<?
//get any data sent in and populate te variables with it.

if($_POST['start'] != '')

{

    $start = $_POST['start'];

}

else

{

    $start = 0;

}

if($_POST['size'] != '')

{

    $size = $_POST['size'];

}

else

{

    $size = 50;

}

if($_POST['key'] != '')

{

    $key = $_POST['key'];

}

else

{

    $key = 0;

}

if($_POST['span'] != '')

{

    $span = $_POST['span'];

}

else

{

    $span = 50;

}


//set the values for control flags

$dataFlag = 1;

$caption = 1;

$pathFlag = 0;

$maxFlag = 0;

$maxNum = "x";

$nameFlag = 0;



//Get global info

include 'config.php';



//open the data stream

$file = $path.'getRankings.php'.'?start='.$start.'&size='.$size;



//Start the page

include 'doctype.txt'; ?>
<html xmlns="http://www.w3.org/1999/xhtml">
   <head>
      <title></title>
<? include 'comment.txt'; ?>
      <meta name="description" content="" />
      <meta name="keywords" content="" />
<? include 'meta.txt'; ?>
      <style type="text/css">
      /*<![CDATA[*/
         body,table,form{
               font-size:12px;
         }
         #frm{
            display: block;
            width:520px;
            margin:auto;
         }
         #frm div{
         }
         table{
            width:500px;
            border-collapse: collapse;
         }
         table tr{
            background-color:#ccc;
         }
         table tr td div{
            font-family:times;
            font-weight:bold;
         }
         .rank{
            width:80px;
            text-align:center;
         }
         .boat{
            width:310px;
         }
         .country{
            width:30px;
            text-align:center;
         }
         .region{
            width:30px;
            text-align:center;
         }
         .district{
            width:20px;
            text-align:center;
         }
         .rating{
            width:60px;
            text-align:right;
         }
         .nadeo{
            border:2px ridge #ccccc;
            width:520px;
            height: 400px;
            margin:auto;
            overflow:scroll;
         }
         th{
            text-align:center;
         }
         #frmNad,.ctrls{
            width:520px;
            margin:auto;
         }
         button{
            width:125px;
            text-align:center;
         }
         img.clsW3c{
            height:31px;
            width:88px;
            border:0;
         }
         img{
            border:0;
         }
      /*]]>*/
      </style>
        <link type="text/css" href="vsk.css" rel="Stylesheet" media="screen" />
   </head>
   <body>
<? include 'menu.txt'; ?>
        <div class="clsBody">
         <form class="frm" id="frmNad" method="post" action="<? $_SERVER['PHP_SELF'];?>">
            <input id="start" name="start" value="<? echo $start; ?>" type="hidden"/>
            <input id="size" name="size" value="<? echo $size; ?>" type="hidden"/>
            <input id="key" name="key" value="<? echo $key; ?>" type="hidden"/>
            <input id="span" name="span" value="<? echo $span; ?>" type="hidden"/>
            <h2>Players ranking</h2>
               <p>Mouseover a flag or blazon for information regarding the origin, click on a flag or blazon for detailed info from <a href ="http://en.wikipedia.org/wiki/Main_Page" title="Wikipedia">Wikipedia</a>.</p>
               <p id="numplayer"> </p>
               <div class="ctrls">
                  <button id="btnStart" onclick="goZero(this.form)">|&lt;</button><button id="btnPrev" onclick="goPrev(this.form)">&lt;</button>
                  <button id="btnNext" onclick="goNext(this.form)">&gt;</button><button id="btnLast" onclick="goLast(this.form)">&gt;|</button>
               </div>
<?
function trustedFile($file)
{

    // only trust local files owned by ourselves

    if (!preg_match("@^([a-z]+)\:\/\/@i", $file)

        && fileowner($file) == getmyuid()) {

            return 1;

    }

    return 0;

}

/*
==============================

Create the opening markup for
the data

==============================
*/

function startElement($parser, $name, $attribs)
{

    global $dataFlag;

    global $caption;

    global $pathFlag;

    global $maxFlag;

    global $nameFlag;

    switch($name)
    {
        case 'RANKING'   :

//the first usage will open the table and set-up the columns

                            if($caption)
                            {
                                echo "<table><tr>\n<th class=\"rank\">Rank</th>\n<th class=\"boat\">Boat-name</th>\n<th class=\"country\" title=\"Country\">Ctry</th>\n<th class=\"region\" title=\"Region, State etc.,\">Reg</th>\n<th class=\"district\" title=\"The district,city etc.\">Dis</th>\n<th class=\"rating\">Rating</th>\n</tr></table>\n";

                                echo "<div class=\"nadeo\">\n<table><col class=\"rank\"><col class=\"boat\"><col class=\"country\"><col class=\"region\"><col class=\"district\"><col class=\"rating\">\n";   $dataFlag = 0;   $caption = 0;
                            } else {
//subsequent usage will add more rows
                                echo "<tr>\n<td>";  $dataFlag = 1;
                            } break;

        case 'NBPLAYERS' :  $maxFlag = 1; $dataFlag = 1;  break;

//data not required

        case 'PLAYER'    :  $dataFlag = 0;  break;

//data not required

        case 'LOGIN'     :  $dataFlag = 0;  break;

//the ballance is data, open a cell and set the flags

        case 'NICKNAME'  :  echo "<td>";  $dataFlag = 1;  $nameFlag = 1; break;

        case 'PATH'      :  echo "<td>";  $dataFlag = 1;  $pathFlag = 1; break;

        case 'RATING'    :  echo "<td>";  $dataFlag = 1;  break;

    }
}

/*
====================================

close the current element

====================================
*/

function endElement($parser, $name)
{
    switch($name)
    {
        case 'RANKING'   : 
//This only needs closing if it is after the first usage
                            if(!$caption)
                            {
                                echo "</td>\n";
                            }
                            break;
        case 'NBPLAYERS' :  break;
//not required
        case 'PLAYER'    :  break;
//not required
        case 'LOGIN'     :  break;
        case 'NICKNAME'  :  echo "</td>\n"; break;
//this is catered for when the data is parsed
        case 'PATH'      :  break;
//this is the last segment of a record, close the row.
        case 'RATING'    :  echo "</td>\n</tr>\n"; break;
    }
}

/*
=================================================================================================

This takes the boat-name, strips the Nadeo formatting from it and replaces it with markup and css

=================================================================================================
*/

function parseName($data)
{

//check for quotes and change to HTML entities
    $str = htmlspecialchars ($data,ENT_QUOTES);

//formatting present, we want the dollar sign so replace with a comma+dollar
//first, find all string formatting and change to lower case for processing
//also, find any instances of 2 dollar signs together and change to a single "$$"

    $str = str_replace('\f', '', $str);
    $str = str_replace('\n', '', $str);
    $str = str_replace('\r', '', $str);
    $str = str_replace('$$', ',$', $str);
    $str = str_replace('$', ',$', $str);
    $str = str_replace('$I', '$i,', $str);
    $str = str_replace('$W', '$w,', $str);
    $str = str_replace('$N', '$n,', $str);
    $str = str_replace('$S', '$s,', $str);
    $str = str_replace('$M', '$m,', $str);
    $str = str_replace('$T', '$t,', $str);
    $str = str_replace('$Z', '$z,', $str);

    $str = preg_replace('/\$/i', ',$', $str);
//    $patterns = '/^\$([a-f0-9]{3})/ig';
//    $str = strtolower(preg_replace('/^\$([a-f0-9]{3})/ig' , '#'.'$1'.',' , $str)) ;
//    $str = strtolower(preg_replace('/^\$([a-f0-9]{3})/ig' , '#'.'$1'.',' , $str)) ;
//    $str = strtolower(preg_replace('/^\$([a-f0-9]{2})/ig' , '#'.'$1'.'0,' , $str)) ;
//    $str = strtolower(preg_replace('/^\$([a-f0-9]{1})/ig' , '#'.'$1'.'00,' , $str)) ;

//remove any leading commas and double commas
    $pattern = array('/^,/', '/,,/');
    $replace = array ('', ',');
    $str = preg_replace($pattern, $replace, $str);

//set the div flag
    $divsFlag = 0;

//check for formatting
    $pattern0 = '/\$/';

//check to see if any dollar chars are present, indicates formatting
    if(preg_match_all($pattern0, $str, $matches))
    {
//use the comma to split the string into an array
        $arr = explode(',',$str);
        $patterns = '/^\$([a-f0-9]{3})/ig';
//run the array
        for($i = 0;$i < count($arr);$i++)
        {
            $arr[$i] = strtolower(preg_replace('/^\$([a-f0-9]{3})/i' , '#'.'$1', $arr[$i])) ;
            $arr[$i] = strtolower(preg_replace('/^\$([a-f0-9]{3})/i' , '#'.'$1', $arr[$i])) ;
            $arr[$i] = strtolower(preg_replace('/^\$([a-f0-9]{2})/i' , '#'.'$1'.'0' , $arr[$i])) ;
            $arr[$i] = strtolower(preg_replace('/^\$([a-f0-9]{1})/i' , '#'.'$1'.'00' , $arr[$i])) ;
            $arr[$i] = strtolower(preg_replace('/^(#0oo)/i' , '#f00' , $arr[$i])) ;
            $pattern = array('/$,/');
            $replace = array ('');
            $arr[$i] = preg_replace($pattern, $replace, $arr[$i]);
        }
        $temp = array();
        for($i = 0;$i < count($arr);$i++)
        {
            if(isset($arr[$i]))
            {
                array_push($temp,$arr[$i]);
            }
        }
        $arr = $temp;
        for($i = 0;$i < count($arr);$i++)
        {

//Check for data in the string, if it is there, separate it
//            $dat = (strlen($arr[$i])> 2) ? substr($arr[$i], 2, strlen($arr[$i]) - 2) : '';

//Get the formatting section of the string
//            $format = substr($arr[$i], 0, 2);

//create an open div with the requisite formatting
            switch(str_replace('$','',$arr[$i]))
            {
                case "i":
//italic
                    $arr[$i] = str_replace($arr[$i],"<div style=\"display:inline;font-style:italic;\">",$arr[$i]); $divsFlag++; break;
                case "w":
//wide spacing
                    $arr[$i] = str_replace($arr[$i],"<div style=\"display:inline;letter-spacing:3px;\">",$arr[$i]); $divsFlag++; break;
                case "n":
//narrow spacing
                    $arr[$i] = str_replace($arr[$i],"<div style=\"display:inline;letter-spacing:1px;\">",$arr[$i]); $divsFlag++; break;
                case "s":
//shadowed
                    $arr[$i] = str_replace($arr[$i],"<div style=\"display:inline;\">",$arr[$i]); $divsFlag++; break;
                case "m":
//normal setting
                    $arr[$i] = str_replace($arr[$i],"<div style=\"display:inline;letter-spacing:2px\">",$format); $divsFlag++; break;
                case "t":
//changes the text to capitals
                    $arr[$i] = str_replace($format,"<div style=\"display:inline;text-transform:uppercase;\">",$format); $divsFlag++; break;
                case "z":
//reset all
                    $arr[$i] = str_replace($format,"<div style=\"display:inline;letter-spacing:1px;text-transform:uppercase;font-style:normal;color:#000000;\">",$format); $divsFlag++; break;
                case "g":
//default color
                    $arr[$i] = str_replace($format,"<div style=\"display:inline;color:inherit;\">",$format); $divsFlag++; break;
                case "$":
//to write a "$"
                    $arr[$i] = str_replace($arr[$i],"$",$arr[$i]); break;
                default :
//if the string is longer than 4 characters, it is colour formatting with, possibly character data attached
//                    if(strlen($arr[$i]) >= 4)
//                    {
                        $temp1 = substr($arr[$i], 1, 3);
//get any data
                        $temp2 = substr($arr[$i], 4, strlen($arr[$i]) - 4);

                        //build a string using the split data
                        if($temp2 == ' ')
                        {
                            $arr[$i] = "<div style=\"display:inline;color:#".$temp1."\">&nbsp;";
                            $divsFlag = $divsFlag + 1;
                        }
                        else
                        {
                            $arr[$i] = "<div style=\"display:inline;color:#".$temp1."\">".$temp2."</div>";

//if any "div's" have been opened, close them at this stage
                            if($divsFlag > 0)
                            {
                                for($j = 0;$j < $divsFlag;$j++) $arr[$i] .=  "</div>";
                                $divsFlag = 0;
                            }
                        }
//                    }
                    break;
            }
        }
        //write the result to the page
        echo implode('',$arr);
    }
    else //no formatting, just write to the page
    {
        echo $data;
    }
}

function charSet()
{
//    $patterns = array ('/\!/', '/"/', '/\#/', '/\$/', '/\%/', '/&/', '/'/','/(/','/)/','/*/','/+/','/,/','/-/','/\./','/\//','/:/','/;/','/</','/=/','/>/','/\?/','/@/','/[/','/\\/','/]/','/\^/','/_/','/$/','/{/','/|/','/}/','/~/','/ /','//','//','//','//','//','/\/','//','//','//','//','//','/$/','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//','//', '/Γ', '/Δ/', '/Θ/', '/Λ/', '/Ξ/', '/Π/', '/Σ/', '/Φ/', '/Ψ/', '/Ω/', '/α/', '/β/', '/γ/', '/δ/', '/ε/', '/ζ/', '/η/', '/θ/', '/ι/', '/κ/', '/λ/', '/μ/', '/ν/', '/ξ/', '/π/', '/ρ/', '/ς/', '/σ/', '/τ/', '/υ/', '/φ/', '/χ/', '/ψ/', '/ω/', '/ϑ/', '/ϒ/', '/ϖ/', '//', '//', '/′/', '/″/', '/‾/', '/⁄/', '/℘/', '/ℑ/', '/ℜ/', '//', '/ℵ/', '/←/', '/↑/', '/→/', '/↓/', '/↔/', '/↵/', '/⇐/', '/⇑/', '/⇒/', '/⇓/', '/⇔/', '/∀/', '/∂/', '/∃/', '/∅/', '/∇/', '/∈/', '/∉/', '/∋/', '/∏/', '/−/', '/−/', '/∗/', '/√/', '/∝/', '/∞/', '/∠/', '/⊥/', '/⊦/', '/∩/', '/∪/', '/∫/', '/∴/', '/∼/', '/≅/', '/≅/', '/≠/', '/≡/', '/≤/', '/≥/', '/⊂/', '/⊃/', '/⊄/', '/⊆/', '/⊇/', '/⊕/', '/⊗/', '/⊥/', '/⋅/', '/⌈/', '/⌉/', '/⌊/', '/⌋/', '/〈/', '/〉/', '/◊/', '/♠/', '/♣/', '/♥/', '/♦/' );
//    $replace = array ("!", "&quot;", "#", "$", "%", "&amp;", "'","(",")","*","+",",","-",".","/",":",";","&lt;","=","&gt;","?","@","[","\","]","^","_","`","{","|","}","~","&nbsp;","&iexcl;","&cent;","&pound;","&curren;","&yen;","&brvbar;","&sect;","&uml;","&copy;","&ordf;","&laquo;","&not;","&shy;","&reg;","&macr;","&deg;","&plusmn;","&sup2;","&sup3;","&acute;","&micro;","&para;","&middot;","&cedil;","&sup1;","&ordm;","&raquo;","&frac14;","&frac12;","&frac34;","&iquest;","&Agrave;","&Aacute;","&Acirc;","&Atilde;","&Auml;","&Aring;","&AElig;","&Ccedil;","&Egrave;","&Eacute;","&Ecirc;","&Euml;","&Igrave;","&Iacute;","&Icirc;","&Iuml;","&ETH;","&Ntilde;","&Ograve;","&Oacute;","&Ocirc;","&Otilde;","&Ouml;","&times;","&Oslash;","&Ugrave;","&Uacute;","&Ucirc;","&Uuml;","&Yacute;","&THORN;","&szlig;","&agrave;","&aacute;","&acirc;","&atilde;","&auml;","&aring;","&aelig;","&ccedil;","&egrave;","&eacute;","&ecirc;","&euml;","&igrave;","&iacute;","&icirc;","&iuml;","&eth;","&ntilde;","&ograve;","&oacute;","&ocirc;","&otilde;","&ouml;","&divide;","&oslash;","&ugrave;","&uacute;","&ucirc;","&uuml;","&yacute;","&thorn;","&yuml;","&fnof;","&Gamma;","&Delta;","&Theta;","&Lambda;","&Xi;","&Pi;","&Sigma;","&Phi;","&Psi;","&Omega;","&alpha;","&beta;","&gamma;","&delta;","&epsilon;","&zeta;","&eta;","&theta;","&iota;","&kappa;","&lambda;","&mu;","&nu;","&xi;","&pi;","&rho;","&sigmaf;","&sigma;","&tau;","&upsilon;","&phi;","&chi;","&psi;","&omega;","&thetasym;","&upsih;","&piv;","&bull;","&hellip;","&prime;","&Prime;","&oline;","&frasl;","&weierp;","&image;","&real;","&trade;","&alefsym;","&larr;","&uarr;","&rarr;","&darr;","&harr;","&crarr;","&lArr;","&uArr;","&rArr;","&dArr;","&hArr;","&forall;","&part;","&exist;","&empty;","&nabla;","&isin;","&notin;","&ni;","&prod;","&sum;","&minus;","&lowast;","&radic;","&prop;","&infin;","&ang;","&and;","&or;","&cap;","&cup;","&int;","&there4;","&sim;","&cong;","&asymp;","&ne;","&equiv;","&le;","&ge;","&sub;","&sup;","&nsub;","&sube;","&supe;","&oplus;","&otimes;","&perp;","&sdot;","&lceil;","&rceil;","&lfloor;","&rfloor;","&lang;","&rang;","&loz;","&spades;","&clubs;","&hearts;","&diams;");
//    $str = preg_replace($patterns, $replace, $data);
}

/*
============================

 Strip any spaces, hyphens
 and accented chars

============================
*/

function clean($data)
{
      $patterns = array ('/[ \-]/', '/(|)/', '//', '//',  '//','/\//','/\'/');
      $replace = array ('', 'e', 'o', 'a', 'u','', '');
      return strtolower(preg_replace ($patterns,$replace,$data));
}

/*
============================

Break the location string into
country/region/district and use
to create markup for the flags

============================
*/

function parseLocation($data)
{
    global $pathFlag;

//The start of every string is "World|" which is not required so lose it
    $temp1 = substr($data, 6);

//The ballance is a string broken with the pipe "|" char, use that as a delimeter to break into an array
    $keywords = explode('|',$temp1,3);

//walk the array
    for($i = 0;$i < count($keywords);$i++)
    {

//take each segment and make a clean copy for use as an image filename
        $cleanData = clean($keywords[$i]);

//the table cell is already open so the first run does not require an opening "td" tag
        if($i > 0) echo "<td>";

//write the flag/link markup to the page
        echo "<a href=\"http://commons.wikimedia.org/wiki/".$keywords[$i]."\" title=\"The flag of ".$keywords[$i]."\"><img src=\"images/flags/".$cleanData.".png\" alt=\"The flag of ".$keywords[$i]."\" /></a></td>\n";

//Some location only have the country, others the country and region only, and empty cells to compensate
        if(count($keywords) == 1) echo "<td>&nbsp;</td>\n<td>&nbsp;</td>\n";

        if(count($keywords) == 2 && $i == 1) echo "<td>&nbsp;</td>\n";
    }

//reset the pathFlag
    $pathFlag = 0;
}

function characterData($parser, $data)
{
    global $dataFlag;
    global $pathFlag;
    global $maxNum;
    global $maxFlag;
    global $nameFlag;
   
    if($dataFlag)
    {
        if($pathFlag)
        {
            //break the location string into components
            parseLocation($data);
        }
        else if($maxFlag)
        {
            //maxNum passes data client-side for scripting purposes.
            $maxNum = $data;
            $maxFlag = 0;
        }
        else if($nameFlag)
        {
            //send the boat name for formatting
            parseName($data);
            $nameFlag = 0;
        }
        else
        {
            echo $data;
        }
    }
}

function PIHandler($parser, $target, $data)
{
    switch (strtolower($target)) {
        case "php":
            global $parser_file;
            // If the parsed document is "trusted", we say it is safe
            // to execute PHP code inside it.  If not, display the code
            // instead.
            if (trustedFile($parser_file[$parser])) {
                eval($data);
            } else {
                printf("Untrusted PHP code: <i>%s</i>",
                        htmlspecialchars($data));
            }
            break;
    }
}

function defaultHandler($parser, $data)
{
    if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") {
    } else {
    }
}

function externalEntityRefHandler($parser, $openEntityNames, $base, $systemId,  $publicId) {
    if ($systemId) {
        if (!list($parser, $fp) = new_xml_parser($systemId)) {
            printf("Could not open entity %s at %s\n", $openEntityNames,
                   $systemId);
            return 0;
        }
        while ($data = fread($fp, 4096)) {
            if (!xml_parse($parser, $data, feof($fp))) {
                printf("XML error: %s at line %d while parsing entity %s\n",
                       xml_error_string(xml_get_error_code($parser)),
                       xml_get_current_line_number($parser), $openEntityNames);
                xml_parser_free($parser);
                return 0;
            }
        }
        xml_parser_free($parser);
        return 1;
    }
    return 0;
}

function new_xml_parser($file)
{
    global $parser_file;

    $xml_parser = xml_parser_create();
    xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 1);
    xml_set_element_handler($xml_parser, "startElement", "endElement");
    xml_set_character_data_handler($xml_parser, "characterData");
    xml_set_processing_instruction_handler($xml_parser, "PIHandler");
    xml_set_default_handler($xml_parser, "defaultHandler");
    xml_set_external_entity_ref_handler($xml_parser, "externalEntityRefHandler");

    if (!($fp = @fopen($file, "r"))) {
        return 0;
    }

    if (!is_array($parser_file)) {
        settype($parser_file, "array");
    }

    $parser_file[$xml_parser] = $file;
    return array($xml_parser, $fp);
}

if (!(list($xml_parser, $fp) = new_xml_parser($file))) {
    die("could not open XML input");
}

//echo "<table>\n";

while ($data = fread($fp, 4096)) {
    if (!xml_parse($xml_parser, $data, feof($fp))) {
        die(sprintf("XML error: %s at line %d\n",
                    xml_error_string(xml_get_error_code($xml_parser)),
                    xml_get_current_line_number($xml_parser)));
    }
}

echo "</table>\n";
xml_parser_free($xml_parser);
?>
         </div>
      </form>
<script type="text/javascript">
//<![CDATA[

/*
<?
echo "start = $start\n";
echo "size = $size\n";
echo "key = $key\n";
echo "span = $span\n";
?>
*/
        min = 0;
        max = <? echo $maxNum; ?>;
        key = <? echo $key; ?>;
        span = <? echo $span; ?>;

        onload = function()
        {
            document.getElementById("numplayer").innerHTML = "Total number of registered Virtual Skipper players: " + max;
        }

        function goZero(frm)
        {
            frm.start.value = min;
            frm.key.value = 0;
            frm.size.value = span;
            frm.submit();
        }

        function goPrev(frm)
        {
            if(key > 50)
            {
                frm.key.value = frm.start.value = key - span;
                frm.size.value = span;
            }
            else
            {
                frm.key.value = frm.start.value = 0;
                frm.size.value = span;
            }
            frm.submit();
        }

        function goNext(frm)
        {
            if(key < max)
            {
                frm.key.value = frm.start.value = (key + span) * 1;
                frm.size.value = span;
                frm.submit();
            }
        }

        function goLast(frm)
        {
                frm.key.value = frm.start.value = max - span;
                frm.size.value = max - span;
                frm.submit();
        }

//]]>
</script>
        </div>
<? include 'footer.txt'; ?>
    </body>
</html>


config.php
Code:

<?
$Login = 'YOUR LOGIN HERE';
$Password = 'YOUR PASSWORD HERE';
$path = 'http://'.$Login.':'.$Password.'@'.'scripts.ac32.virtualskipper.com/';
?>

In action: http://www.diades.net/vsk-rankings.php
_________________
Cheers,

Keith

Web Development help form WebXpertz


Last edited by diades on 18 Dec 2012 12:14; edited 3 times in total
Back to top
View user's profile Send private message
Lupin
mousse


Joined: 24 Jul 2007
Posts: 45
Location: Italy

PostPosted: 09 Jan 2012 14:44    Post subject: Reply with quote

Wow ! ... a great "self-made-parser" ??? Choqu

Great job.

Your link seems give me an error ... but no problem , I will try your solution it could be a good start for my application.

Quote:
$file = $path.'getRankings.php'.'?start='.$start.'&size='.$size;


I'm surprised this simple code returns an XML file ... Sourire

Thanks again, Keith
_________________
Lupin ( Pino - Skyppyno )
... gente che va , gente che viene , tutto senza senso ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
diades
Matelot


Joined: 22 Dec 2008
Posts: 130
Location: Scotland

PostPosted: 07 Jun 2012 12:42    Post subject: Reply with quote

New server, Url updated:

http://www.diades.net/vsk-rankings.php
_________________
Cheers,

Keith

Web Development help form WebXpertz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Virtual Skipper Forum Index -> Main Forum All times are GMT + 1 Hour
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group

Anti Bot Question MOD - phpBB MOD against Spam Bots
Blocked registrations / posts: 251790 / 0