Re: [PHP] safe mode question

2006-01-08 Thread Robin
Doh - 

I figured it out (for those who were interested). The permissions on 
/etc/php.ini was set to 600 (owner == root). Changing this it other read, fixes 
the issue.

Any idea why Suse would do this?

Thanks
-robin

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



[PHP] safe mode question

2006-01-08 Thread Robin
Hi:

I am running PHP 4.3.10 (cli) (built: Dec 11 2005 17:38:29) on SuSe 9.3 - and 
am having some problems getting some scripts running.

php was compiled (by Suse) with:
Configure Command =>  './configure' '--prefix=/usr' '--datadir=/usr/share/php' 
'--mandir=/usr/share/man' '--bindir=/usr/bin' '--libdir=/usr/share' 
'--includedir=/usr/include' '--sysconfdir=/etc' '--with-_lib=lib' 
'--with-config-file-path=/etc' '--with-exec-dir=/usr/lib/php/bin' 
'--disable-debug' '--enable-inline-optimization' '--enable-memory-limit' 
'--enable-magic-quotes' '--enable-safe-mode' '--enable-sigchild' 
'--disable-ctype' '--disable-session' '--without-mysql' '--disable-cli' 
'--without-pear' '--with-openssl' '--enable-force-cgi-redirect' 
'--enable-discard-path' '--enable-cli' '--with-pear' 'i586-suse-linux'

(unrelated question - why have --enable-cli and --disable-cli?)

And I have safe mode off in php.ini,
safe_mode = Off

which is verified by a phpinfo();
safe_mode => Off => Off

However, the script should run from a cvs commit (the CVSROOT/logginfo
# BEGIN added by gforge-plugin-cvstracker
ALL ( php -q -d 
include_path=.:/opt/gforge/gforge:/opt/gforge/gforge/www/include:/etc/gforge 
/opt/gforge/gforge/plugins//cvstracker/bin/post.php %r %p %{sVv} )
# END added by gforge-plugin-cvstracker

And in /opt/gforge/gforge/plugins//cvstracker/bin/post.php, the code:
echo "safemode ";
echo ini_get('safe_mode');

Displays : "safemode 1"

I have tried the same thing from the command line, and the only way I can make 
it the same, is to add the "-n" flag.

Any thoughts or pointers?

Thanks
-Robin

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



[PHP] Question generateing xml on v4.3

2006-01-08 Thread Ted Zeng
Hi,

I use OS X tiger which has a PHP v4.3.12 installed.

I would like to be able to generate xml files.

But when I copied a php script from a tutorial and tried it,
Php complaints that
domxml_new_doc is undefined function

How could that be?

Ted zeng

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



[PHP] Re: strip leading zeros

2006-01-08 Thread M. Sokolewicz

Ross wrote:


Is there a PHP function to strip the leading zeros from a number/string.

R. 
try casting it to an (int) (if it's a number) and you'll have stripped 
the 0's (or to a (float)/(double) if it's not an integer)


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



Re: [PHP] Power

2006-01-08 Thread Dotan Cohen
On 1/8/06, Khorosh Irani <[EMAIL PROTECTED]> wrote:
> Hello
> How I can get the power of an integer number (for example 8 power 2=64) only
> with loops (without pow() function)?
> Thanks
>
>

Is this for your homework? Untested:



Dotan Cohen
http://technology-sleuth.com/short_answer/what_is_hdtv.html
&^
)


Re: [PHP] Remove atribute from links

2006-01-08 Thread Dotan Cohen
On 1/8/06, Jared Williams <[EMAIL PROTECTED]> wrote:
>
> > I have an HTML document at home (the Firefox bookmarks
> > output) that I was trying to parse this morning, with many
> > links as such:
> > http://www.aximsite.com/articles/link.php?id=22";
> > add_date="1130275531" last_charset="windows-1252"
> > id="rdf:#$FOQot">Knowledge Base: What Can I Do With My Axim?
> >
> > I want to parse it to remove the attributes add_date,
> > last_charset, id, and others that are in other entries. The
> > text of the file it produces is 22 kb but the HTML is over 500 kb!
> >
> > I don't have the code with me that I was trying (I'm not at
> > home now- but it has been nagging me all day), but I was
> > running into problems and could NOT get it to just remove the
> > attributes. One regex solution left me with  and
> > others with <>, http://address";
> > ="something" ="somehing else">blahblah, etc...
> >
> > How can I get it to remove, say, attribute xxx and the ="something"
> > that follows it? In all fairness I am not good at regexes and
> > need to practice, but I would appreciate any help I can get-
> > I'm really bogged down with studies and simply cannot devote
> > a full day to this 'trivial' excercise.
>
> I'd forget regexps and use SAX style parser. Trivial then to remove unwanted 
> attributes.
>
> Jared
>
>

Thanks. Looking into that now...

Dotan Cohen
http://technology-sleuth.com/short_answer/what_is_hdtv.html
*@


[PHP] No POST-Data available in Script when Handling ErrorDocument 404

2006-01-08 Thread Oliver Hofer
I wrote a scritpt for testing SOAP-Services. It generates and sends 
requests to other machines but also receives such requests from other 
machines in the net.As there are many 'senders' and muc more URL's they 
are sending their requests to, I intended to write a general 
SOAP-Request handler, that handles all incoming requests.


Therefore I Configured Apache 2.0.55 using the ErrorDocument directive:

ErrorDocument 404 /soap/dispatcher.php

Now my tool is able to handle SOAP-Requests to any URL that is located 
on the Server e.g. (ServerName = spttt.seraph)


http://spttt.seraph/bli/blo/foo (but also)
http://spttt.seraph/sifdino/services/OrderEntryRequestService

Hope you got the it so far.

Now my problem:
The Soap-Rquest handler needs to read the POST-Data that the sender of 
the SOAP-Request posted to the script. $HTTP_RAW_POST_DATA should 
contain this data but also php://input was mentioned in some 
php-mailing-list messages I found in the archives.
My problem is, that my script NEVER gets any POST-Data, if it is called 
by the ErrorDocument 404 Rule. If I address the handler directly, the 
Post-Data ist there.


When the script is called by the apache errorDocument handler, the 
following headers are received:


HTTP/1.1 404 Not Found
Date: Sun, 08 Jan 2006 00:48:45 GMT
Server: Apache/2.0.55 (Win32) PHP/5.1.1 DAV/2
X-Powered-By: PHP/5.1.1
Set-Cookie: PHPSESSID=0q9amr3s44k54i4lrv3no221k3; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, 
pre-check=0

Pragma: no-cache
Status: 200 OK
Content-Length: 1574
Content-Type: text/html; charset=ISO-8859-1


Array
(
[REDIRECT_REQUEST_METHOD] => POST
[REDIRECT_STATUS] => 404
[HTTP_HOST] => spttt.seraph
[CONTENT_TYPE] => text/xml
[CONTENT_LENGTH] => 25
[PATH] => 
C:\Programme\texmf\miktex\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\cvsnt;C:\Programme\Microsoft 
SQL Server\80\Tools\BINNC:\Programme\Gemeinsame Dateien\Ulead 
Systems\MPEG;C:\Programme\Ulead Systems\Ulead FilmBrennerei 2 
SE;C:\Programme\MySQL\MySQL Server 
4.1\bin;C:\Programme\Subversion\bin;C:\Programme\QuickTime\QTSystem\

[SystemRoot] => C:\WINDOWS
[COMSPEC] => C:\WINDOWS\system32\cmd.exe
[PATHEXT] => .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
[WINDIR] => C:\WINDOWS
[SERVER_SIGNATURE] => Apache/2.0.55 (Win32) PHP/5.1.1 
DAV/2 Server at spttt.seraph Port 80


[SERVER_SOFTWARE] => Apache/2.0.55 (Win32) PHP/5.1.1 DAV/2
[SERVER_NAME] => spttt.seraph
[SERVER_ADDR] => 192.168.44.100
[SERVER_PORT] => 80
[REMOTE_ADDR] => 192.168.44.100
[DOCUMENT_ROOT] => D:/projects/spttt/html
[SERVER_ADMIN] => [EMAIL PROTECTED]
[SCRIPT_FILENAME] => D:/projects/spttt/html/soap/dispatcher.php
[REMOTE_PORT] => 1863
[REDIRECT_URL] => /sptdino/services/OrderEntryRequestService
[GATEWAY_INTERFACE] => CGI/1.1
[SERVER_PROTOCOL] => HTTP/1.1
[REQUEST_METHOD] => GET
[QUERY_STRING] =>
[REQUEST_URI] => /sptdino/services/OrderEntryRequestService
[SCRIPT_NAME] => /soap/dispatcher.php
[PHP_SELF] => /soap/dispatcher.php
[REQUEST_TIME] => 1136681325
)

Notice the REQUEST_METHOD, which is GET! Obviously the script get's no 
POST-DATA in a GET-Request...


- Can anyone tell, if this behaviour is by intention?
- Why are the POST-Data not handed to the ErrorDocument - Script?
- Is there a possibility to solve this (workaround)?
- Im I stupid?

Below further information an my test-scripts:

Regards & thanks
Oli



Apache httpd.conf


ServerAdmin [EMAIL PROTECTED]
DocumentRoot D:/projects/spttt/html
ErrorDocument 404 /soap/dispatcher.php
ServerName spttt.seraph
ErrorLog logs/spt-error_log
CustomLog logs/spt-access_log common


/soap/dispatcher.php (target for the ErrorDocument 404 directive)



posttest2.php (sends a POST-Request to an unknown URL on the Server 
which should then be forwarded to the dispatcher.php by Apache 
errorDocument-Handler)


';
$http_msg = "POST /sptdino/services/OrderEntryRequestService HTTP/1.1\r\n";
$http_msg .= "Host: spttt.seraph\r\n";
$http_msg .= "Content-Type: text/xml\r\n";
$http_msg .= "Content-Length:" .strlen($post_msg). "\r\n\r\n";
$http_msg .= $post_msg ."\r\n";
$http_msg;

$errno;
$errdesc;

$fp = @fsockopen("192.168.44.100", 80,$errno, $errdesc,15);

$reply = "";

if ($fp)
{
fputs ($fp, $http_msg);
while (!feof($fp))
{
$reply .= fgets($fp, 1024);
}
fclose ($fp);
}

echo($reply);
print_r($errdesc);
echo "done";
?>

Apache error-log states:

[Sun Jan 08 03:08:15 2006] [error] [client 192.168.44.100] File does not 
exist: D:/projects/spttt/html/sptdino


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



[PHP] Power

2006-01-08 Thread Khorosh Irani
Hello
How I can get the power of an integer number (for example 8 power 2=64) only
with loops (without pow() function)?
Thanks


Re: [PHP] strip leading zeros

2006-01-08 Thread Chris

Ross wrote:


Is there a PHP function to strip the leading zeros from a number/string.

R. 

 


You can use ltrim()

$sString = '0043680450';
$sString = ltrim($sString,'0');

http://www.php.net/ltrim

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



[PHP] strip leading zeros

2006-01-08 Thread Ross

Is there a PHP function to strip the leading zeros from a number/string.

R. 

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



RE: [PHP] Image editing?

2006-01-08 Thread Weber Sites LTD
Check out these code examples to start with : 

http://www.weberdev.com/search.php3?IsSub=1&searchtype=category&category=GD+
image+library&secondary=PHP&PHPFunctions=on

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
PHP Web Logs : http://www.weberblog.com/ 
PHP & MySQL Forums : http://www.weberforums.com/ 
Learn PHP Playing Trivia http://www.webertrivia.com 
Web Development Index http://www.weberindex.com 
Web Templates http://www.webertemplates.com
Search for PHP Code from your browser http://toolbar.weberdev.com 

 

-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Saturday, January 07, 2006 1:59 PM
To: php-general@lists.php.net
Subject: [PHP] Image editing?

Hello,

I might have to start doing some automated image editing or rezising with
PHP. I've never done anything like this before so I would need some
guidelines to get started. Basically what sections of the manual to read and
what tools need to be installed to the server side to get things like this
done. Are there any websites about this issue, other than php.net, that
might provide help to beginners? Thanks for your assistance!

-Will

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

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



RE: [PHP] Remove atribute from links

2006-01-08 Thread Jared Williams

> I have an HTML document at home (the Firefox bookmarks 
> output) that I was trying to parse this morning, with many 
> links as such:
> http://www.aximsite.com/articles/link.php?id=22";
> add_date="1130275531" last_charset="windows-1252"
> id="rdf:#$FOQot">Knowledge Base: What Can I Do With My Axim?
> 
> I want to parse it to remove the attributes add_date, 
> last_charset, id, and others that are in other entries. The 
> text of the file it produces is 22 kb but the HTML is over 500 kb!
> 
> I don't have the code with me that I was trying (I'm not at 
> home now- but it has been nagging me all day), but I was 
> running into problems and could NOT get it to just remove the 
> attributes. One regex solution left me with  and 
> others with <>, http://address";
> ="something" ="somehing else">blahblah, etc...
> 
> How can I get it to remove, say, attribute xxx and the ="something"
> that follows it? In all fairness I am not good at regexes and 
> need to practice, but I would appreciate any help I can get- 
> I'm really bogged down with studies and simply cannot devote 
> a full day to this 'trivial' excercise.

I'd forget regexps and use SAX style parser. Trivial then to remove unwanted 
attributes.

Jared

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



[PHP] Remove atribute from links

2006-01-08 Thread Dotan Cohen
I have an HTML document at home (the Firefox bookmarks output) that I
was trying to parse this morning, with many links as such:
http://www.aximsite.com/articles/link.php?id=22";
add_date="1130275531" last_charset="windows-1252"
id="rdf:#$FOQot">Knowledge Base: What Can I Do With My Axim?

I want to parse it to remove the attributes add_date, last_charset,
id, and others that are in other entries. The text of the file it
produces is 22 kb but the HTML is over 500 kb!

I don't have the code with me that I was trying (I'm not at home now-
but it has been nagging me all day), but I was running into problems
and could NOT get it to just remove the attributes. One regex solution
left me with  and others with <>, http://address";
="something" ="somehing else">blahblah, etc...

How can I get it to remove, say, attribute xxx and the ="something"
that follows it? In all fairness I am not good at regexes and need to
practice, but I would appreciate any help I can get- I'm really bogged
down with studies and simply cannot devote a full day to this
'trivial' excercise.

Thanks, all!

Dotan Cohen
http://technology-sleuth.com/long_answer/why_are_internet_greeting_cards_dangerous.html


[PHP] Re: thought stdin was supposed to default open

2006-01-08 Thread M. Sokolewicz

matt V wrote:

hello,
I read that in the cli version of php, the 3 files, sterror, stdout and 
stdin are already open thus saving having to open them and close them 
each time.  Well, I decided to test that idea and it appears that stdin 
infact is not pre-opened, but my code may be wrong too, who knows.
I made a little test script (see below), but either it ends up 
outputting nothing, or i get the "... assumed 'STDIN'" and "supplied 
argument is not a valid resource" but on the same line.

anyway, code is below



you DO understand that STDIN is a resource and (unlike Perl,) PHP can't 
compare a string to a resource! Next, you're comparing to '\n', note the 
single quotes; you're not comparing to the newline char, you're 
comparing to a \ followed by an n literally.

So..., your code will spit out errors for sure.

while(($line = fgets(STDIN)) != "\n");
{
echo $line;
}
would work though, and have the same functionality you tried to achieve 
in your above code.


simple script, but it appears not to work.  is it my code, or is STDIN 
not opened by default in php4.4

this is on slackware linux version 10.2 running php -v 4.4
matt


it is opened, but you need to use it correctly to get there ;)
- tul

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