Notice d'installation rapide [2016-12-01 01:24:23]

001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021:
022:
023:
024:
025:
026:
027:
028:
029:
030:
031:
032:
033:
034:
035:
036:
037:
038:
039:
040:
041:
042:
043:
044:
045:
046:
047:
048:
049:
050:
051:
052:
053:
054:
055:
056:
057:
058:
059:
060:
061:
062:
063:
064:
065:
066:
067:
068:
069:
070:
071:
072:
073:
074:
075:
076:
077:
078:
079:
// ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //
//                              ---   VOTATION.FR   ---                            //
//                                                                                 //
// Copyright (c) 2016 David Espic. Tous droits Réservés.                           //
// Permission d'utiliser, copier, modifier et distribuer le logiciel               //
// ainsi que sa documentation pour toute application gratuitement                  //
// sous condition que le présent copyright soit apparant sur chaque copie.         //
//                                                                                 //
// Remerciements spécial à Sylvain Viart (SysAdmin) sylvain@opensource-expert.com  //
// Remerciements aussi à Bruno Miguel (Web Design) antunes@geedesign.fr            //
//                                                                                 //
// Remerciements à Linus Torvalds (Linux) et Rasmus Lerdorf (PHP) et toute         //
// la comunauté open-source pour les outils (W3C / Mozilla / Chromium...)          //
//                                                                                 //
// ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //




Installez votre serveur de votation et participez au test grandeur nature.
Selon l'ampleur du test un VPS à 3€/mois peut suffire avec un certificat HTTPS gratuit 
ou à 9€/an et votre nom de domaine à 5€/an.

Le système requière un serveur LAMP classic : Apache2, PHP5, MySQL5 ainsi qu'un certificat 
SSL pour sécuriser les échanges.

La présente archive contient les fichiers suivants :
- xml.php (le fichier de vote)
- htm.php (le fichier de résultats)
- cfg.txt (la présente notice)

Copiez les 2 fichiers PHP dans le répertoire www de votre serveur
Depuis votre console exécutez la commande "chown www-data www" 
Puis en remplaçant les variables entres accolades par les identifiants de base de donnée :
wget -q -O - https://localhost/xml.php?setup&login={baselogin}&passwd={basepasswd}&base={basename}

L'appel en local du script génère 
- le répertoire cfg ou sont enregistré les fichiers de configuration
- les 2 fichiers de config ./cfg/cfg_vote.php et ./cfg/cfg_server
- les fichiers .htaccess pour la réécriture d'url et ./.htaccess pour protéger la config
- les tables en base de donnée ballots et results


Enfin, ajoutez ces 2 actions à votre fichier /etc/crontab pour mettre à jour la config et 
vérifier que les documents ne soient pas modifiés pendant les périodes de lecture votation

# m h dom mon dow user command
0 * * * * root wget -q -O - https://localhost/?setup > /dev/null # UPDATE CONFIG HOURLY
0 * * * * root wget -q -O - https://localhost/?track > /dev/null # TRACK CONFIG MODIF
#Remplacez les 2 zéro en début de ligne par 2 valeurs comprise entre 0 et 59

A l'adresse https://votation.monserveur.me/index.xml votre navigateur devrait afficher
une page XML de ce genre

<?xml version="1.0" encoding="UTF-8"?>
<root>
    <info>
        <sql>ballots</sql>
        <dir>20161209</dir>
    </info>
    <time>2016-12-01 01:16:48</time>
    <ms>0.267</ms>
    <url>/</url>
    <you>MON.IP.PUB.LIC</you>
    <me>IP.DU.SER.VER</me>
    <php>/home/votation/www/xml.php</php>
</root>
 




Une fois votre serveur installé, envoyez nous la clé de connexion $VotationKeyCode et 
l'adresse du script index.xml afin que nous procédions aux tests de charge. 
Merci pour votre participation et votre implication.


Si vous avez besoin d'aide pour installer votre serveur ou si vous souhaitez une formation
n'hésitez pas à contacter Sylvain, notre sys admin.

http://www.monserveur.fr/xml.php (UrlRewrite >> index.xml) [2016-12-11 21:21:01]

001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021:
022:
023:
024:
025:
026:
027:
028:
029:
030:
031:
032:
033:
034:
035:
036:
037:
038:
039:
040:
041:
042:
043:
044:
045:
046:
047:
048:
049:
050:
051:
052:
053:
054:
055:
056:
057:
058:
059:
060:
061:
062:
063:
064:
065:
066:
067:
068:
069:
070:
071:
072:
073:
074:
075:
076:
077:
078:
079:
080:
081:
082:
083:
084:
085:
086:
087:
088:
089:
090:
091:
092:
093:
094:
095:
096:
097:
098:
099:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
282:
283:
284:
285:
286:
287:
288:
289:
290:
291:
292:
293:
294:
295:
296:
297:
298:
299:
300:
301:
302:
303:
304:
305:
306:
307:
308:
309:
310:
311:
312:
313:
314:
315:
316:
317:
318:
319:
320:
321:
322:
323:
324:
325:
326:
327:
328:
329:
330:
331:
332:
333:
334:
335:
336:
337:
338:
339:
340:
341:
342:
343:
344:
345:
346:
347:
348:
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394:
395:
396:
397:
398:
399:
400:
401:
402:
403:
404:
405:
406:
407:
408:
409:
410:
411:
412:
413:
414:
415:
416:
417:
418:
419:
420:
421:
422:
423:
424:
425:
426:
427:
428:
429:
430:
431:
432:
433:
434:
435:
436:
437:
438:
439:
440:
441:
442:
443:
444:
445:
446:
447:
448:
449:
450:
451:
452:
453:
454:
455:
456:
457:
458:
459:
460:
461:
462:
463:
464:
465:
466:
467:
468:
469:
470:
471:
472:
473:
474:
475:
476:
477:
478:
479:
480:
481:
482:
483:
484:
485:
486:
487:
488:
489:
<?php

// ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //
//                              ---   VOTATION.FR   ---                            //
//                                                                                 //
// Copyright (c) 2016 David Espic. Tous droits Réservés.                           //
// Permission d'utiliser, copier, modifier et distribuer le logiciel               //
// ainsi que sa documentation pour toute application gratuitement                  //
// sous condition que le présent copyright soit apparant sur chaque copie.         //
//                                                                                 //
// Remerciements spécial à Sylvain Viart (SysAdmin) sylvain@opensource-expert.com  //
// Remerciements aussi à Bruno Miguel (Web Design) antunes@geedesign.fr            //
//                                                                                 //
// Remerciements à Linus Torvalds (Linux) et Rasmus Lerdorf (PHP) et toute         //
// la comunauté open-source pour les outils (W3C / Mozilla / Chromium...)          //
//                                                                                 //
// ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //


//========================================================================
// DEBUT DU CHRONOMETRE DE SCRIPT
//========================================================================
$executionstarttime=microtime();


//========================================================================
// MICROTIME AS FLOAT
//========================================================================
function microdelai($starttime){ 
        list(
$usec$sec) = explode(" "$starttime);
        
$deb = ((float)$usec + (float)$sec);
        list(
$usec$sec) = explode(" "microtime());
        
$fin = ((float)$usec + (float)$sec);
        return 
substr($fin $deb05);



//========================================================================
// PREVENIR DES INJECTIONS SQL DANS POST ET GET
//========================================================================
$pregs = array();
$pregs['/\s\s+/'] = ' ';
$pregs['/\bSELECT\b/i'] = 'SELеCт';
$pregs['/\bINSERT\b/i'] = 'INSеRт';
$pregs['/\bUPDATE\b/i'] = 'UPDΑтE';
$pregs['/\bTRUNCATE\b/i'] = 'TRUNCΑтE';
$pregs['/\bDROP TABLE\b/i'] = 'DROPтΑBLE';
foreach (
$pregs as $pattern => $replacement)
{
    foreach (
$_POST as $key => $value)
        
$_POST[$key] = preg_replace($pattern$replacement$_POST[$key]);
    foreach (
$_GET as $key => $value)
        
$_GET[$key] = preg_replace($pattern$replacement$_GET[$key]);
}

//========================================================================
// SETUP
//========================================================================
if (isset($_GET['setup']))
{
    echo 
"<html><body>";

    
// TESTER OU CREER LE REPERTOIRE DE CONFIGURATION (+ .HTACCESS)
    // SECTION À SUPPRIMER UNE FOIS QUE VOUS PASSEZ EN PRODUCTION
    
if (isset($_GET['login']) && isset($_GET['passwd']) && isset($_GET['base']))
    {
        echo 
"<h1>MAKE/CHECK ./cfg</h1>\r\n";
        if (!
is_dir("./cfg")) mkdir("./cfg"0755true);
    
        echo 
"<h1>MAKE/CHECK ./cfg/.htaccess</h1>\r\n";
        
$fd=fopen ("./cfg/.htaccess""w+");
        
fwrite ($fd"Order deny,allow\r\n");
        
fwrite ($fd"allow from 127.0.0.1\r\n");
        
fwrite ($fd"deny from all\r\n");
        
fclose ($fd);
        echo 
"<textarea>".file_get_contents("./cfg/.htaccess")."</textarea><br>\r\n";

        if (!
file_exists("./.htaccess"))
        {
            echo 
"<h1>MAKE/CHECK ./.htaccess</h1>\r\n";
            
$fd=fopen ("./.htaccess""w+");
            
fwrite ($fd"Options +FollowSymlinks\r\n");
            
fwrite ($fd"RewriteEngine On\r\n");
            
fwrite ($fd"RewriteRule ^index\.xml$ /xml.php [L]\r\n");
            
fwrite ($fd"RewriteRule ^index\.htm$ /htm.php [L]\r\n");
            
fclose ($fd);
            echo 
"<textarea>".file_get_contents("./.htaccess")."</textarea><br>\r\n";
        }
        
$dblink mysql_connect("localhost"$_GET['login'], $_GET['passwd']) or die("Setup Erreur MySQL ".mysql_error());
        if (
mysql_select_db($_GET['base'], $dblink))
        {
            echo 
"<h1>MAKE/CHECK ./cfg/cfg_vote.php</h1>\r\n";
            
$fd=fopen ("./cfg/cfg_vote.php""w+");
            
fwrite ($fd"<?php\r\n");
            
fwrite ($fd"// LES ADRESSES IP DE VOTATION.FR\r\n");
            
fwrite ($fd"\$VotationServerIps = array('91.134.134.242');\r\n");
            
fwrite ($fd"// MOT DE PASSE DU SERVEUR votation.fr POUR POSTER LES CLEFS\r\n");
            if (!isset(
$_GET['keycode'])) $_GET['keycode'] = hash("sha256""As1mplePassVV0rD".rand(11119999).date('u'));
            
fwrite ($fd"\$VotationKeyCode = '".$_GET['keycode']."';\r\n");
            
fwrite ($fd"\r\n");
            
fwrite ($fd"// Accès base de donnée\r\n");
            
fwrite ($fd"\$masterhost='localhost';\r\n");
            
fwrite ($fd"\$masterlogin='".$_GET['login']."';\r\n");
            
fwrite ($fd"\$masterpasswd='".$_GET['passwd']."';\r\n");
            
fwrite ($fd"\$masterbase='".$_GET['base']."';\r\n");
            
fwrite ($fd"?>\r\n");
            
fclose ($fd);
            echo 
"<textarea>".file_get_contents("./cfg/cfg_vote.php")."</textarea><br>\r\n";
            include_once(
"./cfg/cfg_vote.php");
        }
    }


//    if (($_SERVER["REMOTE_ADDR"] != $_SERVER["SERVER_ADDR"]) && ($_SERVER["REMOTE_ADDR"] != '127.0.0.1')) die("\t<error>PRIVATE_SCRIPT</error>\r\n</root>");

    // POUR DEBUG
    
ini_set('error_reporting'E_ALL);
    
ini_set("display_errors"1); 
    
    
// RECUPERATION LISTE SERVEURS SUR VOTATION.FR
    
echo "<h1>GET CONFIG FROM www.votation.fr</h1>\r\n";
    
$data file_get_contents("https://www.votation.fr/index.xml?config");
    
$data str_replace('<?xml version="1.0" encoding="UTF-8"?>'""$data);
    
$data str_replace(array("\r""\n""\t"), ""$data);
    
    
// SI ON A UNE BALISE ERREUR ON ARRETE...
    
if (($deb strpos($data"<error>"))) {
        
$fin strpos($data"</error>"$deb);
        die(
"VOTATION SERVER RETURNED AN ERROR : ".substr($data$deb+7$fin-$deb-7));
    }
    
    
// PARSER LE XML
    
$serverUrls = array(); $fin 0;
    while ((
$deb strpos($data"<serverUrl>"$fin))) {
        
$fin strpos($data"</serverUrl>"$deb);
        
$url substr($data$deb+11$fin-$deb-11);
        
$serverUrls[] = $url;
    }
    
    
$me "https://".$_SERVER["HTTP_HOST"].substr($_SERVER["REQUEST_URI"], 0strpos($_SERVER["REQUEST_URI"], "?"));
    
$MyRank array_search($me$serverUrls);
    echo 
"MYRANK=".$MyRank." (".$me.")<br>\r\n";
    if (
$MyRank 0$PreviousServer $serverUrls[$MyRank-1]; else $PreviousServer '';
    if (
$MyRank < (count($serverUrls)-1)) $NextServer $serverUrls[$MyRank+1]; else $NextServer '';

    
// LES SUJETS / QUESTIONS
    
$projects = array(); $fin 0;
    while ((
$deb strpos($data"<Titre>"$fin))) {
        
$fin strpos($data"</Titre>"$deb);
        
$Titre substr($data$deb+7$fin-$deb-7);
        
$projects[] = $Titre;
    }
    
    
// LE NOM DE LA VOTATION
    
$deb strpos($data"<Date>");
    
$fin strpos($data"</Date>"$deb);
    
$Date substr($data$deb+6$fin-$deb-6);

    
// LE NOMBRE DE PROJETS DE LA VOTATION
    
$deb strpos($data"<ProjectsCount>");
    
$fin strpos($data"</ProjectsCount>"$deb);
    
$VotationProjectCount substr($data$deb+15$fin-$deb-15);

    
// LE REPERTOIRE DE LA VOTATION
    
$deb strpos($data"<Dir>");
    
$fin strpos($data"</Dir>"$deb);
    
$Dir substr($data$deb+5$fin-$deb-5);
    if (
is_dir("./".$Dir) || mkdir("./".$Dir0755true))
        echo 
"MKDIR : ./".$Dir."<br>\r\n";

    
// ECRIRE LE FICHIER servers.php
    
$fd=fopen ("./cfg/servers.php""w+");
    
fwrite ($fd"<?php\r\n");
    
fwrite ($fd"// MyUrl = ".$me."\r\n");
    
fwrite ($fd"// MyRank = ".$MyRank."\r\n");
    
fwrite ($fd"// Updated ".date('Y-m-d H:i:s')."\r\n");
    
fwrite ($fd"\$VotationDate = '".$Date."';\r\n");
    
fwrite ($fd"\$VotationProjectCount = '".$VotationProjectCount."';\r\n");
    
fwrite ($fd"\$VotationDir = '".$Dir."';\r\n");
    
fwrite ($fd"\$PreviousServer = '".$PreviousServer."';\r\n");
    
fwrite ($fd"\$NextServer = '".$NextServer."';\r\n");
    
fwrite ($fd"\$TabServersList = array(\r\n");
    for (
$I=0$I<count($serverUrls); $I++)
        
fwrite ($fd"\t\"".$serverUrls[$I]."\",\r\n");
    
fwrite ($fd");\r\n");
    
fwrite ($fd"?>\r\n");
    
fclose ($fd);
    echo 
"<textarea>".file_get_contents("./cfg/servers.php")."</textarea><br>\r\n";


    
// CREATION DE LA TABLE BULLETINS EN BASE DE DONNEES
    
echo "<h1>CREATE BALLOTS TABLE</h1>\r\n";
    
$sql = <<<EOD
    CREATE TABLE IF NOT EXISTS `ballots` (
        `ID` int(11) NOT NULL AUTO_INCREMENT,
        `IP` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Adresse IP du votant',
        `UID` varchar(10) COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Identifiant unique du votant',
        `USK` varchar(6) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Mot de passe temporaire du votant',
        `IDS` int(11) DEFAULT NULL COMMENT 'Le score de certification',
        `UNS` int(11) DEFAULT NULL COMMENT 'Le score de comprehension',
        `DON` int(11) DEFAULT NULL COMMENT 'Montants des dons',
        `V1` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V2` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V3` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V4` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V5` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V6` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V7` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V8` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `V9` enum('OUI','ABS','NON') COLLATE utf8_unicode_ci NOT NULL DEFAULT 'ABS',
        `MD5` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Signature MD5 de la Photo',
        `AddTime` datetime DEFAULT NULL COMMENT 'Date d''ajout UID',
        `PostTime` datetime DEFAULT NULL COMMENT 'Reception du bulletin',
        PRIMARY KEY (`ID`),
        KEY `UID` (`UID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
EOD;
    
mysql_query($sql) or die (mysql_error());
    echo 
"<textarea>".$sql."</textarea>\r\n";
    
mysql_query("CHECK TABLE `ballots`;") or die (mysql_error());
    echo 
"<h3>SQL CHECK : `ballots`</h3>\r\n";
    
mysql_query("OPTIMIZE TABLE  `ballots`;") or die (mysql_error());
    echo 
"<h3>SQL OPTIMIZE : `ballots`</h3>\r\n";


    
// CREATION DE LA TABLE RESULTATS EN BASE DE DONNEES
    
echo "<h1>CREATE RESULTS TABLE</h1>\r\n";
    
$sql "CREATE TABLE IF NOT EXISTS `results` (\r\n";
    for (
$I=1$I<($VotationProjectCount+1); $I++)
    {
        
$sql.= "`T".$I."OUI` int(11) DEFAULT 1 COMMENT 'Total OUI ".$I."',\r\n";
        
$sql.= "`T".$I."ABS` int(11) DEFAULT 1 COMMENT 'Total ABS ".$I."',\r\n";
        
$sql.= "`T".$I."NON` int(11) DEFAULT 1 COMMENT 'Total NON ".$I."',\r\n";
        
$sql.= "`I".$I."OUI` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Id OUI ".$I."',\r\n";
        
$sql.= "`I".$I."ABS` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Id ABS ".$I."',\r\n";
        
$sql.= "`I".$I."NON` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Id NON ".$I."',\r\n";
        
$sql.= "`U".$I."OUI` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Comp OUI ".$I."',\r\n";
        
$sql.= "`U".$I."ABS` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Comp ABS ".$I."',\r\n";
        
$sql.= "`U".$I."NON` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Comp NON ".$I."',\r\n";
        
$sql.= "`F".$I."OUI` DECIMAL(11,2) DEFAULT 1 COMMENT 'Total Dons OUI ".$I."',\r\n";
        
$sql.= "`F".$I."ABS` DECIMAL(11,2) DEFAULT 1 COMMENT 'Total Dons ABS ".$I."',\r\n";
        
$sql.= "`F".$I."NON` DECIMAL(11,2) DEFAULT 1 COMMENT 'Total Dons NON ".$I."',\r\n";
        
$sql.= "`X".$I."OUI` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Id x Comp OUI ".$I."',\r\n";
        
$sql.= "`X".$I."ABS` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Id x Comp ABS ".$I."',\r\n";
        
$sql.= "`X".$I."NON` DECIMAL(11,2) DEFAULT 1 COMMENT 'Score Id x Comp NON ".$I."',\r\n";
    }
    
$sql.= "`TMP` datetime DEFAULT NULL COMMENT 'Dernier increment'\r\n";
    
$sql.= ") ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";

//    echo "\t<debug><![CDATA[SQL THIS : ".$sql."]]></debug>\r\n";

    
mysql_query($sql) or die (mysql_error());
    echo 
"<textarea>".$sql."</textarea>\r\n";
    
mysql_query("CHECK TABLE `results`;") or die (mysql_error());
    echo 
"<h3>SQL CHECK : `results`</h3>\r\n";
    
mysql_query("OPTIMIZE TABLE  `results`;") or die (mysql_error());
    echo 
"<h3>SQL OPTIMIZE : `results`</h3>\r\n";
    
// INSERT LE SEUL ENREGISTREMENT
    
if (mysql_num_rows(mysql_query("SELECT * FROM `results`")) == 0)
        
mysql_query("INSERT INTO `results` (TMP) VALUES (NOW())") or die (mysql_error());

    die(
"</body></html>");
}


//========================================================================
// LE FICHIER CONFIG DU SERVEUR DE STOCKAGE
//========================================================================
include_once("./cfg/cfg_vote.php");
if (
file_exists("./cfg/".$servercfg)) include_once("./cfg/".$servercfg);
$http_url "https://".$_SERVER['HTTP_HOST'];

//========================================================================
// CONNEXION AU SERVEUR DE BDD 
//========================================================================
$dblink mysql_connect($masterhost$masterlogin$masterpasswd) or die("\t<error>Erreur MySQL ".mysql_error()."</error>\r\n</root>"); 
mysql_select_db($masterbase$dblink) or die("\t<error>Erreur MySQL : ".mysql_error()."</error>\r\n</root>");
$masterhost='';
$masterlogin='';
$masterpasswd='';


//========================================================================
// FAIRE PATIENTER LE VOTANT (ANTI FLOOD / BRUTAL HACKING) SAUF VOTATION POUR LES CLEFS ET LES SERVEURS OFFICIELS
//========================================================================
if (($_SERVER["REMOTE_ADDR"] != "127.0.0.1") && !in_array($_SERVER["REMOTE_ADDR"], $VotationServerIps)) usleep(rand(100000500000));


//========================================================================
// ACCEPTER LE CROSS-DOMAIN DEPUIS https://www.votation.fr
//========================================================================
if (isset($_SERVER['HTTP_ORIGIN'])) switch ($_SERVER['HTTP_ORIGIN']) {
    case 
'https://www.votation.fr':
    
header('Access-Control-Allow-Origin: '.$_SERVER['HTTP_ORIGIN']);
    
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
    
header('Access-Control-Max-Age: 1000');
    
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
    break;
}


//========================================================================
// ENTETE ET CONFIGURATION
//========================================================================
ini_set('default_charset''utf-8');
header('Content-Type: text/xml; charset=utf-8');
header('Last-Modified: ' date('r'));
header("Expires: ".date('D, d M Y H:i:s')." GMT");
header("Content-Disposition: inline; filename='".str_replace("/"""$_SERVER["REQUEST_URI"])."'"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: public");


//========================================================================
// DEBUT DU XML
//========================================================================
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
echo 
"<root>\r\n";

//========================================================================
// POUR UNE NOUVELLE CLEF PUBLIQUE VERIF QUE CA VIENT DU SERVEUR VOTATION.FR
//========================================================================
if (isset($_POST['UID']) && isset($_POST['IDS']) && isset($_POST['UNS']) && isset($_POST['DON']))
{
    if (
in_array($_SERVER["REMOTE_ADDR"], $VotationServerIps) || ($_SERVER["REMOTE_ADDR"] == "127.0.0.1"))
    {
        
// VERIF QUE VOTATION PASSE LE BON KEYCODE
        
if ($_POST['KeyCode'] == $VotationKeyCode)
        {
            
$UID preg_replace("/[^A-Za-z0-9]/"''$_POST['UID']);
            
$IDS $_POST['IDS'];
            
$UNS $_POST['UNS'];
            
$DON $_POST['DON'];
            
$USK rand(100000999999);
            
// ON TEST UNE UPDATE SI LE UID EXISTE DEJA SINON ON AJOUTE
            
mysql_query("UPDATE `ballots` SET USK='".$USK."', IDS='".$IDS."', UNS='".$UNS."', DON='".$DON."' WHERE UID='".$UID."' AND PostTime IS NULL") or die (mysql_error());
            if (
mysql_affected_rows() == 0)
                
mysql_query("INSERT INTO `ballots` (`UID`, `USK`, `IDS`, `UNS`, `DON`, `AddTime`) VALUES ('".$UID."', '".$USK."', '".$IDS."', '".$UNS."', '".$DON."', NOW())") or die (mysql_error());
            echo 
"\t<USK>".$USK."</USK>\r\n";
        }
        else die(
"\t<error>WRONG_KEYS_CODE</error>\r\n</root>");
    }
    else die(
"\t<error>VOTATION_SERVER_ONLY</error>\r\n</root>");
}


//========================================================================
// UN BULLETIN DE VOTE ARRIVE DEPUIS UNE ADRESSE DIFFÉRENTE
//========================================================================
//echo "\t<debug>POST=".print_r($_POST, true)."</debug>\r\n";
if (isset($_POST['UID']) && isset($_POST['USK']) && isset($_POST['PNG']) && isset($_POST['VOT']))
{
    if (!
in_array($_SERVER["REMOTE_ADDR"], $VotationServerIps))
    {
        if (
$_VOTER mysql_fetch_assoc(mysql_query("SELECT * FROM `ballots` WHERE `UID`='".addslashes($_POST['UID'])."' AND `USK`='".addslashes($_POST['USK'])."'")) or die (mysql_error()))
        {
            
$VOT explode("|"$_POST['VOT']);
            if (
count($VOT) == $VotationProjectCount)
            {
                
// Concatener les choix : créer le répertoire et écrire la requete
                
$reqarg "";
                for (
$I=0$I<$VotationProjectCount$I++)
                {
                    
$VotationDir.="/".($I+1).$VOT[$I];
                    
$reqarg.="V".($I+1)."='".$VOT[$I]."', ";
                }
                
// Créer ou vérifier la presence du répertoire
                
if (is_dir("./".$VotationDir) || mkdir("./".$VotationDir0755true))
                {
                    
// Suprimer l'entête
                    
$data urldecode($_POST['PNG']);
                    
$data str_replace(' ''+'$data);
                    
$data str_replace('data:image/png;base64,'''$data);
                    
$md5 md5($data);
                    if (
strlen($data) < 600000)
                    {
                        
$data base64_decode($data);
                        
$file "/".$VotationDir."/".$md5.".png";
                        
$fileUrl $http_url.$file;
                        
$newimage imagecreatefromstring($data);
                        if (
$newimage !== false)
                        {
                            
//imagesavealpha($newimage, true);
                            
imagepng($newimage".".$file9);
                            
imagedestroy($newimage);
                            if (
file_exists(".".$file))
                            {
                                
// INCREMENTER LES COMPTEURS
                                
$sql "UPDATE `results` SET ";
                                for (
$I=0$I<$VotationProjectCount$I++)
                                {
                                    
$sql.= "`T".($I+1).$VOT[$I]."` = `T".($I+1).$VOT[$I]."` + 1, ";
                                    
$sql.= "`I".($I+1).$VOT[$I]."` = `I".($I+1).$VOT[$I]."` + ".($_VOTER['IDS']/100).", ";
                                    
$sql.= "`U".($I+1).$VOT[$I]."` = `U".($I+1).$VOT[$I]."` + ".($_VOTER['UNS']/100).", ";
                                    
$sql.= "`F".($I+1).$VOT[$I]."` = `F".($I+1).$VOT[$I]."` + ".($_VOTER['DON']).", ";
                                    
$sql.= "`X".($I+1).$VOT[$I]."` = `X".($I+1).$VOT[$I]."` + ".round($_VOTER['IDS']*$_VOTER['UNS']/100002).", ";
                                }
                                
$sql.= "`TMP` = NOW() WHERE 1=1";
                                echo 
"\t<sql>".$sql."</sql>\r\n";
                                
mysql_query($sql) or die (mysql_error());

//                                echo "\t<debug><![CDATA[".$data."]]></debug>\r\n";
                                
echo "\t<success>".$fileUrl."</success>\r\n";
                                
mysql_query("UPDATE `ballots` SET MD5='".$md5."', ".$reqarg." PostTime=NOW() WHERE UID='".addslashes($_POST['UID'])."'") or die (mysql_error());
                                
                                
                                
// RENVOYER LES RESULTATS
                                
$results mysql_query("SELECT * FROM `results`") or die (mysql_error());
                                echo 
"\t<resultString>".implode("|"mysql_fetch_row($results))."</resultString>\r\n";
                            }
                            else echo 
"\t<error>L'image ".$file." n'a pas pu être enregistrée.</error>\r\n";
                        }
                        else echo 
"\t<error>L'image n'a pas pu être crée.</error>\r\n";
                    }
                    else echo 
"\t<error>L'image est trop volumineuse. (>0.5Mo) La taille recomandées est 250x250.</error>\r\n";
                }
                else echo 
"\t<error>Impossible de créer le répertoire.</error>\r\n";
            }
            else echo 
"\t<error>".$VotationProjectCount." projets sont à voter. Vous devez vous prononcer pour (OUI), contre (NON), ou abstention (ABS).</error>\r\n";
        }
        else die (
"\t<error>VOTER_UID-USK_MISMATCH</error>\r\n</root>");
    }
    else die(
"\t<error>VOTATION_CUSTOMER_ONLY</error>\r\n</root>");
}


//========================================================================
// AFFICHER LES RESULTATS EN COURS
//========================================================================
if (isset($_GET['results'])) 
{
    
$results mysql_query("SELECT * FROM `results`") or die (mysql_error());
    echo 
"\t<results>\r\n";
    foreach(
mysql_fetch_assoc($results) as $key => $value)
        echo 
"\t\t<".$key.">".$value."</".$key.">\r\n";
    echo 
"\t</results>\r\n";
}

//========================================================================
// SURVEILLANCE DU FORMULAIRE, LIBRAIRIES, CONFIG DE votation.fr
// COMPARER MD5 AVEC MD5 DE LA COPIE LOCALE (SE FAIT EN LOCALHOST)
//========================================================================
/*
if (isset($_GET['track']) && (($_SERVER["REMOTE_ADDR"] == "127.0.0.1") || ($_SERVER["REMOTE_ADDR"] == $_SERVER['SERVER_ADDR'])))
{
    $ListeOfficielle = Array (
        'Form' => 'http://www.votation.fr',
        'Lib' => 'http://www.votation.fr/lib/votation.js',
        'Config' => 'http://www.votation.fr/xml.php?config',
    );

    foreach ($ListeOfficielle as $key => $value)
    {
        $source = file_get_contents($value);
        echo "\t<Script>\r\n";
        echo "\t\t<Name>".$key."</Name>\r\n";
        echo "\t\t<Url>".$value."</Url>\r\n";
        echo "\t\t<Len>".strlen($source)."</Len>\r\n";
    //    echo "\t\t<Deb><![CDATA[".substr($source, 0, 30)."]]></Deb>\r\n";
    //    echo "\t\t<Fin><![CDATA[".substr($source, -30)."]]></Fin>\r\n";
        echo "\t\t<Crc>".md5($source)."</Crc>\r\n";
        echo "\t</Script>\r\n";

        // Historiser les modifications éventuelles et signaler en cas de changement du contenu pendant période de lecture
    }
}
*/


//========================================================================
// INFO DE FIN DE PAGE
//========================================================================
echo "\t<info>\r\n";
echo 
"\t\t<sql>ballots</sql>\r\n";
echo 
"\t\t<res>results</res>\r\n";
echo 
"\t\t<dir>".$VotationDir."</dir>\r\n";
echo 
"\t\t<cfg>".$servercfg."</cfg>\r\n";
echo 
"\t</info>\r\n";
echo 
"\t<time>".date('Y-m-d H:i:s')."</time>\r\n";
echo 
"\t<ms>".microdelai($executionstarttime)."</ms>\r\n";
echo 
"\t<url>".$_SERVER["REQUEST_URI"]."</url>\r\n";
echo 
"\t<you>".$_SERVER["REMOTE_ADDR"]."</you>\r\n";
echo 
"\t<me>".$_SERVER['SERVER_ADDR']."</me>\r\n";
echo 
"\t<uri>".$_SERVER['HTTP_HOST'].$_SERVER["REQUEST_URI"]."</uri>\r\n";
echo 
"\t<php>".__FILE__."</php>\r\n";
echo 
"</root>\r\n";


?>

http://www.monserveur.fr/htm.php (UrlRewrite >> index.htm) [2017-09-24 18:21:41]

001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021:
022:
023:
024:
025:
026:
027:
028:
029:
030:
031:
032:
033:
034:
035:
036:
037:
038:
039:
040:
041:
042:
043:
044:
045:
046:
047:
048:
049:
050:
051:
052:
053:
054:
055:
056:
057:
058:
059:
060:
061:
062:
063:
064:
065:
066:
067:
068:
069:
070:
071:
072:
073:
074:
075:
076:
077:
078:
079:
080:
081:
082:
083:
084:
085:
086:
087:
088:
089:
090:
091:
092:
093:
094:
095:
096:
097:
098:
099:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
<?php

// ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //
//                              ---   VOTATION.FR   ---                            //
//                                                                                 //
// Copyright (c) 2016 David Espic. Tous droits Réservés.                           //
// Permission d'utiliser, copier, modifier et distribuer le logiciel               //
// ainsi que sa documentation pour toute application gratuitement                  //
// sous condition que le présent copyright soit apparant sur chaque copie.         //
//                                                                                 //
// Remerciements spécial à Sylvain Viart (SysAdmin) sylvain@opensource-expert.com  //
// Remerciements aussi à Bruno Miguel (Web Design) antunes@geedesign.fr            //
//                                                                                 //
// Remerciements à Linus Torvalds (Linux) et Rasmus Lerdorf (PHP) et toute         //
// la comunauté open-source pour les outils (W3C / Mozilla / Chromium...)          //
//                                                                                 //
// ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //


//========================================================================
// DEBUT DU CHRONOMETRE DE SCRIPT
//========================================================================
$executionstarttime=microtime();
session_start();
$_SESSION['timestamp']=date('U');

error_reporting(E_ALL);

//========================================================================
// VARIABLES DE BASE (CERTAINES DOIVENT PASSER AU FICHIER CFG)
//========================================================================
include_once("./cfg/cfg_vote.php");
if (
file_exists("./cfg/".$servercfg)) include_once("./cfg/".$servercfg); else $TabserverIPs = array();
$http_url "https://".$_SERVER['HTTP_HOST'];


//========================================================================
// FAIRE PATIENTER LE CLIENT
//========================================================================
usleep(rand(100000500000));


//========================================================================
// CONNEXION AU SERVEUR DE BDD 
//========================================================================
$dblink mysql_connect($masterhost$masterlogin$masterpasswd) or die("\t<error>Erreur MySQL ".mysql_error()."</error>\r\n</root>"); 
mysql_select_db($masterbase$dblink) or die("\t<error>Erreur MySQL : ".mysql_error()."</error>\r\n</root>");
$masterhost='';
$masterlogin='';
$masterpasswd='';


//========================================================================
// ENTETES DIVERSES
//========================================================================
header('Last-Modified: ' date('r'filectime(__FILE__)));
header("Expires: ".date('r'time()+3600)); // date('D, d M Y H:i:s')." GMT" // Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
header("Content-Disposition: inline; filename='".str_replace("/"""$_SERVER["REQUEST_URI"])."'"); 
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("content-language: ".$goltog_lang);
header('Content-Type: text/html; charset=utf-8');
ini_set('default_charset''utf-8');
set_time_limit(1);


//========================================================================
// RENVOYER LES RESULTATS
//========================================================================
$_RESULTS mysql_query("SELECT * FROM `".$resultstable."`") or die (mysql_error()) or die (mysql_error());
$_RESULT implode("|"mysql_fetch_row($_RESULTS));
?>

<html>
<head>
    <meta charset="UTF-8">
    <title>Resultat votation <?php echo $$VotationDate ?></title>
    <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0' >
    <link rel='apple-touch-icon-precomposed' sizes='120x120' href='./img/Logo_120px.png' >
    <meta property='og:url' content='<?php echo $http_url?>'>
    <meta property='og:type' content='website'>
    <meta property='og:title' content='Voter Oui ! Elire Non !'>
    <meta property='og:description' content='Un outil au service de la démocratie.'>
    <meta property='fb:app_id' content='https://www.facebook.com/votation.fr/'>
    <meta property='og:image' content='<?php echo $http_url?>/img/OgLogo.png'>
    <meta property='og:image:type' content='image/png'>
    <meta property='og:image:width' content='200'>
    <meta property='og:image:height' content='200'>
    <style>

#Wrap { background-color: #DDD; font-size:12px; text-align:center; max-width:660px; margin-left:auto; margin-right:auto; background-image:url(/img/Mariane.png); background-repeat: no-repeat; background-position: bottom right; background-size: contain; }
#Header, #ResultsList { display:block; padding:10px; margin:20px; border:solid 1px grey; border-radius:5px; background-color:white; }

li { list-style-type: none; }
a { text-decoration: underline; cursor:pointer; color:#333; }

#ResultsList li { min-width:600px; max-width:600px; padding:0px; font-size:10px; text-align:left; background-color:#FFFFFF; }
.RES { background-color:#FFFFFF; text-align:right; color:black; display:inline-block; height:12px; width:250px; margin:0px 0px 3px 0px; padding:1px 1px 1px 0px;}
.OUI { background-color:#234D9B; text-align:right; color:white; display:inline-block; height:12px; margin:0px 0px 3px 0px; padding:1px 1px 1px 0px; }
.ABS { background-color:#DDDDDD; text-align:center; color:#888; display:inline-block; height:12px; margin:0px 0px 3px 0px; padding:1px 0px 1px 0px; }
.NON { background-color:#E53916; text-align:left; color:white; display:inline-block; height:12px; margin:0px 0px 3px 0px; padding:1px 0px 1px 1px; }
.X { font-size:16px; height:18px; padding-top:2px; padding-bottom:2px; }

    </style>
<script type='text/javascript' >

//============================================
// Fonction de remplacement à document.getElementById()
//============================================
function dge(id)
{
    return document.getElementById(id);
}
//============================================
// AFFICHER LES RESULTATS D'UNE QUESTION / SUJET
//============================================
function displayResult(R, OUI, ABS, NON, S, label, unit)
{
    OUI = parseFloat(OUI);
    ABS = parseFloat(ABS);
    NON = parseFloat(NON);
    
    var TOT = OUI + ABS + NON;
    var OUI100 = Math.round(100 * OUI / TOT);
    var ABS100 = Math.round(100 * ABS / TOT);
    var NON100 = Math.round(100 * NON / TOT);
    
    var LEN = 300;
    var OUILEN = Math.round(LEN * OUI / TOT);
    var NONLEN = Math.round(LEN * NON / TOT);
    var ABSLEN = LEN - OUILEN - NONLEN;
    
    console.log("Rank="+R+" OUI="+OUI+" ABS="+ABS+" NON="+NON+" TOT="+TOT+" {"+S+" "+label+"}");
    console.log("OUILEN="+OUILEN+" ABSLEN="+ABSLEN+" NONLEN="+NONLEN);

    dge("RES"+R+S).innerHTML = label;

    if (OUI100>5) dge("OUI"+R+S).innerHTML = OUI100+"%";
    else dge("OUI"+R+S).innerHTML = "-";
        
    if (ABS100>5) dge("ABS"+R+S).innerHTML = ABS100+"%";
    else dge("ABS"+R+S).innerHTML = "-";

    if (NON100>5) dge("NON"+R+S).innerHTML = NON100+"%";
    else dge("NON"+R+S).innerHTML = "-";

    dge("OUI"+R+S).title = "OUI : " + OUI + unit + " ("+OUI100+"%)";
    dge("ABS"+R+S).title = "ABS : " + ABS + unit + " ("+ABS100+"%)";
    dge("NON"+R+S).title = "NON : " + NON + unit + " ("+NON100+"%)";

    dge("OUI"+R+S).style.width = OUILEN+"px";
    dge("ABS"+R+S).style.width = ABSLEN+"px";
    dge("NON"+R+S).style.width = NONLEN+"px";
}
//============================================
// FONCTION AFFICHER TOUS LES RESULTATS TEMPORAIRES
//============================================
function displayResults()
{
    var resultString = '<?php echo $_RESULT?>';
    var Tab = resultString.split('|');
    var count = <?php echo count($TabProjects); ?>;
    
    // Si on a bien le bon nombre de valeurs
    if (Tab.length = 15 * count + 1)
    {
        // Pour chaque question / sujet
        for (var i=0; i<count; i++)
        {
            var oui = parseInt(Tab[15*i+0]);
            var abs = parseInt(Tab[15*i+1]);
            var non = parseInt(Tab[15*i+2]);
            dge("voterCount_"+(i+1)).innerHTML = "(" + (oui+non) + " décisions sur " + (oui+abs+non) + " votants)";
        
            displayResult(i+1, Tab[15*i+0], Tab[15*i+1], Tab[15*i+2], "T", "Par nombre de voix exprimées", " voix exprimées");
            displayResult(i+1, Tab[15*i+3], Tab[15*i+4], Tab[15*i+5], "I", "Pondéré par certification", " voix pondérées");
            displayResult(i+1, Tab[15*i+6], Tab[15*i+7], Tab[15*i+8], "U", "Pondéré par compréhension", " voix pondérées");
            displayResult(i+1, Tab[15*i+9], Tab[15*i+10], Tab[15*i+11], "F", "Pondéré par total les dons", "€");
            displayResult(i+1, Tab[15*i+12], Tab[15*i+13], Tab[15*i+14], "X", "Pondérés par certification et compréhension", " voix pondérées");
        }
    }
}

</script>

</head>

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/fr_FR/all.js#xfbml=1";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<body id='Wrap' >

<!-- Debut du contenu -->
<div id='Header' >
<img src='./img/EnteteVotation.png' style='width:100%; max-width:600px;' alt='Voter Oui Elire Non' >
<h1>Résultats temporaires de la votation du <?php echo $VotationDate?> :</h1>
</div>
<ol id='ResultsList' >
<?php $I=1// LES RESULTATS DES PROJETS
foreach ($TabProjects as $_PROJECT)
{
    echo 
"<li><h3>".$_PROJECT." <span id='voterCount_".$I."' ></span></h3>\r\n";
    echo 
"<div class='RES' id='RES".$I."T' ></div>";
    echo 
"<div class='OUI' id='OUI".$I."T' ></div>";
    echo 
"<div class='ABS' id='ABS".$I."T' ></div>";
    echo 
"<div class='NON' id='NON".$I."T' ></div>";
    echo 
"<br>";
    echo 
"<div class='RES' id='RES".$I."I' ></div>";
    echo 
"<div class='OUI' id='OUI".$I."I' ></div>";
    echo 
"<div class='ABS' id='ABS".$I."I' ></div>";
    echo 
"<div class='NON' id='NON".$I."I' ></div>";
    echo 
"<br>";
    echo 
"<div class='RES' id='RES".$I."U' ></div>";
    echo 
"<div class='OUI' id='OUI".$I."U' ></div>";
    echo 
"<div class='ABS' id='ABS".$I."U' ></div>";
    echo 
"<div class='NON' id='NON".$I."U' ></div>";
    echo 
"<br>";
    echo 
"<div class='RES' id='RES".$I."F' ></div>";
    echo 
"<div class='OUI' id='OUI".$I."F' ></div>";
    echo 
"<div class='ABS' id='ABS".$I."F' ></div>";
    echo 
"<div class='NON' id='NON".$I."F' ></div>";
    echo 
"<br>";
    echo 
"<div class='RES' id='RES".$I."X' ></div>";
    echo 
"<div class='OUI X' id='OUI".$I."X' ></div>";
    echo 
"<div class='ABS X' id='ABS".$I."X' ></div>";
    echo 
"<div class='NON X' id='NON".$I."X' ></div>";
    echo 
"</li>\r\n";
    
$I++;
?>
</ol>
<div class="fb-like" data-href="http://www.votation.fr" data-send="true" data-width="450" data-show-faces="true"></div>

<div id='footer' ><a href='https://www.votation.fr/votation.htm' target='_blank' >La page de vote</a> | <a href='https://www.votation.fr/index2.php' target='_blank' >La plateforme coopérative</a> | <a href='tel:0606576757' >Support téléphonique</a> | <a href='mailto:contact@votation.fr' >Support courrier</a> </div>
<script type='text/javascript' >displayResults();</script>
</body>
</html>



<?php
mysql_close
($dblink);
?>

GitHub Download sources

/etc/crontab

# m h dom mon dow user command
0 * * * * root wget -q -O - https://localhost/?setup > /dev/null # UPDATE CONFIG HOURLY
0 * * * * root wget -q -O - https://localhost/?track > /dev/null # TRACK CONFIG MODIF