OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 16 Jul 2004 16:46:31 -0000 Issue 2880

php-general-digest-helplists.php.net
Date: Fri Jul 16 2004 - 11:46:31 CDT


php-general Digest 16 Jul 2004 16:46:31 -0000 Issue 2880

Topics (messages 190674 through 190730):

mysql connection question
        190674 by: JOHN MEYER
        190703 by: Torsten Roehr

track click throughs
        190675 by: cab
        190677 by: Ed Lazor
        190678 by: Curt Zirzow
        190681 by: cab
        190682 by: cab
        190686 by: Daniel Kullik

Most used oop pattern to use for php application development?
        190676 by: Brent Clements
        190704 by: Torsten Roehr
        190722 by: Justin Patrin

Need help with line breaks in a textarea form
        190679 by: PHP User
        190680 by: John W. Holmes
        190714 by: PHP User
        190717 by: PHP User
        190726 by: John W. Holmes
        190729 by: PHP User

Using SSL and PHP
        190683 by: Harlequin
        190684 by: Ed Lazor

How To capture WebCam
        190685 by: khuram noman
        190713 by: Jason Barnett

Trouble with include/require
        190687 by: A. Lanza
        190690 by: Daniel Kullik
        190691 by: A. Lanza
        190692 by: Daniel Kullik
        190699 by: A. Lanza
        190706 by: Daniel Kullik
        190718 by: Curt Zirzow
        190730 by: Jason Barnett

Re: image
        190688 by: Frank Holtschke

Re: problem including images in safe_mode
        190689 by: Frank Holtschke

Getting the primary key from a MySQL insert
        190693 by: Andrew Wood
        190694 by: Daniel Kullik
        190695 by: Andrew Wood
        190696 by: John W. Holmes

Re: PHP and MySQL Installation on Apache for Windows
        190697 by: Ciprian Constantinescu

Re: Dynamic to Static
        190698 by: rush

Re: Encrypting passwords from page to page -mcrypt question
        190700 by: Ciprian Constantinescu

flash to image using PHP
        190701 by: Cosmin

Checking for character absence with regular expressions
        190702 by: Rory McKinley
        190721 by: Matt M.

Re: Want to save png to file
        190705 by: Victor Spång Arthursson
        190708 by: Jason Wong

Re: Got JavaScript error when using PHP's include()...
        190707 by: Scott Fletcher
        190709 by: Scott Fletcher
        190710 by: Scott Fletcher
        190715 by: Curt Zirzow

Re: including external C header files and libraries
        190711 by: Jason Barnett

Re: How to tell if the file is already locked with flock()???
        190712 by: Jason Barnett

Re: Embedded Email Directives
        190716 by: Manuel Lemos

Re: problem with super global '$_REQUEST'
        190719 by: Justin Patrin

SNMP traps generation
        190720 by: Alessandro Vitale

Echoing Results in a Table
        190723 by: Harlequin
        190724 by: Justin Patrin
        190727 by: John W. Holmes

quotes in text.
        190725 by: Ed Curtis
        190728 by: John W. Holmes

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

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

attached mail follows:


Hi,
For a long time, on all of my mysql pages, I've done something like this

$conn = mysql_connect($server,$username,$password) or die("Could not
connect")
mysql_select_db($db);

I've finally put that into its own script file, moved it to my include
files, and simply included it whereever I needed a connection. My question
is, could this get me into trouble if multiple people access the database at
the same time?

attached mail follows:


"John Meyer" <jmeyer2003msn.com> wrote in message
news:BAY11-F24wqTyFfxv4k000df3c1hotmail.com...
> Hi,
> For a long time, on all of my mysql pages, I've done something like this
>
> $conn = mysql_connect($server,$username,$password) or die("Could not
> connect")
> mysql_select_db($db);
>
>
> I've finally put that into its own script file, moved it to my include
> files, and simply included it whereever I needed a connection. My
question
> is, could this get me into trouble if multiple people access the database
at
> the same time?

Including it is no different to placing it directly into your code. So there
will be no difference.

Regards, Torsten Roehr

attached mail follows:


Hi,

newbie question

I have a linked image, I want to track the users/times the image has been
clicked.

I've set up another .php page that populates a database with the click, then
I wanted to:
  Header("Location: http://someothersite ");

but I get the lovely Headers already set error message.

Any suggestions please? Locations of tutorials on this sort of thing.

Col

attached mail follows:


Check the script that records the click. It shouldn't have any output,
spaces, or extra lines before or after <?php ?>

> -----Original Message-----
> From: cab [mailto:m4mpetcol.com]
> Sent: Thursday, July 15, 2004 9:39 PM
> To: php-generallists.php.net
> Subject: [PHP] track click throughs
>
> Hi,
>
> newbie question
>
> I have a linked image, I want to track the users/times the image has been
> clicked.
>
> I've set up another .php page that populates a database with the click,
> then
> I wanted to:
> Header("Location: http://someothersite ");
>
> but I get the lovely Headers already set error message.
>
> Any suggestions please? Locations of tutorials on this sort of thing.
>
> Col
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


* Thus wrote cab:
> Hi,
>
> newbie question
>
> I have a linked image, I want to track the users/times the image has been
> clicked.
>
> I've set up another .php page that populates a database with the click, then
> I wanted to:
> Header("Location: http://someothersite ");
>
> but I get the lovely Headers already set error message.

PHP tells you exactly where the line is that started the output.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Ed,

Thank you found it with your help.

Cheers
Col

"Ed Lazor" <Ed.Lazord20News.com> wrote in message
news:php.general-190677news.php.net...
> Check the script that records the click. It shouldn't have any output,
> spaces, or extra lines before or after <?php ?>
>
>
>
> > -----Original Message-----
> > From: cab [mailto:m4mpetcol.com]
> > Sent: Thursday, July 15, 2004 9:39 PM
> > To: php-generallists.php.net
> > Subject: [PHP] track click throughs
> >
> > Hi,
> >
> > newbie question
> >
> > I have a linked image, I want to track the users/times the image has
been
> > clicked.
> >
> > I've set up another .php page that populates a database with the click,
> > then
> > I wanted to:
> > Header("Location: http://someothersite ");
> >
> > but I get the lovely Headers already set error message.
> >
> > Any suggestions please? Locations of tutorials on this sort of thing.
> >
> > Col
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Ed,

Sorry it redirects now but on checking the database is no longer being
updated?

<?php

require_once('/home/virtual/<site>/var/www/cgi-bin/Connections/DB_connection
_script.php');
 $newUserTracking = mysql_query("INSERT INTO track (user,type) VALUES ('
','Join')");
 Header("Location:
https://secure.ibill.com/cgi-win/ccard/rscookie.exe?RevShareID=what
ever&returnto=http://www.google.com/index.htm");
?>

Help
Col

"Ed Lazor" <Ed.Lazord20News.com> wrote in message
news:php.general-190677news.php.net...
> Check the script that records the click. It shouldn't have any output,
> spaces, or extra lines before or after <?php ?>
>
>
>
> > -----Original Message-----
> > From: cab [mailto:m4mpetcol.com]
> > Sent: Thursday, July 15, 2004 9:39 PM
> > To: php-generallists.php.net
> > Subject: [PHP] track click throughs
> >
> > Hi,
> >
> > newbie question
> >
> > I have a linked image, I want to track the users/times the image has
been
> > clicked.
> >
> > I've set up another .php page that populates a database with the click,
> > then
> > I wanted to:
> > Header("Location: http://someothersite ");
> >
> > but I get the lovely Headers already set error message.
> >
> > Any suggestions please? Locations of tutorials on this sort of thing.
> >
> > Col
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


mysql_query() should return a boolean true if your insert-query works.
Check that.

[code]
print (mysql_query('insert bla...')) ? '(-:' : ')-:';
die();
[/code]

Cab wrote:
> Ed,
>
> Sorry it redirects now but on checking the database is no longer being
> updated?
>
> <?php
>
> require_once('/home/virtual/<site>/var/www/cgi-bin/Connections/DB_connection
> _script.php');
> $newUserTracking = mysql_query("INSERT INTO track (user,type) VALUES ('
> ','Join')");
> Header("Location:
> https://secure.ibill.com/cgi-win/ccard/rscookie.exe?RevShareID=what
> ever&returnto=http://www.google.com/index.htm");
> ?>
>
> Help
> Col
>
> "Ed Lazor" <Ed.Lazord20News.com> wrote in message
> news:php.general-190677news.php.net...
>
>>Check the script that records the click. It shouldn't have any output,
>>spaces, or extra lines before or after <?php ?>
>>
>>
>>
>>>-----Original Message-----
>>>From: cab [mailto:m4mpetcol.com]
>>>Sent: Thursday, July 15, 2004 9:39 PM
>>>To: php-generallists.php.net
>>>Subject: [PHP] track click throughs
>>>
>>>Hi,
>>>
>>>newbie question
>>>
>>>I have a linked image, I want to track the users/times the image has
>
> been
>
>>>clicked.
>>>
>>>I've set up another .php page that populates a database with the click,
>>>then
>>>I wanted to:
>>> Header("Location: http://someothersite ");
>>>
>>>but I get the lovely Headers already set error message.
>>>
>>>Any suggestions please? Locations of tutorials on this sort of thing.
>>>
>>>Col
>>>
>>>--
>>>PHP General Mailing List (http://www.php.net/)
>>>To unsubscribe, visit: http://www.php.net/unsub.php

--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

attached mail follows:


Good Evening All,

I know this will probably start a flame war, but I want to get everyone's opinion on which oop pattern is either the accepted pattern or most used pattern for php application.

I'm pretty partial to MVC but it has it's benefits and drawbacks. What does everyone else use?

Hopefully my question will start some meaningful conversation. Unless of course I'm asking a redundant question and this has already been answered. Excuse my redundancy if it has.

Have a great night everyone!

Brent

attached mail follows:


>"Brent Clements" <bclemimaginative-enterprises.com> wrote in message
news:006901c46af1$7da3b5c0$110110acmaggie...
>Good Evening All,
>
>I know this will probably start a flame war, but I want to get everyone's
opinion on which oop pattern is either the >accepted pattern or most used
pattern for php application.
>
>I'm pretty partial to MVC but it has it's benefits and drawbacks. What does
everyone else use?
>
>Hopefully my question will start some meaningful conversation. Unless of
course I'm asking a redundant question and this >has already been answered.
Excuse my redundancy if it has.
>
>Have a great night everyone!
>
>Brent

Hi Brent,

you can use more than one pattern within an application (Singleton,
Decorater etc.) so maybe you have to change your question ;)

Here's some good resource on the topic:
http://www.phppatterns.com/

Regards, Torsten Roehr

attached mail follows:


On Thu, 15 Jul 2004 23:57:59 -0500, Brent Clements
<bclemimaginative-enterprises.com> wrote:
> Good Evening All,
>
> I know this will probably start a flame war, but I want to get everyone's opinion on which oop pattern is either the accepted pattern or most used pattern for php application.
>
> I'm pretty partial to MVC but it has it's benefits and drawbacks. What does everyone else use?
>
> Hopefully my question will start some meaningful conversation. Unless of course I'm asking a redundant question and this has already been answered. Excuse my redundancy if it has.
>

Many PHP developers use the MVC pattern (sometimes loosely) when
developing applications. I find it very useful in my larger
applications. For small things, my view and controller tend to be the
same piece of code.

As for other patterns, many PEAR libraries implement other ones and I
use them from within my apps constantly. IMHO, many of the other
design patterns (drivers, decorators, renderers, factories, etc) are
library-level. They work very well for a specific piece of code which
fits into MVC in one of its areas.

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Hi,

I have been trying to format the textarea output and have come across some
code that almost does what I need, but I still have one small problem.

Look at the text below that was input into my textarea:

Now is the time for all young men to come to the aid of the party. Now is
the time for all young men to come to the aid of the party.
Testing
Now is the time for all young men to come to the aid of the party. Now is
the time for all young men to come to the aid of the party.
Testing.

When I print this out to my webpage it has a line break before and after the
word Testing. I want it to be a wysiwyg - so in the case above there should
be no extra line breaks. It should look exactly as typed.

The code I tried to change the \n to <BR> are:

$text2= nl2br ($text);
or
$text2 str_replace("\n","<br>",$text);

This is what I have in my form.

<textarea rows=10 cols=51 name="text"><textarea>

Thanks, any help is appreciated.

attached mail follows:


PHP User wrote:

> Hi,
>
> I have been trying to format the textarea output and have come across some
> code that almost does what I need, but I still have one small problem.
>
> Look at the text below that was input into my textarea:
>
> Now is the time for all young men to come to the aid of the party. Now is
> the time for all young men to come to the aid of the party.
> Testing
> Now is the time for all young men to come to the aid of the party. Now is
> the time for all young men to come to the aid of the party.
> Testing.
>
> When I print this out to my webpage it has a line break before and after the
> word Testing. I want it to be a wysiwyg - so in the case above there should
> be no extra line breaks. It should look exactly as typed.
>
> The code I tried to change the \n to <BR> are:
>
> $text2= nl2br ($text);
> or
> $text2 str_replace("\n","<br>",$text);
>
> This is what I have in my form.
>
> <textarea rows=10 cols=51 name="text"><textarea>

<textarea rows="10" cols="51"
name="text"><?=htmlentities($text2)?></textarea>

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


 
Thanks for the info John, but your suggestion produces the same output. Look
at the source below to see what it produces.

Now is the time for all young men to come to the aid of the party. Now is
the time for all young men to come to the aid of the party.<br />
<br><br />
<br>Testing<br />
<br><br />
<br>Now is the time for all young men to come to the aid of the party. Now
is the time for all young men to come to the aid of the party.<br />
<br><br />
<br>Testing

After 'party' and 'Testing' I hit enter twice, but as you can see above it
adds a 3rd and 4th <br>...

Suggestions?

Thanks

-----Original Message-----
From: John W. Holmes [mailto:holmes072000charter.net]
Sent: July 16, 2004 2:00 AM
To: PHP User
Cc: PHP
Subject: Re: [PHP] Need help with line breaks in a textarea form

PHP User wrote:

> Hi,
>
> I have been trying to format the textarea output and have come across
> some code that almost does what I need, but I still have one small
problem.
>
> Look at the text below that was input into my textarea:
>
> Now is the time for all young men to come to the aid of the party. Now
> is the time for all young men to come to the aid of the party.
> Testing
> Now is the time for all young men to come to the aid of the party. Now
> is the time for all young men to come to the aid of the party.
> Testing.
>
> When I print this out to my webpage it has a line break before and
> after the word Testing. I want it to be a wysiwyg - so in the case
> above there should be no extra line breaks. It should look exactly as
typed.
>
> The code I tried to change the \n to <BR> are:
>
> $text2= nl2br ($text);
> or
> $text2 str_replace("\n","<br>",$text);
>
> This is what I have in my form.
>
> <textarea rows=10 cols=51 name="text"><textarea>

<textarea rows="10" cols="51"
name="text"><?=htmlentities($text2)?></textarea>

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

attached mail follows:


 
John,

Something came to mind as soon as I sent my last email, and it seems to
work. Not sure it will work in every circumstance but the few tests I tried
seemed ok. This is what I did. I added the two following lines to my script.

$text=str_replace("\n","<br>",$text);
$text=str_replace("<br />","",$text);

Thanks for your input....

CR

-----Original Message-----
From: John W. Holmes [mailto:holmes072000charter.net]
Sent: July 16, 2004 2:00 AM
To: PHP User
Cc: PHP
Subject: Re: [PHP] Need help with line breaks in a textarea form

PHP User wrote:

> Hi,
>
> I have been trying to format the textarea output and have come across
> some code that almost does what I need, but I still have one small
problem.
>
> Look at the text below that was input into my textarea:
>
> Now is the time for all young men to come to the aid of the party. Now
> is the time for all young men to come to the aid of the party.
> Testing
> Now is the time for all young men to come to the aid of the party. Now
> is the time for all young men to come to the aid of the party.
> Testing.
>
> When I print this out to my webpage it has a line break before and
> after the word Testing. I want it to be a wysiwyg - so in the case
> above there should be no extra line breaks. It should look exactly as
typed.
>
> The code I tried to change the \n to <BR> are:
>
> $text2= nl2br ($text);
> or
> $text2 str_replace("\n","<br>",$text);
>
> This is what I have in my form.
>
> <textarea rows=10 cols=51 name="text"><textarea>

<textarea rows="10" cols="51"
name="text"><?=htmlentities($text2)?></textarea>

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

attached mail follows:


PHP User wrote:
> Something came to mind as soon as I sent my last email, and it seems to
> work. Not sure it will work in every circumstance but the few tests I tried
> seemed ok. This is what I did. I added the two following lines to my script.
>
> $text=str_replace("\n","<br>",$text);
> $text=str_replace("<br />","",$text);

Okay... let's say you have $text that is text that was entered into a
textarea. To put it _back into_ a textare, you simply need to do this:

<textarea rows="5" cols="50"><?=htmlentities($text)?></textarea>

That's it. If you want to display $text to the user outside of a
<textarea>, then you do this:

echo nl2br(htmlentities($text));

If you want to insert $text into a database and magic_quotes_gpc is
enabled, you do this:

$query = "INSERT INTO yourtable (textcolumn) VALUES ('$text')";

If magic_quotes_gpc is not enabled (you can check with
get_magic_quotes_gpc(), btw), then you'd use this:

$text = addslashes($text);
$query = "INSERT INTO yourtable (textcolumn) VALUES ('$text')";

If you'd like to extract the winning lottery numbers from $text, you
simply...

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


John,

If I just echo $text on the webpage now, everything shows as it should.

HOWEVER, another problem I didn't even clue into until now. This form gets
emailed to a specified address and all I get in my email is one long line
with no line breaks. How do I fix this? I was reading a thread in a web
based group you were having with another person, but none of your
suggestions there worked.

Suggestions....

Thanks again...

-----Original Message-----
From: John W. Holmes [mailto:holmes072000charter.net]
Sent: July 16, 2004 12:14 PM
To: PHP User
Cc: PHP
Subject: Re: [PHP] Need help with line breaks in a textarea form

PHP User wrote:
> Something came to mind as soon as I sent my last email, and it seems
> to work. Not sure it will work in every circumstance but the few tests
> I tried seemed ok. This is what I did. I added the two following lines to
my script.
>
> $text=str_replace("\n","<br>",$text);
> $text=str_replace("<br />","",$text);

Okay... let's say you have $text that is text that was entered into a
textarea. To put it _back into_ a textare, you simply need to do this:

<textarea rows="5" cols="50"><?=htmlentities($text)?></textarea>

That's it. If you want to display $text to the user outside of a <textarea>,
then you do this:

echo nl2br(htmlentities($text));

If you want to insert $text into a database and magic_quotes_gpc is enabled,
you do this:

$query = "INSERT INTO yourtable (textcolumn) VALUES ('$text')";

If magic_quotes_gpc is not enabled (you can check with
get_magic_quotes_gpc(), btw), then you'd use this:

$text = addslashes($text);
$query = "INSERT INTO yourtable (textcolumn) VALUES ('$text')";

If you'd like to extract the winning lottery numbers from $text, you
simply...

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals - www.phparch.com

attached mail follows:


Hi everyone.

We've recently decided to move all our PHP pages to an SSL server. Can
anyone give any advice on any caveats I should be aware of...?

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------

attached mail follows:


You add an S to http ;)

Beyond that, some servers allow one webspace for your files and encryption
is based on whether you specify the S or not. Some servers have separate
directories for http and https files.

> -----Original Message-----
> Hi everyone.
>
> We've recently decided to move all our PHP pages to an SSL server. Can
> anyone give any advice on any caveats I should be aware of...?

attached mail follows:


Hi everyone

Is there any body woh knows how to capture web cam in
php i need some tutorial / code that helps me in this
regard.waiting for soon reply

Thanks
Khuram

        
                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail

attached mail follows:


Please search google for tutorials, you can often find them when you use
the right keywords.

attached mail follows:


Hi list,

i'm trying to include files in my php scripts but things seem not to
work properly. In my script, i include a file like this:

<?php include 'includes/db.inc' ?>

I have all include files in includes directory, that's a children of the
directory where my scrips are. The include_path config. variable is set
like this:

include_path = ".:/php/includes"
(i have uncommented that line)

PHP does not include my files. What i am doing wrong?

Thanks

AL

attached mail follows:


You should not overwrite the whole include-path. Just append new paths.
This should do:

[code]
// Expand include-path (';' on Windows)
$sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':';
ini_set('include_path', ini_get('include_path') . $sep .
dirname(__FILE__) . 'includes/');
[/code]

Daniel

A. Lanza wrote:

> Hi list,
>
> i'm trying to include files in my php scripts but things seem not to
> work properly. In my script, i include a file like this:
>
> <?php include 'includes/db.inc' ?>
>
> I have all include files in includes directory, that's a children of the
> directory where my scrips are. The include_path config. variable is set
> like this:
>
> include_path = ".:/php/includes"
> (i have uncommented that line)
>
> PHP does not include my files. What i am doing wrong?
>
> Thanks
>
> AL

--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

attached mail follows:


In fact, i'm not changing the include_path in my code, just uncommented
the line in php.ini configuration file.

Do i have to set include_path in code? Where in code should i put that
piece of code setting include_path? Is there any simple way to include
files using relative paths from the ones where main scripts are?

I have /var/www/html/project, where i put my scripts. includes directory
is under that path. I want to put all my include files in there. I
guessed that including files like this, include 'includes/db.inc', would
work, since include_path is set to "." in php.ini, but it does not.

Any help?

On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote:
> You should not overwrite the whole include-path. Just append new paths.
> This should do:
>
> [code]
> // Expand include-path (';' on Windows)
> $sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':';
> ini_set('include_path', ini_get('include_path') . $sep .
> dirname(__FILE__) . 'includes/');
> [/code]
>
>
> Daniel
>
>
> A. Lanza wrote:
>
> > Hi list,
> >
> > i'm trying to include files in my php scripts but things seem not to
> > work properly. In my script, i include a file like this:
> >
> > <?php include 'includes/db.inc' ?>
> >
> > I have all include files in includes directory, that's a children of the
> > directory where my scrips are. The include_path config. variable is set
> > like this:
> >
> > include_path = ".:/php/includes"
> > (i have uncommented that line)
> >
> > PHP does not include my files. What i am doing wrong?
> >
> > Thanks
> >
> > AL
>
>
> --
> WWE e-commerce IT GmbH
> Eiffestrasse 462, D-20537 Hamburg
> Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

attached mail follows:


Does your PHP-interpreter parse .inc files at all?

Did you get any error-messages? If not, set your error-reporting level
to E_ALL any force PHP to display errors on screen.

[code]
error_reporting(E_ALL);
ini_set('display_errors', true);
[/code]

Place this code before your include() call.
PHP should print out an error-message if it fails to include a file.

A. Lanza wrote:

> In fact, i'm not changing the include_path in my code, just uncommented
> the line in php.ini configuration file.
>
> Do i have to set include_path in code? Where in code should i put that
> piece of code setting include_path? Is there any simple way to include
> files using relative paths from the ones where main scripts are?
>
> I have /var/www/html/project, where i put my scripts. includes directory
> is under that path. I want to put all my include files in there. I
> guessed that including files like this, include 'includes/db.inc', would
> work, since include_path is set to "." in php.ini, but it does not.
>
> Any help?
>
> On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote:
>
>>You should not overwrite the whole include-path. Just append new paths.
>>This should do:
>>
>>[code]
>>// Expand include-path (';' on Windows)
>>$sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':';
>>ini_set('include_path', ini_get('include_path') . $sep .
>>dirname(__FILE__) . 'includes/');
>>[/code]
>>
>>
>>Daniel
>>
>>
>>A. Lanza wrote:
>>
>>
>>>Hi list,
>>>
>>>i'm trying to include files in my php scripts but things seem not to
>>>work properly. In my script, i include a file like this:
>>>
>>><?php include 'includes/db.inc' ?>
>>>
>>>I have all include files in includes directory, that's a children of the
>>>directory where my scrips are. The include_path config. variable is set
>>>like this:
>>>
>>>include_path = ".:/php/includes"
>>>(i have uncommented that line)
>>>
>>>PHP does not include my files. What i am doing wrong?
>>>
>>>Thanks
>>>
>>>AL
>>
>>
>>--
>>WWE e-commerce IT GmbH
>>Eiffestrasse 462, D-20537 Hamburg
>>Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

attached mail follows:


Still i cannot place my include files in a directory other than the same
as my main scripts...

I have scripts in /var/www/html/project/ directory. I would like to put
the include files in /var/www/html/project/includes. How should i
include them in the main scripts?

I've tried the two following ways,

1.
include 'includes/file.inc';

2.
ini_set('include_path', './includes');
include 'file.inc';

but neither of them have worked.

Any help?

On Fri, 2004-07-16 at 11:30, Daniel Kullik wrote:
> Does your PHP-interpreter parse .inc files at all?
>
> Did you get any error-messages? If not, set your error-reporting level
> to E_ALL any force PHP to display errors on screen.
>
> [code]
> error_reporting(E_ALL);
> ini_set('display_errors', true);
> [/code]
>
> Place this code before your include() call.
> PHP should print out an error-message if it fails to include a file.
>
>
> A. Lanza wrote:
>
> > In fact, i'm not changing the include_path in my code, just uncommented
> > the line in php.ini configuration file.
> >
> > Do i have to set include_path in code? Where in code should i put that
> > piece of code setting include_path? Is there any simple way to include
> > files using relative paths from the ones where main scripts are?
> >
> > I have /var/www/html/project, where i put my scripts. includes directory
> > is under that path. I want to put all my include files in there. I
> > guessed that including files like this, include 'includes/db.inc', would
> > work, since include_path is set to "." in php.ini, but it does not.
> >
> > Any help?
> >
> > On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote:
> >
> >>You should not overwrite the whole include-path. Just append new paths.
> >>This should do:
> >>
> >>[code]
> >>// Expand include-path (';' on Windows)
> >>$sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':';
> >>ini_set('include_path', ini_get('include_path') . $sep .
> >>dirname(__FILE__) . 'includes/');
> >>[/code]
> >>
> >>
> >>Daniel
> >>
> >>
> >>A. Lanza wrote:
> >>
> >>
> >>>Hi list,
> >>>
> >>>i'm trying to include files in my php scripts but things seem not to
> >>>work properly. In my script, i include a file like this:
> >>>
> >>><?php include 'includes/db.inc' ?>
> >>>
> >>>I have all include files in includes directory, that's a children of the
> >>>directory where my scrips are. The include_path config. variable is set
> >>>like this:
> >>>
> >>>include_path = ".:/php/includes"
> >>>(i have uncommented that line)
> >>>
> >>>PHP does not include my files. What i am doing wrong?
> >>>
> >>>Thanks
> >>>
> >>>AL
> >>
> >>
> >>--
> >>WWE e-commerce IT GmbH
> >>Eiffestrasse 462, D-20537 Hamburg
> >>Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
>
>
> --
> WWE e-commerce IT GmbH
> Eiffestrasse 462, D-20537 Hamburg
> Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

attached mail follows:


Using chmod 710 on your include-directroy and chmod 640 on your scripts
might solve your file-permission problem.

A. Lanza wrote:

> Still i cannot place my include files in a directory other than the same
> as my main scripts...
>
> I have scripts in /var/www/html/project/ directory. I would like to put
> the include files in /var/www/html/project/includes. How should i
> include them in the main scripts?
>
> I've tried the two following ways,
>
> 1.
> include 'includes/file.inc';
>
> 2.
> ini_set('include_path', './includes');
> include 'file.inc';
>
> but neither of them have worked.
>
> Any help?
>
> On Fri, 2004-07-16 at 11:30, Daniel Kullik wrote:
>
>>Does your PHP-interpreter parse .inc files at all?
>>
>>Did you get any error-messages? If not, set your error-reporting level
>>to E_ALL any force PHP to display errors on screen.
>>
>>[code]
>>error_reporting(E_ALL);
>>ini_set('display_errors', true);
>>[/code]
>>
>>Place this code before your include() call.
>>PHP should print out an error-message if it fails to include a file.
>>
>>
>>A. Lanza wrote:
>>
>>
>>>In fact, i'm not changing the include_path in my code, just uncommented
>>>the line in php.ini configuration file.
>>>
>>>Do i have to set include_path in code? Where in code should i put that
>>>piece of code setting include_path? Is there any simple way to include
>>>files using relative paths from the ones where main scripts are?
>>>
>>>I have /var/www/html/project, where i put my scripts. includes directory
>>>is under that path. I want to put all my include files in there. I
>>>guessed that including files like this, include 'includes/db.inc', would
>>>work, since include_path is set to "." in php.ini, but it does not.
>>>
>>>Any help?
>>>
>>>On Fri, 2004-07-16 at 10:35, Daniel Kullik wrote:
>>>
>>>
>>>>You should not overwrite the whole include-path. Just append new paths.
>>>>This should do:
>>>>
>>>>[code]
>>>>// Expand include-path (';' on Windows)
>>>>$sep = ('WIN' == substr(PHP_OS, 0, 3)) ? ';' : ':';
>>>>ini_set('include_path', ini_get('include_path') . $sep .
>>>>dirname(__FILE__) . 'includes/');
>>>>[/code]
>>>>
>>>>
>>>>Daniel
>>>>
>>>>
>>>>A. Lanza wrote:
>>>>
>>>>
>>>>
>>>>>Hi list,
>>>>>
>>>>>i'm trying to include files in my php scripts but things seem not to
>>>>>work properly. In my script, i include a file like this:
>>>>>
>>>>><?php include 'includes/db.inc' ?>
>>>>>
>>>>>I have all include files in includes directory, that's a children of the
>>>>>directory where my scrips are. The include_path config. variable is set
>>>>>like this:
>>>>>
>>>>>include_path = ".:/php/includes"
>>>>>(i have uncommented that line)
>>>>>
>>>>>PHP does not include my files. What i am doing wrong?
>>>>>
>>>>>Thanks
>>>>>
>>>>>AL
>>>>
>>>>
>>>>--
>>>>WWE e-commerce IT GmbH
>>>>Eiffestrasse 462, D-20537 Hamburg
>>>>Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50
>>
>>
>>--
>>WWE e-commerce IT GmbH
>>Eiffestrasse 462, D-20537 Hamburg
>>Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

attached mail follows:


* Thus wrote A. Lanza:
> In fact, i'm not changing the include_path in my code, just uncommented
> the line in php.ini configuration file.
>
> Do i have to set include_path in code? Where in code should i put that
> piece of code setting include_path? Is there any simple way to include
> files using relative paths from the ones where main scripts are?
>
> I have /var/www/html/project, where i put my scripts. includes directory
> is under that path. I want to put all my include files in there. I
> guessed that including files like this, include 'includes/db.inc', would
> work, since include_path is set to "." in php.ini, but it does not.

From my understanding you have:

php.ini:include_path = ".:/php/includes";

The scripts you want to include are located in:
  /var/www/html/project/includes

All you have to do is set your include_path in php.ini:
  include_path = "/var/www/html/project/includes:.:/php/includes";

restart webserver.

Then to include the file you want, include it relative to the
include_path:

  include('db.inc');

That will try and find a file in these locations in order:
  /var/www/html/projects/include/db.inc
  ./db.inc
  /php/includes/db.inc

And will use the first one found.

I would not suggest using ini_set() inside you're scripts to
adjust your paths.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


> That will try and find a file in these locations in order:
> /var/www/html/projects/include/db.inc
> ./db.inc
> /php/includes/db.inc
>
> And will use the first one found.
>
> I would not suggest using ini_set() inside you're scripts to
> adjust your paths.
>
>
>
> Curt

Hey Curt, why do you suggest we don't use ini_set to adjust paths? I'm
using it as part of my library autoloader - it may not be as efficient
as changing the path directly but it seems to work well.

<?php
/**
  * Used to load all class definitions. It temporarily adds directories
  * listed in $classDirs to the include path and tries to load the class
  * definition from the new temporary path. Path resets to original
  * after failure / success.
  *
  * param string The name of the class that you want to instanciate.
  * This should use PEAR-style class names, e.g.
  * Directory_Subdir_File
  * return object|void
  */
function __autoload($class) {
   if (empty($class) || strpos($class, '://')) {
     // Zend engine can't throw exceptions in __autoload()
     trigger_error('Cannot get class file', E_USER_WARNING);
     return;
   }

   if (!defined('PATH_SEPARATOR')) {
     if (strstr(PHP_OS, 'WIN')) {
       define('PATH_SEPARATOR', ';');
     } else {
       define('PATH_SEPARATOR', ':');
     }
   }

   static $origPath = null;
   if (is_null($origPath)) {
     $origPath = ini_get('include_path');
   }

   static $newPath = null;
   if (is_null($newPath)) {
     $cur = dirname(__FILE__ . DIRECTORY_SEPARATOR);
     $classDirs = array($cur);
     $aryPath = explode(PATH_SEPARATOR, $origPath);
     $aryPath = array_merge($aryPath, $classDirs);
     $newPath = implode(PATH_SEPARATOR, $aryPath);
   }

   // Do PEAR-like file inclusion
   $class = str_replace('_', DIRECTORY_SEPARATOR, $class);
   ini_set('include_path', $newPath);
   include_once ($class . ".php");
   if (!class_exists($class)) {
     trigger_error("No class definition for $class found in library",
                   E_USER_ERROR);
   }
   ini_set('include_path', $origPath);
}

?>

attached mail follows:


Php wrote:
> like i call an image if the img tag but instead of loading the image it
> loads a php script
>

did you send the mime-type header first? Something like:
header("Content-Type: image/png");
Then you can do an include of the image or something like that.

> "Jason Wong" <php-generalgremlins.biz> wrote in message
> news:200407160819.57548.php-generalgremlins.biz...
>
>>On Friday 16 July 2004 08:06, php wrote:
>>
>>
>>>how do you catch an image request and instead of the image display php?
>>
>>Please elaborate.
>>
>>--
>>Jason Wong -> Gremlins Associates -> www.gremlins.biz
>>Open Source Software Systems Integrators
>>* Web Design & Hosting * Internet & Intranet Applications Development *
>>------------------------------------------
>>Search the list archives before you post
>>http://marc.theaimsgroup.com/?l=php-general
>>------------------------------------------
>>/*
>>Neil Armstrong tripped.
>>*/

attached mail follows:


Jason Wong wrote:
> On Thursday 15 July 2004 23:30, Frank Holtschke wrote:
>
>
>>>Even if you could prevent an included file from being parsed, I can't see
>>>how it would help you as you can't assign the contents to a variable. But
>>>you say that you "sometimes have problems" which implies that sometimes
>>>it works. Could you explain how it works?
>>
>>We just flush it on the display. the php-script is an image src like
>><img src="showImage.php">
>
>
> That's interesting.
>
>
>>The showImage.php does an include of the image which is located out of
>>the DocumentRoot.
>>The image is generated by a cron script. Mostly it works but sometimes
>>we have the problem
>>described above.
>>
>>
>>>And anyway why are your images in safe_mode_include_dir in the first
>>>place?
>>
>>Cause php-scripts (owned by different uids => therefore the
>>safe_mode_include_dir ) of various virtual servers make use of the image.
>
>
> Several suggestions:
>
> 1) If the various virtual servers have no need to perform file operations
> anywhere else then you may get away with setting open_basedir appropriately.
>
> 2) Use the safe_mode_gid switch.
>
> 3) If cronjob is owned by root then have it create images for each of the
> virtual servers and set permissions accordingly.
>

thanks for your suggestions. We think about a very simple solution. Just
changing the parser-identifier
from '<?' to '<?php' by setting the short_open_tag=Off in the php.ini
. The probability of the substring
  '<?php' in the image-stream seems to be very low.

attached mail follows:


If the primary key in a MySQL DB is an autoincrementing integer, is
there anyway of automatically getting it back when I do an insert in
PHP. In other words taking the status returned by mysql_query and
extracting the PK of the record we just entered?

attached mail follows:


Here you can find an overview of all existing MySQL functions in PHP:
http://www.php.net/mysql

And this is the function you are looking for:
http://www.php.net/manual/en/function.mysql-insert-id.php

And please take your time to look at this posting:
http://marc.theaimsgroup.com/?l=php-general&m=108986762507986&w=2

Daniel

Andrew Wood wrote:
> If the primary key in a MySQL DB is an autoincrementing integer, is
> there anyway of automatically getting it back when I do an insert in
> PHP. In other words taking the status returned by mysql_query and
> extracting the PK of the record we just entered?

--
WWE e-commerce IT GmbH
Eiffestrasse 462, D-20537 Hamburg
Tel.: +49-40-2530659-0, Fax: +49-40-2530659-50

attached mail follows:


Thanks. When it says 'the last insert' is that just the last insert my
PHP script did, or the last insert on the DB as a whole?

On 16 Jul 2004, at 11:40, johnjohnallsopp.co.uk wrote:

>> If the primary key in a MySQL DB is an autoincrementing integer, is
>> there anyway of automatically getting it back when I do an insert in
>> PHP. In other words taking the status returned by mysql_query and
>> extracting the PK of the record we just entered?
>
> int mysql_insert_id ([resource link-id]) returns the key from the most
> recent INSERT statement or 0 if there's no auto-increment field.
>
> At last, a question I can answer :-)
>
> HTH
> J
>

attached mail follows:


Andrew Wood wrote:
> Thanks. When it says 'the last insert' is that just the last insert my
> PHP script did, or the last insert on the DB as a whole?

Read the links Daniel just sent out.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


PHP doesn't detect anything. You need to have your mysql server running and
you try with mysql_connect() or mysql_pconnect() to see if you can connect
to the server

"Sean Vasey" <phpmailicefusionmedia.com> wrote in message
news:20040716032720.8697.qmailserver289.com...
> Does anyone know how to get PHP to detect MySQL after it has been
installed and is running on an Apache 1.3.1 server for Windows? Any help
would be greatly appreciated.
>

attached mail follows:


"Ed Lazor" <Ed.Lazord20News.com> wrote in message
news:php.general-190558news.php.net...
> Is anyone taking a dynamic PHP / MySQL site and storing or cacheing it
> statically in order for pages to display more quickly when visitors access
> the site? If so, what solutions are you using to achieve this?

well, mysql query result cacheing is great preformance booster, and so is
any kind of php accellerator )which basically cache compiled byte codes).
Often turning on html compression has great effect on performance.

As for application level cacheing, if needed, I cache parts of the page that
repeat often menues, toolbars, articles, and store resulting html for them
in db, so that the do not need to be recalculated each time page is
displayed. (I use TT support for cacheing).

rush
--
http://www.templatetamer.com/

attached mail follows:


Why don't you try POST instead of GET? This way the password will not be
visible in the URL.

"Scott Taylor" <scotttaylorbigfoot.com> wrote in message
news:40F70407.7020301bigfoot.com...
>
> I would like to go from page to page, submitting the password through a
> GET query string. Of course I wouldn't want to do this unencrypted. So
> is mcrypt the best option?
>
> When submitting the data, would I also need to sumit the IV as well as
> the encrypted data? Or am I completely off base with this one? Should
> I also base64_encode() this data when passing it?
>
> Scott Taylor

attached mail follows:


Is it possible to convert a swf file(static, no animation) to an image
format(jpeg or png preferably) using PHP?
I have a flash script which chooses the colors for a logo and saves it a
swf file and I need to transform it in an image file so I could I use
it in a PDF file

attached mail follows:


Hi List

I am currently trying to check for the absence of certain substrings
within larger strings using
regular expressions. I know that I could use on of the string functions,
but in the interests of
flexibility I must use a regexp match of some shape or variety. Up until
now, I have used PHP's
POSIX functions, but if someone has a solution for PCRE, I will use that
as well.

An example of my problem:

I need to check that the substring " R" (that's a space followed by an
uppercase R) is not contained within my haystack.

E.g. Whatever pattern I match, if I match it against the following
haystacks:

"Blah Blah R 99.99" or "Blah Blah R99.99" it should return negative
(i.e. the substring is contained within the haystack)

while

"Blah Blah 99.99CR" should return positive (i.e. the substring is not
within the haystack).

I have RTFM, RTFA, STFW and perhaps I am not phraseing my search terms
correctly, as I am having no luck.

Can anyone suggest a solution?

====================
Rory McKinley
Nebula Solutions
+27 21 555 3227 - office
+27 21 551 0676 - fax
+27 82 857 2391 - mobile
www.nebula.co.za
====================

This e-mail is intended only for the person to whom it is addressed and
may contain confidential information which may be legally privileged.
Nebula Solutions accepts no liability for any loss, expense or damage
arising from this e-mail and/or any attachments.

attached mail follows:


> I need to check that the substring " R" (that's a space followed by an
> uppercase R) is not contained within my haystack.

Just one way to do it:

$strings[] = 'Blah Blah R 99.99';
$strings[] = 'Blah Blah R99.99';
$strings[] = 'Blah Blah 99.99CR';
foreach($strings as $value) {

if (preg_match('/\sR/', $value)) {
   echo 'A match was found in '.$value.'<br />';
} else {
   echo 'A match was not found '.$value.'<br />';
}
}

attached mail follows:


        
2004-07-08 kl. 06.25 skrev Wudi:

> int imagepng ( resource image [, string filename])

Back on track again!

What I don't know is how to save the file - do I read the datastream
from imagepng and then create a file and write the stream to it?

Sincerely

Victor

attached mail follows:


On Friday 16 July 2004 20:41, Victor Spång Arthursson wrote:
> 2004-07-08 kl. 06.25 skrev Wudi:
> > int imagepng ( resource image [, string filename])
>
> Back on track again!
>
> What I don't know is how to save the file - do I read the datastream
> from imagepng and then create a file and write the stream to it?

If you already have an image resource then calling imagepng() with a filename
will create and write the file for you.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
IBM's original motto:
        Cogito ergo vendo; vendo ergo sum.
*/

attached mail follows:


It doesn't matter where because the webpage is loading, the JavaScript is
not running while loading. It only run when the user click on the pop-up
window. It worked fine if I use HTML/JavaScript only. Just that it doesn't
work when I use PHP.

FletchSOD
"Neal Owen" <apatheticmrichi.com> wrote in message
news:1089928699.4636.1.camelneal.mrichi.com...
> You defined jsTest after the include where it should be before.
>
>
> On Thu, 2004-07-15 at 16:24, Scott Fletcher wrote:
> > When an include file contain plain JavaScript codes, with the echo
command
> > before and after the include file. I get the javascript error saying
> > "undefined jsTest"... Anyone know why is that?
> >
> > --snip--
> > echo "<table><tr><td></td></tr></table>";
> > echo "<script type='text/javascript'>";
> > include('test.inc');
> > echo " var jsTest = 0; ";
> > echo "</script>";
> > echo "<form><input type='button></form>";
> > --snip--
> >
> > Let's say the script in the test.inc contain
> >
> > --snip--
> > function test() {
> > if (jsTest != 0) {
> > //blah blah balh...
> > }
> > }
> > --snip--
> >
> > Thanks,
> > FletchSOD
> --
> Neal Owen | IT Programmer
> Marketing Resources, Inc.
> Main : 312.238.8923 x1218
> Direct : 630.592.3118
>
> nowenmrichi.com | http://www.mrichi.com

attached mail follows:


Okay, I still get this same error when I move the jsTest to before the
function....

FletchSOD

"Neal Owen" <apatheticmrichi.com> wrote in message
news:1089928699.4636.1.camelneal.mrichi.com...
> You defined jsTest after the include where it should be before.
>
>
> On Thu, 2004-07-15 at 16:24, Scott Fletcher wrote:
> > When an include file contain plain JavaScript codes, with the echo
command
> > before and after the include file. I get the javascript error saying
> > "undefined jsTest"... Anyone know why is that?
> >
> > --snip--
> > echo "<table><tr><td></td></tr></table>";
> > echo "<script type='text/javascript'>";
> > include('test.inc');
> > echo " var jsTest = 0; ";
> > echo "</script>";
> > echo "<form><input type='button></form>";
> > --snip--
> >
> > Let's say the script in the test.inc contain
> >
> > --snip--
> > function test() {
> > if (jsTest != 0) {
> > //blah blah balh...
> > }
> > }
> > --snip--
> >
> > Thanks,
> > FletchSOD
> --
> Neal Owen | IT Programmer
> Marketing Resources, Inc.
> Main : 312.238.8923 x1218
> Direct : 630.592.3118
>
> nowenmrichi.com | http://www.mrichi.com

attached mail follows:


Oh never mind... I looked up at
http://us3.php.net/manual/en/function.include.php and saw this...

--snip--
When a file is included, parsing drops out of PHP mode and into HTML mode at
the beginning of the target file, and resumes again at the end. For this
reason, any code inside the target file which should be executed as PHP code
must be enclosed within valid PHP start and end tags.
--snip--

So by moving those over to PHP like this solve my problem...

--snip--
<?
    echo "<script type='text/javascript'>";
    blah blah
?>
--snip--

FletchSOD
"Neal Owen" <apatheticmrichi.com> wrote in message
news:1089928699.4636.1.camelneal.mrichi.com...
> You defined jsTest after the include where it should be before.
>
>
> On Thu, 2004-07-15 at 16:24, Scott Fletcher wrote:
> > When an include file contain plain JavaScript codes, with the echo
command
> > before and after the include file. I get the javascript error saying
> > "undefined jsTest"... Anyone know why is that?
> >
> > --snip--
> > echo "<table><tr><td></td></tr></table>";
> > echo "<script type='text/javascript'>";
> > include('test.inc');
> > echo " var jsTest = 0; ";
> > echo "</script>";
> > echo "<form><input type='button></form>";
> > --snip--
> >
> > Let's say the script in the test.inc contain
> >
> > --snip--
> > function test() {
> > if (jsTest != 0) {
> > //blah blah balh...
> > }
> > }
> > --snip--
> >
> > Thanks,
> > FletchSOD
> --
> Neal Owen | IT Programmer
> Marketing Resources, Inc.
> Main : 312.238.8923 x1218
> Direct : 630.592.3118
>
> nowenmrichi.com | http://www.mrichi.com

attached mail follows:


* Thus wrote Scott Fletcher:
> When an include file contain plain JavaScript codes, with the echo command
> before and after the include file. I get the javascript error saying
> "undefined jsTest"... Anyone know why is that?

With the information you've provided, jsTest is never accessed. So
its impossible for that error to occur.

Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!

attached mail follows:


Jeremy Booker wrote:
> I have a 3rd party SDK written in C. It includes a compiled .a file and
> a header file (.h).
>
> Is there any way that I can call the functions included in the SDK from
> within a php script?
>
> Regards,
> Jeremy

Yes you can extend the Zend engine. You'll need to write an extension
wrapper and build the extension into PHP - it can be as easy as that for
procedural coding. You may also want to register settings for php.ini
and/or some globals (i.e. global in PHP). If you want object-oriented
access to your SDK then that's another can of worms.

attached mail follows:


Scott Fletcher wrote:

> Hi!
>
> How do we tell if the file is already locked when someone use a flock()
> on the file??
>
> FletchSOD

Do you mean within PHP code? If that's the case then this is taken care
of by the flock() function... it checks the file's status and based on
the parameter(s) that you use it will give you access or not. I believe
that if another script tries to access the file but doesn't try to
flock() it then they can simply do whatever they want with the file
(someone correct me here if I'm wrong).

attached mail follows:


Hello,

On 07/15/2004 10:25 PM, Jordi Canals wrote:
> Dennis Gearon wrote:
>
> > remove carriage returns to prevent embedded email directives
>
> In an other thread, I readed that sentence. I'm interested to find more
> information about that. I have some mail forms and want to make them as
> secure and possible, but do not know about what and where should I filter.
>
> Should I filter all CR and LF Just in headers or also I should do that
> in the message body? (Which is sent in the SMTP DATA section).

For SMTP, all lines should be ended with CR+LF, or else messages may be
discarded by spam filters or other programs. However, if you use the
mail() function it may do some filtering on its own.

Anyway, you may want to take a look at this SMTP class to check how it
filters message lines sent by SMTP:

http://www.phpclasses.org/smtpclass

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


It does. ;-) I was just throwing out an interesting piece of code.

Honestly, I'm surprised that it doesn't segfault PHP. Good job, internals!

On Thu, 15 Jul 2004 21:02:10 -0700, Dennis Gearon <gearondfireserve.net> wrote:
> I bet it would work, 'cause whenever $GLOBALS is 'print_r'd, Globals shows up and a 'recursion note' ends the execution of 'print_r'.
>
>
>
> Justin Patrin wrote:
>
> > You *can* unset it, you just have to unset the place where it really
> > sits. When you have a global in a function, then unset it, you only
> > disconnect the variable. unset doesn't destroy a variable, it just
> > breaks the reference.
> >
> > As I said in my earlier e-mail, using this *will* work (I tested it):
> >
> > unset($GLOBALS['_REQUEST']);
> >
> > $GLOBALS is itself a superglobal.....hmmm, wonder what would happen if
> > you unset($GLOBALS['GLOBALS'])....
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> !DSPAM:40f75144237587900317931!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Hi all,
does anybody know any good library (class|script) for generating SNMP traps
wirtten in PHP?
thanks in advance,

A.

***************************************
 Alessandro Vitale
 Jr. Software Engineer
 Tiscali International Network Spa
 +39 070 4601678
 avitaletiscali.com
***************************************

attached mail follows:


I've managed to develop a query which pulls a finite number of records from
a table based on a query.

What commends do I now use to present these results in a table...?

--
-----------------------------
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-----------------------------

attached mail follows:


http://www.google.com/search?hl=en&ie=UTF-8&q=HTML+table&btnG=Google+Search

On Fri, 16 Jul 2004 17:07:17 +0100, Harlequin
<michael.masonarraspeople.co.uk> wrote:
> I've managed to develop a query which pulls a finite number of records from
> a table based on a query.
>
> What commends do I now use to present these results in a table...?
>
> --
> -----------------------------
> Michael Mason
> Arras People
> www.arraspeople.co.uk
> -----------------------------
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
> !DSPAM:40f7fb4e155681589816038!
>
>

--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

attached mail follows:


Harlequin wrote:

> I've managed to develop a query which pulls a finite number of records from
> a table based on a query.
>
> What commends do I now use to present these results in a table...?

How would you show a table now with a single record? Start there. Now,
what areas would need repeating with a "finite number" of records? Those
elements should be in a loop, either FOR, FOREACH or WHILE, more than
likely.

If you don't know how to run your query and extract the results, then
you've got some reading to do. Check the PHP manual; there are user
comments that walk you through everything.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

attached mail follows:


I'm having some difficulty with quotation marks, both single and double,
input via a textarea in a form.

Here's and example of text.

Trying out the "Special Character" thing.

Page 1 is the form.

Page 2 is the data shown back to the user.
original POST data is not touched. NO stripslashes
original typed text is show to the user by stripslashes($thistext)
original POST data is transferred to next page via hidden input field
without stripping slashes.

Page 3 posts the data to a MySQL database.
original POST data is not touched. No stipslashes.
Text gets cut off in database (Trying out the)

What exactly do I need to do to the text so that any quotation marks
(single or double) get input into the database.

TIA,

Ed Curtis

attached mail follows:


Ed Curtis wrote:

> I'm having some difficulty with quotation marks, both single and double,
> input via a textarea in a form.
>
> Here's and example of text.
>
> Trying out the "Special Character" thing.
>
> Page 1 is the form.
>
> Page 2 is the data shown back to the user.
> original POST data is not touched. NO stripslashes
> original typed text is show to the user by stripslashes($thistext)
> original POST data is transferred to next page via hidden input field
> without stripping slashes.
>
> Page 3 posts the data to a MySQL database.
> original POST data is not touched. No stipslashes.
> Text gets cut off in database (Trying out the)
>
> What exactly do I need to do to the text so that any quotation marks
> (single or double) get input into the database.

Let's say you have $_POST['text'] from the user.

To display the value back to the user with magic_quotes_enabled, you'd
do this:

echo htmlentities(stripslashes($_POST['text']));

To put the value into a hidden form element, you'd do this:

<input type="hidden" name="text"
value="<?=htmlentities(stripslashes($_POST['text']))?>">

Now, $_POST['text'] will come out correctly on Page 3. Since you seem to
have magic_quotes_gpc enabled, you can put the value directly into your
query.

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com