[PHP] query regard forms in PHP

2006-01-29 Thread suresh kumar
 hai,
i am having 3 files,namely page1,page2  and page3,when i enter username 
and password in my first page i want 2  display  my username and password  in 
my third page through  second page.
  
 A.suresh
  


-
 Jiyo cricket on Yahoo! India cricket

Re: [PHP] XML and htmlentities conditionally?

2006-01-29 Thread Brian V Bonini
On Sun, 2006-01-29 at 02:01, Adam Hubscher wrote:
> I have a block of XML that looks as follows:
> 
> <*_~_*> Røyken VGS <*_~_*>

> My question is, can I in any way efficiently (i -stress- efficiently, if 
> anyone read my previous XML and special characters post its a rather 
> large XMl file (breaking 18mb now) and speed is of the essence) cause 
> html_entity_decode to not decode those tags?

What's the end results your looking for?

If you are trying to pass that data straight through the parser try
wrapping it in CDATA.



-- 

s/:-[(/]/:-)/g


BrianGnuPG -> KeyID: 0x04A4F0DC | Key Server: pgp.mit.edu
==
gpg --keyserver pgp.mit.edu --recv-keys 04A4F0DC
Key Info: http://gfx-design.com/keys
Linux Registered User #339825 at http://counter.li.org

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



[PHP] How can I get ENUM values from column info?

2006-01-29 Thread afan
Hi to all,
I need to collect info about columns from a selected table.
I use this:

$result = mysql_query("SELECT * FROM ". $TableName);
$fields = mysql_num_fields($result);
for ($i=0; $i < $fields; $i++)
{
$type  = mysql_field_type($result, $i);
$name  = mysql_field_name($result, $i);
$len  = mysql_field_len($result, $i);
$flags = mysql_field_flags($result, $i);

   echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
}

If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
ONLY 'enum'.
How can I get all ENUM values?

Thanks for any help or direction.

-afan

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



[PHP] Collecting info about columns in a table

2006-01-29 Thread Afan Pasalic

Hi to all,
I need to collect info about columns from a selected table.
I use this:

$result = mysql_query("SELECT * FROM ". $TableName);
$fields = mysql_num_fields($result);
for ($i=0; $i < $fields; $i++)
{
$type  = mysql_field_type($result, $i);
$name  = mysql_field_name($result, $i);
$len  = mysql_field_len($result, $i);
$flags = mysql_field_flags($result, $i);

   echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
}

If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show  
ONLY 'enum'.

How can I get all ENUM values?

Thanks for any help or direction.

-afan

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



[PHP] Re: query regard forms in PHP

2006-01-29 Thread James Benson


suresh kumar wrote:
>  hai,
> i am having 3 files,namely page1,page2  and page3,when i enter 
> username and password in my first page i want 2  display  my username and 
> password  in my third page through  second page.
>   
>  A.suresh
>   
> 
>   
> -
>  Jiyo cricket on Yahoo! India cricket




You want to be using sessions


http://php.net/session




-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



Re: [PHP] XML and htmlentities conditionally?

2006-01-29 Thread Adam Hubscher

Brian V Bonini wrote:

On Sun, 2006-01-29 at 02:01, Adam Hubscher wrote:


I have a block of XML that looks as follows:

<*_~_*> Røyken VGS <*_~_*>



My question is, can I in any way efficiently (i -stress- efficiently, if 
anyone read my previous XML and special characters post its a rather 
large XMl file (breaking 18mb now) and speed is of the essence) cause 
html_entity_decode to not decode those tags?



What's the end results your looking for?

If you are trying to pass that data straight through the parser try
wrapping it in CDATA.





The information is used to keep a database up to date for a service that 
was created in order to provide more advanced functionality for the 
service that made it.


The XML file is not -mine-, and to search for all the html entities and 
wrap them in cdata before parsing would be kinda silly I think :O


So yea, thats what I was trying to avoid having to do :O

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



[PHP] Integration between PHP and PostgreSQL

2006-01-29 Thread Mark
I have a couple extensions that maybe useful for PHP users who use
PostgreSQL.

I have a serializer for PHP that serializes session data to a documented XML
format. That extension is called XMLDBX. I also have a PostgreSQL extension
that will read this XML data and allow you to query it.

select xmldbx('data.myclass.userid', mytable.session)

$myclass['userid'] or $myclass->userid will be returned if it was
serialized.

more info at:

http://www.mohawksoft.org

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



[PHP] PHP charset problem

2006-01-29 Thread php @ net mines

Hi all

I'm using PHP 4.x and MySQL 3.x. I'm saving in my DB various fields with 
greek text.
What I need to do is pass that data to flash in UTF format, but the MySQL 
doesn't support UTF.


Is there a way to take the greek text and convert it to UTFchars so Flash 
can read it?


Many Thanks

Mario 


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



[PHP] Support between MySQL and PHP

2006-01-29 Thread Philip R. Thompson
Hi all.

I figured this question was suitable for both the MySQL list and the 
PHP-General list. Here's what I'm running into.

I just installed MySQL5 and currently have PHP 4.3.11 installed. I 
am wanting to connect to the mysql database on localhost, but I 
get the following results:

--

"Client does not support authentication protocol requested by 
server; consider upgrading MySQL client"
--

Well, I have the lastest stable version of MySQL, so I did some more 
research on what the problem might be. When I checked my 
information for PHP using phpinfo(), it gave me the "Client API 
version" for MySQL was 3.23.49. So, I'm thinking my version of PHP 
cannot connect to my version of MySQL. I then considered if I 
installed the MySQLi extension for PHP (supports versions of MySQL 
> 4.1), would that help me? Or, if I just upgraded PHP to version 5, 
would that help me?

Does anyone have any suggestions on the direction I should go?

Thanks in advance,
~Philip

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



[PHP] Re: Support between MySQL and PHP

2006-01-29 Thread James Benson
Downgrading to MySQL 4.1 should fix the problem.




Philip R. Thompson wrote:
> Hi all.
> 
> I figured this question was suitable for both the MySQL list and the 
> PHP-General list. Here's what I'm running into.
> 
> I just installed MySQL5 and currently have PHP 4.3.11 installed. I 
> am wanting to connect to the mysql database on localhost, but I 
> get the following results:
> 
> --
> 
> "Client does not support authentication protocol requested by 
> server; consider upgrading MySQL client"
> --
> 
> Well, I have the lastest stable version of MySQL, so I did some more 
> research on what the problem might be. When I checked my 
> information for PHP using phpinfo(), it gave me the "Client API 
> version" for MySQL was 3.23.49. So, I'm thinking my version of PHP 
> cannot connect to my version of MySQL. I then considered if I 
> installed the MySQLi extension for PHP (supports versions of MySQL 
>> 4.1), would that help me? Or, if I just upgraded PHP to version 5, 
> would that help me?
> 
> Does anyone have any suggestions on the direction I should go?
> 
> Thanks in advance,
> ~Philip

-- 



-

Master CIW Designer  http://www.ciwcertified.com
Zend Certified Engineer  http://www.zend.com


http://www.jamesbenson.co.uk

-

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



Re: [PHP] Support between MySQL and PHP

2006-01-29 Thread Steve Edberg

At 1:18 PM -0600 1/29/06, Philip R. Thompson wrote:

Hi all.

I figured this question was suitable for both the MySQL list and the
PHP-General list. Here's what I'm running into.

I just installed MySQL5 and currently have PHP 4.3.11 installed. I
am wanting to connect to the mysql database on localhost, but I
get the following results:

--

"Client does not support authentication protocol requested by
server; consider upgrading MySQL client"
--

Well, I have the lastest stable version of MySQL, so I did some more
research on what the problem might be. When I checked my
information for PHP using phpinfo(), it gave me the "Client API
version" for MySQL was 3.23.49. So, I'm thinking my version of PHP
cannot connect to my version of MySQL. I then considered if I
installed the MySQLi extension for PHP (supports versions of MySQL

 4.1), would that help me? Or, if I just upgraded PHP to version 5,

would that help me?

Does anyone have any suggestions on the direction I should go?



Yes, the authentication protocol for MySQL changed at (I think) 
version 4.1. While you *could* downgrade MySQL, you could also 
upgrade your MySQL client libraries, which is what I would recommend. 
If PHP was compiled statically, you'll have to recompile it; 
otherwise you can just upgrade MySQL client libraries.


One other question: have you restarted your webserver since the MySQL 
upgrade? If not, it's possible the libraries were upgraded when MySQL 
was but your web server isn't using them. You could check by running 
php -i | grep -i mysql on the commandline, or just restart the 
webserver and recheck phpinfo().


The MySQLi is officially supported by PHP5 only, although apparently 
a number of people are using it with PHP4.


For more info, see:

http://dev.mysql.com/doc/refman/4.1/en/php.html

http://dev.mysql.com/doc/refman/4.1/en/application-password-use.html

http://www.php.net/mysql

http://www.php.net/mysqli

steve

--
+--- my people are the people of the dessert, ---+
| Steve Edberghttp://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center[EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+ said t e lawrence, picking up his fork +

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



Re: [PHP] Collecting info about columns in a table

2006-01-29 Thread tedd

Hi to all,
I need to collect info about columns from a selected table.
I use this:

$result = mysql_query("SELECT * FROM ". $TableName);
$fields = mysql_num_fields($result);
for ($i=0; $i < $fields; $i++)
{
$type  = mysql_field_type($result, $i);
$name  = mysql_field_name($result, $i);
$len  = mysql_field_len($result, $i);
$flags = mysql_field_flags($result, $i);

   echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
}

If I have columns type ENUM('live', 'hidden', 'pending'), $flags 
will show ONLY 'enum'.

How can I get all ENUM values?

Thanks for any help or direction.

-afan


-afan:

$type  = mysql_field_type($result, 'live');
$name  = mysql_field_name($result, 'hidden');
$len  = mysql_field_len($result, 'pending');

Provided that 'live', 'hidden', 'pending' are fields in your table.

tedd
--

http://sperling.com/

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



[PHP] PHP on domain...

2006-01-29 Thread Gustav Wiberg

Hi guys!

How can you check if a domain (that you don't own), can run PHP-code?

Is it possible? 


/G
@varupiraten.se

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



Re: [PHP] How can I get ENUM values from column info?

2006-01-29 Thread Silvio Porcellana [tradeOver]

[EMAIL PROTECTED] wrote:


If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
ONLY 'enum'.
How can I get all ENUM values?

Thanks for any help or direction.

-afan



This doesn't really seem a PHP question... BUT... give a look here:
http://dev.mysql.com/doc/refman/5.0/en/enum.html

There is one user comment ('Posted by J. Santiago Scarfo on March 31 
2005 7:16pm') that I think can help you.


Silvio

--
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

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



Re: [PHP] PHP on domain...

2006-01-29 Thread Steve Edberg

At 10:08 PM +0100 1/29/06, Gustav Wiberg wrote:

Hi guys!

How can you check if a domain (that you don't own), can run PHP-code?

Is it possible?
/G
@varupiraten.se



Answer 1:

Call them, fax them, email them, IM them, or check their website. 
This is the only way to know for sure.


Answer 2:

Check http://netcraft.com/

I don't know all the tools they use to record server information, but 
I presume that it includes methods like Answer 3 below.


Answer 3:

If you want to do this via a program, the answer is - in general, no. 
However, many servers will return an HTTP header containing this 
info. Also, (at least on Apache) server signatures may be set to 
reveal this info on error displays. You could open a socket 
connection to port 80 of the desired domain, and issue a HEAD 
request. You'll have to parse the results for Server and/or 
X-Powered-By and possibly other headers. Here's some examples via 
telnet:


telnet  80
Trying ...
Connected to .
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 200 OK
Date: Sun, 29 Jan 2006 21:23:03 GMT
Server: Apache
Content-Type: text/html
Connection: close



telnet  80
Trying ...
Connected to .
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 403 Access Forbidden
Server: Microsoft-IIS/5.0
Date: Sun, 29 Jan 2006 21:32:26 GMT
Content-Length: 4126
Content-Type: text/html



telnet  80
Trying ...
Connected to .
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 302 Moved Temporarily
Date: Sun, 29 Jan 2006 21:36:52 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
X-Powered-By: PHP/4.3.10
Location: index_html.html
Content-Type: text/html
Connection: close



However, many servers are set to not reveal this info for security 
purposes; it could also be spoofed for the same reason. For example, 
the second site above (the IIS one) actually *does* support PHP 
according to their website. See


http://www.php.net/manual/en/ref.sockets.php

for info on opening & reading from sockets; there is an example on 
this page in the user comments about sending HTTP HEAD requests.


steve

--
+--- my people are the people of the dessert, ---+
| Steve Edberghttp://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center[EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+ said t e lawrence, picking up his fork +

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



Re: [PHP] Collecting info about columns in a table

2006-01-29 Thread Gerry Danen
I think Afan means they are values in an enum field. But I may be mistaken... :)

Gerry

On 1/29/06, tedd <[EMAIL PROTECTED]> wrote:
> >Hi to all,
> >I need to collect info about columns from a selected table.
> >I use this:
> >
> >$result = mysql_query("SELECT * FROM ". $TableName);
> >$fields = mysql_num_fields($result);
> >for ($i=0; $i < $fields; $i++)
> >{
> >   $type  = mysql_field_type($result, $i);
> >   $name  = mysql_field_name($result, $i);
> >   $len  = mysql_field_len($result, $i);
> >   $flags = mysql_field_flags($result, $i);
> >
> >echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
> >}
> >
> >If I have columns type ENUM('live', 'hidden', 'pending'), $flags
> >will show ONLY 'enum'.
> >How can I get all ENUM values?
> >
> >Thanks for any help or direction.
> >
> >-afan
>
> -afan:
>
> $type  = mysql_field_type($result, 'live');
> $name  = mysql_field_name($result, 'hidden');
> $len  = mysql_field_len($result, 'pending');
>
> Provided that 'live', 'hidden', 'pending' are fields in your table.

--
Gerry
http://portal.danen.org/

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



[PHP] Re: query regard forms in PHP

2006-01-29 Thread M. Sokolewicz

look Suresh Kumar,

you came to this list about 2 weeks ago stating "i am working as a web 
designer in PHP & Mysql.i know the basics of PHP & Mysql". Since that 
post, you've posted the following questions:
1. i dont know how 2 store images in gif/jpeg format in Mysql Database.i 
also want 2 know PHP Code 2 store images in Mysql Database. reply me 
soon its very urgent .
2. i dont know   exact  PHP code for how 2 open file browser window to 
uplad file or an image plz help me.its very urgent.

3. a JS question ending in "plz help me itz very urgent."
4. for eg while(list(t1,t2,...)=mysql_fetch_row($result)): endwhile; 
while i use $t1 ouside while loop ,its corresponding value is not 
displaying,how can i display the value of $t1.
5.  am having 3 files  Login.php,home.php and home1.php when i entered 
username and passwd in my first login page i want want i entered as 
username and passwd in my third page ie home1.php.


Now, from these 5 posts you've made, I would like to advise you this: 
you do NOT know the basics of PHP/MySQL. PLEASE, learn at LEAST the 
basics of PHP and MySQL, get a book, attend a class, read a couple of 
tutorials, etc. But most of all, please, get a basic understanding of 
how PHP works (serverside vs. clientside, sessions/posting/getting data, 
etc).


By posting all these questions, you're getting either annoyed responses, 
or just 1 word (or URL) ones. Why? Because it's clear that giving you 
responses which explain everything simply won't work for you, because 
you don't have the basis to understand (and repeat) them.


hope you'll continue using PHP and actually delve a bit into it before 
continuing along the path as you're doing now,

- tul

P.S. this was not meant as a (personal) rant. If it appeares as such, 
then sorry, it is not meant to be.


suresh kumar wrote:

 hai,
i am having 3 files,namely page1,page2  and page3,when i enter username 
and password in my first page i want 2  display  my username and password  in 
my third page through  second page.
  
 A.suresh
  



-
 Jiyo cricket on Yahoo! India cricket


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



Re: [PHP] How can I get ENUM values from column info?

2006-01-29 Thread Afan Pasalic
I saw that one. Actually, I'm using right now the code below the one you  
mentiones (from Peter Rekdal). but was thinking that there is kind of  
pre-defines php function, smething like mysql_field_name(), or  
mysql_field_len(), or mysql_field_flags(). That's why I posted my question  
on this group. :)


Thanks Silvio.

-afan


On Sun, 29 Jan 2006 15:50:07 -0600, Silvio Porcellana [tradeOver]  
<[EMAIL PROTECTED]> wrote:



[EMAIL PROTECTED] wrote:
 If I have columns type ENUM('live', 'hidden', 'pending'), $flags will  
show

ONLY 'enum'.
How can I get all ENUM values?
 Thanks for any help or direction.
 -afan



This doesn't really seem a PHP question... BUT... give a look here:
http://dev.mysql.com/doc/refman/5.0/en/enum.html

There is one user comment ('Posted by J. Santiago Scarfo on March 31  
2005 7:16pm') that I think can help you.


Silvio





--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



Re: [PHP] PHP on domain...

2006-01-29 Thread Gustav Wiberg


- Original Message - 
From: "Steve Edberg" <[EMAIL PROTECTED]>
To: "Gustav Wiberg" <[EMAIL PROTECTED]>; "PHP General" 


Sent: Sunday, January 29, 2006 10:51 PM
Subject: Re: [PHP] PHP on domain...



At 10:08 PM +0100 1/29/06, Gustav Wiberg wrote:

Hi guys!

How can you check if a domain (that you don't own), can run PHP-code?

Is it possible?
/G
@varupiraten.se



Answer 1:

Call them, fax them, email them, IM them, or check their website. This is 
the only way to know for sure.


Answer 2:

Check http://netcraft.com/

I don't know all the tools they use to record server information, but I 
presume that it includes methods like Answer 3 below.


Answer 3:

If you want to do this via a program, the answer is - in general, no. 
However, many servers will return an HTTP header containing this info. 
Also, (at least on Apache) server signatures may be set to reveal this 
info on error displays. You could open a socket connection to port 80 of 
the desired domain, and issue a HEAD request. You'll have to parse the 
results for Server and/or X-Powered-By and possibly other headers. Here's 
some examples via telnet:


telnet  80
Trying ...
Connected to .
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 200 OK
Date: Sun, 29 Jan 2006 21:23:03 GMT
Server: Apache
Content-Type: text/html
Connection: close



telnet  80
Trying ...
Connected to .
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.1 403 Access Forbidden
Server: Microsoft-IIS/5.0
Date: Sun, 29 Jan 2006 21:32:26 GMT
Content-Length: 4126
Content-Type: text/html



telnet  80
Trying ...
Connected to .
Escape character is '^]'.
HEAD / HTTP/1.0

HTTP/1.0 302 Moved Temporarily
Date: Sun, 29 Jan 2006 21:36:52 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10 mod_ssl/2.8.22 OpenSSL/0.9.7e
X-Powered-By: PHP/4.3.10
Location: index_html.html
Content-Type: text/html
Connection: close



However, many servers are set to not reveal this info for security 
purposes; it could also be spoofed for the same reason. For example, the 
second site above (the IIS one) actually *does* support PHP according to 
their website. See


http://www.php.net/manual/en/ref.sockets.php

for info on opening & reading from sockets; there is an example on this 
page in the user comments about sending HTTP HEAD requests.


steve

--
+--- my people are the people of the dessert, ---+
| Steve Edberghttp://pgfsun.ucdavis.edu/ |
| UC Davis Genome Center[EMAIL PROTECTED] |
| Bioinformatics programming/database/sysadmin (530)754-9127 |
+ said t e lawrence, picking up his fork +

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


Hi there!

Thanx for info!

/G

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



Re: [PHP] Collecting info about columns in a table

2006-01-29 Thread Gerry Danen
Afan,

Here's some code that will show enum values:


$q2 = "describe ". $tname . " ;";
$r2 = mysql_query($q2) or die(mysql_error());
while ( $a2 = mysql_fetch_array($r2) )
{
$els = count($a2);
echo "";
for ($i2 = 0; $i2 < $els; $i2++)
{
$f = $a2[$i2] ;
if ($f == "") $f = " ";
echo $f . " | ";
}
echo "\n";
}

Perhaps combining it with your code will give you what you need.

Gerry

On 1/29/06, Afan Pasalic <[EMAIL PROTECTED]> wrote:
> Hi to all,
> I need to collect info about columns from a selected table.
> I use this:
>
> $result = mysql_query("SELECT * FROM ". $TableName);
> $fields = mysql_num_fields($result);
> for ($i=0; $i < $fields; $i++)
> {
> $type  = mysql_field_type($result, $i);
> $name  = mysql_field_name($result, $i);
> $len  = mysql_field_len($result, $i);
> $flags = mysql_field_flags($result, $i);
>
> echo $type . " | " . $name . " | " . $len . " | " . $flags ."\n";
> }
>
> If I have columns type ENUM('live', 'hidden', 'pending'), $flags will show
> ONLY 'enum'.
> How can I get all ENUM values?
>
> Thanks for any help or direction.
>
> -afan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Gerry
http://portal.danen.org/

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



[PHP] Retrieve output from HTML or PHP file

2006-01-29 Thread Peter Lauri
Best group member,

 

I have a php script running and need to save the output from an HTML-file or
PHP-file. What I want to do:

 

$the_output = thenicefunction('file.html');

 

Any suggestions?

 

/Peter

 

 

 

 

 



Re: [PHP] Retrieve output from HTML or PHP file

2006-01-29 Thread Chris

Hi Peter,

Close :)

file('file.html');
see http://www.php.net/file
or

file_get_contents('file.html');
see http://www.php.net/file_get_contents

the 'file' function returns an array, 'file_get_contents' returns it as 
a string.


Peter Lauri wrote:

Best group member,

 


I have a php script running and need to save the output from an HTML-file or
PHP-file. What I want to do:

 


$the_output = thenicefunction('file.html');

 


Any suggestions?

 


/Peter


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



RE: [PHP] Retrieve output from HTML or PHP file

2006-01-29 Thread Peter Lauri
Hi Chris,

As I read in the documentation it only takes the content of the file. If
there is a script in the file I want that to be fun first. A file like this:

--
HTLM content

HTML content
--

I want the result from my function to be

--
HTLM content
Hello World
HTML content
--

The file_get_contents('file.html') will give me

--
HTLM content

HTML content
--

Or am I not correct?

Best regards,
Peter Lauri




-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 30, 2006 11:49 AM
To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Retrieve output from HTML or PHP file

Hi Peter,

Close :)

file('file.html');
see http://www.php.net/file
or

file_get_contents('file.html');
see http://www.php.net/file_get_contents

the 'file' function returns an array, 'file_get_contents' returns it as 
a string.

Peter Lauri wrote:
> Best group member,
> 
>  
> 
> I have a php script running and need to save the output from an HTML-file
or
> PHP-file. What I want to do:
> 
>  
> 
> $the_output = thenicefunction('file.html');
> 
>  
> 
> Any suggestions?
> 
>  
> 
> /Peter

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



Re: [PHP] Retrieve output from HTML or PHP file

2006-01-29 Thread Chris

Hi Peter,

Ah, I understand now.

If the file echo'ed it's output you could do:

ob_start();
include('file.php');
$output = ob_get_contents();
ob_end_clean();

or:

$output = exec('script.php');

(but make sure you use escapeshellarg &/or escapeshellcmd where 
applicable for security reasons).


first method would be better, more robust and more portable.

Peter Lauri wrote:

Hi Chris,

As I read in the documentation it only takes the content of the file. If
there is a script in the file I want that to be fun first. A file like this:

--
HTLM content

HTML content
--

I want the result from my function to be

--
HTLM content
Hello World
HTML content
--

The file_get_contents('file.html') will give me

--
HTLM content

HTML content
--

Or am I not correct?

Best regards,
Peter Lauri




-Original Message-
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 30, 2006 11:49 AM

To: Peter Lauri
Cc: php-general@lists.php.net
Subject: Re: [PHP] Retrieve output from HTML or PHP file

Hi Peter,

Close :)

file('file.html');
see http://www.php.net/file
or

file_get_contents('file.html');
see http://www.php.net/file_get_contents

the 'file' function returns an array, 'file_get_contents' returns it as 
a string.


Peter Lauri wrote:


Best group member,



I have a php script running and need to save the output from an HTML-file


or


PHP-file. What I want to do:



$the_output = thenicefunction('file.html');



Any suggestions?



/Peter





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



Re: [PHP] Retrieve output from HTML or PHP file

2006-01-29 Thread Michael Hulse
I have used output buffering[1] in the past to do what you are  
describing.




# HTML to be written:
ob_start(); // Begin output buffering:
	require($_SERVER['DOCUMENT_ROOT'].$path.'/ 
'.$name_of_template.$name_of_template_ext);
	$message = ob_get_contents(); // Put contents of the above require  
into $message.

ob_end_clean(); // Clean the output buffer.



Probably better ways to do above, but maybe that will help you in some  
way.


Oh, you may also want to look into the eval() function[2].

[1] http://us2.php.net/manual/en/function.ob-start.php
[2] http://us2.php.net/manual/en/function.eval.php

Cheers, Micky
--
BCC for Privacy: http://www.cs.rutgers.edu/~watrous/bcc-for-privacy.html
My del.icio.us: http://del.icio.us/mhulse

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



RE: [PHP] Retrieve output from HTML or PHP file

2006-01-29 Thread Albert
Peter Lauri wrote:
> As I read in the documentation it only takes the content of the file. If
> there is a script in the file I want that to be fun first. A file like 
> this:
>
> --
> HTLM content
> 
> HTML content
> --
>
> I want the result from my function to be
>
> --
> HTLM content
> Hello World
> HTML content
> --
>
> The file_get_contents('file.html') will give me
>
> --
> HTLM content
> 
> HTML content
> --
>
> Or am I not correct?

Yes you are correct.

Why don't you include the file? PHP will parse the PHP inside it and output
the HTML...

If you want to get the contents into a variable then do something like:


Albert

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.23/243 - Release Date: 2006/01/27
 

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



Re: [PHP] Command Line PHP Advice

2006-01-29 Thread Nirmalya Lahiri
 
Hi,
 you can do this by using unix command 'for'. Please apply the
command written below & reply me your experiment result.

for filename in `ls *.txt`;do ./edit.php $filename var1 var2;done


--Nirmalya
 

Angelo Christou <[EMAIL PROTECTED]> wrote: Hello List
I would like some advice from PHP users regarding PHP and the command line. I 
have a PHP script that does a whole bunch of stuff to a file on my intranet.

./edit.php filename var1 var2

Everything works fine but I need to run it on a list of files  - 

./edit.php invoice00212.txt var1 var2
./edit.php invoice00213.txt var1 var2
./edit.php invoice00214.txt var1 var2

I have a list of several thousand files that will change every month. The list 
has the filenames and variables, like this so I am half way there I think -

invoice00212.txt var1 var2
invoice00213.txt var1 var2
invoice00214.txt var1 var2

My question is how should I incorporate this with my PHP script?

I read that it's better to split scripts up into small reusable parts so my 
plan is to keep the logic out of the edit.php script and simply pass the 
variables to it using another script. Am I on the right path doing this?

I am only a beginner with PHP so I admit I don’t really know what I’m doing, 
that is why I am asking for pointers from the PHP Mail List :)

Below is my model, however I am unsure how to achieve this or even if it's the 
best way to do it?

open filelist.txt
for each line create $filename $var1 $var2
then run
./edit.php $filename $var1 $var2
loop back to the next line
end

Many thanks in advance,
Ang.
 

  
-
Do you Yahoo!?
 With a free 1 GB, there's more in store with Yahoo! Mail.



-
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with your Yahoo! Mail.

Re: [PHP] Command Line PHP Advice

2006-01-29 Thread Nirmalya Lahiri
Angelo,
  I am very happy after knowing that it is working. :)
 
 --Nirmalya
 
 
Angelo Christou <[EMAIL PROTECTED]> wrote: 
Hello Nirmalya,

Thank you for your response. With the help of your reply, I've now got it 
working! :)

Ang.



Nirmalya Lahiri <[EMAIL PROTECTED]> wrote: Hi,
 you can do this by using unix command 'for'. Please apply the
command written below..& reply me your experiment result.

for filename in `ls *.txt`;do ./edit.php $filename var1 var2;done


--Nirmalya



--- Angelo Christou  wrote:

> Hello List
> I would like some advice from PHP users regarding PHP and the
> command line. I have a PHP script that does a whole bunch of stuff
> to a file on my intranet.
> 
> ./edit.php filename var1 var2
> 
> Everything works fine but I need to run it on a list of files  - 
> 
>  ./edit.php invoice00212.txt var1 var2
> ./edit.php invoice00213.txt var1 var2
> ./edit.php invoice00214.txt var1 var2
> 



   

-
Bring words and photos together (easily) with
  PhotoMail  - it's free and works with your Yahoo! Mail.



-
Bring words and photos together (easily) with
 PhotoMail  - it's free and works with your Yahoo! Mail.

[PHP] php and consol interface

2006-01-29 Thread Gregory Machin
Hi
I'm developing a web interface for server admin in php, but the bos has
added a complication, he wants ssh / telnet colson for as well,  is i
posible  to  create a consol  app in php  ?  My original idea was to have a
couple of files that the web interface would you to stor the settings and
generate the configs, but now i have to rethink my planning because of the
consol interface. Would you have any sugestions on how to keep consistancy
between the 2 interfaces configurations  ie. if the config is changed at the
consol it should be reflected on the web interfact..

Thanks for you time



--
Gregory Machin
[EMAIL PROTECTED]
[EMAIL PROTECTED]
www.linuxpro.co.za
www.exponent.co.za
Web Hosting Solutions
Scalable Linux Solutions
www.iberry.info (support and admin)

+27 72 524 8096