php-general Digest 15 Dec 2002 08:02:34 -0000 Issue 1764

Topics (messages 128293 through 128322):

Re: Formatting dates (from MySQL)
        128293 by: freaky
        128294 by: Marco Tabini
        128295 by: John W. Holmes

Undefined Variable
        128296 by: Anthony Ritter
        128297 by: Marco Tabini
        128298 by: Anthony Ritter
        128299 by: Marco Tabini
        128300 by: Anthony Ritter

Hey, If anyone can help me with this at all, I would really appreciate it...
        128301 by: Ryan Smaglik
        128322 by: Jason Wong

Parse Errors
        128302 by: Andy Turegano
        128303 by: DL Neil

Querying two tables
        128304 by: Cesar Aracena

Session: I RTFM
        128305 by: John Taylor-Johnston
        128306 by: Marco Tabini
        128309 by: TomH
        128312 by: John Taylor-Johnston
        128313 by: John Taylor-Johnston
        128315 by: Justin French
        128319 by: michael kimsal
        128321 by: conbud

question
        128307 by: r.vellinga
        128314 by: Justin French
        128318 by: Andy Turegano

PHP/ldap - atomic attribute modification
        128308 by: Carl J Meyer

Re: A little regex help
        128310 by: Justin French

Re: migrating from register_globals on to off
        128311 by: Justin French

Installing PEAR on windows
        128316 by: Davy Obdam

Strange problem with PHP,SSI
        128317 by: sport4ever
        128320 by: conbud

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 ---
Hey there,

I was just looking at the date/time functions
(http://www.php.net/manual/en/function.time.php) and I can't seem to find a
function that can format a date that is supplied in the format of a DATETIME
column.

So, I was wondering, is there a function that can format it properly or
should I let the database handle the formatting (I'm really new to SQL, I
didn't come across anything to mod in the select statement yet). I could
ofcourse split it on space for a time and a date var and then split the date
on -'s for years, months and days but efficient is something else I think
:-) In the archives I saw some examples doing exactly that, but nothing with
a single function (unless home defined ofcourse).

Kind regards and TIA



--- End Message ---
--- Begin Message ---
You should be able to use strtotime() to transform the datetime string
into a UNIX timestamp, which you can then format back using date().
However, this is a very circuitous way--either use SQL to format it or,
if your DBMS supports it, have it returned already as a UNIX timestamp.
The actual SQL commands depend on which DBMS you actually use.


Marco
-- 
------------
php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!
--- Begin Message ---
Hey there,

I was just looking at the date/time functions
(http://www.php.net/manual/en/function.time.php) and I can't seem to find a
function that can format a date that is supplied in the format of a DATETIME
column.

So, I was wondering, is there a function that can format it properly or
should I let the database handle the formatting (I'm really new to SQL, I
didn't come across anything to mod in the select statement yet). I could
ofcourse split it on space for a time and a date var and then split the date
on -'s for years, months and days but efficient is something else I think
:-) In the archives I saw some examples doing exactly that, but nothing with
a single function (unless home defined ofcourse).

Kind regards and TIA




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

--- End Message ---
--- End Message ---
--- Begin Message ---
> I was just looking at the date/time functions
> (http://www.php.net/manual/en/function.time.php) and I can't seem to
find
> a
> function that can format a date that is supplied in the format of a
> DATETIME
> column.
> 
> So, I was wondering, is there a function that can format it properly
or
> should I let the database handle the formatting (I'm really new to
SQL, I
> didn't come across anything to mod in the select statement yet). I
could
> ofcourse split it on space for a time and a date var and then split
the
> date
> on -'s for years, months and days but efficient is something else I
think
> :-) In the archives I saw some examples doing exactly that, but
nothing
> with
> a single function (unless home defined ofcourse).

You can use the DATE_FORMAT() function in your SELECT query to format
the date however you want it. Or, you can use UNIX_TIMESTAMP() to pull
it out in the unix format and then use the PHP function date() to format
it. 

http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html
#Date_and_time_functions

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/


--- End Message ---
--- Begin Message ---
Using MS Win 98 / Apache Server:

I'm trying to test a form box using the php mail() function.

All is well when I fill in the text boxes and hit submit.

I receive the e-mail.

The form action in the html page is:

<FORM ACTION="http://localhost/getform.php";  METHOD="POST">

_Now_

when I copy both of those files which are:

1. The html file for the form box

- I have now changed the form action to read:

<FORM ACTION="http://www.narrowsburg.org/getform.php";  METHOD="POST">

and

2. the .php file for the script

and publish them to my site which is hosted on my ISP's MS Server, and then
input data in the form boxes and hit submit:

I now get the following:
..........................
NOTICE: Undefined Variable: name in
d:\inetpub\www.narrowsburg.org\getform.php  in line 7
........................

Then, when I check my e-mail I get a message with no input data from the
variables like the name, e-mail, address, etc.

Thanking all in advance who might help me out.
Tony Ritter








--




--- End Message ---
--- Begin Message ---
Best guess, your local server has register_globals on and your ISP
doesn't. However, without seeing your code it's going to be difficult to
tell for sure! :-)


Marco
-- 
------------
php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!
--- Begin Message ---
Using MS Win 98 / Apache Server:

I'm trying to test a form box using the php mail() function.

All is well when I fill in the text boxes and hit submit.

I receive the e-mail.

The form action in the html page is:

<FORM ACTION="http://localhost/getform.php";  METHOD="POST">

_Now_

when I copy both of those files which are:

1. The html file for the form box

- I have now changed the form action to read:

<FORM ACTION="http://www.narrowsburg.org/getform.php";  METHOD="POST">

and

2. the .php file for the script

and publish them to my site which is hosted on my ISP's MS Server, and then
input data in the form boxes and hit submit:

I now get the following:
..........................
NOTICE: Undefined Variable: name in
d:\inetpub\www.narrowsburg.org\getform.php  in line 7
........................

Then, when I check my e-mail I get a message with no input data from the
variables like the name, e-mail, address, etc.

Thanking all in advance who might help me out.
Tony Ritter








--





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

--- End Message ---
--- End Message ---
--- Begin Message ---
>"Marco Tabini <[EMAIL PROTECTED]> wrote in message:
> Best guess, your local server has register_globals on and your ISP
> doesn't. However, without seeing your code it's going to be difficult to
> tell for sure! :-)
>
>
> Marco
....................................................

Thanks for the reply Marco.

The following is the code.  Any advice would be greatly appreciated.
Happy holidays...
Tony
....................................

//this is the the html page

<HTML>
<FORM ACTION="http://www.narrowsburg.org/getform.php"; METHOD="POST">

Your Name:<BR><INPUT TYPE="TEXT" NAME="thename" SIZE="40"><BR>
Business Name:<BR><INPUT TYPE="TEXT" NAME="bizname" SIZE="40"><BR>
Contact Person:<BR><INPUT TYPE="TEXT" NAME="contactname" SIZE="40"><BR>
Telephone Number:<BR><INPUT TYPE="TEXT" NAME="phone" SIZE="40"><BR>
e-mail address:<BR><INPUT TYPE="TEXT" NAME="email" SIZE="40"><BR>
Mailing Address:<BR><INPUT TYPE="TEXT" NAME="mailing" SIZE="40"><BR>
Town:<INPUT TYPE="TEXT" NAME="town" SIZE="40"><BR>State:<INPUT TYPE="TEXT"
NAME="state" SIZE="7">&nbsp&nbspZip Code:<INPUT TYPE="TEXT" NAME="zip"
SIZE="11"><BR>
Category:<BR><INPUT TYPE="TEXT" NAME="cat" SIZE="40"><BR>
Description of your business: <TEXTAREA NAME="description" ROWS=5
COLS=27></TEXTAREA><BR><BR>

<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Submit Form"><BR>
</FORM>
</HTML>
....................

//this is the .php file called "getform.php"

<?

if (($thename == "") && ($email == "") && ($description == "")) {
 header("Location: http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:    $thename\n";
$msg .= $thename ."'s business name is:    $bizname\n";
$msg .= "The contact person is:    $contactname\n";
$msg .= $thename. "'s phone number is:    $phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:          $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
.................


--- End Message ---
--- Begin Message ---
Hey Anthony--

It's definitely a register_globals problem. Your ISP has turned it off
because it's generally considered a significant security risk.

The best way to solve it is to use the superglobal $_POST to access your
post data. In your PHP script, change all the variables that you take
from the form into their $_POST[''] equivalent (see below for a rough
example--I put the assignments at the beginning because I wanted to
touch your code as little as possible). Also, keep in mind that you're
not performing any checks on the data--I'm sure you want to do it once
you've sorted the current problem out, but the way it is now you're
leaving yourself exposed to a number of possible attacks.

$thename = $_POST['thename'];
$email = $_POST['email'];
$description = $_POST['description'];
$bizname = $_POST['bizname'];
$contactname = $_POST['contactname'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$mailing = $_POST['mailing'];
$town = $_POST['town'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$cat = $_POST['cat'];

if (($thename == "") && ($email == "") && ($description == "")) {
 header("Location: http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:    $thename\n";
$msg .= $thename ."'s business name is:    $bizname\n";
$msg .= "The contact person is:    $contactname\n";
$msg .= $thename. "'s phone number is:    $phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:          $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
-- 
------------
php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!
--- Begin Message ---
>"Marco Tabini <[EMAIL PROTECTED]> wrote in message:
> Best guess, your local server has register_globals on and your ISP
> doesn't. However, without seeing your code it's going to be difficult to
> tell for sure! :-)
>
>
> Marco
....................................................

Thanks for the reply Marco.

The following is the code.  Any advice would be greatly appreciated.
Happy holidays...
Tony
....................................

//this is the the html page

<HTML>
<FORM ACTION="http://www.narrowsburg.org/getform.php"; METHOD="POST">

Your Name:<BR><INPUT TYPE="TEXT" NAME="thename" SIZE="40"><BR>
Business Name:<BR><INPUT TYPE="TEXT" NAME="bizname" SIZE="40"><BR>
Contact Person:<BR><INPUT TYPE="TEXT" NAME="contactname" SIZE="40"><BR>
Telephone Number:<BR><INPUT TYPE="TEXT" NAME="phone" SIZE="40"><BR>
e-mail address:<BR><INPUT TYPE="TEXT" NAME="email" SIZE="40"><BR>
Mailing Address:<BR><INPUT TYPE="TEXT" NAME="mailing" SIZE="40"><BR>
Town:<INPUT TYPE="TEXT" NAME="town" SIZE="40"><BR>State:<INPUT TYPE="TEXT"
NAME="state" SIZE="7">&nbsp&nbspZip Code:<INPUT TYPE="TEXT" NAME="zip"
SIZE="11"><BR>
Category:<BR><INPUT TYPE="TEXT" NAME="cat" SIZE="40"><BR>
Description of your business: <TEXTAREA NAME="description" ROWS=5
COLS=27></TEXTAREA><BR><BR>

<INPUT TYPE="SUBMIT" NAME="SUBMIT" VALUE="Submit Form"><BR>
</FORM>
</HTML>
....................

//this is the .php file called "getform.php"

<?

if (($thename == "") && ($email == "") && ($description == "")) {
 header("Location: http://localhost/n_proserv_x.html";);
 exit;
}
$msg = "This e-mail was sent from:\n";
$msg .= "Sender's Name:    $thename\n";
$msg .= $thename ."'s business name is:    $bizname\n";
$msg .= "The contact person is:    $contactname\n";
$msg .= $thename. "'s phone number is:    $phone\n";
$msg .= $thename. "'s e-mail address is: $email\n";
$msg .= $thename. "'s mailing address is: $mailing\n";
$msg .= "Town: $town\n";
$msg .= "State: $state\n";
$msg .= "Zip Code: $zip\n";
$msg .= $thename."'s category is: $cat\n";
$msg .= "and the message is:          $description\n\n";
$to = "[EMAIL PROTECTED]";
$subject = "Narrowsburg Chamber of Commerce";
$mailheaders = "From: $thename\n";
$mailheaders .= "Reply to:$email\n\n";
mail($to, $subject, $msg, $mailheaders);
?>
.................



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

--- End Message ---
--- End Message ---
--- Begin Message ---
Marco Tabini <[EMAIL PROTECTED]> wrote in message:
> Hey Anthony--
>
> It's definitely a register_globals problem. Your ISP has turned it off
> because it's generally considered a significant security risk.
>
> The best way to solve it is to use the superglobal $_POST to access your
> post data. In your PHP script, change all the variables that you take
> from the form into their $_POST[''] equivalent (see below for a rough
> example--I put the assignments at the beginning because I wanted to
> touch your code as little as possible). Also, keep in mind that you're
> not performing any checks on the data--I'm sure you want to do it once
> you've sorted the current problem out, but the way it is now you're
> leaving yourself exposed to a number of possible attacks.
>
> $thename = $_POST['thename'];
(snipped)
.........................................

Yep.

That did it.  Thanks again Marco.

Two more questions:

1. Can you give me some examples about:

"leaving yourself exposed to a number of possible attacks."

and

2. Where can I pick up the PHP magazine in your post sig.

best...
TR





--- End Message ---
--- Begin Message ---
I got a generic ³text to png on the fly² script which works fine but I want
to change it so that the image only the size of the text. (so the text has
no border, or padding around it) For and example of what I want to do check
out: http://www.spoono.com/font/?string=This is what i want to do&.png
I have the script:
<?

  Header("Content-type: image/png");

  if(!isset($s)){$s=8;}

  $size = 
imagettfbbox($s,0,"/home/xelerix/public_html/font/fonts/04B_03__.TTF",$text)
;

  $dx = abs($size[2]-$size[0]);

  $dy = abs($size[5]-$size[3]);

  $xpad=9;

  $ypad=9;

  $im = imagecreate($dx+$xpad,$dy+$ypad);

  $bg = ImageColorAllocate($im, 102,102,102);

  $white = ImageColorAllocate($im, 255,255,255);

  ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2), $white,
"/home/xelerix/public_html/font/fonts/04B_03__.TTF", $text);

  imagepng($im);

  ImageDestroy($im);

?>

The text for the image is called from a url like
www.xelerix.com/font/font.php?text=Hi

Thanks!


--- End Message ---
--- Begin Message ---
On Sunday 15 December 2002 06:31, Ryan Smaglik wrote:

First, please use a _descriptive_ subject. Something which gives people an 
idea of what your post is about.

> I got a generic ³text to png on the fly² script which works fine but I want
> to change it so that the image only the size of the text. (so the text has
> no border, or padding around it) For and example of what I want to do check
> out: http://www.spoono.com/font/?string=This is what i want to do&.png
> I have the script:
> <?
>
>   Header("Content-type: image/png");
>
>   if(!isset($s)){$s=8;}
>
>   $size =
> imagettfbbox($s,0,"/home/xelerix/public_html/font/fonts/04B_03__.TTF",$text
>) ;
>
>   $dx = abs($size[2]-$size[0]);
>
>   $dy = abs($size[5]-$size[3]);
>
>   $xpad=9;
>
>   $ypad=9;

By their very name, I would guess these two values are used as padding to give 
a border around the text. Try removing them.

>   $im = imagecreate($dx+$xpad,$dy+$ypad);
>
>   $bg = ImageColorAllocate($im, 102,102,102);
>
>   $white = ImageColorAllocate($im, 255,255,255);
>
>   ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2), $white,
> "/home/xelerix/public_html/font/fonts/04B_03__.TTF", $text);
>
>   imagepng($im);
>
>   ImageDestroy($im);
>
> ?>


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"This isn't brain surgery; it's just television."
- David Letterman
*/

--- End Message ---
--- Begin Message ---
I am a PHP beginner so this error may be a stupid one. Anyway, I'm
trying to write a simple addition script. The client enters two numbers,
then my script (adder.php) adds them. However, when the script is run, I
get "Parse Error On Line 3" I have no idea exactly what I have done wrong.
Here is the script.

<?
print ("Your first number is:$firstnumber\n")
print ("Your second number is:$secondnumber\n")
$answer=$firstnumber+$second number
echo ("The answer is: $answer\n")
?>

Any help would be greatly appreciated. Thank you.


--- End Message ---
--- Begin Message ---
Andy,

> I am a PHP beginner so this error may be a stupid one. Anyway, I'm
> trying to write a simple addition script. The client enters two numbers,
> then my script (adder.php) adds them. However, when the script is run, I
> get "Parse Error On Line 3" I have no idea exactly what I have done wrong.
> Here is the script.
>
> <?
> print ("Your first number is:$firstnumber\n")
> print ("Your second number is:$secondnumber\n")
> $answer=$firstnumber+$second number
> echo ("The answer is: $answer\n")
> ?>
>
> Any help would be greatly appreciated. Thank you.


PHP code lines must end with a semi-colon (;).
Also, HTML newlines are <br> (not \n)
Some PHPs won't like the short tags, recommend: <?PHP

Regards,
=dn

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

I have several tables from which I have to fetch certain products &
categories based on customer selection. The tables are as follows:

Table 1 - Categories
catid (autonum)
catname

Table 2 - Sub categories
subcatid (autonum)
subcatname

Table 3 - Products
prodid (autonum)
prodname

Table 4 - Relationships
Catid
Subcatid
Prodid

Now, the question is how to fetch all the sub-categories let's say that
are related to category 0001. I know it's as simple as relating two
tables in one query, but I don't remember how. Any help appreciated.


Cesar L. Aracena
[EMAIL PROTECTED]
[EMAIL PROTECTED]
(0299) 156-356688
Neuquén (8300) Capital
Argentina



--- End Message ---
--- Begin Message ---
>Jason wrote:
>RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.

>Sessions depends on a number of factors
>including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
                 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
cleaner way?


<?php
#session_name("TestALS");
session_start();

if (isset($_POST["familyname"]))
{
session_register("familyname");
$familyname = $_POST["familyname"];
echo "Yay: \$familyname= $familyname<br>";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname<br>";
}



--- End Message ---
--- Begin Message ---
I haven't followed the rest of the thread, but how about using a
function?

function getvar ($varname)
{
        if (isset ($_POST[$varname])
        {
                $_SESSION[$varname] = $_POST[$varname];
                return $_POST[$varname];
        }
        elseif (isset ($_SESSION[$varname]))
                return $_SESSION[$varname];
}

session_start();

// You don't need session_register anymore

$familyname = getvar('familyname');


and so on--just one line per variable.

Hope this helps.

Cheers,


Marco
-- 
------------
php|architect - The Magazine for PHP Professionals
The monthly magazine dedicated to the world of PHP programming

Check us out on the web at http://www.phparch.com!
--- Begin Message ---
>Jason wrote:
>RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.

>Sessions depends on a number of factors
>including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
                 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
cleaner way?


<?php
#session_name("TestALS");
session_start();

if (isset($_POST["familyname"]))
{
session_register("familyname");
$familyname = $_POST["familyname"];
echo "Yay: \$familyname= $familyname<br>";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname<br>";
}




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

--- End Message ---
--- End Message ---
--- Begin Message ---
When faced with this problem I tried the following (works)

The top section of PHP code just reads the POST return array
and plops it into a series of successive _SESSION vars

Included is a FORM to use that shows the simple code at work

HTH
TomHenry

================ Tested =================
<?
session_start();

//echo "<HR>List the _POST key/val pairs<P>";

// Try to cycle though the _POST vars
// and use them as input to creating _SESSION vars

while(list($k,$v)=each($_POST)){
$_SESSION[$k]=$v;
//echo "_name_ <b>".stripslashes($k)."</b> _value_ <b>".stripslashes($v)."</b><br>";
}

// easy way to peek at the contents of what we just did

echo "<hr>print_r of the \$_SESSION array<P>";
print_r($_SESSION);
echo "<hr>";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Nextpage</title>
</head>

<body>
<P><HR><P>
<b><u>Is our _SESSION here?</u></b>
<P>
<Table width=60% border=1 cellspacing=0 cellpadding=5>
<TR><TH>Key</TH><TH>Value</TH></TR>
<?
while(list($k,$v)=each($_SESSION)){
echo "<TR><TD>".stripslashes($k)."</TD><TD>".stripslashes($v)."</TD></TR>";
}
?>
</TABLE>
<P><HR><P>
<form action=<?=$PHP_SELF?> method=POST>
key <input type="text" name="key" value='KeyOne' size="15" maxlength="25"> -- value <input type="text" name="value" value='ValueOne' size="30" maxlength="80">
<br>
Name: <input type='text' name='name' value="Tim O'Toole " size='12'> -- Address: <input type='text' name='address' value='123 Main Street'>
<input NAME=action type=submit value="Submit">
</form>
<P><HR><P>
</body>
</html>



John Taylor-Johnston wrote:
Jason wrote:
RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.


Sessions depends on a number of factors
including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
                 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, cleaner way?


<?php
#session_name("TestALS");
session_start();

if (isset($_POST["familyname"]))
{
session_register("familyname");
$familyname = $_POST["familyname"];
echo "Yay: \$familyname= $familyname<br>";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname<br>";
}




--- End Message ---
--- Begin Message ---
Thanks.

John



> When faced with this problem I tried the following (works)
>
> The top section of PHP code just reads the POST return array
> and plops it into a series of successive _SESSION vars
>
> Included is a FORM to use that shows the simple code at work
>
> HTH
> TomHenry
>
> ================  Tested  =================
> <?
> session_start();
>
> //echo "<HR>List the _POST key/val pairs<P>";
>
> // Try to cycle though the _POST vars
> // and use them as input to creating _SESSION vars
>
> while(list($k,$v)=each($_POST)){
> $_SESSION[$k]=$v;
> //echo "_name_ <b>".stripslashes($k)."</b> _value_
> <b>".stripslashes($v)."</b><br>";
> }
>
> // easy way to peek at the contents of what we just did
>
> echo "<hr>print_r of the \$_SESSION array<P>";
> print_r($_SESSION);
> echo "<hr>";
> ?>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
>
> <html>
> <head>
>         <title>Nextpage</title>
> </head>
>
> <body>
> <P><HR><P>
> <b><u>Is our _SESSION here?</u></b>
> <P>
> <Table width=60% border=1 cellspacing=0 cellpadding=5>
> <TR><TH>Key</TH><TH>Value</TH></TR>
> <?
> while(list($k,$v)=each($_SESSION)){
> echo
> "<TR><TD>".stripslashes($k)."</TD><TD>".stripslashes($v)."</TD></TR>";
> }
> ?>
> </TABLE>
> <P><HR><P>
> <form action=<?=$PHP_SELF?> method=POST>
> key <input type="text" name="key" value='KeyOne' size="15"
> maxlength="25"> -- value <input type="text" name="value"
> value='ValueOne' size="30" maxlength="80">
> <br>
> Name: <input type='text' name='name' value="Tim O'Toole " size='12'>
> -- Address: <input type='text' name='address' value='123 Main Street'>
> <input NAME=action type=submit value="Submit">
> </form>
> <P><HR><P>
> </body>
> </html>
>
> John Taylor-Johnston wrote:
> >>Jason wrote:
> >>RTFM again.
> >
> >
> > Jason, again, I RTFM, but did not get it working.
> > Otherwise I wouldn't have dared ask a question.
> >
> >
> >>Sessions depends on a number of factors
> >>including your version of PHP and the setting of register_globals.
> >
> >
> > The FM manual says:
> >
> > "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"
> >
> > So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)
> >
> > Ok. I quit using $HTTP_POST_VARS["familyname"].
> >
> > With a little rethinking, I have this working, I hope.
> >
> > Now ... is there a cleaner way to assign my variable "familyname"?
> >
> > Pseudo code:
> >
> > if _post["familyname"] exists set session variable
> >                  (no sense in setting it until I post it)
> > if _session["familyname"] exists, $familyname = $_SESSION["familyname"];
> >
> > I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
>cleaner way?
> >
> >
> > <?php
> > #session_name("TestALS");
> > session_start();
> >
> > if (isset($_POST["familyname"]))
> > {
> > session_register("familyname");
> > $familyname = $_POST["familyname"];
> > echo "Yay: \$familyname= $familyname<br>";
> > }
> >
> > if (isset($_SESSION["familyname"]))
> > {
> > $familyname = $_SESSION["familyname"];
> > echo "yay session works, \$familyname= $familyname<br>";
> > }
> >
> >
> >

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064


--- End Message ---
--- Begin Message ---
Marco (or anyone)

What is the difference between:
$familyname = getvar("familyname");
and
$familyname = getvar('familyname');

What do single quotes do, as a general rule, that double cannot (he asks remembering 
something, but not sure what)?




Marco Tabini wrote:

> I haven't followed the rest of the thread, but how about using a
> function?
>
> function getvar ($varname)
> {
>         if (isset ($_POST[$varname])
>         {
>                 $_SESSION[$varname] = $_POST[$varname];
>                 return $_POST[$varname];
>         }
>         elseif (isset ($_SESSION[$varname]))
>                 return $_SESSION[$varname];
> }
>
> session_start();
>
> // You don't need session_register anymore
>
> $familyname = getvar('familyname');
>
> and so on--just one line per variable.
>
> Hope this helps.
>
> Cheers,
>
> Marco
> --
> ------------
> php|architect - The Magazine for PHP Professionals
> The monthly magazine dedicated to the world of PHP programming
>
> Check us out on the web at http://www.phparch.com!
>
>                                                   
>-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Subject: [PHP] Session: I RTFM
> Date: Sat, 14 Dec 2002 18:41:40 -0500
> From: John Taylor-Johnston <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> Organization: FLSH, U-de-S
> To: [EMAIL PROTECTED]
>
> >Jason wrote:
> >RTFM again.
>
> Jason, again, I RTFM, but did not get it working.
> Otherwise I wouldn't have dared ask a question.
>
> >Sessions depends on a number of factors
> >including your version of PHP and the setting of register_globals.
>
> The FM manual says:
>
> "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"
>
> So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)
>
> Ok. I quit using $HTTP_POST_VARS["familyname"].
>
> With a little rethinking, I have this working, I hope.
>
> Now ... is there a cleaner way to assign my variable "familyname"?
>
> Pseudo code:
>
> if _post["familyname"] exists set session variable
>                  (no sense in setting it until I post it)
> if _session["familyname"] exists, $familyname = $_SESSION["familyname"];
>
> I'll have about 30 variables. Going to be alot of lines. There must be an easier, 
>cleaner way?
>
> <?php
> #session_name("TestALS");
> session_start();
>
> if (isset($_POST["familyname"]))
> {
> session_register("familyname");
> $familyname = $_POST["familyname"];
> echo "Yay: \$familyname= $familyname<br>";
> }
>
> if (isset($_SESSION["familyname"]))
> {
> $familyname = $_SESSION["familyname"];
> echo "yay session works, \$familyname= $familyname<br>";
> }
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--
John Taylor-Johnston
-----------------------------------------------------------------------------
"If it's not open-source, it's Murphy's Law."

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   -     Université de Sherbrooke:
          http://compcanlit.ca/
          819-569-2064


--- End Message ---
--- Begin Message ---
John,

PHP looks for "$vars or {$vars} to parse in the string" when double quotes
are used... whereas when single quotes are used, it won't parse/substitute
the vars.

<?
// works:
echo "My favourite fruit is {$fruit}";
echo "My favourite fruit is $fruit";
echo 'My favourite fruit is '.$fruit;

// doesn't work:
echo 'My favourite fruit is {$fruit}';
echo 'My favourite fruit is $fruit';
?>

So, when you're not using $vars, using single quotes will be marginally
faster... perhaps not important on small sites, but very important on big
ones, and a decent habbit to get into :)


Justin


on 15/12/02 12:30 PM, John Taylor-Johnston
([EMAIL PROTECTED]) wrote:

> Marco (or anyone)
> 
> What is the difference between:
> $familyname = getvar("familyname");
> and
> $familyname = getvar('familyname');
> 
> What do single quotes do, as a general rule, that double cannot (he asks
> remembering something, but not sure what)?
> 
> 
> 
> 
> Marco Tabini wrote:
> 
>> I haven't followed the rest of the thread, but how about using a
>> function?
>> 
>> function getvar ($varname)
>> {
>> if (isset ($_POST[$varname])
>> {
>> $_SESSION[$varname] = $_POST[$varname];
>> return $_POST[$varname];
>> }
>> elseif (isset ($_SESSION[$varname]))
>> return $_SESSION[$varname];
>> }
>> 
>> session_start();
>> 
>> // You don't need session_register anymore
>> 
>> $familyname = getvar('familyname');
>> 
>> and so on--just one line per variable.
>> 
>> Hope this helps.
>> 
>> Cheers,
>> 
>> Marco
>> --
>> ------------
>> php|architect - The Magazine for PHP Professionals
>> The monthly magazine dedicated to the world of PHP programming
>> 
>> Check us out on the web at http://www.phparch.com!
>> 
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> -----------------------------------------------------------------------------
>> ----------------------------------------------------
>> 
>> Subject: [PHP] Session: I RTFM
>> Date: Sat, 14 Dec 2002 18:41:40 -0500
>> From: John Taylor-Johnston <[EMAIL PROTECTED]>
>> Reply-To: [EMAIL PROTECTED]
>> Organization: FLSH, U-de-S
>> To: [EMAIL PROTECTED]
>> 
>>> Jason wrote:
>>> RTFM again.
>> 
>> Jason, again, I RTFM, but did not get it working.
>> Otherwise I wouldn't have dared ask a question.
>> 
>>> Sessions depends on a number of factors
>>> including your version of PHP and the setting of register_globals.
>> 
>> The FM manual says:
>> 
>> "$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"
>> 
>> So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test
>> offline)
>> 
>> Ok. I quit using $HTTP_POST_VARS["familyname"].
>> 
>> With a little rethinking, I have this working, I hope.
>> 
>> Now ... is there a cleaner way to assign my variable "familyname"?
>> 
>> Pseudo code:
>> 
>> if _post["familyname"] exists set session variable
>> (no sense in setting it until I post it)
>> if _session["familyname"] exists, $familyname = $_SESSION["familyname"];
>> 
>> I'll have about 30 variables. Going to be alot of lines. There must be an
>> easier, cleaner way?
>> 
>> <?php
>> #session_name("TestALS");
>> session_start();
>> 
>> if (isset($_POST["familyname"]))
>> {
>> session_register("familyname");
>> $familyname = $_POST["familyname"];
>> echo "Yay: \$familyname= $familyname<br>";
>> }
>> 
>> if (isset($_SESSION["familyname"]))
>> {
>> $familyname = $_SESSION["familyname"];
>> echo "yay session works, \$familyname= $familyname<br>";
>> }
>> 
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> --
> John Taylor-Johnston
> -----------------------------------------------------------------------------
> "If it's not open-source, it's Murphy's Law."
> 
> ' ' '   Collège de Sherbrooke:
> ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
> -     Université de Sherbrooke:
> http://compcanlit.ca/
> 819-569-2064
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Instead of
while(list($k,$v)=each($_POST)){
$_SESSION[$k]=$v;
//echo "_name_ <b>".stripslashes($k)."</b> _value_ <b>".stripslashes($v)."</b><br>";
}
why not just

$_SESSION = array_merge($_SESSION,$_POST);

???


Michael Kimsal
http://www.phpappserver.com
734-480-9961

--- End Message ---
--- Begin Message ---
John Taylor-Johnston wrote:
Jason wrote:
RTFM again.

Jason, again, I RTFM, but did not get it working.
Otherwise I wouldn't have dared ask a question.


Sessions depends on a number of factors
including your version of PHP and the setting of register_globals.

The FM manual says:

"$_SESSION (or $HTTP_SESSION_VARS with PHP 4.0.6 or less) is recommended"

So I am using "PHP Version 4.1.2" (and "4.2.3" on my localhost to test offline)

Ok. I quit using $HTTP_POST_VARS["familyname"].

With a little rethinking, I have this working, I hope.

Now ... is there a cleaner way to assign my variable "familyname"?

Pseudo code:

if _post["familyname"] exists set session variable
                 (no sense in setting it until I post it)
if _session["familyname"] exists, $familyname = $_SESSION["familyname"];

I'll have about 30 variables. Going to be alot of lines. There must be an easier, cleaner way?


<?php
#session_name("TestALS");
session_start();

if (isset($_POST["familyname"]))
{
session_register("familyname");
$familyname = $_POST["familyname"];
echo "Yay: \$familyname= $familyname<br>";
}

if (isset($_SESSION["familyname"]))
{
$familyname = $_SESSION["familyname"];
echo "yay session works, \$familyname= $familyname<br>";
}



Hey, I dont know how much easier it will be but it is faster, you could use a switch statement.

switch ($_SESSION['familyname'])
{
case 'name1':
do something;
break;

case 'name2':
do something;
break;

default:
do this if the variable doesnt match a case;
break;
}

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

still trying to get PHP 4 support on Apache 2. (Windows ME)
Mysql is working Fine, Apache also.

but when i insert the 2 or 3 lines " Load module etc."  the server will shut down 

can somebody help me please ?

ricardo


--- End Message ---
--- Begin Message ---
I assume you know that running PHP on Apache 2 is NOT RECOMMENDED YET, or at
the very least, listed as "experimental"??

Justin


on 15/12/02 11:13 AM, r.vellinga ([EMAIL PROTECTED]) wrote:

> Hello,
> 
> still trying to get PHP 4 support on Apache 2. (Windows ME)
> Mysql is working Fine, Apache also.
> 
> but when i insert the 2 or 3 lines " Load module etc."  the server will shut
> down 
> 
> can somebody help me please ?
> 
> ricardo
> 
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Yes, that is indeed true.

On Sun, 15 Dec 2002, Justin French wrote:

> I assume you know that running PHP on Apache 2 is NOT RECOMMENDED YET, or at
> the very least, listed as "experimental"??
>
> Justin
>
>
> on 15/12/02 11:13 AM, r.vellinga ([EMAIL PROTECTED]) wrote:
>
> > Hello,
> >
> > still trying to get PHP 4 support on Apache 2. (Windows ME)
> > Mysql is working Fine, Apache also.
> >
> > but when i insert the 2 or 3 lines " Load module etc."  the server will shut
> > down
> >
> > can somebody help me please ?
> >
> > ricardo
> >
> >
> >
>
> Justin French
> --------------------
> http://Indent.com.au
> Web Development &
> Graphic Design
> --------------------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

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

Anyone out there have significant experience using the PHP/ldap
interface?  It appears to me that it's missing some important
functionality, but I might just not be seeing how to do it.

I have a user-management application which needs to manage an openLDAP
user base of several thousand users.  For adding users, we need a way to
get the next available UID number without creating a race condition
where two users could simultaneously grab the same UID number.

The question of how to best do this (on the LDAP side) has been hashed
over quite a bit on the openldap-software mailing list.  Without
repeating all that discussion, the conclusion is that we need to grab a
"highestAssignedUid" attribute of the "ou=users,dc=example,dc=com" entry
and increment it using an attribute modify operation like this:

dn: ou=users,dc=example,dc=com
changetype: modify
delete: highestAssignedUid
highestAssignedUid: 500
-
add: highestAssignedUid
highestAssignedUid: 501

This solves the problem, because LDAP modify operations are atomic, and
this modify operation will fail if the 'highestAssignedUid' attribute no
longer has the value that we grabbed (eg 500).  So if we grab the
highestAssignedUid, and then our increment fails, we just back off and
try the whole thing over again.  If the increment succeeds, we know
we've got a unique UIDnumber.

But here's the problem: The PHP/ldap interface doesn't seem to have any
way of supporting this type of modify, where one value is deleted and
another added in a single atomic modify operation.  ldap_mod_replace()
and ldap_modify() replace /all/ the values of an attribute, irrespective
of previous values.  ldap_mod_del() will delete a specific value of an
attribute, and ldap_mod_add() will add a value to an attribute without
replacing existing ones, but if I have to make two function calls I've
lost the crucial feature, which is atomicity, and reintroduced the race
condition.

Is there any good solution here?

TIA for any advice,
Carl

--- End Message ---
--- Begin Message ---
Not sure if it will be quicker or not, but I don't think you NEED a regex:

- get rid of 'for more information'
- split on 'See' into $pre and $code
- trim the bits down
- wrap $code in a URL
- glue it all back together

UNTESTED CODE:
<?
// string
$str = 'Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information';

// set up
$ms = "http://support.microsoft.com/default.aspx?scid=kb;en-us;";;
$suffix = 'for more information';
$splitter = 'See';

// do it
list($pre,$code) = explode($splitter,$str = str_replace($suffix,'',$str));
$pre = trim($pre); $code = trim($code);
$str = "{$pre} See <a href=\"{$ms}{$code}\">{$code}</a> {$suffix}";

echo $str;
?>

If this gets heavy traffic, u may want to test which is faster -- or you may
not care!!


Justin


on 14/12/02 5:21 AM, Gareth Hastings ([EMAIL PROTECTED]) wrote:

> Hi,
> 
> I'm trying to work out the regex needed to split either one of the
> following lines
> 
> Windows 2000 Hotfix (Pre-SP4) See Q322842 for more information
> Windows XP Hotfix (SP2) See Q327696 for more information
> 
> Into one of these
> 
> Windows 2000 Hotfix (Pre-SP4) See <a
> href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322842'>Q
> 322842</a> for more information
> Windows XP Hotfix (SP2) See <a
> href='http://support.microsoft.com/default.aspx?scid=kb;en-us;Q327696>Q3
> 27696</a> for more information
> 
> I can work out half of the expression but not the other half lol, I've
> used a combination of ereg and split but I'm sure this can be done with
> 1 ereg statement. Here is my code
> 
> $ms = "http://support.microsoft.com/default.aspx?scid=kb;en-us;";;
> 
> 
> if (ereg("(\[See )([Q|q][0-9]+)( for more information\])", $name))
> {
> $sp = split("\[See ", $name);
> ereg("([Q|q][0-9]+)( for more information\])", $sp[1], $qb);
> 
> $url = $sp[0] . "See <a href='$ms" . $qb[1] . "'
> target='_blank'>" . $qb[1] . "</a> for more information";
> 
> }
> 
> Any ideas?
> 
> Gareth
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message ---
Why not:

1. place a .htaccess file in each existing client/developer directory
switching the value to ON -- being careful to ensure you don't wipe over an
existing .htaccess file!!

2. switch the value to OFF in php.ini


This means all current clients will have continued support for ON, and all
new ones will default to OFF.  If existing clients which to go with OFF,
they just delete the .htaccess file.


OR the vice-versa can be done... advise clients that you are moving to OFF
in a month, explain the benefits, and make a .htaccess file available to
those who don't want to migrate... so that their stuff doesn't break.

Most developers will know which way they're writing code.


You ultimately need to:

- change the default to OFF
- allow existing clients to "patch" to ON



Justin


on 15/12/02 12:43 AM, Willem ([EMAIL PROTECTED]) wrote:

> Hello,
> 
> Lately we discovered that, by mistake, we've run PHP with register_globals
> on for a few months for all our customers.
> 
> Since we want to turn it off, we need to figure out which customers use the
> 'register_globals' functionality so we can ask them to modify their scripts.
> 
> However, checking all php code by hand is a non-trivial task, because there
> are 20,000+ php scripts. Is there a way to:
> 
> a) parse all .php scripts once and detect whether they depend on register
> globals on?
> 
> or probably easier:
> 
> b) add something to our current setup so that when a scripts is executed and
> uses the register globals functionality, we get a notification
> automatically?
> 
> Any suggestions?
> Thanks!
> 
> 
> 

Justin French
--------------------
http://Indent.com.au
Web Development & 
Graphic Design
--------------------

--- End Message ---
--- Begin Message --- Hi people,

I have a question, i would like to use PEAR in some of my applications, how can i download and iinstall PEAR on windows. I have Apache 2.0.43 with PHP 4.3.0 RC3 installed on a windows XP machine. I read on http://pear.php.net/manual/en/faq.windows.php .....

To make PEAR work on Windows, you simple need to add the PEAR installation dir (e.g. c:\php\pear) to the include_path directive in your php.ini.
Well i thats easy, but i dont have a pear directory? Making a new directory is easy also;-), but...... How and where do i download and instal the PEAR packages on my machine... Thanks...

Best regards,..

Davy Obdam
mailto:[EMAIL PROTECTED]



--- End Message ---
--- Begin Message ---
PHP version: 4.2.1
OS: RedHat Linux 8
Apache version: 2.0

My problem is that I can't execute more than one (SSI include) on my website JUST for 
PHP file.. so there is NO problems at all if I include HTML or SHTML files.

Anyway, if I include 2 PHP files into any page, the first INCLUDE statement would 
execute correctly and print out the file output, but the second INCLUDE statement 
would NOT execute, and instead, the statement printed in the page source as it is:

<!--#include virtual="sympoll/poll.php?id=2" -->

notice that this problem was not exist in my server before I upgrade PHP from 4.1.2 to 
4.2.1 and Apache from 1.3 to 2.0 and Linux from 7.3 to 8.0 !!

any idea?

--- End Message ---
--- Begin Message ---
Sport4ever wrote:
PHP version: 4.2.1
OS: RedHat Linux 8
Apache version: 2.0

My problem is that I can't execute more than one (SSI include) on my website JUST for PHP file.. so there is NO problems at all if I include HTML or SHTML files.

Anyway, if I include 2 PHP files into any page, the first INCLUDE statement would execute correctly and print out the file output, but the second INCLUDE statement would NOT execute, and instead, the statement printed in the page source as it is:

<!--#include virtual="sympoll/poll.php?id=2" -->

notice that this problem was not exist in my server before I upgrade PHP from 4.1.2 to 4.2.1 and Apache from 1.3 to 2.0 and Linux from 7.3 to 8.0 !!

any idea?


Hey, you could try using the PHP include

<?php include('path/to/file') ?>

or

<?php require('path/to/file') ?>

--- End Message ---

Reply via email to