找回密码
 新注册用户
搜索
查看: 5219|回复: 25

SETI@China签名档

[复制链接]
发表于 2004-11-23 13:41:59 | 显示全部楼层 |阅读模式
回复

使用道具 举报

 楼主| 发表于 2004-11-23 13:46:21 | 显示全部楼层

http://www.visualecho.org/setibanner/

[ Last edited by 烦人 on 2004-11-23 at 01:47 PM ]
回复

使用道具 举报

发表于 2004-11-23 15:28:49 | 显示全部楼层
很漂亮啊!
回复

使用道具 举报

发表于 2004-11-23 16:13:11 | 显示全部楼层
vonv  在 2004-11-23 03:28 PM 发表:

很漂亮啊!


确实漂亮,不过换签名就不想了,懒啊
回复

使用道具 举报

发表于 2004-11-23 16:50:29 | 显示全部楼层
老 song 可不懒!
光是每天下载的 wu 都要上 G !

都是在家用 ADSL 下的么?每天这么大流量,电信没意见吧?
回复

使用道具 举报

发表于 2004-11-23 16:53:41 | 显示全部楼层
要是能把小型机搬家里去就好了。20M专线
回复

使用道具 举报

发表于 2004-11-23 16:59:38 | 显示全部楼层
偶记得以前看过一个消息,重庆一家庭用户 ADSL 流量特大,电信去查,发现那位仁兄把左邻右舍都挂到了自家的 ADSL 线路上。
每月还收网络使用费!&^%*$……
也做了回 ISP 。
最后,电信把那家伙告到法院去了……

老 song 可要小心哦……电信会找麻烦的。
回复

使用道具 举报

发表于 2004-11-23 17:02:39 | 显示全部楼层
vonv  在 2004-11-23 16:59 发表:

偶记得以前看过一个消息,重庆一家庭用户 ADSL 流量特大,电信去查,发现那位仁兄把左邻右舍都挂到了自家的 ADSL 线路上。
每月还收网络使用费!&^%*$……
也做了回 ISP 。
最后,电信把那家伙告到法院去了 ...


不好意思!
这帖写长了点,老 song 都回复了!
没看见,不好意思啊!
回复

使用道具 举报

发表于 2004-11-23 17:03:27 | 显示全部楼层
这个单位电信不敢告,况且是合法的20M专线。

不过我家里的流量也比较大,是包月不限时的2M
回复

使用道具 举报

发表于 2004-11-23 17:12:21 | 显示全部楼层
song  在 2004-11-23 17:03 发表:

这个单位电信不敢告,况且是合法的20M专线。

不过我家里的流量也比较大,是包月不限时的2M


还是沿海好!成都这边 ADSL 包月最高速率才 1M !
回复

使用道具 举报

发表于 2004-11-23 18:35:23 | 显示全部楼层
偶这里都8M了,只是上传不爽,ADSL的最大缺点
回复

使用道具 举报

 楼主| 发表于 2004-11-23 18:40:29 | 显示全部楼层
二楼这个签名档真是中看不中用,更新太慢了..我估计设置的是每24小时更新一次
说到网速,俺又不得不来臭美一下了:家里是FTTB+LAN,单位里是100Mbps的光纤
回复

使用道具 举报

发表于 2004-11-23 20:28:33 | 显示全部楼层
在拉萨我有 512K的线路用已经觉得很不错了:)
回复

使用道具 举报

发表于 2004-11-23 21:41:33 | 显示全部楼层
是1MB还是1Mb?差八倍呢!我这里最高可以稳定在220kB/s下载,只要对方支持
回复

使用道具 举报

 楼主| 发表于 2004-11-23 22:49:15 | 显示全部楼层
二楼签名档的源码


  1. <?php
  2. $version = "1.10";

  3. // setistats XML/GIF banner
  4. // written by Multi-Dimensional Visual Echo (Roger C. Venable), [url]http://www.visualecho.org[/url]
  5. // Licensed under LGPL, see [url]http://www.gnu.org/copyleft/lesser.html[/url]
  6. //
  7. // Features:
  8. //  * XML fetch from SETI is proxyable
  9. //  * caches SETI XML to file so the SETI's XML feed is not overused
  10. //  * recovers well from unavailable XML data
  11. //  * usable in Linux or Windows PHP enabled web sites
  12. //  * uses a minimum of external/additional components
  13. //
  14. // Installation:
  15. //   To use, you need the 'curl' and Imagemagick 'convert' commands:
  16. //   See [url]http://curl.haxx.se/[/url] and [url]http://www.imagemagick.com/[/url]
  17. //
  18. //   CHANGE all the lines marked with *** CHANGE THIS ***
  19. //   CHECK  all the lines marked with *** CHECK THIS ***
  20. //
  21. // This micro-engine can easily be modified to use other background
  22. //   graphics and other XML feeds (i.e. Planetside).  Enjoy!
  23. //

  24. $debug = false; // *** CHECK THIS ***
  25. $scrap_dir = "/var/www/tmp/"; // *** CHANGE THIS ***
  26. $refresh_age = 86400; // twenty-four hours (DON'T SPAM SETI!)

  27. // this is the Imagemagick convert command, see [url]http://www.imagemagick.com[/url]
  28. $command = "/usr/bin/convert"; // *** CHANGE THIS ***

  29. // Usable system font directory
  30. $fontdir = "/usr/share/fonts/"; // *** CHANGE THIS ***
  31. $default_sysfont = "arial.ttf"; // *** CHANGE THIS ***

  32. // this is the base URL for SETI XML data
  33. $urlbase = "http://setiathome2.ssl.berkeley.edu/fcgi-bin/fcgi".'?'."cmd=user_xml".'&'."email=";
  34. // make proxy empty ("") to disable
  35. $proxy = ""; // *** CHANGE THIS ***
  36. // this is the  curl command, See [url]http://curl.haxx.se/[/url]
  37. $curlcmd = "/usr/bin/curl"; // *** CHANGE THIS ***

  38. // this is the background graphic
  39. $infile = $scrap_dir."seti_template.gif"; // *** CHECK THIS ***
  40.   
  41. $email = $_GET['email'];
  42. if ($email == '')
  43.   exit(0);

  44. // clean
  45. $email = substr(urlencode( $email ), 0, 255); // change if your email address is > 255
  46. $email = strip_tags( $email );

  47. $url = $urlbase.$email;

  48. // this is the XML file which will be updated if old
  49. $xmlfile = $scrap_dir."setistats_".str_replace("%", "Z", $email).".xml"; // *** CHECK THIS ***
  50. // files which will be deleted on next access after $refresh_age seconds
  51. $globber1 = $scrap_dir."setistats_*.xml"; // *** CHECK THIS ***

  52. // this is the output file
  53. $outfile = $scrap_dir."setistatgif_".str_replace("%", "Z", $email).".gif"; // *** CHECK THIS ***
  54. // files which will be deleted on next access after $refresh_age seconds
  55. $globber2 = $scrap_dir."setistatgif_*.gif"; // *** CHECK THIS ***

  56. if (!function_exists("file_get_contents")) {
  57.   function file_get_contents($filename, $use_include_path = 0) {
  58.     $data = ""; // just to be safe. Dunno, if this is really needed
  59.     $file = @fopen($filename, "rb", $use_include_path);
  60.     if ($file) {
  61.       while (!feof($file)) $data .= fread($file, 1024);
  62.       fclose($file);
  63.     }
  64.     return $data;
  65.   }
  66. }

  67. if ($debug)
  68. {
  69.   header("Content-type: text/html\n\n");
  70.   print "setistats.php version ".$version."<BR>";
  71.   print "Images will be refreshed after ".$refresh_age." seconds<BR>";
  72.   print "Using convert command: ".$command."<BR>";
  73.   print "Using background image: ".$infile."<BR>";
  74.   print "Using fonts in directory: ".$fontdir."<BR>";
  75. }
  76. else
  77.   header("Content-type: image/gif\n\n");

  78. if ($debug)
  79. {
  80.   print "Using XML file: ".$xmlfile."<BR>";
  81.   if (file_exists($xmlfile))
  82.     print "&nbsp;&nbsp;File mod time: ".filemtime($xmlfile)." (".(time() - filemtime($xmlfile))." seconds old), will refresh in: ".(filemtime($xmlfile) + $refresh_age - time())." seconds<BR>";
  83.   else
  84.     print "&nbsp;&nbsp;File does not exist, now: ".time()."<BR>";
  85. }

  86. if (!file_exists($xmlfile) || ((filemtime($xmlfile) + $refresh_age) <= time()))
  87. {
  88.   if (file_exists($xmlfile))
  89.     unlink($xmlfile);

  90.   if ( $proxy )
  91.     $cmd = $curlcmd." -x ".$proxy." -o ".$xmlfile." "".$url.""";
  92.   else
  93.     $cmd = $curlcmd." -o ".$xmlfile." "".$url.""";
  94.   
  95.   if ($debug)
  96.     print "Fetch command: ( $cmd )<BR>";
  97.   exec ($cmd,$result,$value);

  98.   if ($debug)
  99.     print "Should have created file: ".$xmlfile."<BR>";
  100. }

  101. if ($debug)
  102. {
  103.   print "Using output file: ".$outfile."<BR>";
  104.   if (file_exists($outfile))
  105.     print "&nbsp;&nbsp;File mod time: ".filemtime($outfile)." (".(time() - filemtime($outfile))." seconds old), will refresh in: ".(filemtime($outfile) + $refresh_age - time())." seconds<BR>";
  106.   else
  107.     print "&nbsp;&nbsp;File does not exist, now: ".time()."<BR>";
  108. }

  109. $kill_bad_gif = 0;
  110. if (!file_exists($outfile) || ((filemtime($outfile) + $refresh_age) <= time()))
  111. {
  112.   if (file_exists($outfile))
  113.     unlink($outfile);

  114.   $fillcolor = "white";
  115.   $last_color = "";
  116.   $last_pointsize = "";
  117.   $last_font = "";
  118.   
  119.   $txt = "";
  120.   $last_data = "";

  121.   $use_next_a = 1;
  122.   $elements = array(
  123.     "numresults" => array("format" => "%s", "font" => $default_sysfont, "pointsize" => "18", "color" => $fillcolor,
  124.       "x" => "150", "y" => "29", "func" => "intformat"),
  125.     "a" => array("format" => "%s", "font" => $default_sysfont, "pointsize" => "12", "color" => "yellow",
  126.       "x" => "150", "y" => "12", "func" => "use_only_first_a"),
  127.     "resultsperday" => array("format" => "%s Results per day", "font" => $default_sysfont, "pointsize" => "10", "color" => $fillcolor,
  128.       "x" => "280", "y" => "31", "func" => ""),
  129.     "lastresulttime" => array("format" => "Last Result: %s GMT", "font" => $default_sysfont, "pointsize" => "10", "color" => $fillcolor,
  130.       "x" => "280", "y" => "40", "func" => ""),
  131.     "num_samerank" => array("format" => "Results Processed", "font" => $default_sysfont, "pointsize" => "10", "color" => $fillcolor,
  132.       "x" => "150", "y" => "40", "func" => ""),
  133.     "name" => array("format" => "%s", "font" => $default_sysfont, "pointsize" => "12", "color" => "yellow",
  134.       "x" => "150", "y" => "12", "func" => "got_name"),
  135.     "avecpu" => "0",
  136.     "usertime" => array("format" => "%s user time", "font" => $default_sysfont, "pointsize" => "10", "color" => $fillcolor,
  137.       "x" => "280", "y" => "22", "func" => ""),
  138.     "regdate" => "0",
  139.     "rank" => "0",
  140.     "ranktotalusers" => "0",
  141.     "cputime" => array("format" => "%s CPU", "font" => $default_sysfont, "pointsize" => "10", "color" => $fillcolor,
  142.       "x" => "400", "y" => "22", "func" => ""),
  143.     "top_rankpct" => array("format" => "Top Rank %s", "font" => $default_sysfont, "pointsize" => "10", "color" => $fillcolor,
  144.       "x" => "400", "y" => "31", "func" => "neg_percent")
  145.     );
  146.   
  147.   $data = file_get_contents($xmlfile) or ($data = "x0YgnRp");

  148.   if ($data == "x0YgnRp")
  149.   {
  150.     if ($debug)
  151.       print "<B>Error reading XML data</B><BR>";
  152.     $txt = " -pointsize 32 -font ".$fontdir.$default_sysfont." -draw "text 170,25 'Error'" -pointsize 10";
  153.     $txt = "$txt -font ".$fontdir.$default_sysfont." -draw "text 170,35 'XML DATA UNAVAILABLE'"";
  154.   }
  155.   else if ($data !== false)
  156.   {
  157.     if ($debug)
  158.       print "Got ".strlen($data)." bytes of XML data from $xmlfile<BR>";
  159.     $xml_parser = xml_parser_create();
  160.     xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);
  161.     xml_set_element_handler($xml_parser, "startElement", "endElement");
  162.     xml_set_character_data_handler($xml_parser, "characterData");
  163.   
  164.     if (!xml_parse($xml_parser, $data, TRUE))
  165.     {
  166.       $error = sprintf("XML error at line %d: %s", xml_get_current_line_number($xml_parser),
  167.         xml_error_string(xml_get_error_code($xml_parser)));

  168.       if ($debug)
  169.       {
  170.         print "<B>Error parsing XML data: $error</B><BR>";
  171.       }

  172.       if ( $error == "XML error at line 4: syntax error" )
  173.         $error = "XML feed from SETI@home is temporarily down or disabled";
  174.       if ( $error == "XML error at line 4: junk after document element" )
  175.         $error = "XML feed from SETI@home is temporarily down or disabled";

  176.       unlink($xmlfile);
  177.       $kill_bad_gif = 1;
  178.       $txt = " -pointsize 32 -font ".$fontdir.$default_sysfont." -draw "text 170,25 'Error'" -pointsize 10";
  179.       $txt = "$txt -font ".$fontdir.$default_sysfont." -draw "text 170,35 '$error'"";
  180.     }
  181.   
  182.     xml_parser_free($xml_parser);
  183.   }
  184.   
  185.   $command = $command . " -antialias ";
  186.   $command = $command . $txt . " " . $infile . " " . $outfile;
  187.   
  188.   if ($debug)
  189.     print "Command: ".$command."<BR>";
  190.   exec ($command,$result,$value);
  191.   if ($debug)
  192.     print "Should have created file: ".$outfile."<BR>";
  193. }
  194.   
  195. if (!$debug)
  196. {
  197.   $img = file_get_contents($outfile);
  198.   echo $img;
  199. }

  200. if ( $kill_bad_gif > 0 )
  201.   unlink($outfile);

  202. // wipe old files
  203. foreach (glob($globber1) as $outfile)
  204. {
  205.   if ((filemtime($outfile) + $refresh_age) <= time())
  206.   {
  207.     if ($debug)
  208.       print "Destroying old file: ".$outfile."<BR>";
  209.     unlink($outfile);
  210.   }
  211. }
  212. foreach (glob($globber2) as $outfile)
  213. {
  214.   if ((filemtime($outfile) + $refresh_age) <= time())
  215.   {
  216.     if ($debug)
  217.       print "Destroying old file: ".$outfile."<BR>";
  218.     unlink($outfile);
  219.   }
  220. }

  221. exit();

  222. function startElement($parser, $name, $attrs)
  223. {
  224. }

  225. function endElement($parser, $name)
  226. {
  227.   global $last_data, $elements, $txt, $fontdir, $debug, $last_pointsize, $last_font, $last_color;

  228.   $last_data = ltrim($last_data);
  229.   if ( $last_data && is_array($elements[$name]) )
  230.   {
  231.     if ($elements[$name]["func"] != "" && function_exists($elements[$name]["func"]))
  232.     {
  233.       $func = $elements[$name]["func"];
  234.       $last_data = $func($last_data);
  235.     }

  236.     if ($debug)
  237.       print "Parsed XML element: ".$name." = ".$last_data."<BR>";

  238.     if ( $last_data )
  239.     {
  240.       $element = sprintf( $elements[$name]["format"], $last_data );
  241.       if ( $elements[$name]["pointsize"] != $last_pointsize )
  242.         $txt = "$txt -pointsize ".$elements[$name]["pointsize"];
  243.       $last_pointsize = $elements[$name]["pointsize"];
  244.       if ( $elements[$name]["font"] != $last_font )
  245.         $txt = "$txt -font ".$fontdir.$elements[$name]["font"];
  246.       $last_font = $elements[$name]["font"];
  247.       if ( $elements[$name]["color"] != $last_color )
  248.         $txt = "$txt -fill ".$elements[$name]["color"];
  249.       $last_color = $elements[$name]["color"];
  250.       $txt = "$txt -draw "text ";
  251.       $txt = $txt.$elements[$name]["x"].",".$elements[$name]["y"]." '$element'"";
  252.     }
  253.   }
  254.   $last_data = "";
  255. }

  256. function characterData($parser, $data)
  257. {
  258.   global $last_data;
  259.   if ( trim($data) != "" )
  260.     $last_data = $data;
  261. }

  262. function use_only_first_a($data)
  263. {
  264.   global $use_next_a;
  265.   if ( $use_next_a > 0 )
  266.   {
  267.     $use_next_a = 0;
  268.     return( $data );
  269.   }
  270.   else
  271.     return( "" );
  272. }

  273. function got_name($data)
  274. {
  275.   global $use_next_a;
  276.   $use_next_a = 0;
  277.   return( $data );
  278. }

  279. function intformat($data)
  280. {
  281.   return( number_format($data) );
  282. }

  283. function neg_percent($data)
  284. {
  285.   return( strval( 100.0 - floatval($data) )."%%" );
  286. }

  287. ?>
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 新注册用户

本版积分规则

论坛官方淘宝店开业啦~
欢迎大家多多支持基金会~

Archiver|手机版|小黑屋|中国分布式计算总站 ( 沪ICP备05042587号 )

GMT+8, 2024-6-29 05:08

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表