php-general Digest 9 Nov 2001 20:43:27 -0000 Issue 985

Topics (messages 74005 through 74056):

Re: Looking for security annoucements
        74005 by: Jimmy
        74018 by: Mark Roedel
        74039 by: Jimmy

php test page not working with apache 1.3.22
        74006 by: Caleb Carvalho
        74034 by: Neil Freeman

PHP Redirect / header("location: ")
        74007 by: phantom
        74008 by: Bas Jobsen
        74009 by: Scott Houseman

Javascript & php / need help
        74010 by: xrichx
        74011 by: Morten Winkler Jørgensen

get names of vars $HTTP_POST_VARS?
        74012 by: Vladimir Galkov
        74013 by: Stefan Rusterholz
        74014 by: Hidayet Dogan
        74015 by: Joffrey van Wageningen

Faking MS Access on MySQL linux box
        74016 by: mweb.inwind.it

Real problemas with sessions and SSI...
        74017 by: Christian Dechery

help please: exec/pasthru/system/popen problem
        74019 by: Wolfram Kriesing

Saving Dynamically Generated Pages
        74020 by: Chris
        74021 by: Wolfram Kriesing
        74023 by: Chris

Associative Arrays Performance under Linux
        74022 by: Mike Boulet

GD
        74024 by: Thargor

PHP Usage Stats
        74025 by: Chris

Security question: getenv()
        74026 by: Johnson, Kirk

Re: Newbie Question
        74027 by: Steve Brett

Classes Question
        74028 by: Paul - Zenith Tech Inc
        74030 by: pierre-yves

Re: Apostrophes and Textareas
        74029 by: Steve Brett

Re: Append to STDIN
        74031 by: Christian Reiniger

Dallas Texas PHP User Group?
        74032 by: Clint Tredway

How do I logout a user ?
        74033 by: John Martin Alfredsson
        74036 by: Julio Nobrega Trabalhando

call a function from a DLL?
        74035 by: GRI

Re: [PHP-WIN] call a function from a DLL?
        74037 by: Alain Samoun

Re: [PHP-DEV] Re: [PHP-WIN] call a function from a DLL?
        74038 by: James Moore

Any known reason, why 'ob_start("ob_gzhandler")' does not work?
        74040 by: Sebastian Stadtlich

Regular expression question
        74041 by: Leon Mergen

fopen and while problem
        74042 by: Dennis Moore

Re: PHP/XSLT questions
        74043 by: Jeff Warrington

variable issue
        74044 by: Clint Tredway
        74045 by: Johnson, Kirk
        74046 by: R'twick Niceorgaw
        74051 by: Matthew Luchak
        74055 by: Clint Tredway

Eval()??? A variables contents?
        74047 by: Christopher Raymond
        74048 by: Kurt Lieber
        74050 by: Chris Hobbs
        74052 by: Christopher Raymond
        74053 by: Johnson, Kirk

Re: [PHP-DB] Re: [PHP-DEV] Re: [PHP-WIN] call a function from a DLL?
        74049 by: Matthew Loff

MORE INFO  > Eval()??? A variables contents?
        74054 by: Christopher Raymond
        74056 by: Chris Hobbs

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 ---
I'm running phpBB not phpNuke and I'm subcribed to Buftraq, hope the otehrs
are more helpful for me...

Jimmy



--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Jimmy [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, November 09, 2001 2:41 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Looking for security annoucements
> 
> 
> I'm running phpBB not phpNuke and I'm subcribed to Buftraq, 
> hope the others are more helpful for me...

What version of phpBB?  I know there were a number of security fixes in
the last few releases (current looks to be 1.4.4)...


---
Mark Roedel             |  "Blessed is he who has learned to laugh
Systems Programmer      |   at himself, for he shall never cease
LeTourneau University   |   to be entertained."
Longview, Texas, USA    |                           -- John Powell 
--- End Message ---
--- Begin Message ---
1.4.0 was hacked, but just for fun on tuesday, on wednesday I upgraded to
1.4.2 and it was hacked by another hacker in the night!!!

I looked at the 1.4.2 for my customization, and this morning at the 1.4.4
and saw that even basic security holes are not fixed. The project team is
working on the 2.0 so I think the release is not serious.

I spent all the day to recover the defaced topics and texts, now I gonna
backup and think to another solution...

Thanks for the reply anyway,

Jimmy

-----Message d'origine-----

De : Mark Roedel [mailto:[EMAIL PROTECTED]]

Envoyé : vendredi 9 novembre 2001 15:22

À : Jimmy; [EMAIL PROTECTED]

Objet : RE: [PHP] Looking for security annoucements



> -----Original Message-----

> From: Jimmy [mailto:[EMAIL PROTECTED]]

> Sent: Friday, November 09, 2001 2:41 AM

> To: [EMAIL PROTECTED]

> Subject: Re: [PHP] Looking for security annoucements

>

>

> I'm running phpBB not phpNuke and I'm subcribed to Buftraq,

> hope the others are more helpful for me...

What version of phpBB? I know there were a number of security fixes in

the last few releases (current looks to be 1.4.4)...



---

Mark Roedel | "Blessed is he who has learned to laugh

Systems Programmer | at himself, for he shall never cease

LeTourneau University | to be entertained."

Longview, Texas, USA | -- John Powell



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

I've just finish upgrading my apache server to apache 1.3.22,
I have also compiled my php-4.0.6 with it.

When I try to test it using

<? php phpinfo(); ?> saved as php, the browser tries to download it instead.

I have added the application type under httpd.conf and restarted the server
./apachectl restart.

when I type

./apachectl status it does not show that the php-4.0.6 has be compiled with 
it.

Am i missing some steps? please point me out,

p.s. i have added the module of php4 /libphp4.a to apache
and did the make command to make it executable.

Thanks,

Caleb Carvalho
Application Engineer
LoadRunner/APM
-----------------------------------------------------------------------------------------
Enterprise Testing and Performance Management Solutions
-----------------------------------------------------------------------------------------
Mercury Interactive
410 Frimley Business Park
Frimley, Surrey.  GU16 7ST
United Kingdom
Telephone :  +44 (0)1276 808300


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--- End Message ---
--- Begin Message ---
Probably not your problem but shouldn't your php line be as follows:
<?php phpinfo(); ?>

ie without the space between <? and php?

Caleb Carvalho wrote:

> Hi all,
>
> I've just finish upgrading my apache server to apache 1.3.22,
> I have also compiled my php-4.0.6 with it.
>
> When I try to test it using
>
> <? php phpinfo(); ?> saved as php, the browser tries to download it instead.
>
> I have added the application type under httpd.conf and restarted the server
> ./apachectl restart.
>
> when I type
>
> ./apachectl status it does not show that the php-4.0.6 has be compiled with
> it.
>
> Am i missing some steps? please point me out,
>
> p.s. i have added the module of php4 /libphp4.a to apache
> and did the make command to make it executable.
>
> Thanks,
>
> Caleb Carvalho
> Application Engineer
> LoadRunner/APM
> 
>-----------------------------------------------------------------------------------------
> Enterprise Testing and Performance Management Solutions
> 
>-----------------------------------------------------------------------------------------
> Mercury Interactive
> 410 Frimley Business Park
> Frimley, Surrey.  GU16 7ST
> United Kingdom
> Telephone :  +44 (0)1276 808300
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> ***************************************************************
>  This message was virus checked with: SAVI 3.50
>  last updated 5th November 2001
> ***************************************************************

--
--------------------------------
 Email:  [EMAIL PROTECTED]
         [EMAIL PROTECTED]
--------------------------------


--- End Message ---
--- Begin Message ---
I am trying to set up a redirect scirpt that in ASP was
response.redirect(escape("newpage.asp")).

I tried in PHP >> header("location: newpage.php")

but all i got was an error message saying that my header content had
already been sent.  This PHP script was above the html script.

Am I doing something wrong?  Thank you.

--- End Message ---
--- Begin Message ---
> Am I doing something wrong?  Thank you.
You may print nothing before the redirect header!
<?
echo "hello";
header("Location: go");
exit;
#wrong!
?>

<?
<?
header("Location: go");
exit;
echo "hello";
#oke, but "hello" isn't print
?>
?>
----- Original Message ----- 
From: "phantom" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 10:01 AM
Subject: [PHP] PHP Redirect / header("location: ")


> I am trying to set up a redirect scirpt that in ASP was
> response.redirect(escape("newpage.asp")).
> 
> I tried in PHP >> header("location: newpage.php")
> 
> but all i got was an error message saying that my header content had
> already been sent.  This PHP script was above the html script.
> 
> Am I doing something wrong?  Thank you.
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

--- End Message ---
--- Begin Message ---
Make sure that there is no output from your PHP script - or any HTML code
whatsoever - before you call the header function.
Cheers
Scott
----- Original Message -----
From: "phantom" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 11:01 AM
Subject: [PHP] PHP Redirect / header("location: ")


> I am trying to set up a redirect scirpt that in ASP was
> response.redirect(escape("newpage.asp")).
>
> I tried in PHP >> header("location: newpage.php")
>
> but all i got was an error message saying that my header content had
> already been sent.  This PHP script was above the html script.
>
> Am I doing something wrong?  Thank you.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


--- End Message ---
--- Begin Message ---
The problem is, i need a javascript which i can write into the database,
which on the oher side can read out a php SESSION. Is this possible?
Yes? how?

It's for a navigation bar wich gets the names of links in the navigation
bar out of the database, and i have a SESSION where he writes in, the
name of the guy wich is logged in, so i want to make a link in the menu
bar with his name! I hope this eyplains my problem a little bit. If u
need more details to help me please contact me at [EMAIL PROTECTED]
Thanks!

[
mysql
php4
iis
win2k
]

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


x> The problem is, i need a javascript which i can write into the database,
x> which on the oher side can read out a php SESSION. Is this possible?
x> Yes? how?

Javascript in browser
php on server

Pass varibales from javascript -> php via urls and forms
Pass varibales from php -> javascript via echo's





-- 
Kind regards,
  Morten Winkler


--- End Message ---
--- Begin Message ---
Good day!
 Is there any way to get names of vars and values from $HTTP_POST_VARS if  I
don't know their names and (ofcourse) values? (number can be taken from
count($HTTP_POST_VARS)  ) ...

 This is nesesery to write a function wich write log of user's work with
remote filesystem.
Vladimir Galkov
[EMAIL PROTECTED]
ICQ 84873967


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

HTTP_POST_VARS is an array, so you can iterate with forach:
foreeach($HTTP_POST_VARS as $variableName => $variableValue){
    echo "<P>In Variable $variableName you submitted:
".htmlentities($variableValue)."</P>\n";
}

For further information go on http://www.php.net, there is a _very_ good
documentation. (For this topic look at "array functions")

Stefan Rusterholz, [EMAIL PROTECTED]
----------------------------------
interaktion gmbh
Stefan Rusterholz
Zürichbergstrasse 17
8032 Zürich
----------------------------------
T. +41 1 253 19 55
F. +41 1 253 19 56
W3 www.interaktion.ch
----------------------------------


----- Original Message -----
From: "Vladimir Galkov" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 1:36 PM
Subject: [PHP] get names of vars $HTTP_POST_VARS?


> Good day!
>  Is there any way to get names of vars and values from $HTTP_POST_VARS if
I
> don't know their names and (ofcourse) values? (number can be taken from
> count($HTTP_POST_VARS)  ) ...
>
>  This is nesesery to write a function wich write log of user's work with
> remote filesystem.
> Vladimir Galkov
> [EMAIL PROTECTED]
> ICQ 84873967
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>
>

--- End Message ---
--- Begin Message ---
Or other way:

while (list($key, $val) = each($HTTP_POST_VARS))
  echo "$key = $val<br>\n";


                                             Hidayet Dogan
                              [EMAIL PROTECTED]

Pleksus Bilisim Teknolojileri D.T.O. A.S.
----------------------------------------------------------
caldiran sok. 14/6 06420 kolej ankara * www.pleksus.com.tr
tel : +90 312 4355343 * faks: +90 312 4354006

On Fri, 9 Nov 2001, Vladimir Galkov wrote:

> Good day!
>  Is there any way to get names of vars and values from $HTTP_POST_VARS if  I
> don't know their names and (ofcourse) values? (number can be taken from
> count($HTTP_POST_VARS)  ) ...
> 
>  This is nesesery to write a function wich write log of user's work with
> remote filesystem.
> Vladimir Galkov
> [EMAIL PROTECTED]
> ICQ 84873967
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 

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

a great way to debug things like this is to use var_dump or print_r...

http://www.php.net/manual/en/function.var-dump.php
http://www.php.net/manual/en/function.print-r.php

<pre>
<?php var_dump($HTTP_POST_VARS); ?>
</pre>

short and simple :)

with kind regards,
Joffrey van Wageningen


On Fri, 9 Nov 2001, Hidayet Dogan wrote:
> Or other way:
>
> while (list($key, $val) = each($HTTP_POST_VARS))
>   echo "$key = $val<br>\n";
>
> On Fri, 9 Nov 2001, Vladimir Galkov wrote:
>
> > Good day!
> >  Is there any way to get names of vars and values from $HTTP_POST_VARS if  I
> > don't know their names and (ofcourse) values? (number can be taken from

--- End Message ---
--- Begin Message ---
Hello,

For reasons not worth discussing here, I have to develop and test on
Linux/Apache some PHP pages that will have to access via ODBC a MS Access database on 
an NT/IIS/PHP server.

I would like to do it by writing PHP pages that access via ODBC
some mysql or other database on my linux box, in such a way that,
if it works there, I just change some general setting, upload the pages
and they work for sure on the MS Access thing (something like:
ifdef LINUX then ODBC_ACCESSES_MYSQL
ifdef NT    then ODBC_ACCESSES_MS_Access)

I am sure that this must be possible, but would really appreciate some
examples/pointers to specific tutorial/similar stories/etc.

                TIA,
                        mweb

--- End Message ---
--- Begin Message ---
Can someone explain to me why sessions don't work with SSI?

Let me explain my case:
I have a php script called miec.php, which uses sessions extensively. It's 
a script to show products from a catalog randomly, and in the session it 
keeps the products already shown, so it doesn't repeat... it works just fine.

So... if I go to my browser and point to miec.php, and keep reloading it, I 
can see it working... the sessions get updated perfectly and then reseted 
when the maxinum number of allowed products is reached...

Then I have another file called test.shtml which includes miec.php via SSI 
(<!--#include virtual="miec.php"-->), the include is perfect... even the 
cookies holding the userId works... but the session simply doesn't work...

When I load test.shtml, a session is create by miec.php, I can even see the 
file on the server. But if I reload the page, another session is created 
instead of using the same, so it's not persistent... thus, it doesn't work 
at all.

The weird thing is: if I call miec.php directly, the session gets created 
normally, if then I point the browser to test.shtml, the session persists 
normally, and then everything works as expected... I believe this is not 
the expected behaviour...

Does sessions work with SSI or not?


--- End Message ---
--- Begin Message ---
i was now trying all the examples from the docs but no success yet
can someone please help?

i want to convert an image to another format i was fread-ing the one
image into
        $image1
so they are binary in there
and i want to pass that to imagemagick's convert, using:
        convert gif:- jpg:-
which reads from stdin and outputs the result to stdout
how can i pass the _binary_ $image1 to convert and retreive the
        $convertedImage
reason, i want to insert the image as a blob and i dont want to mess
with files

thank you

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

I’m using PHP to allow a user to update several MySql records in a batch
process. During the update I print to the browser information about the
update (records deleted, added, changed…etc.). What I would like to do
is also save this report so the user can access it at a later time.

I’m considering writing all the update information to a datafile before
displaying it to the user, say through an include(); What I would like
to do is direct the output (all my prints) to that report file. It seems
though that I might have to go through my code and explicitly use fputs
to accomplish this task.

Any suggestions welcome.

Thanks,
Chris


--- End Message ---
--- Begin Message ---
> I’m considering writing all the update information to a datafile
> before displaying it to the user, say through an include(); What I
> would like to do is direct the output (all my prints) to that
> report file. It seems though that I might have to go through my
> code and explicitly use fputs to accomplish this task.

have a look at "output buffering"
   http://www.php.net/manual/en/function.ob-start.php
this way you can send output you actually send to the browser save in 
a buffer and do with it whatever u want :-)

-- 
Wolfram
--- End Message ---
--- Begin Message ---
It appears this function is only available for PHP4+. I have been trying
to stay compatible with PHP3 but maybe I should abandon this requirement.
Do you know of any URLs that may provide stats on versions of PHP in use?

Thanks,
Chris


Wolfram Kriesing wrote:

> > I’m considering writing all the update information to a datafile
> > before displaying it to the user, say through an include(); What I
> > would like to do is direct the output (all my prints) to that
> > report file. It seems though that I might have to go through my
> > code and explicitly use fputs to accomplish this task.
>
> have a look at "output buffering"
>    http://www.php.net/manual/en/function.ob-start.php
> this way you can send output you actually send to the browser save in
> a buffer and do with it whatever u want :-)
>
> --
> Wolfram

--- End Message ---
--- Begin Message ---
I have been troubleshooting the performance of some code for a couple of
days and I have not been able to find out what is happening.

Here's the pseudo-code

- Get jobs from the MySql database. Return all customers. Returns 10 rows.
then for each customer return their active jobs. ( About 1 to 2 rows ).
- for each row build and array entry which looks like the following

    Array Customers
    {
        Array CustInfo()
        {
            Array Job 1 Info
                    Array Functions()
                    Array Details()
            Array Job 2 Info
                    Array Functions()
                    Array Details()
        }
        Array CustInfo()
        {
            Array Job 1 Info
                    Array Functions()
                    Array Details()
            Array Job 2 Info
                    Array Functions()
                    Array Details()
        }
    }

    There may be more than one customer (CustInfo) stored.  The problem is
that under Windows 2000 server the code that builds the array takes 1/1000
of second to execute for each item added to the custinfo array.  When I move
the same code and database to my Red Hat 7.1 Linux server  it takes 2/100 of
a second!! So the whole process of building the arrays takes a total of
2/10th of a second under Windows 2000 server and takes 2 seconds on the
Linux server.
I have never seen this kind of issue before under Linux and was wondering
what it could be? PHP Config option? Linux config option?

Specs of the Servers
=================================
The Windows 2000 server is a 600Mhz Pentium with 384Megs ram

The Linux server is Red Hat 7.1 on a Dual gighz server with 512 megs ram..

Both servers are running php 4.0.6.

There is no load on the Linux server to affect the numbers. All other
processes including other PHP code runs great and much faster than Windows
2000.

Any advice would be appreciated.




--- End Message ---
--- Begin Message ---
Hello,

 im searching the gd.dll for windows with gif support.
 who can help me?

-- 
 Thargor                          mailto:[EMAIL PROTECTED]

http://www.vergessene-welt.de

--- End Message ---
--- Begin Message ---
Are there any refrences that would indicate the percent of sites (PHP
installs) using various versions of PHP (i.e., 60% PHP4, 30% PHP3,
etc.)?

--- End Message ---
--- Begin Message ---
Happy Friday!

I don't know anything about the innards of the PHP/Apache relationship. I am
wondering if there is a security advantage to using the getenv() function to
access an environment variable, instead of using the $HTTP_SERVER_VARS
array, or, if register_globals is on, the global version of the variable.
Using $SERVER_NAME as an example, and assuming register_globals is on, if

$foo = gentenv("SERVER_NAME");
$bar = $HTTP_SERVER_VARS["SERVER_NAME"];

are $foo, $bar and $SERVER_NAME guaranteed to have the same value? Can a
cracker poison one of these but not the other? Does getenv() get the value
from Apache or PHP's namespace?

You know what I'm getting at, right? ;)

TIA

Happy Friday!

Kirk
--- End Message ---
--- Begin Message ---
have a look at get_html_translation_table() in the php manual.

there is an example of conversion of all special chars so they can be
inserted into the database as text (i.e. £>&pound) and a cool way of
'decoding' them if you need to write them to a file. A Browser wil interpret
them correctly when they are displayed.

This must be the question of the day as i have posted this answer three
times today :-)

Let me know if you need any more help

Steve

get_html_translation_table manual page is below:

      PHP Manual
      Prev  Next

----------------------------------------------------------------------------
----

get_html_translation_table
(PHP 4 >= 4.0b4)

get_html_translation_table --  Returns the translation table used by
htmlspecialchars() and htmlentities()
Description

string get_html_translation_table (int table [, int quote_style])


get_html_translation_table() will return the translation table that is used
internally for htmlspecialchars() and htmlentities(). There are two new
defines (HTML_ENTITIES, HTML_SPECIALCHARS) that allow you to specify the
table you want. And as in the htmlspecialchars() and htmlentities()
functions you can optionally specify the quote_style you are working with.
The default is ENT_COMPAT mode. See the description of these modes in
htmlspecialchars(). Example 1. Translation Table Example

$trans = get_html_translation_table (HTML_ENTITIES);
$str = "Hallo & <Frau> & Krämer";
$encoded = strtr ($str, $trans);



The $encoded variable will now contain: "Hallo &amp; &lt;Frau&gt; &amp;
Kr&auml;mer".

The cool thing is using array_flip() to change the direction of the
translation.


$trans = array_flip ($trans);
$original = strtr ($str, $trans);




The content of $original would be: "Hallo & <Frau> & Krämer".
  Note: This function was added in PHP 4.0.


See also: htmlspecialchars(), htmlentities(), strtr(), and array_flip().


----------------------------------------------------------------------------
----
      Prev Home Next
      explode Up get_meta_tags





"Jay Fitzgerald" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Ok, I am still fairly new at PHP and MySQL also, so please bear with me.
>
>
> TASK: I have a client that wants to have job openings listed on their site
> and they want to be able to add, edit and delete the postings themselves.
I
> would do this in flat-file format but there is the risk of that file size
> getting too large and slowing down the server.
>
>
> SOLUTION: I have created a MySQL database that will hold all the postings
> in a table called 'jobs' and have created a PHP form that will post this
> jobs into the db.
>
> PROBLEM: When I go to the PHP form and enter all of the pertinent job
> information, there is one specific field that will have to have carriage
> returns/line breaks in it between paragraphs. Everything is working except
> for this. Is there a way whenever the user presses <ENTER>, that either
> PHP/MySQL will convert this into a <BR> tag only when being displayed in a
> browser and not in the db??
>
>
> Can anyone out there please help me with this? I am available off-list as
> well if it will be easier to pass code back and forth. Any assistance is
> greatly appreciated!
>
>
>
> Should you have any questions, comments or concerns, feel free to call me
> at 318-338-2034.
>
> Thank you for your time,
>
> Jay Fitzgerald, Design Director - CSBW-A, CPW-A, CWD-A, CEMS-A
> ==========================================================
> Bayou Internet..............(888)
> 30-BAYOU........................http://www.bayou.com
> Mississippi Internet.......(800)
> MISSISSIPPI...............http://www.mississippi.net
> Vicksburg Online..........(800)
> MISSISSIPPI................http://www.vicksburg.com
> ==========================================================
> Tel: (318) 338-2034                ICQ: 38823829                     Fax:
> (318) 323-5053
>


--- End Message ---
--- Begin Message ---
I'm hoping somebody has the answer to this!

I have 3 pages, one a normal PHP page, and 2 which are classes.

One class, is a MySQL class I have written to connect/update users, etc
And the other is the manage users on the system.

Is there a way I can get the "users" class to talk to the "mysql" class?

I have this code to make a new instance of the MySQL class (the True means
use persistent connections) and a new instance of the users class

    $db = new MySQL(True);
    $users = new Users();

I am then using this code to check the list of banned users

    $users->CheckBannedUser("spacetowns",$db);

 In the CheckBannedUser function, I have this

    $db->sql_query("SELECT user FROM banned_users");

But that does not work, (it works fine when used from the standard PHP page)

Is it not possible to do what I am trying to do?
Or am I doing it all wrong?

Many thanks,
Paul



--- End Message ---
--- Begin Message ---
Hello,

what I would do is build the instance of your mysql class in the constructor
of the user class

class User{
  var $db;

  // constructor
  function User(){
    $this->db = new Mysql(True);
  }

  // function that show how to use the Mysql class in the User class
  function foo(){
    $this->db->sql_query("SELECT user FROM banned_users");
  }
} // end class

hope it help,
py


----- Original Message -----
From: "Paul - Zenith Tech Inc" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 11:26 AM
Subject: [PHP] Classes Question


> I'm hoping somebody has the answer to this!
>
> I have 3 pages, one a normal PHP page, and 2 which are classes.
>
> One class, is a MySQL class I have written to connect/update users, etc
> And the other is the manage users on the system.
>
> Is there a way I can get the "users" class to talk to the "mysql" class?
>
> I have this code to make a new instance of the MySQL class (the True means
> use persistent connections) and a new instance of the users class
>
>     $db = new MySQL(True);
>     $users = new Users();
>
> I am then using this code to check the list of banned users
>
>     $users->CheckBannedUser("spacetowns",$db);
>
>  In the CheckBannedUser function, I have this
>
>     $db->sql_query("SELECT user FROM banned_users");
>
> But that does not work, (it works fine when used from the standard PHP
page)
>
> Is it not possible to do what I am trying to do?
> Or am I doing it all wrong?
>
> Many thanks,
> Paul
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>

--- End Message ---
--- Begin Message ---
have a look at get_html_translation_table htmlspecialchars() ,
htmlentities()  and get_html_translation_table.

these function do all the work for you without reinventing the wheel.

Steve

"Joe Van Meer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> Hi there...I'm new to php coming from an asp background. I have a form
with
> two textarea form elements which is eventually inserted into a sqlServer
db.
> Everything works great, but one small problem How do I work around
> apostrophes within the textareas? I keep getting errors when they are
> present and no errors when I remove all of the apostrophes.
>
> Thx in advance, Joe
>
>


--- End Message ---
--- Begin Message ---
On Friday 09 November 2001 05:16, Cleber S. Mori wrote:
> Hi again...
>
> I had already RTFM...
> Neither in exec or  ``'s I found any thing about STDIN...

Just a blind shot:

$Data = escapeshellarg ($MyVariable);
system ("echo $Data | myscript.py -param");

-- 
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)

I saw God --------- and she was black.
--- End Message ---
--- Begin Message ---
Does this exist? If so what is the URL to the website. If it does not exist, I am 
thinking of starting one.

Thanks


--
Clint Tredway
www.factorxsoftware.com

Get Chatster - a free CF Chat Program
http://www.factorxsoftware.com/download/

Need help with a Factor Product?
http://www.factorxsoftware.com/forum/

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

I have a site where I do the user autentication myself. (I auth
against a database). I want to be able to let a user logout, that is
when the user is logged out she/he should not be able to just 
press the back button in the browser to get back or use a cached copy
of the login screen.

How do I do this ?
The Server is IIS and PHP is 4.0.6.

/Martin
jma(at)jma.se

--- End Message ---
--- Begin Message ---
  When they click logout, remove the marker from the database that specify
they are logged in.

  Then you must on all pages see if this marker is either 'on' or 'off'. But
sessions would be better for this since it is one sql query less. Just
unregister the variable on logout and check with:

if (!session_is_registered('user_logged')) {
   // Anything for non logged users, for example:
   header('Location: login.php');
}

  Being 'user_logged' the varibale name you will register when they logged
in.


--

Julio Nobrega

A hora está chegando:
http://toca.sourceforge.net
"John Martin Alfredsson" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi !
>
> I have a site where I do the user autentication myself. (I auth
> against a database). I want to be able to let a user logout, that is
> when the user is logged out she/he should not be able to just
> press the back button in the browser to get back or use a cached copy
> of the login screen.
>
> How do I do this ?
> The Server is IIS and PHP is 4.0.6.
>
> /Martin
> jma(at)jma.se
>


--- End Message ---
--- Begin Message ---
Hi there,

I was wondering if it is possible to call a function from my self
created DLL  from my PHP script.

Thanks in advanced.

--- End Message ---
--- Begin Message ---
See:
http://www.php.net/manual/en/faq.com.php#AEN63770
A+
Alain

On Fri, Nov 09, 2001 at 05:12:09PM +0000, GRI wrote:
> Hi there,
> 
> I was wondering if it is possible to call a function from my self
> created DLL  from my PHP script.
> 
> Thanks in advanced.
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
> See:
> http://www.php.net/manual/en/faq.com.php#AEN63770
> A+
> Alain

That FAQ isnt totally right. With the new w32api extension you can do so but
its still very experimental so Id advise you either to write your own little
extension to PHP to access your dll (shouldnt take you more than a couple of
hours), implement a com interface to your dll or wait for the w32api
extension to become more stable.

Cheers,

- James

--- End Message ---
--- Begin Message ---
Hi all
 
I have two scripts on the server in the SAME directory.
 
both have this line in the beginning:
 
ob_start("ob_gzhandler");
 
in one script it works. in the other it does not.......
it buffers, but does not zip the html...
the one where it does not work is VERy huge and does lots of stuff, so i
can't post it here.
what could prevent the gz_handler from  working????
 
this drives me nuts
*igoandcrynow*
 
Sebastian
 
 
--- End Message ---
--- Begin Message ---
Hello,

I have a little question regarding regular expressions... I want to check
for the pattern

$num::

But, $num may not be started with another number (assume the number will be
51 , 1 will also match (the pattern 1:: is available in 51::) ... Currently,
my regular expression is:

eregi("([^0-9]$num::)", $string);

But that doesn't seem to work... The other option, the start of a line or a
: also didn't work:

eregi("([^|:]$sess_id::)", $string);

Anyone can help me with this?

Thanks in advance,

Leon Mergen

--- End Message ---
--- Begin Message ---
I am having problems using the fopen functions within a while loop.  I am having problems passing variables into the function.  Has anyone else had this problem?
 
 
Example:
 
  $work_dir="$DOCUMENT_ROOT/click/oct01";
  $ls_res=system("ls $work_dir/*.html > $work_dir/ls.txt");
  $ar_file_list=file("$work_dir/ls.txt");
  reset($ar_file_list);
 
    while (list ($key, $val) = each ($ar_file_list)) {
          settype($val, "string");
          echo "$val<br>"; 
           if (is_writeable($val)) {
                $s = stat($val);
                $bytes = $s[7];
  
                echo "Bytes:  $bytes Exists: $val";
           }
  
       $fx = fopen($val, "r");
       $text = fread($fx,filesize($val));
       $size=filesize($val);
       echo "$size - $text <hr>";
       fclose($fx);
     }
Configure Command:
 
 './configure' '--with-apache=/u1/source/apache_1.3.20' '--with-zlib=/usr/local' '--with-jpeg-dir=/usr/local' '--with-png-dir=/u1/source/libpng-1.0.12' '--with-freetype-dir=/usr/local/include/freetype2' '--with-tiff-dir=/u1/source/tiff-v3.5.6-beta' '--with-gd=/u1/source/gd-2.0.1' '--with-mysql=/usr/local/bin/mysql-3.23.41' '--with-pdflib' '--enable-static-pdflib' '--enable-ftp' '--enable-gd-native-tt' '--enable-gd-imgstrttf' '--enable-trans-sid'
 
--- End Message ---
--- Begin Message ---
In <[EMAIL PROTECTED]>, Vikram Vaswani
wrote:

There is an undocumented function in php4.0.6 that allows you 
to specify an XSLT callback function for errors. You can
then create a function to parse out the error array created
by the callback function. It actually captures not only 
errors but also acts to log the work of the underlying
XSLT processor.

the function is xsl_set_error_handler and has parameters
of 1) the XSLT processor instance and 2) A string representing
the callback function name.

e.g. xslt_set_error_handler($this->xslth,"XSLT_ErrorHandler");

Here is a sample of the callback function i have. Using the
base php fuction error_log, you get the logging you want
as well.

function XSLT_ErrorHandler($parser, $code, $level, $errors) {
    if ($errors["msgtype"] == "log") {
        error_log(getNiceTime()."XSLT Status Code: $code\n",3,XSLT_LOG);
        error_log(getNiceTime()."XSLT Status Level: $level\n",3,XSLT_LOG);
        error_log(getNiceTime()."XSLT Status: {$errors['msg']}\n",3,XSLT_LOG);
    } else if ($errors["msgtype"] == "error") {
        error_log(getNiceTime()."XSLT Error Code: $code\n",3,XSLT_ERROR_LOG);
        error_log(getNiceTime()."XSLT Error Level: $level\n",3,XSLT_ERROR_LOG);
        error_log(getNiceTime()."XSLT Error FILE: 
{$errors['URI']}\n",3,XSLT_ERROR_LOG);
        error_log(getNiceTime()."XSLT Error LINE: 
{$errors['line']}\n",3,XSLT_ERROR_LOG);
        error_log(getNiceTime()."XSLT Error: {$errors['msg']}\n",3,XSLT_ERROR_LOG);
    }
}

Jeff


> Hi all,
> 
> I am working with the XSLT functions in PHP 4.0.6. I'm trying to trap
> errors with the xslt_error() functions - however, the function generates
> no output even if I deliberately introduce errors into the XSLT sheet.
> 
> Same goes for the openlog() function. Anyone have any ideas how I can
> use these to generate and log errors?
> 
> TIA,
> 
> Vikram
--- End Message ---
--- Begin Message ---
Hey everyone, I need some help with a variable issue. How can I delcare a variable and 
then if a url variable of the same name is present use that value instead?

this is what I have:
if(!$dte)
{
$dte=date("j", time()+$ctime);
}
else
{
$dte=$dte;
}
and this causing an error in the 'if' expression.

Thanks!
clint
--- End Message ---
--- Begin Message ---
The else clause can be removed, since it is not doing anything. What is the
error message?

Kirk

> Hey everyone, I need some help with a variable issue. How can 
> I delcare a variable and then if a url variable of the same 
> name is present use that value instead?
> 
> this is what I have:
> if(!$dte)
> {
> $dte=date("j", time()+$ctime);
> }
> else
> {
> $dte=$dte;
> }
> and this causing an error in the 'if' expression.
--- End Message ---
--- Begin Message ---
replace the if statement  if(!$dte)
with
if (!isset($dte))

----- Original Message -----
From: "Johnson, Kirk" <[EMAIL PROTECTED]>
To: "PHP General" <[EMAIL PROTECTED]>
Sent: Friday, November 09, 2001 2:35 PM
Subject: RE: [PHP] variable issue


> The else clause can be removed, since it is not doing anything. What is
the
> error message?
>
> Kirk
>
> > Hey everyone, I need some help with a variable issue. How can
> > I delcare a variable and then if a url variable of the same
> > name is present use that value instead?
> >
> > this is what I have:
> > if(!$dte)
> > {
> > $dte=date("j", time()+$ctime);
> > }
> > else
> > {
> > $dte=$dte;
> > }
> > and this causing an error in the 'if' expression.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>

--- End Message ---
--- Begin Message ---
if(!isset($dte))
{
$dte=date("j", time()+$ctime);}

You don't need the else statement.

____________________________ 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-----Original Message-----
From: Clint Tredway [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 09, 2001 2:37 PM
To: PHP General
Subject: [PHP] variable issue


Hey everyone, I need some help with a variable issue. How can I delcare
a variable and then if a url variable of the same name is present use
that value instead?

this is what I have:
if(!$dte)
{
$dte=date("j", time()+$ctime);
}
else
{
$dte=$dte;
}
and this causing an error in the 'if' expression.

Thanks!
clint

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
thanks for all the help. I realized that I did not need the else, and the isset() 
works great! Now I have my calendar working the way I want it to!

Thanks!
Clint

---------- Original Message ----------------------------------
From: "Matthew Luchak" <[EMAIL PROTECTED]>
Date: Fri, 9 Nov 2001 15:07:22 -0500

if(!isset($dte))
{
$dte=date("j", time()+$ctime);}

You don't need the else statement.

____________________________ 
Matthew Luchak 
Webmaster
Kaydara Inc. 
[EMAIL PROTECTED]


-----Original Message-----
From: Clint Tredway [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 09, 2001 2:37 PM
To: PHP General
Subject: [PHP] variable issue


Hey everyone, I need some help with a variable issue. How can I delcare
a variable and then if a url variable of the same name is present use
that value instead?

this is what I have:
if(!$dte)
{
$dte=date("j", time()+$ctime);
}
else
{
$dte=$dte;
}
and this causing an error in the 'if' expression.

Thanks!
clint

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


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



PHP Gurus:

I have one for you. I'm sure there is a simple solution, but I'm having
difficulty finding it.


Let's say I have:

$content = "<?PHP Query_Database( $category );?>";


If I use <?PHP echo $content; ?>, it doesn't evaluate that content. What am
I doing wrong here?


Is there an equivalent to JavaScript's eval($commands) function?


TIA,

Christopher Raymond

--- End Message ---
--- Begin Message ---
On Friday 09 November 2001 11:51 am, Christopher Raymond wrote:
> Let's say I have:
>
> $content = "<?PHP Query_Database( $category );?>";
>
>
> If I use <?PHP echo $content; ?>, it doesn't evaluate that content. What am
> I doing wrong here?

What you're doing doesn't make any sense.  If it were to work, it would look 
like the following:

<?PHP <?PHP Query_Database( $category );?> ; ?>,

or something similar.  I think what you want to do is:
<?php
  $content = query_database($category);
  echo $content;
?>

that's using psuedo-code, of course.  You'll want to substitute correct php 
syntax for returning database results.

--kurt
--- End Message ---
--- Begin Message ---
I just asked a similar question yesterday. The answer is, conveniently
enough, eval().

One trick from the php.net page on the function is to do somehting like
this:

$content = "<?PHP Query_Database( $category );?>";
echo eval ("?>$content");


Christopher Raymond wrote:
> 
> PHP Gurus:
> 
> I have one for you. I'm sure there is a simple solution, but I'm having
> difficulty finding it.
> 
> Let's say I have:
> 
> $content = "<?PHP Query_Database( $category );?>";
> 
> If I use <?PHP echo $content; ?>, it doesn't evaluate that content. What am
> I doing wrong here?
> 
> Is there an equivalent to JavaScript's eval($commands) function?
> 
> TIA,
> 
> Christopher Raymond
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Chris Hobbs       Silver Valley Unified School District
Head geek:              Technology Services Coordinator
webmaster:   http://www.silvervalley.k12.ca.us/~chobbs/
postmaster:               [EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
on 11/9/01 2:01 PM, Kurt Lieber at [EMAIL PROTECTED] wrote:

> What you're doing doesn't make any sense.  If it were to work, it would look
> like the following:
> 
> <?PHP <?PHP Query_Database( $category );?> ; ?>,
> 
> or something similar.  I think what you want to do is:
> <?php
> $content = query_database($category);
> echo $content;
> ?>
> 
> that's using psuedo-code, of course.  You'll want to substitute correct php
> syntax for returning database results.




Kurt:

I understand where you are coming from, and I appreciate your answer.
However, I'm trying to get PHP to parse commands that are stored in a
variable because I'm passing those commands to a function. Inside the
function, it needs to evaluate the commands stored in the variable.

Does you solution solve that or does my description clarify my problem
better?


Thanks,

Christopher

--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/function.eval.php

Kirk


> -----Original Message-----
> From: Christopher Raymond [mailto:[EMAIL PROTECTED]]
> Sent: Friday, November 09, 2001 1:11 PM
> To: PHP List
> Subject: Re: [PHP] Eval()??? A variables contents?
> 
> 
> on 11/9/01 2:01 PM, Kurt Lieber at [EMAIL PROTECTED] wrote:
> 
> > What you're doing doesn't make any sense.  If it were to 
> work, it would look
> > like the following:
> > 
> > <?PHP <?PHP Query_Database( $category );?> ; ?>,
> > 
> > or something similar.  I think what you want to do is:
> > <?php
> > $content = query_database($category);
> > echo $content;
> > ?>
> > 
> > that's using psuedo-code, of course.  You'll want to 
> substitute correct php
> > syntax for returning database results.
> 
> 
> 
> 
> Kurt:
> 
> I understand where you are coming from, and I appreciate your answer.
> However, I'm trying to get PHP to parse commands that are stored in a
> variable because I'm passing those commands to a function. Inside the
> function, it needs to evaluate the commands stored in the variable.
> 
> Does you solution solve that or does my description clarify my problem
> better?
--- End Message ---
--- Begin Message ---

You can system()/exec()/passthru() and run rundll32 on the library,
can't you?


-----Original Message-----
From: James Moore [mailto:[EMAIL PROTECTED]] 
Sent: Friday, November 09, 2001 12:34 PM
To: Alain Samoun; GRI
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP-DB] Re: [PHP-DEV] Re: [PHP-WIN] call a function from a
DLL?


> See:
> http://www.php.net/manual/en/faq.com.php#AEN63770
> A+
> Alain

That FAQ isnt totally right. With the new w32api extension you can do so
but
its still very experimental so Id advise you either to write your own
little
extension to PHP to access your dll (shouldnt take you more than a
couple of
hours), implement a com interface to your dll or wait for the w32api
extension to become more stable.

Cheers,

- James


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

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


Okay there are two files involved here. First is my index.php file:

$params = array('class' => 'text10', 'content' => 'Query_Database( $category
)');

switch ( $mode ) {
        
    case "list":
        
        Make_TR( $params ); // This is executing the included function.
        break;
            
    default:
        Display_Default();
        
}



Then there's the function that's located elsewhere in an include file:


<?PHP

function Make_TR ( $params ) {

  ( $params["class"] ) ? $class = "class=" . $params["class"] : $class = "";
  ( $params["content"] ) ? $content = $params["content"] : $content = "";

?>

<tr>
  <td width="535" <?PHP echo $class;?>>
    <div align="left">
      <br>
      <?PHP echo $content;?><br>
      <br>
    </div>
  </td>
</tr>

<?PHP

}

?>



Christopher  <-- Still has no solution :-(

--- End Message ---
--- Begin Message ---
OK, maybe I'm missing something, but why not just replace:

>       <?PHP echo $content;?><br>

with:

       <?PHP echo eval($content);?><br>

Assuming your Query_Database() function returns a string, this should
work fine.

Christopher Raymond wrote:
> 
> Okay there are two files involved here. First is my index.php file:
> 
> $params = array('class' => 'text10', 'content' => 'Query_Database( $category
> )');
> 
> switch ( $mode ) {
> 
>     case "list":
> 
>         Make_TR( $params ); // This is executing the included function.
>         break;
> 
>     default:
>         Display_Default();
> 
> }
> 
> Then there's the function that's located elsewhere in an include file:
> 
> <?PHP
> 
> function Make_TR ( $params ) {
> 
>   ( $params["class"] ) ? $class = "class=" . $params["class"] : $class = "";
>   ( $params["content"] ) ? $content = $params["content"] : $content = "";
> 
> ?>
> 
> <tr>
>   <td width="535" <?PHP echo $class;?>>
>     <div align="left">
>       <br>
>       <?PHP echo $content;?><br>
>       <br>
>     </div>
>   </td>
> </tr>
> 
> <?PHP
> 
> }
> 
> ?>
> 
> Christopher  <-- Still has no solution :-(
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
Chris Hobbs       Silver Valley Unified School District
Head geek:              Technology Services Coordinator
webmaster:   http://www.silvervalley.k12.ca.us/~chobbs/
postmaster:               [EMAIL PROTECTED]
--- End Message ---

Reply via email to