The script looks generally correct. I've cleaned it up a bit and made some 
(minor) improvements and added it to GNUnet's contrib/ directory, I think it 
should be useful for people that run PHP but not CGI scripts.  

I suspect that your connect:492 error comes from an old public key in your 
data/hosts (did you maybe delete your .hostkey file at some point?).  I 
certainly do not see this relate to problems with the PHP script, and I've 
now tested the (attached) version, and it works just fine.

I'm also making a hostlist generated by this PHP script available under
http://gnunet.org/hostlist.php (should be the same as 
http://gnunet.org/hostlist which is generated using the "cat" approach 
described in the README).  However, the order of entries in the PHP script is 
randomized, which should be slightly better. 

Happy hacking!

Christian

On Monday 17 April 2006 11:07, Krasko Oleksandr wrote:
> hi once again today
>
> > >> * Webserver with CGI
> > >
> > > what vebserver and interpritator do you utillize in this case ??
> >
> > Any webserver with CGI support: Apache, IIS, maybe thttpd, maybe fnord,
> > ... ...
> > I don't understand.
>
> forget foolishness
>
> I made an attempt create a php (laziness to me install and configure
> interpritator for sh for Apache) script in place of hostlist.cgi wrote
> something such (run in localhost, apache ):
> =======
> <?php
> header("Content-Type: application/octet-stream\r\n\r\n");
> $extmas = array('6','8','12','17','23','25');
> $path = 'D:\Program Files\GNU\GNUnet\var\lib\GNUnet\data\hosts';
> if ($d = opendir($path)) {
> } else {
>       'Can\'t open dir'."\n";
> }
> $mas = array();
> while ($fname = readdir($d)) {
>       if (is_file($path.'/'.$fname)) {
>               $n = strpos($fname, '.');
>               $len = strlen($fname);
>               if (in_array(substr($fname, -1*($len-$n-1)), $extmas)) {
>                       $mas[] = array(intval(substr($fname, 
> -1*($len-$n-1))),$fname);
>               }
>       }
> }
> sort($mas);
> foreach ($mas as $val) {
>       echo file_get_contents($path.'/'.$val[1]);
> }
> ?>
> ======
> on localhost I not get errors,on removehost I get next error:"Failure
> of at connect.c:492." :(
> before tim as run nods (gnunetd -d) on machines I copy all of hostkey
> on removehost and localhost in the proper directories(data\hosts).
> Appropriate code that did I write? how can he be improved? and is it
> needed?
>
>
> _______________________________________________
> Help-gnunet mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/help-gnunet

Attachment: hostlist.php
Description: application/php

_______________________________________________
Help-gnunet mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnunet

Reply via email to