stats par promo, et qqs php qui ont pas besoin de templates ...
authorx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 21:17:42 +0000 (21:17 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 21:17:42 +0000 (21:17 +0000)
htdocs/cacert.php [new file with mode: 0644]
htdocs/getphoto.php [new file with mode: 0644]
htdocs/stats/nb_by_promo.php [new file with mode: 0644]
templates/stats/nb_by_promo.tpl [new file with mode: 0644]

diff --git a/htdocs/cacert.php b/htdocs/cacert.php
new file mode 100644 (file)
index 0000000..98404c4
--- /dev/null
@@ -0,0 +1,8 @@
+<?php
+  $fp=fopen("/etc/ssl/xorgCA/cacert.pem","r");
+  $data=fread($fp,10000);
+  fclose($fp);
+  Header("Content-Type: application/x-x509-ca-cert");
+  Header("Content-Length: ".strlen($data));
+  echo $data;
+?>
diff --git a/htdocs/getphoto.php b/htdocs/getphoto.php
new file mode 100644 (file)
index 0000000..9ac453d
--- /dev/null
@@ -0,0 +1,31 @@
+<?php
+require("db_connect.inc.php");
+require("controlpermanent.inc.php");
+require_once("appel.inc.php");
+require_once("validations.inc.php");
+
+// getdata.php3 - by Florian Dittmer <dittmer@gmx.net> 
+// Example php script to demonstrate the direct passing of binary data 
+// to the user. More infos at http://www.phpbuilder.com 
+// Syntax: getdata.php3?id=<id> 
+
+if(isset($_REQUEST['x'])) {
+       if(isset($_REQUEST['req']) && $_REQUEST['req']="true") {
+               $myphoto = PhotoReq::get_unique_request($_REQUEST['x']);
+               Header("Content-type: image/".$myphoto->mimetype);
+               echo $myphoto->data;
+       } else {
+               $result = mysql_query("SELECT attachmime, attach FROM photo WHERE uid = '{$_REQUEST['x']}'");
+
+               if(  list($type,$data) = @mysql_fetch_row($result) ) {
+                       Header(  "Content-type: image/$type");
+                       echo $data;
+               } else {
+                       Header(  "Content-type: image/png");
+                       $f=fopen(url("none.png"),"r");
+                       echo fread($f,30000);
+                       fclose($f);
+               }
+       }
+}
+?>
diff --git a/htdocs/stats/nb_by_promo.php b/htdocs/stats/nb_by_promo.php
new file mode 100644 (file)
index 0000000..2e2eaf8
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+require("auto.prepend.inc.php");
+new_skinned_page('stats/nb_by_promo.tpl', AUTH_COOKIE);
+
+$result = mysql_query("SELECT promo,COUNT(*) FROM auth_user_md5 WHERE promo > 1900 GROUP BY promo ORDER BY promo");
+$max=0; $min=3000;
+while(list($promo,$nb)=mysql_fetch_row($result)) {
+    $promo=intval($promo);
+    if(!isset($nbpromo[$promo/10]))
+        $nbpromo[$promo/10] = Array('','', '','', '','', '','', '','');
+    $nbpromo[$promo/10][$promo%10]=$nb;
+}
+
+$page->assign_by_ref('nbs', $nbpromo);
+$page->assign('min', $min-$min % 10);
+$page->assign('max', $max+10-$max%10);
+
+$page->display();
+?>
diff --git a/templates/stats/nb_by_promo.tpl b/templates/stats/nb_by_promo.tpl
new file mode 100644 (file)
index 0000000..9406d24
--- /dev/null
@@ -0,0 +1,35 @@
+{* $Id: nb_by_promo.tpl,v 1.1 2004-01-27 21:17:43 x2000habouzit Exp $ *}
+
+<div class="rubrique">
+  Inscrits par promo
+</div>
+
+<p class="normal">
+Voici le nombre d'inscrits par promo :
+</p>
+
+{dynamic}
+<table class="bicol" cellpadding="3" cellspacing="0" summary="Statistiques">
+  <tr>
+    <th></th>
+    <th>0</th><th>1</th><th>2</th><th>3</th><th>4</th>
+    <th>5</th><th>6</th><th>7</th><th>8</th><th>9</th>
+  </tr>
+  {foreach item=nb10 key=lustre from=$nbs}
+  <tr>
+    <th>{$lustre}-</th>
+    {foreach item=nb from=$nb10}
+    <td class="center">{$nb|default:"-"}</td>
+    {/foreach}
+  </tr>
+  {/foreach}
+</table>
+{/dynamic}
+
+<div class="rubrique">
+  Inscrits par promo en (%)
+</div>
+
+<img src="/stats/graph-promo2.png" />
+
+{* vim:set et sw=2 sts=2 sws=2: *}