Re: [PHP] Wiki recommendation?

2009-11-26 Thread Lester Caine

Skip Evans wrote:

Hey all,

Thanks much for the recommendations. I'll check them out.

We don't need fine grained control over access; basically admins that 
can modify content and the public who cannot.


But right now DocuWiki is sounding good, and I'd rather, for some 
strange reason, not use a DB, although I can't justify that in any 
rational way. I mean, MySQL is already on the machine.


Perhaps good enough reason for NOT wanting to use a database ;)
Although a lot more stable than it used to be - but until one can run a backup 
transparently at intervals is it really suitable for live data? My own live 
sites just mirror to a backup machine including a backup of the database 
automatically.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Detecting The Encoding Of A Text File

2009-11-26 Thread Nisse Engström
On Thu, 26 Nov 2009 06:55:31 +0200, Nitsan Bin-Nun wrote:

> Hi,
> 
> I have been trying for the last couple of hours to determine the
> encoding of a text file (.txt in windowz).
> 
> I have this code:
> 
> $contents = file_get_contents($config['
> txt_dir'] . $file);
> $encoding = mb_detect_encoding($contents,
> "UTF-8,ISO-8859-1,WINDOWS-1252"); //,Windows-1255
> 
> echo "||encoding:".$encoding."||";
> 
> if ($encoding == 'UTF-8')
> {
> $utfcontents = $contents;
> }
> else if ($encoding == 'ISO-8859-1')
> {
> $utfcontents = utf8_encode($contents);
> }
> 
> var_dump($utfcontents);
> 
> The $encoding is ISO-8859-1, the text file contains Hebrew characters, then
> I'm converting it to utf8.
> 
> The above code is outputing gibbrish, it seems that it has converted it in
> some way but not in the
> proper way that it should have converted it.

If you know that the file contains Hebrew, maybe you should
try converting from ISO-8859-8?


/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Wiki recommendation?

2009-11-26 Thread Olav
Jonathan Tapicer wrote:

> I also recommend dokuwiki (with a k, not c :) ):
> http://www.dokuwiki.org/

I will add just my 2 cts to that. I have used several wikis but I always 
come back to DokuWiki. Among other things that I like about it, like 
plugins, is the fact that it is file based. It can be nice sometimes to 
be able to make certain changes to your pages with a normal editor, 
search and replace tool or whatever.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Detecting The Encoding Of A Text File

2009-11-26 Thread Nitsan Bin-Nun
Someone have already suggested it but I haven't tried it yet.

The thing is that right now it contains Hebrew, but tommorrow this file will
be in German or any other accented language.
I'm trying to create a function which would detect the encoding and convert
it into UTF8.

(I don't have much experience in encoding.. :( )

2009/11/26 Nisse Engström 

> On Thu, 26 Nov 2009 06:55:31 +0200, Nitsan Bin-Nun wrote:
>
> > Hi,
> >
> > I have been trying for the last couple of hours to determine the
> > encoding of a text file (.txt in windowz).
> >
> > I have this code:
> >
> > $contents = file_get_contents($config['
> > txt_dir'] . $file);
> > $encoding = mb_detect_encoding($contents,
> > "UTF-8,ISO-8859-1,WINDOWS-1252"); //,Windows-1255
> >
> > echo "||encoding:".$encoding."||";
> >
> > if ($encoding == 'UTF-8')
> > {
> > $utfcontents = $contents;
> > }
> > else if ($encoding == 'ISO-8859-1')
> > {
> > $utfcontents = utf8_encode($contents);
> > }
> >
> > var_dump($utfcontents);
> >
> > The $encoding is ISO-8859-1, the text file contains Hebrew characters,
> then
> > I'm converting it to utf8.
> >
> > The above code is outputing gibbrish, it seems that it has converted it
> in
> > some way but not in the
> > proper way that it should have converted it.
>
> If you know that the file contains Hebrew, maybe you should
> try converting from ISO-8859-8?
>
>
> /Nisse
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] SOAP: Return object to client

2009-11-26 Thread Manoj Singh
Hi All,

I am implementing the web service through PHP SOAP library.

Actually I want to return the object to the client through web service so
that client can call all the methods of that object.

Please help me out.

Regards,
Manoj


Re: [PHP] Re: Detecting The Encoding Of A Text File

2009-11-26 Thread דניאל דנון
If windows notepad can detect encoding there must be a way to do it
yourself.

Maybe try to get the file's headers, I think it should also contain the
encoding of the file...

2009/11/26 Nitsan Bin-Nun 

> Someone have already suggested it but I haven't tried it yet.
>
> The thing is that right now it contains Hebrew, but tommorrow this file
> will
> be in German or any other accented language.
> I'm trying to create a function which would detect the encoding and convert
> it into UTF8.
>
> (I don't have much experience in encoding.. :( )
>
> 2009/11/26 Nisse Engström 
>
> > On Thu, 26 Nov 2009 06:55:31 +0200, Nitsan Bin-Nun wrote:
> >
> > > Hi,
> > >
> > > I have been trying for the last couple of hours to determine the
> > > encoding of a text file (.txt in windowz).
> > >
> > > I have this code:
> > >
> > > $contents = file_get_contents($config['
> > > txt_dir'] . $file);
> > > $encoding = mb_detect_encoding($contents,
> > > "UTF-8,ISO-8859-1,WINDOWS-1252"); //,Windows-1255
> > >
> > > echo "||encoding:".$encoding."||";
> > >
> > > if ($encoding == 'UTF-8')
> > > {
> > > $utfcontents = $contents;
> > > }
> > > else if ($encoding == 'ISO-8859-1')
> > > {
> > > $utfcontents = utf8_encode($contents);
> > > }
> > >
> > > var_dump($utfcontents);
> > >
> > > The $encoding is ISO-8859-1, the text file contains Hebrew characters,
> > then
> > > I'm converting it to utf8.
> > >
> > > The above code is outputing gibbrish, it seems that it has converted it
> > in
> > > some way but not in the
> > > proper way that it should have converted it.
> >
> > If you know that the file contains Hebrew, maybe you should
> > try converting from ISO-8859-8?
> >
> >
> > /Nisse
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>



-- 
Use ROT26 for best security


Re: [PHP] Re: Detecting The Encoding Of A Text File

2009-11-26 Thread Ashley Sheridan
On Thu, 2009-11-26 at 15:39 +0200, דניאל דנון wrote:

> If windows notepad can detect encoding there must be a way to do it
> yourself.
> 
> Maybe try to get the file's headers, I think it should also contain the
> encoding of the file...
> 
> 2009/11/26 Nitsan Bin-Nun 
> 
> > Someone have already suggested it but I haven't tried it yet.
> >
> > The thing is that right now it contains Hebrew, but tommorrow this file
> > will
> > be in German or any other accented language.
> > I'm trying to create a function which would detect the encoding and convert
> > it into UTF8.
> >
> > (I don't have much experience in encoding.. :( )
> >
> > 2009/11/26 Nisse Engström 
> >
> > > On Thu, 26 Nov 2009 06:55:31 +0200, Nitsan Bin-Nun wrote:
> > >
> > > > Hi,
> > > >
> > > > I have been trying for the last couple of hours to determine the
> > > > encoding of a text file (.txt in windowz).
> > > >
> > > > I have this code:
> > > >
> > > > $contents = file_get_contents($config['
> > > > txt_dir'] . $file);
> > > > $encoding = mb_detect_encoding($contents,
> > > > "UTF-8,ISO-8859-1,WINDOWS-1252"); //,Windows-1255
> > > >
> > > > echo "||encoding:".$encoding."||";
> > > >
> > > > if ($encoding == 'UTF-8')
> > > > {
> > > > $utfcontents = $contents;
> > > > }
> > > > else if ($encoding == 'ISO-8859-1')
> > > > {
> > > > $utfcontents = utf8_encode($contents);
> > > > }
> > > >
> > > > var_dump($utfcontents);
> > > >
> > > > The $encoding is ISO-8859-1, the text file contains Hebrew characters,
> > > then
> > > > I'm converting it to utf8.
> > > >
> > > > The above code is outputing gibbrish, it seems that it has converted it
> > > in
> > > > some way but not in the
> > > > proper way that it should have converted it.
> > >
> > > If you know that the file contains Hebrew, maybe you should
> > > try converting from ISO-8859-8?
> > >
> > >
> > > /Nisse
> > >
> > > --
> > > PHP General Mailing List (http://www.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> > >
> >
> 
> 
> 


A plain text file wouldn't have headers like that would it? At least,
not in the sense that an image file has a header, or an office document
file has a header.

Thanks,
Ash
http://www.ashleysheridan.co.uk




[PHP] php htaccess logins and logouts

2009-11-26 Thread Ashley Sheridan
Hi all,

I've got a site set up that is using an htaccess file to provide secure
access to a directory. That is working fine. What I wondered was, is
there a way to log out via PHP. As I understand it, the login mechanism
is part of Apache, so I guess what I'm really asking is, is there a way
that I can get Apache to end the 'session' that Apache has set up, using
PHP?

I'm sure I've seen cPanel do it, so I was wondering how easy this would
be to do myself.

Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Re: Detecting The Encoding Of A Text File

2009-11-26 Thread Nisse Engström
On Thu, 26 Nov 2009 15:39:04 +0200, דניאל דנון wrote:

> If windows notepad can detect encoding there must be a way to do it
> yourself.
> 
> Maybe try to get the file's headers, I think it should also contain the
> encoding of the file...

Plain text files don't have any headers. Perhaps they use
heuristics, eg. examine the distribution of characters to
determine a probable encoding.

[Quick Google...]




/Nisse

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Detecting The Encoding Of A Text File

2009-11-26 Thread דניאל דנון
I was thinking that if notepad can open it correctly it has headers - but
the link you gave clarify that, my bad.

2009/11/26 Nisse Engström 

> On Thu, 26 Nov 2009 15:39:04 +0200, דניאל דנון wrote:
>
> > If windows notepad can detect encoding there must be a way to do it
> > yourself.
> >
> > Maybe try to get the file's headers, I think it should also contain the
> > encoding of the file...
>
> Plain text files don't have any headers. Perhaps they use
> heuristics, eg. examine the distribution of characters to
> determine a probable encoding.
>
> [Quick Google...]
>
> 
>
>
> /Nisse
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Use ROT26 for best security


Re: [PHP] PHP Equivalent to Java Jar or Python Eggs

2009-11-26 Thread Greg Maruszeczka
On Thu, 26 Nov 2009 13:09:48 +1030
James McLean  wrote:

> On Thu, Nov 26, 2009 at 11:50 AM,   wrote:
> >
> > Has anyone done any work towards packaging of PHP in a manner
> > similar to jar or eggs? I was working on a project the other day
> > with a lot of class files and thought this would be a cool, simple
> > way to deploy the app.
> 
> Yes; Greg Beaver has done a lot of work with PHAR, which is very
> similar. See http://au2.php.net/phar
> 
> Cheers
> 


...it's even bundled with PHP 5.3+

GM

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] My new address

2009-11-26 Thread Austin Ladd
Acce dot ssRx pro ap vides Men’s He gbh alth prod ak ucts to tr vr eat ere zee 
ctile dysf ltm unction (ED). Cho ge ose from all three FD xpq A-appr cz oved ED 
pres uq crip ac tion medi gd cations: Via ff gra, Cia iad lis and Lev ja itra. 
Only a small per id cent og age of men seek help for ED, alth is ough a lar khi 
ge num zl ber of men expe wyp rience it in var gds ying deg nq rees. All three 
F iq DA-app dpj roved dru pxc gs are pro pt ven to be eff nky ective in most 
hea cev lthy men. See Acces gaw sRx’s prod rz uct information pages for deta iz 
ils about dos pm ages, dire fw ctions, side eff pg ects, pre ua cautions, freq 
tj uently ask wvl ed ques dkj tions, links to manu ii facturer web jvb sites 
and patie vt nt/presc tky ribing infor pp mation. You can also acc sjt ess aVia 
ezt gra, Ci fmv alis, Lev cy itra compa up rison chart that sum wr marizes medi 
uq cation info xy rmation for the thr bx ee ED d oig rugs in one cent rsq ral 
loc oel ation.  Via huj gra   Silde pd nafil 50/100mg
  $1.42 Per P oa illMore info

C prr ia rva lis   Tada gb lafil 10/20mg
  $1.66 Per P ys illMore info
   

Levi kj tra   Vard js enafil 20mg
  $1.72 Per P bk illMore info
  

Re: [PHP] register_globals and sessions

2009-11-26 Thread Brady Mitchell
On Wed, Nov 25, 2009 at 3:01 PM, Allen McCabe  wrote:
> *Warning*: Unknown: Your script possibly relies on a session side-effect
> which existed until PHP 4.2.3. Please be advised that the session extension
> does not consider global variables as a source of data, unless
> register_globals is enabled. You can disable this functionality and this
> warning by setting session.bug_compat_42 or session.bug_compat_warn to off,
> respectively in *Unknown* on line *0*

It sounds like you're trying to use $_SESSION without having a
session_start() call first.

> I have Googled this extensively, and the solutions other people tried
> (turning off the warning) don't work for me; I don't have permission to my
> PHP settings (currently working on a free-hosted site).

There are many settings that can be changed using the function ini_set
(http://php.net/ini_set) and display_errors is one of them.
That said, it is always best to fix stuff like this than just hiding
it. When you just hide errors/warnings/notices things don't always
work reliably.

HTH,

Brady

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] string concatenation with fgets

2009-11-26 Thread aurfalien

So here is my final test code, notice the check for ' ' in the if.

Since I'm on Linux, this has to do with whats between the last LF and  
EOF which is nothing but this nothing will get printed out.


$file = fopen("somefile.txt", "r");
while (! feof($file))
{
$names = trim(fgets($file));
if ($names == '')
{
break;
}
print $names."sometext\n";
}
fclose($file);


- aurf

On Nov 24, 2009, at 5:52 PM, ryan wrote:


Is this what you want

$file = fopen("test.txt", "r");
while (!feof($file)) {
  $line = trim(fgets($file));
  print $line."sometext\n";
  }
fclose($file);

outputs
asometext
bsometext
csometext

Ref to http://us3.php.net/manual/en/function.fgets.php. "Reading  
ends when /length/ - 1 bytes have been read, on a newline (which is  
included in the return value), or on EOF (whichever comes first). If  
no length is specified, it will keep reading from the stream until  
it reaches the end of the line. "



aurfal...@gmail.com wrote:

Hi all,

I'm trying to append some text to what I read from a file.

My code;

$file = fopen("foo.txt", "r");
while (!feof($file)) {
   $line = fgets($file);
   print $line."sometext";
   }
fclose($file);

foo,txt;
a
b
c
d
e
f
g

And when I run the script, it looks like;
a
sometextb
sometextc
sometextd
...


Any ideas?

Thanks in advance,
- aurf






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php htaccess logins and logouts

2009-11-26 Thread James McLean
On Fri, Nov 27, 2009 at 12:12 AM, Ashley Sheridan
 wrote:
> Hi all,
>
> I've got a site set up that is using an htaccess file to provide secure
> access to a directory. That is working fine. What I wondered was, is
> there a way to log out via PHP. As I understand it, the login mechanism
> is part of Apache, so I guess what I'm really asking is, is there a way
> that I can get Apache to end the 'session' that Apache has set up, using
> PHP?
>
> I'm sure I've seen cPanel do it, so I was wondering how easy this would
> be to do myself.

IIRC if you unset $_SERVER['PHP_AUTH_USER'] and
$_SERVER['PHP_AUTH_PW'] it will log you out.

Cheers.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] php htaccess logins and logouts

2009-11-26 Thread Andy Shellam (Mailing Lists)
Hi,

> 
> IIRC if you unset $_SERVER['PHP_AUTH_USER'] and
> $_SERVER['PHP_AUTH_PW'] it will log you out.

I've done some research on this in the past - and not all browsers/web servers 
honour that as it's the browser that keeps the username/password cached and 
sends it after a 401 response, so the server knows nothing about the "login" - 
i.e.

1. User visits page 1
2. Server sends 401 Unauthorised header
3. Browser does not have any login details for the realm and prompts user
4. User inputs credentials, browser re-submits the request with the credentials 
attached
5. User visits page 2
6. Server sends 401 Unauthorised header
7. Browser has login details for the realm and re-submits the request with the 
credentials attached

From the conclusion I came to after my research, there is no reliable way for 
the server to de-authorise a login after a 401 request.

There are tricks you can do on the server, such as changing the authentication 
realm when the user has logged out - but if the user visits the same site again 
the realms will match and they will be logged in.

I've seen a "hack" which uses a cookie on the user's machine - if the user has 
the cookie, the correct authentication realm is returned in the authentication 
request.  If the user doesn't have the cookie, the server sends a random realm 
to trick the browser into thinking it's not logged in.  By the time you've done 
all that, you might as well just use sessions.

Regards,
Andy
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php