php-general Digest 29 Aug 2005 17:45:41 -0000 Issue 3652

Topics (messages 221492 through 221524):

Re: Getting queries from files FYI
        221492 by: Jasper Bryant-Greene

guidance for communicating between frames
        221493 by: R. Vijay Daniel
        221500 by: Jens Schulze

Issue with generating asx playlist with php
        221494 by: Dan Rossi
        221501 by: Dan Rossi
        221505 by: Dan Rossi
        221521 by: Andy Pieters

How can I format text in textarea?
        221495 by: bushra
        221497 by: Jasper Bryant-Greene

Re: PHP MySql Extension No Loading
        221496 by: Shaw, Chris - Accenture
        221498 by: Jasper Bryant-Greene
        221514 by: Glen Zimmerman
        221517 by: Glen Zimmerman

ftp_nlist dont work for me :(
        221499 by: Erik Gyepes

regular expression for time
        221502 by: babu
        221507 by: Al
        221508 by: Leif Gregory

Protecing files
        221503 by: Thomas
        221504 by: Jay Blanchard
        221506 by: John Nichel

Re: sscanf() not returning info
        221509 by: Dan Baker

Computers name?
        221510 by: Gustav Wiberg

Re: Easier way to clean GET Variables ?
        221511 by: Jay Paulson
        221524 by: Robert Cummings

LAN IP address
        221512 by: Philippe Reynolds
        221513 by: John Nichel
        221515 by: Erik Gyepes
        221516 by: Philippe Reynolds
        221519 by: Erik Gyepes
        221520 by: Tim Van Wassenhove

Re: PHP Security
        221518 by: cron.odi.com.br

Re: <kein Betreff>
        221522 by: Andy Pieters
        221523 by: Brian P. O'Donnell

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Raj Shekhar wrote:
Robin Vickery <[EMAIL PROTECTED]> writes:


On 8/23/05, Jay Blanchard <[EMAIL PROTECTED]> wrote:

You may (or may not) remember me posting to the list a couple of weeks
ago asking about using REGEX to get queries out of PHP files for a
migration project. I had to let it go for several days, but started
working on it again yesterday, here is the code (no REGEX was used in
the making of this code);

Just a thought - and I know it's a little late, sorry.

Have you considered writing a wrapper for mysql_query() that logs its
parameters?


(I cannot locate the original post, hence replying to this mail)

You can enable logging in mysql server itself to log all queries
http://dev.mysql.com/doc/mysql/en/binary-log.html ( there are ways to
restrict logging to only some databases) . Later when you want to replay
the sql statements, you can use mysqlbinlog

Yes, but as this is a migration project (as indicated by the OP), that would require you going through and running every possible branch of the application code to get MySQL to execute the queries and therefore log them.

Logging queries that are run is a different thing than pulling all of the SQL queries out of given PHP files.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

--- End Message ---
--- Begin Message ---

Hi,

Please give me some solution to communicate between two frames in php.
I need to track the actions in one frame and to report it to another frame.

regards
vijay

--- End Message ---
--- Begin Message ---
You can e.g. use javascript for intra-frame communication, but for a
more specific answer we need a more specific question.

Jens

--- End Message ---
--- Begin Message --- Hi there I am trying to use php to output an asx playlist but depends on a special hash in the url to prevent hotlinking. I am using a session to store a generated token when generating the url to display in an embedded player. The token is added in the filename and I am using rewrite rules to load another php script which does a check of the hash in the querystring with the token stored in the session. However its having unexpected results. When i add the check for the session token the media player either doesnt player in PC or outputs playlist format not recognised in Mac. If i do a check for the hash only its ok. Here is an example

if ($_GET['h'] && $_GET['filename'] && $this->hash) {
                        
                        $file = 
WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}

breaks with this

if ($_GET['h'] && $_GET['filename'] && $this->token) {
                        
                        $file = 
WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}

ideally i want it to look like

if ($_GET['h'] && $_GET['filename'] && (strcmp($this->token,$this->hash)==0)) {
                        
                        $file = 
WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}


they are being set earlier in the script like so

$this->token = trim($_SESSION['token']);
$this->hash = trim($_GET['h']);

any ideas ?

--- End Message ---
--- Begin Message --- I have just discovered on closer debugging, the windows media plugin is loading the file twice, i can see the stop button flicker twice and i made an error log and the word loaded shows up twice, would this be causing an issue with the session ?

On 29/08/2005, at 5:20 PM, Dan Rossi wrote:

Hi there I am trying to use php to output an asx playlist but depends on a special hash in the url to prevent hotlinking. I am using a session to store a generated token when generating the url to display in an embedded player. The token is added in the filename and I am using rewrite rules to load another php script which does a check of the hash in the querystring with the token stored in the session. However its having unexpected results. When i add the check for the session token the media player either doesnt player in PC or outputs playlist format not recognised in Mac. If i do a check for the hash only its ok. Here is an example

if ($_GET['h'] && $_GET['filename'] && $this->hash) {
                        
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}

breaks with this

if ($_GET['h'] && $_GET['filename'] && $this->token) {
                        
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}

ideally i want it to look like

if ($_GET['h'] && $_GET['filename'] && (strcmp($this->token,$this->hash)==0)) {
                        
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}


they are being set earlier in the script like so

$this->token = trim($_SESSION['token']);
$this->hash = trim($_GET['h']);

any ideas ?

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


--- End Message ---
--- Begin Message ---

On 29/08/2005, at 10:00 PM, Dan Rossi wrote:

I have just discovered on closer debugging, the windows media plugin is loading the file twice, i can see the stop button flicker twice and i made an error log and the word loaded shows up twice, would this be causing an issue with the session ?

Ok its quite obvious I just discovered the session is being created again when the file is loaded from the windows media plugin therefore token variable is not there. Any ideas what could have been doing this ? I logged two different sess id's being created.


On 29/08/2005, at 5:20 PM, Dan Rossi wrote:

Hi there I am trying to use php to output an asx playlist but depends on a special hash in the url to prevent hotlinking. I am using a session to store a generated token when generating the url to display in an embedded player. The token is added in the filename and I am using rewrite rules to load another php script which does a check of the hash in the querystring with the token stored in the session. However its having unexpected results. When i add the check for the session token the media player either doesnt player in PC or outputs playlist format not recognised in Mac. If i do a check for the hash only its ok. Here is an example

if ($_GET['h'] && $_GET['filename'] && $this->hash) {
                        
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}

breaks with this

if ($_GET['h'] && $_GET['filename'] && $this->token) {
                        
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}

ideally i want it to look like

if ($_GET['h'] && $_GET['filename'] && (strcmp($this->token,$this->hash)==0)) {
                        
$file = WMSERVER.Feeds_Hotlink_Check::strip_paths($_GET['filename']);
                        $this->filename = preg_replace('/stream/','wmv',$file);
                        $this->tpl->compile('playlist.html');
                        header("Content-Type: video/x-ms-wmv");
                        die(trim($this->tpl->outputObject($this)));
}


they are being set earlier in the script like so

$this->token = trim($_SESSION['token']);
$this->hash = trim($_GET['h']);

any ideas ?

--
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


--- End Message ---
--- Begin Message ---
On Monday 29 August 2005 16:09, Dan Rossi wrote:
> ? I logged two different sess id's being created.

Hi

I have seen this behaviour as well, although in another context.  The solution 
was to have the session_start instruction be one of the very first.

In fact, in my software, the session_start is the second instruction on ALL 
pages.

<?php

        require_once 'globals.inc.php';

        /* rest of script*/
?>

And globals.inc.php is like

<?php
        session_start();

        define(yadaydayda....
?>

Hope this helps



With kind regards



Andy


-- 
Registered Linux User Number 379093
Now listening to Blank and Jones and Friends (2005 week 34) - guest DJ Jochen 
Miller

   amaroK::the Coolest Media Player in the known Universe!


   Cockroaches and socialites are the only things that can 
   stay up all night and eat anything.
                                            Herb Caen
--
-- --BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
L+++>++++$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>++++$@ h++(*) r-->++ y--()>++++
-- ---END GEEK CODE BLOCK------
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/

--

Attachment: pgp1MRJYCCT4i.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Hi
When I enter text as more than on paragrahs in a textarea field,The text is displayed in one solid block of text even though I have entered it in paragraphs. How I can to insert line breaks in the text. (The values of textarea is stored in database and then displayed.)


Bushra

--- End Message ---
--- Begin Message ---
bushra wrote:
Hi
When I enter text as more than on paragrahs in a textarea field,The text is displayed in one solid block of text even though I have entered it in paragraphs. How I can to insert line breaks in the text. (The values of textarea is stored in database and then displayed.)

If you have the text in $string, then this will output it safely and with correct line breaks:

print(nl2br(htmlspecialchars($string)));

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

--- End Message ---
--- Begin Message ---
I thought you had to put the php.ini in the c:\windows directory?

-----Original Message-----
From: Glen Zimmerman [mailto:[EMAIL PROTECTED]
Sent: 27 August 2005 22:39
To: [email protected]
Subject: RE: [PHP] PHP MySql Extension No Loading


*************************************

This e-mail has been received by the Revenue Internet e-mail service.

*************************************

Yes, I have the dll in the right place (C:\php\ext), and PHPIniDir is set to
C:\php where php.ini is located.  I know that php.ini is being picked up,
because the changes I make to the file take affect when I restart Apache.
PHP is loading properly as the php function, phpinfo, does display the proper
information page when I run a test.  I just cannot get php_mysql.dll to load.

I have gone through the PHP installation documentation several times, but it
has not made a difference.

I just don't know what I have over looked. 





************************

This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*************************

--- End Message ---
--- Begin Message ---
Shaw, Chris - Accenture wrote:
I thought you had to put the php.ini in the c:\windows directory?

Please don't top-post. He said that when he changes the php.ini file the changes take effect after restarting Apache, so that's not the problem. See my other comments below.

-----Original Message-----
From: Glen Zimmerman [mailto:[EMAIL PROTECTED]
Sent: 27 August 2005 22:39
To: [email protected]
Subject: RE: [PHP] PHP MySql Extension No Loading

Yes, I have the dll in the right place (C:\php\ext), and PHPIniDir is set to
C:\php where php.ini is located.  I know that php.ini is being picked up,
because the changes I make to the file take affect when I restart Apache.
PHP is loading properly as the php function, phpinfo, does display the proper
information page when I run a test.  I just cannot get php_mysql.dll to load.

Have you placed the MySQL client library (libmysql.dll or something similar) into c:\windows\system32 ?

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s

--- End Message ---
--- Begin Message ---
No, according to the documentation, it goes into the directory pointed
to by PHPIniDir.  My php.ini file is being read properly when Apache
loads.  Its just when I have the line, extension=php_mysql.dll ,
uncommented that I receive the error.

>>> "Shaw, Chris - Accenture" <[EMAIL PROTECTED]> 08/29/2005 2:36:34 AM
>>>
I thought you had to put the php.ini in the c:\windows directory?
-----Original Message-----
From: Glen Zimmerman [mailto:[EMAIL PROTECTED] 
Sent: 27 August 2005 22:39
To: [email protected] 
Subject: RE: [PHP] PHP MySql Extension No Loading


*************************************

This e-mail has been received by the Revenue Internet e-mail service.

*************************************
Yes, I have the dll in the right place (C:\php\ext), and PHPIniDir is
set to C:\php where php.ini is located.  I know that php.ini is being
picked up, because the changes I make to the file take affect when I
restart Apache.  PHP is loading properly as the php function, phpinfo,
does display the proper information page when I run a test.  I just
cannot get php_mysql.dll to load.
 
I have gone through the PHP installation documentation several times,
but it has not made a difference.
 
I just don't know what I have over looked.  
 
 
************************

This message has been delivered to the Internet by the Revenue Internet
e-mail service

*************************


--- End Message ---
--- Begin Message ---
Thanks, Jasper, that seems to have done the trick.  I'm not sure I
understand why it is necessary to put the dll in system32, since there is an
environment variable for the path that is pointing to c:\php.  I would seem
that it would pick up the dll through this env variable.

>>> Jasper Bryant-Greene<[EMAIL PROTECTED]> 08/29/2005 2:56:05 AM
>>>
Shaw, Chris - Accenture wrote:
> I thought you had to put the php.ini in the c:\windows directory?

Please don't top-post. He said that when he changes the php.ini file the 
changes take effect after restarting Apache, so that's not the problem. 
See my other comments below.

> -----Original Message-----
> From: Glen Zimmerman [mailto:[EMAIL PROTECTED] 
> Sent: 27 August 2005 22:39
> To: [email protected] 
> Subject: RE: [PHP] PHP MySql Extension No Loading
> 
> Yes, I have the dll in the right place (C:\php\ext), and PHPIniDir is set
to
> C:\php where php.ini is located.  I know that php.ini is being picked up,
> because the changes I make to the file take affect when I restart Apache.
> PHP is loading properly as the php function, phpinfo, does display the
proper
> information page when I run a test.  I just cannot get php_mysql.dll to
load.

Have you placed the MySQL client library (libmysql.dll or something 
similar) into c:\windows\system32 ?

-- 
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/ 

If you find my advice useful, please consider donating to a poor
student! You can choose whatever amount you think my advice was
worth to you. http://tinyurl.com/7oa5s 

--- End Message ---
--- Begin Message ---
Hi folks!

I have compiled PHP 5.0.4 at my Slackware machine at home, I have the FTP support enable and I trying connect to the FTP with this little scritp:

<?php
$connect = ftp_connect("ftp.slackware.at") or die("Couldn't connect to ftp 
server");
$login = ftp_login($connect,"anonymous","[EMAIL PROTECTED]") or die("Couldn't login 
to ftp server");

$ftp_dir = ftp_pwd($connect) or die("error ftp dir");
$fileArray = ftp_nlist($connect,$ftp_dir) or die("error file array");

echo var_dump($fileArray);
?>

And I always get: error file array, so there is problem with the ftp_nlist I think. But the sripts work well at my webhosting, but It dont get work it at home at my machine.
May I enable something in PHP? Some settings, or what?

Thanks very much.

Erik Gyepes

--- End Message ---
--- Begin Message ---
HI,
 
how can i write regular expression for time in 24-hour format i:e, HH:MM:SS. 
using preg_match.
 
thanks
babu

                
---------------------------------
How much free photo storage do you get? Store your holiday snaps for FREE with 
Yahoo! Photos. Get Yahoo! Photos

--- End Message ---
--- Begin Message ---
babu wrote:
HI,
how can i write regular expression for time in 24-hour format i:e, HH:MM:SS. using preg_match. thanks
babu

                
---------------------------------
How much free photo storage do you get? Store your holiday snaps for FREE with 
Yahoo! Photos. Get Yahoo! Photos

You need to be more specific about:

What is before and after the time string.  It's probably white-space. That so?

Can your HH, values be without the leading zero, e.g., 2:12:15.

Can you be certain that MM and SS will be included. If the time is entered by users, they can get lazy and give you "2", for example.

Given the simplest case. $pattern= "%\s(\d\d:\d\:\d\d)\s%"; ["%" is simply the delimitor, it can be almost any thing.] The \s is optional, it says white-space.

$num= preg($pattern, $string [,$match_array]) $time_value= $match_array[1]; $num of matches in case you want to test for none or more than 1.
--- End Message ---
--- Begin Message ---
Hello babu,

Monday, August 29, 2005, 6:50:32 AM, you wrote:
> how can i write regular expression for time in 24-hour format i:e,
> HH:MM:SS. using preg_match.

<?php
$xtime="19:59:53";
if (preg_match("/([01][0-9]|[2][0-3]):[0-5][0-9]:[0-5][0-9]/", $xtime))
  echo "Good";
else
  echo "Bad";
?>


--                        TBUDL/BETA/DEV/TECH Lists Moderator / PGP 0x6C0AB16B
 __    ____  ____  ____   Geocaching:                    http://gps.PCWize.com
(  )  ( ___)(_  _)( ___)  TBUDP Wiki Site:  http://www.PCWize.com/thebat/tbudp
 )(__  )__)  _)(_  )__)   Roguemoticons & Smileys:    http://PCWize.com/thebat
(____)(____)(____)(__)    PHP Tutorials and snippets:    http://www.DevTek.org

Save your pennies.  The dollars go to the I.R.S.

--- End Message ---
--- Begin Message ---
 


Hi there,

How can I protect all files with extension .xml from being accessed by the
outside? For Apache can one use .htaccess (if yes, how?), is there a generic
way of keeping stalkers from viewing your config files?

Thomas





SPIRAL EYE STUDIOS 
P.O. Box 37907, Faerie Glen, 0043

Tel: +27 12 362 3486
Fax: +27 12 362 3493 
Mobile: +27 82 442 9228
Email: [EMAIL PROTECTED]
Web:  <http://www.spiraleye.co.za> www.spiraleye.co.za 

 


--- End Message ---
--- Begin Message ---
[snip]
How can I protect all files with extension .xml from being accessed by
the
outside? For Apache can one use .htaccess (if yes, how?), is there a
generic
way of keeping stalkers from viewing your config files?
[/snip]

You can put them outside of the web root so that they are not accessible
to the general public.

--- End Message ---
--- Begin Message ---
Thomas wrote:

Hi there,

How can I protect all files with extension .xml from being accessed by the
outside? For Apache can one use .htaccess (if yes, how?), is there a generic
way of keeping stalkers from viewing your config files?

You can put them outside of the web root, or you can use .htaccess. For .htaccess, look at the Apache manual.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
"Simon Fredriksson" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Can anyone tell me what is wrong here?
>
> <?php
> $data = "<a class=\"new20030101\" href=\"Zero01.jpg\">Pic 1</a>";
> $info = sscanf($data,"<a class=\"%s\" href=\"%s\">%s</a>");
> var_dump($info);
> ?>

One way to do this is:
<?php
$data = "<a class=\"new20030101\" href=\"Zero01.jpg\">Pic 1</a>";
sscanf($data,"<a class=\"%s\" href=\"%s\">%s</a>", $class, $href, $text);
echo "Class = $class<br>";
echo "href = $href<br>";
echo "test = $text<br>";
?>

Another way is:
<?php
$data = "<a class=\"new20030101\" href=\"Zero01.jpg\">Pic 1</a>";
list ($class, $href, $text) = sscanf($data,"<a class=\"%s\" 
href=\"%s\">%s</a>");
echo "Class = $class<br>";
echo "href = $href<br>";
echo "test = $text<br>";
?>

DanB

--- End Message ---
--- Begin Message ---
Hi there!

Is it possible to get (retrieve) the computername of the client? I just want the name for comparing...

/G
@varupiraten.se

--- End Message ---
--- Begin Message ---
Can anybody point to a good resource of a collection of filtering for
common inputs such as those listed by Chris above?...

I've searched for that and generally found one of two things:

1. Nothing useful.
2. A system so baroque and complex and with so much other baggage, it
would be impossible to integrate.  See 1.

I'm looking more for code snippets or specific Regex functions for
each item, rather than a monolithic Borg-like "filtering package" and
have never one I liked.

That could be mostly my fault due to peculiar requirements, but there
it is.

I'd like to know this too. As well as the examples are in this thread I don't think they handled multi dimensional arrays. It'd be nice if they did. :)
--- End Message ---
--- Begin Message ---
On Mon, 2005-08-29 at 11:07, Jay Paulson wrote:
> > Can anybody point to a good resource of a collection of filtering for
> > common inputs such as those listed by Chris above?...
> >
> > I've searched for that and generally found one of two things:
> >
> > 1. Nothing useful.
> > 2. A system so baroque and complex and with so much other baggage, it
> > would be impossible to integrate.  See 1.
> >
> > I'm looking more for code snippets or specific Regex functions for
> > each item, rather than a monolithic Borg-like "filtering package" and
> > have never one I liked.
> >
> > That could be mostly my fault due to peculiar requirements, but there
> > it is.
> 
> I'd like to know this too.  As well as the examples are in this thread 
> I don't think they handled multi dimensional arrays.  It'd be nice if 
> they did. :)

I've adapted my previous solution for multi-dimensional retrieval using
unix directory style path lookup:

function arrayGetValue( &$array, $path, $default=null )
{
    $subArray = &$array;

    $bits = explode( '/', $path );

    foreach( $bits as $aBit )
    {
        if( isset( $subArray[$aBit] ) )
        {
            $subArray = &$subArray[$aBit];
        }
        else
        {
            unset( $subArray );
            $subArray = $default;

            break;
        }
    }

    return $subArray;
}

function arrayGetValueProcessed( &$array, $path, $process, $default=null
)
{
    return $process( arrayGetValue( $array, $path, $default ) );
}

function cleanser( $value )
{
    return mysql_real_escape_string( trim( $value ) ) );
}

//
// Example.
//
$title = arrayGetValueProcessed( $games, $userId.'/favourite/rpg' )


Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Hi all,

I would like to find a way to get my computers LAN IP address through PHP. I tried using the gethostbyname("HOSTNAME") function, however I only got back the 127.0.0.1 address.

Any help is always appreciated
Cheers
Phil

--- End Message ---
--- Begin Message ---
Philippe Reynolds wrote:
Hi all,

I would like to find a way to get my computers LAN IP address through PHP. I tried using the gethostbyname("HOSTNAME") function, however I only got back the 127.0.0.1 address.

Any help is always appreciated
Cheers
Phil

Server or client IP?

Server : $_SERVER['SERVER_ADDR']
Client : $_SERVER['REMOTE_ADDR']

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi.

I think you want to get the internal IP adress which computer uses? Am I right? If yes, that is not possible with PHP directly, but it is possible with Java and PHP.

Erik

Philippe Reynolds wrote:

Hi all,

I would like to find a way to get my computers LAN IP address through PHP. I tried using the gethostbyname("HOSTNAME") function, however I only got back the 127.0.0.1 address.

Any help is always appreciated
Cheers
Phil


--- End Message ---
--- Begin Message --- Yes, I would hard code my IP address but when the computer crashs the server assigns it a different IP address, so I have to make my code a tad more dynamic...

I havn't touched Java in a while, would you know the function for that?

Thanks again

I think you want to get the internal IP adress which computer uses? Am I right? If yes, that is not possible with PHP directly, but it is possible with Java and PHP

--- End Message ---
--- Begin Message ---
Okay.

There I have script for you: http://pokusy.depi.sk/internalip.zip. Just download it and see the source.
You can see how it works here: http://pokusy.depi.sk/inernalip/ip.php.

Hope that helps you.

Erik

Philippe Reynolds wrote:

Yes, I would hard code my IP address but when the computer crashs the server assigns it a different IP address, so I have to make my code a tad more dynamic...

I havn't touched Java in a while, would you know the function for that?

Thanks again

I think you want to get the internal IP adress which computer uses? Am I right? If yes, that is not possible with PHP directly, but it is possible with Java and PHP



--- End Message ---
--- Begin Message ---
On 2005-08-29, "Philippe Reynolds" <[EMAIL PROTECTED]> wrote:
> Yes, I would hard code my IP address but when the computer crashs the server 
> assigns it a different IP address, so I have to make my code a tad more 
> dynamic...

Have you had a look at tools that you get at dynip etc?

-- 
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>

--- End Message ---
--- Begin Message ---
Sorry for the split of threds, i dont have the original email.

 

This is the answer from computerworld regarding the article 
http://www.computerworld.com/securitytopics/security/holes/story/0,10801,104124,00.html
 , 



>Thank you for taking the time to write in. I see your point. 

>The article should have said that there was a flaw in *a* Web service protocol 
>*for* PHP. Saying "the PHP Web services protocol" may have given readers the 
>wrong >idea. 

>However, this particular PEAR implementation is bundled with one of the newer 
>release candidates of PHP (PHP 4.4.0RC2), at which point it gets difficult to 
>determine >whether something is or is not part of "PHP." In any case, I have 
>issued a clarification at 

>http://www.computerworld.com/news/corrections 

>Regards, 



--
Sharon Machlis
Online Managing Editor
Computerworld
http://www.computerworld.com 

One Speen Street
P.O. Box 9171
Framingham, MA  01701-9171
Phone: +1 508 820 8231
E-mail: [EMAIL PROTECTED] 




To:        [EMAIL PROTECTED] 
cc:        [EMAIL PROTECTED] (bcc: cweditor) 

Subject:        PHP hit by another critical flaw (104124) 


 
Hello,

This article is wrong, XML-RPC for PHP has a security flaw not PHP itself and 
php is not a Web Service Protocol. 

Angelo 




--- End Message ---
--- Begin Message ---
On Sunday 28 August 2005 19:26, Jan Broermann wrote:
> _________________________________________________________________________
> Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle
> Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179

Lauffen sie scheissen!  Was mache Sie dar?

-- 
Registered Linux User Number 379093
Now listening to Blank and Jones and Friends (2005 week 34) - guest DJ Jochen 
Miller

   amaroK::the Coolest Media Player in the known Universe!


   Cockroaches and socialites are the only things that can 
   stay up all night and eat anything.
                                            Herb Caen
--
-- --BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
L+++>++++$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>++++$@ h++(*) r-->++ y--()>++++
-- ---END GEEK CODE BLOCK------
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/

--

Attachment: pgpUwQLo6qF9G.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
It's bad enough when somebody posts a blank email to the list, but when
people start posting blank replies, it gets really frustrating.

Please cease & desist.

Thanks

Brian

"Andy Pieters" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

--- End Message ---

Reply via email to