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 20 May 2003 16:21:53 -0000 Issue 2068

php-general-digest-helplists.php.net
Date: Tue May 20 2003 - 11:21:53 CDT


php-general Digest 20 May 2003 16:21:53 -0000 Issue 2068

Topics (messages 148245 through 148295):

URGENT BUSINESS RELATIONSHIP
        148245 by: DR RAYMOND IBRU

Re: ldap_search
        148246 by: Philippe Saladin

vpopmail_add_user
        148247 by: nabil
        148261 by: Tom Rogers
        148267 by: nabil
        148273 by: Tom Rogers

disappearing php variables?
        148248 by: Megalion
        148255 by: Mohit Mittal
        148262 by: Megalion
        148269 by: Mohit Mittal
        148270 by: Megalion

problem in fopen
        148249 by: HPS
        148256 by: Jason Wong
        148282 by: Àíòîí

store $PHP_SELF into session variable
        148250 by: Osman Omar
        148252 by: Rasmus Lerdorf

how to calculate
        148251 by: buttoz
        148253 by: Rasmus Lerdorf

Extracting HTML from a file
        148254 by: Shaun
        148263 by: Jason Wong
        148264 by: Tom Rogers

Re: while....for....problem
        148257 by: Jason Wong

Re: Problem with IF..
        148258 by: Jason Wong

PHPA causing problems?
        148259 by: Leif K-Brooks
        148283 by: Manuel Lemos
        148289 by: Pablo

Re: execute and write, or execute or write
        148260 by: Jason Wong

Append to begining of a String
        148265 by: Shaun
        148268 by: Dana Freer
        148274 by: Àíòîí

Re: Array Logic
        148266 by: Ford, Mike [LSS]

Re: composed variables
        148271 by: Ford, Mike [LSS]
        148280 by: Àíòîí

Seriously screwed php install.
        148272 by: John Wards
        148278 by: Jason Wong
        148279 by: John Wards

Re: faster output from php and postgres --please help!
        148275 by: David Otton

Control Browser
        148276 by: John
        148284 by: Rolf Brusletto

syscall and rexec
        148277 by: Mostafa Afifi

Re: Generating a Static HTML Page from PHP
        148281 by: Lowell Allen

php4 and apache
        148285 by: Patrick Ahler
        148294 by: Jason Wong

Truncated values in update form
        148286 by: Alberto Brea
        148287 by: Alex Ciurea
        148288 by: CPT John W. Holmes

Re: oracle 92 / IIS / windows
        148290 by: Catalin Trifu

Re: PHP Security on Apache
        148291 by: Jonathan Wilkes

Disable select box
        148292 by: Shaun
        148295 by: CPT John W. Holmes

PHP & authorize.net
        148293 by: Clint Tredway

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:


FROM THE DESK OF THE DR. RAYMOND IBRU.
STRICTLY CONFIDENTIAL AND URGENT
ATTN: THE PRESIDENT/CEO.
PERMISSION TO REMMIT THE SUM OF 26.5MILLION US DOLLARS INTO YOUR ACCOUNT.
With reference to recommendation of your esteemed firm. I do hereby wish to reach you for this urgent business relationship.
Between 1990-1998, I was Chairman of Tneder Board of the Nigeria National Petroleum Corporation, which was responsible for the award of contracts, valuation and settle ment of contract proceeds after commissioning of the project, I used my position to inflate a certain contract awarded to an Keyston Joe Petroleum company USA to the tune of $26.5million . The original contract value by $100,000,000 but with the consent of the contrator, we inflated the said value by $26.5million briging the total to $126.5million. The contract has been executed, commissioned and the actual contract of $100million value has been paid to the contractor leaving behind the inflated sum of $26.5million. But we could not claim this fund during the military regime.
The fact that we are prohibited by law from operating a foreign account as civil servants, we solicit your kind assistance in claiming the over-invoiced value of $26.5million be rest assured that there is no form of risk involved or anti-legal implications as the contract was properly executed and the value fully settled. Being a turnkey project and with such value there is no way any local company or person resident in Nigeria can lay claims to it but, rather someone overseas i.e Europe, America Asia etc.
You will be compensated with 20% of the total of $26.5million if you accept our request to assist us while 70% will be left behind for me and my coleagues. The balance of 10% will be used to offset any expenses incuured during the process of transfer as a result of this transaction.
You arr also required to forward these infomations to me:
a. Your office telephone and fax number including your cell phone where i can reach you at all time for further vital communication regards to the development regards to this transaction.
b. The name of the company that will act as the beneficiary of the payment or your private name and full address.
c. The name and full address of your bank,your account number,account name and the branch code of your bank
This is to enable us seek for approval from the appropriate ministry and top authorities concern with the fund release approval into your norminated account.
Awaiting your response asap and God bless.
Best regards
Dr Raymond Ibru. (PhD)

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148246.ezm"

Message-ID: <20030520064555.95263.qmailpb1.pair.com>
To: php-generallists.php.net
From: "Philippe Saladin" <pheuhyahoo.fr>
Date: Tue, 20 May 2003 08:45:32 +0200
Subject: Re: ldap_search

"Mike Tuller" <phpce.anoka.k12.mn.us> a écrit dans le message news:
3EE7A331-8A25-11D7-8F6A-0003938E6950ce.anoka.k12.mn.us...

[...]
> $department = "CED-Office";
> $location = "LC/DC";
>
> if ($ldap)
> {
>
> // Search surname entry
> $sr=ldap_search($ldap,"o=ISD11, c=US",
> "physicaldeliveryofficename=$location");
>
> This only does a search by location. How can I have it so that I can do
> a search by location and department without getting an error?

$filter "(|(physicaldeliveryofficename=$location*)(physicaldeliveryofficename=$depar
tement*))";
$sr=ldap_search($ldap,"o=ISD11, c=US", $filter);

It should do the trick.

> Thanks,
> Mike

Regards,
Philippe

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148247.ezm"

Message-ID: <20030520064940.190.qmailpb1.pair.com>
To: php-generallists.php.net
From: "nabil" <nabil.attaraws-syria.com>
Date: Tue, 20 May 2003 09:49:35 +0300
Subject: vpopmail_add_user

Any one can help me with vpopmail_add_user ...
 i want to create a virtual mailbox to a non linux user, as a free mailbox
can any user register himself ..

Nabil

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148261.ezm"

Date: Tue, 20 May 2003 17:48:25 +1000
From: Tom Rogers <trogerskwikin.com>
Reply-To: Tom Rogers <trogerskwikin.com>
Message-ID: <965936106.20030520174825kwikin.com>
To: "nabil" <nabil.attaraws-syria.com>
CC: php-generallists.php.net
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP] vpopmail_add_user

Hi,

Tuesday, May 20, 2003, 4:49:35 PM, you wrote:
n> Any one can help me with vpopmail_add_user ...
n> i want to create a virtual mailbox to a non linux user, as a free mailbox
n> can any user register himself ..

n> Nabil
You should explain what 'exacxtly' your problem is as this is a bit vague....
A lot depends how you have vpopmail setup to do password checking, I
use vpasswd checking and do something like this:

if(!vpopmail_add_user($_POST['uname'],$domain,$_POST['pword'])){
       echo 'Failed to add user '.$_POST['uname'].'<br>';
}

If you have a busy site it is better to run the exec command to use
the vpopmail binaries as you may get into file locking problems with
the builtin vpopmail functions (speaking from old experience, YMMV)
--
regards,
Tom

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148267.ezm"

Message-ID: <20030520083551.10685.qmailpb1.pair.com>
To: php-generallists.php.net
From: "nabil" <nabil.attaraws-syria.com>
Date: Tue, 20 May 2003 11:35:36 +0300
Subject: Re: [PHP] vpopmail_add_user

Thanks Tom for ur reply..

Actualy i have no exact problem with it, but i m trying create a vdomain
then anable my php code to create a vpop mail account on the server ..

The situation is that i use PLESK to create a new v-mailboxes on my virtual
domains, and i want to get rid of any non open source application.
so i decided to write my php code to do it... if you could help me more it
will be very nice of you.

Best regards
Nabil

"Tom Rogers" <trogerskwikin.com> wrote in message
news:965936106.20030520174825kwikin.com...
> Hi,
>
> Tuesday, May 20, 2003, 4:49:35 PM, you wrote:
> n> Any one can help me with vpopmail_add_user ...
> n> i want to create a virtual mailbox to a non linux user, as a free
mailbox
> n> can any user register himself ..
>
> n> Nabil
> You should explain what 'exacxtly' your problem is as this is a bit
vague....
> A lot depends how you have vpopmail setup to do password checking, I
> use vpasswd checking and do something like this:
>
> if(!vpopmail_add_user($_POST['uname'],$domain,$_POST['pword'])){
> echo 'Failed to add user '.$_POST['uname'].'<br>';
> }
>
> If you have a busy site it is better to run the exec command to use
> the vpopmail binaries as you may get into file locking problems with
> the builtin vpopmail functions (speaking from old experience, YMMV)
> --
> regards,
> Tom
>

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148273.ezm"

Date: Tue, 20 May 2003 19:07:14 +1000
From: Tom Rogers <trogerskwikin.com>
Reply-To: Tom Rogers <trogerskwikin.com>
Message-ID: <1182640952.20030520190714kwikin.com>
To: "nabil" <nabil.attaraws-syria.com>
CC: php-generallists.php.net
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re[2]: [PHP] vpopmail_add_user

Hi,

Tuesday, May 20, 2003, 6:35:36 PM, you wrote:
n> Thanks Tom for ur reply..

n> Actualy i have no exact problem with it, but i m trying create a vdomain
n> then anable my php code to create a vpop mail account on the server ..

n> The situation is that i use PLESK to create a new v-mailboxes on my virtual
n> domains, and i want to get rid of any non open source application.
n> so i decided to write my php code to do it... if you could help me more it
n> will be very nice of you.

n> Best regards
n> Nabil

I have no knowledge of PLESK, is that what you want to eliminate?

What i do is run vpopmail as the same user as the web server and let
it create the directories for itself and apache like this

/usr/local/apache/domains/domain_name/mail

This is where the vpasswd file lives and the mailboxes

Then I have an apache module (mod_dynvhost http://funkcity.com/0101/projects/dynvhost/README) which looks for

/usr/local/apache/domains/domain_name/www

If that exists it sets it as the document root and away it goes.

I had to hack vpopmail to create the mail dir and the dynvhost so it
would work with domain.com and www.domain.com pointing to one
directory

It also sets an enviroment variable to

/usr/local/apache/domains/domain_name/include

which makes it easy to include files outside of the document root

let me know if you want to play with copies of these

--
regards,
Tom

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148248.ezm"

Message-Id: <4.2.0.58.20030520001602.0210f260megalion.org>
Date: Tue, 20 May 2003 00:26:45 -0700
To: php-generallists.php.net
From: Megalion <phpmegandodson.com>
Mime-Version: 1.0
Content-Type: multipart/alternative;
        boundary="===========_12007756=_.ALT"
Subject: disappearing php variables?

--===========_12007756=_.ALT
Content-Type: text/plain; charset="us-ascii"; formatowed

I have a problem with php variables that are set outside an include, being
empty when called inside the include.

in http://ponder.megalion.org/index_photoskin.html I have the following
code (snipped for length)

$mtBlogURL = "http://ponder.megalion.org/";
$rootPath = "/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs";
if ($skin="") { $skin = "venturaSunset"; }
if ($page="index") { $skinPath = "/mt/skins/"; }
else if ( $page="archive") { $skinPath = "/mt/skins/"; }
else if ( $page="category") { $skinPath = "/mt/skins/"; }
else if ( $page="date") { $skinPath = "/mt/skins/"; }
else if ( $page="individual") { $skinPath = "/mt/skins/"; }
else { $skinPath = "/mt/skins/"; }
include $rootPath."/mt/tmpl/php_functions.php";
include $mtBlogURL.$skinPath.$skin."/header.php";

in /mt/skins/venturaSunset/header.php, I have the following code:

echo "rootPath is ".$rootPath."<br>";
echo "page is ".$page."<br>";
echo "pageTitle is ".$pageTitle."<br>";
?>
<html>
<head>
<title><?=$blogTitle?><?if ($pageTitle!="") { ?> - <?=$pageTitle?><?}?></title>
<link rel="stylesheet" type="text/css"
href="<?=$mtBlogURL?><?=$skinPath?><?=$skin?>/theme.css">
<SCRIPT src="<?=$skinPath?>rollover.js" TYPE="text/javascript"></SCRIPT>
</head>
<body>
<?=getcwd();?>

The output at the top of the page in the browser is as follows:
rootPath is
page is
pageTitle is
/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/mt/skins/venturaSunset

source code:
rootPath is <br>page is <br>pageTitle is <br><html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="/theme.css">
<SCRIPT src="rollover.js" TYPE="text/javascript"></SCRIPT>
</head>

I've been going over this for over 2 hours and I can't find any reason why
the header.php thinks all my variables are empty. I even did a test where I
created http://ponder.megalion.org/test.php that had <? $test = "This is a
test"; include "include.php"; ?> and created also
http://ponder.megalion.org/include.php that simply has <?=$test?> and it
works. The include.php file is able to see php variables set in the calling
file. So why is header.php unable to see variables set in
index_photoskin.html?

Btw I have php processing enabled for html files via the apache config file
but I don't see that making a difference as I copied test.php as test.html
and http://ponder.megalion.org/test.html works just as well as the other.

I'm racking my brain as to what's going on... as some of you may
recognize... this is my installation of the Movable Type blog software and
I'm attempting to make it skinnable.

Thanks

Megalion

--===========_12007756=_.ALT--

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148255.ezm"

Reply-To: <mohit.mittalpatni.com>
From: "Mohit Mittal" <mohit.mittalpatni.com>
To: <php-generallists.php.net>
Date: Tue, 20 May 2003 13:14:29 -0700
Message-ID: <002601c31f0c$6c429f80$8858a8c0Mohitm>
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: RE: [PHP] disappearing php variables?

Hi,
        I was looking at the code that you have given in your mail. The line
<body>
<?=getcwd();?>
suggests that most probably your echo statements

echo "rootPath is ".$rootPath."<br>";
echo "page is ".$page."<br>";
echo "pageTitle is ".$pageTitle."<br>";

are a part of this getcwd(); function. Global variables cannot be recognized
inside functions, until especially declared so. The following may be of some
help to you:

The scope of a variable is the context within which it is defined. For the
most part all PHP variables only have a single scope. This single scope
spans included and required files as well. For example:
$a = 1;[PARA]include "b.inc";[PARA]
Here the $a variable will be available within the included b.inc script.
However, within user-defined functions a local function scope is introduced.
Any variable used inside a function is by default limited to the local
function scope. For example:
 [PARA]$a = 1; /* global scope */ [PARA][PARA]Function Test () { [PARA]
echo $a; /* reference to local scope variable */ [PARA]} [PARA][PARA]Test
();[PARA]
This script will not produce any output because the echo statement refers to
a local version of the $a variable, and it has not been assigned a value
within this scope. You may notice that this is a little bit different from
the C language in that global variables in C are automatically available to
functions unless specifically overridden by a local definition. This can
cause some problems in that people may inadvertently change a global
variable. In PHP global variables must be declared global inside a function
if they are going to be used in that function. An example:
$a = 1;[PARA]$b = 2;[PARA][PARA]Function Sum () {[PARA] global $a,
$b;[PARA][PARA] $b = $a + $b;[PARA]} [PARA][PARA]Sum ();[PARA]echo
$b;[PARA]
The above script will output "3". By declaring $a and $b global within the
function, all references to either variable will refer to the global
version. There is no limit to the number of global variables that can be
manipulated by a function.
A second way to access variables from the global scope is to use the special
PHP-defined $GLOBALS array. The previous example can be rewritten as:
$a = 1;[PARA]$b = 2;[PARA][PARA]Function Sum () {[PARA] $GLOBALS["b"] $GLOBALS["a"] + $GLOBALS["b"];[PARA]} [PARA][PARA]Sum ();[PARA]echo
$b;[PARA]
The $GLOBALS array is an associative array with the name of the global
variable being the key and the contents of that variable being the value of
the array element.
        Hope this helps you.

Regards,

Mohit Mittal
Software Engineer
Patni Computer Systems (P) Ltd.
Noida,
Office Tel:
91 120 2516880 - 83
Ext: 1261
Residence Tel:
91 11 26890175

 -----Original Message-----
From: Megalion [mailto:phpmegandodson.com]
Sent: Tuesday, May 20, 2003 12:27 AM
To: php-generallists.php.net
Subject: [PHP] disappearing php variables?

I have a problem with php variables that are set outside an include, being
empty when called inside the include.

in http://ponder.megalion.org/index_photoskin.html I have the following
code (snipped for length)

$mtBlogURL = "http://ponder.megalion.org/";
$rootPath = "/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs";
if ($skin="") { $skin = "venturaSunset"; }
if ($page="index") { $skinPath = "/mt/skins/"; }
else if ( $page="archive") { $skinPath = "/mt/skins/"; }
else if ( $page="category") { $skinPath = "/mt/skins/"; }
else if ( $page="date") { $skinPath = "/mt/skins/"; }
else if ( $page="individual") { $skinPath = "/mt/skins/"; }
else { $skinPath = "/mt/skins/"; }
include $rootPath."/mt/tmpl/php_functions.php";
include $mtBlogURL.$skinPath.$skin."/header.php";

in /mt/skins/venturaSunset/header.php, I have the following code:

echo "rootPath is ".$rootPath."<br>";
echo "page is ".$page."<br>";
echo "pageTitle is ".$pageTitle."<br>";
?>
<html>
<head>
<title><?=$blogTitle?><?if ($pageTitle!="") { ?> -
<?=$pageTitle?><?}?></title>
<link rel="stylesheet" type="text/css"
href="<?=$mtBlogURL?><?=$skinPath?><?=$skin?>/theme.css">
<SCRIPT src="<?=$skinPath?>rollover.js" TYPE="text/javascript"></SCRIPT>
</head>
<body>
<?=getcwd();?>

The output at the top of the page in the browser is as follows:
rootPath is
page is
pageTitle is
/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/mt/skins/venturaSuns
et

source code:
rootPath is <br>page is <br>pageTitle is <br><html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="/theme.css">
<SCRIPT src="rollover.js" TYPE="text/javascript"></SCRIPT>
</head>

I've been going over this for over 2 hours and I can't find any reason why
the header.php thinks all my variables are empty. I even did a test where I
created http://ponder.megalion.org/test.php that had <? $test = "This is a
test"; include "include.php"; ?> and created also
http://ponder.megalion.org/include.php that simply has <?=$test?> and it
works. The include.php file is able to see php variables set in the calling
file. So why is header.php unable to see variables set in
index_photoskin.html?

Btw I have php processing enabled for html files via the apache config file
but I don't see that making a difference as I copied test.php as test.html
and http://ponder.megalion.org/test.html works just as well as the other.

I'm racking my brain as to what's going on... as some of you may
recognize... this is my installation of the Movable Type blog software and
I'm attempting to make it skinnable.

Thanks

Megalion

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148262.ezm"

Message-Id: <4.2.0.58.20030520010500.02220b98megalion.org>
Date: Tue, 20 May 2003 01:13:35 -0700
To: php-generallists.php.net
From: Megalion <phpmegandodson.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; formatowed
Subject: RE: [PHP] disappearing php variables?

Hi

Thanks for your reply...

getcwd() isn't a user-defined function in my case. I was using the php
function getcwd() get current working directory as a debug tool to
ascertain where "I" was at that point in the script... clearly the current
working directory had changed from
/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/
which is where it should be at the start of the script as it's being called
by index_photoskin.html located in that directory and ends up in
/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/mt/skins/venturaSunset
right after the include of the header.php file as the line you were
referring to "echo getcwd()" is located inside it.

Thanks for confirming my expectations on what should be happening... the
variables are not defined within a function and should therefore be
available to header.php (the include) but are not for some strange reason.

I tried changing the line inside the header.php that was trying to output
the $rootPath variable defined in the index_photoskin.html file from :
echo "rootPath is ".$rootPath."<br>";
to
echo "rootPath is ".$GLOBALS["rootPath"]."<br>";

and still no luck. I still get "rootPath is "

Stranger and stranger that my entire $GLOBAL array has virtually
disappeared in the eyes of the header.php include.

Any more ideas?

Megalion

At 01:14 PM 5/20/2003 -0700, you wrote:
>Hi,
> I was looking at the code that you have given in your mail. The line
><body>
><?=getcwd();?>
>suggests that most probably your echo statements
>
>echo "rootPath is ".$rootPath."<br>";
>echo "page is ".$page."<br>";
>echo "pageTitle is ".$pageTitle."<br>";
>
>are a part of this getcwd(); function. Global variables cannot be recognized
>inside functions, until especially declared so. The following may be of some
>help to you:
>
>The scope of a variable is the context within which it is defined. For the
>most part all PHP variables only have a single scope. This single scope
>spans included and required files as well. For example:
>$a = 1;[PARA]include "b.inc";[PARA]
>Here the $a variable will be available within the included b.inc script.
>However, within user-defined functions a local function scope is introduced.
>Any variable used inside a function is by default limited to the local
>function scope. For example:
> [PARA]$a = 1; /* global scope */ [PARA][PARA]Function Test () { [PARA]
>echo $a; /* reference to local scope variable */ [PARA]} [PARA][PARA]Test
>();[PARA]
>This script will not produce any output because the echo statement refers to
>a local version of the $a variable, and it has not been assigned a value
>within this scope. You may notice that this is a little bit different from
>the C language in that global variables in C are automatically available to
>functions unless specifically overridden by a local definition. This can
>cause some problems in that people may inadvertently change a global
>variable. In PHP global variables must be declared global inside a function
>if they are going to be used in that function. An example:
>$a = 1;[PARA]$b = 2;[PARA][PARA]Function Sum () {[PARA] global $a,
>$b;[PARA][PARA] $b = $a + $b;[PARA]} [PARA][PARA]Sum ();[PARA]echo
>$b;[PARA]
>The above script will output "3". By declaring $a and $b global within the
>function, all references to either variable will refer to the global
>version. There is no limit to the number of global variables that can be
>manipulated by a function.
>A second way to access variables from the global scope is to use the special
>PHP-defined $GLOBALS array. The previous example can be rewritten as:
>$a = 1;[PARA]$b = 2;[PARA][PARA]Function Sum () {[PARA] $GLOBALS["b"] >$GLOBALS["a"] + $GLOBALS["b"];[PARA]} [PARA][PARA]Sum ();[PARA]echo
>$b;[PARA]
>The $GLOBALS array is an associative array with the name of the global
>variable being the key and the contents of that variable being the value of
>the array element.
> Hope this helps you.
>
>Regards,
>
>Mohit Mittal
>Software Engineer
>Patni Computer Systems (P) Ltd.
>Noida,
>Office Tel:
>91 120 2516880 - 83
>Ext: 1261
>Residence Tel:
>91 11 26890175
>
> -----Original Message-----
>From: Megalion [mailto:phpmegandodson.com]
>Sent: Tuesday, May 20, 2003 12:27 AM
>To: php-generallists.php.net
>Subject: [PHP] disappearing php variables?
>
>
>I have a problem with php variables that are set outside an include, being
>empty when called inside the include.
>
>in http://ponder.megalion.org/index_photoskin.html I have the following
>code (snipped for length)
>
>
>$mtBlogURL = "http://ponder.megalion.org/";
>$rootPath = "/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs";
>if ($skin="") { $skin = "venturaSunset"; }
>if ($page="index") { $skinPath = "/mt/skins/"; }
>else if ( $page="archive") { $skinPath = "/mt/skins/"; }
>else if ( $page="category") { $skinPath = "/mt/skins/"; }
>else if ( $page="date") { $skinPath = "/mt/skins/"; }
>else if ( $page="individual") { $skinPath = "/mt/skins/"; }
>else { $skinPath = "/mt/skins/"; }
>include $rootPath."/mt/tmpl/php_functions.php";
>include $mtBlogURL.$skinPath.$skin."/header.php";
>
>in /mt/skins/venturaSunset/header.php, I have the following code:
>
>echo "rootPath is ".$rootPath."<br>";
>echo "page is ".$page."<br>";
>echo "pageTitle is ".$pageTitle."<br>";
>?>
><<<< <?=getcwd();?> The output at the top of the page in the browser is as
>follows: rootPath is page is pageTitle is
>/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/mt/skins/venturaSun
>s et source code: rootPath is
>page is
>pageTitle is
>I've been going over this for over 2 hours and I can't find any reason why
>the header.php thinks all my variables are empty. I even did a test where
>I created http://ponder.megalion.org/test.php that had <? $test = "This is
>a test"; include "include.php"; ?> and created also
>http://ponder.megalion.org/include.php that simply has <?=$test?> and it
>works. The include.php file is able to see php variables set in the
>calling file. So why is header.php unable to see variables set in
>index_photoskin.html? Btw I have php processing enabled for html files via
>the apache config file but I don't see that making a difference as I
>copied test.php as test.html and http://ponder.megalion.org/test.html
>works just as well as the other. I'm racking my brain as to what's going
>on... as some of you may recognize... this is my installation of the
>Movable Type blog software and I'm attempting to make it skinnable. Thanks
>Megalion -- PHP General Mailing List (http://www.php.net/) To unsubscribe,
>visit: http://www.php.net/unsub.php

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148269.ezm"

Reply-To: <mohit.mittalpatni.com>
From: "Mohit Mittal" <mohit.mittalpatni.com>
To: <php-generallists.php.net>
Date: Tue, 20 May 2003 14:27:10 -0700
Message-ID: <003001c31f16$93446320$8858a8c0Mohitm>
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: RE: [PHP] disappearing php variables?

Hi Megalion,
                Since you have asked "Any more ideas?", I am taking a shot in the blind.
In your php.ini file of the server, are the two directives, register_globals
and track_vars enabled. This I am asking because, if both track_vars and
register_globals are enabled, then the global variables and the
$HTTP_SESSION_VARS entries reference the same value. Any by any chance, if
one of your include files has a line of the type:
$HTTP_SESSION_VARS = array() or $GLOBALS ray()
then you can expect your global variables to lose their values, by the time
you echo them in header include file.
        If this is not the case, then I am also out of ideas.

Mohit Mittal
Software Engineer
Patni Computer Systems (P) Ltd.
Noida,
Office Tel:
91 120 2516880 - 83
Ext: 1261
Residence Tel:
91 11 26890175

 -----Original Message-----
From: Megalion [mailto:phpmegandodson.com]
Sent: Tuesday, May 20, 2003 1:14 AM
To: php-generallists.php.net
Subject: RE: [PHP] disappearing php variables?

Hi

Thanks for your reply...

getcwd() isn't a user-defined function in my case. I was using the php
function getcwd() get current working directory as a debug tool to
ascertain where "I" was at that point in the script... clearly the current
working directory had changed from
/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/
which is where it should be at the start of the script as it's being called
by index_photoskin.html located in that directory and ends up in
/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/mt/skins/venturaSuns
et
right after the include of the header.php file as the line you were
referring to "echo getcwd()" is located inside it.

Thanks for confirming my expectations on what should be happening... the
variables are not defined within a function and should therefore be
available to header.php (the include) but are not for some strange reason.

I tried changing the line inside the header.php that was trying to output
the $rootPath variable defined in the index_photoskin.html file from :
echo "rootPath is ".$rootPath."<br>";
to
echo "rootPath is ".$GLOBALS["rootPath"]."<br>";

and still no luck. I still get "rootPath is "

Stranger and stranger that my entire $GLOBAL array has virtually
disappeared in the eyes of the header.php include.

Any more ideas?

Megalion

At 01:14 PM 5/20/2003 -0700, you wrote:
>Hi,
> I was looking at the code that you have given in your mail. The
line
><body>
><?=getcwd();?>
>suggests that most probably your echo statements
>
>echo "rootPath is ".$rootPath."<br>";
>echo "page is ".$page."<br>";
>echo "pageTitle is ".$pageTitle."<br>";
>
>are a part of this getcwd(); function. Global variables cannot be
recognized
>inside functions, until especially declared so. The following may be of
some
>help to you:
>
>The scope of a variable is the context within which it is defined. For the
>most part all PHP variables only have a single scope. This single scope
>spans included and required files as well. For example:
>$a = 1;[PARA]include "b.inc";[PARA]
>Here the $a variable will be available within the included b.inc script.
>However, within user-defined functions a local function scope is
introduced.
>Any variable used inside a function is by default limited to the local
>function scope. For example:
> [PARA]$a = 1; /* global scope */ [PARA][PARA]Function Test () { [PARA]
>echo $a; /* reference to local scope variable */ [PARA]} [PARA][PARA]Test
>();[PARA]
>This script will not produce any output because the echo statement refers
to
>a local version of the $a variable, and it has not been assigned a value
>within this scope. You may notice that this is a little bit different from
>the C language in that global variables in C are automatically available to
>functions unless specifically overridden by a local definition. This can
>cause some problems in that people may inadvertently change a global
>variable. In PHP global variables must be declared global inside a function
>if they are going to be used in that function. An example:
>$a = 1;[PARA]$b = 2;[PARA][PARA]Function Sum () {[PARA] global $a,
>$b;[PARA][PARA] $b = $a + $b;[PARA]} [PARA][PARA]Sum ();[PARA]echo
>$b;[PARA]
>The above script will output "3". By declaring $a and $b global within the
>function, all references to either variable will refer to the global
>version. There is no limit to the number of global variables that can be
>manipulated by a function.
>A second way to access variables from the global scope is to use the
special
>PHP-defined $GLOBALS array. The previous example can be rewritten as:
>$a = 1;[PARA]$b = 2;[PARA][PARA]Function Sum () {[PARA] $GLOBALS["b"] >$GLOBALS["a"] + $GLOBALS["b"];[PARA]} [PARA][PARA]Sum ();[PARA]echo
>$b;[PARA]
>The $GLOBALS array is an associative array with the name of the global
>variable being the key and the contents of that variable being the value of
>the array element.
> Hope this helps you.
>
>Regards,
>
>Mohit Mittal
>Software Engineer
>Patni Computer Systems (P) Ltd.
>Noida,
>Office Tel:
>91 120 2516880 - 83
>Ext: 1261
>Residence Tel:
>91 11 26890175
>
> -----Original Message-----
>From: Megalion [mailto:phpmegandodson.com]
>Sent: Tuesday, May 20, 2003 12:27 AM
>To: php-generallists.php.net
>Subject: [PHP] disappearing php variables?
>
>
>I have a problem with php variables that are set outside an include, being
>empty when called inside the include.
>
>in http://ponder.megalion.org/index_photoskin.html I have the following
>code (snipped for length)
>
>
>$mtBlogURL = "http://ponder.megalion.org/";
>$rootPath = "/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs";
>if ($skin="") { $skin = "venturaSunset"; }
>if ($page="index") { $skinPath = "/mt/skins/"; }
>else if ( $page="archive") { $skinPath = "/mt/skins/"; }
>else if ( $page="category") { $skinPath = "/mt/skins/"; }
>else if ( $page="date") { $skinPath = "/mt/skins/"; }
>else if ( $page="individual") { $skinPath = "/mt/skins/"; }
>else { $skinPath = "/mt/skins/"; }
>include $rootPath."/mt/tmpl/php_functions.php";
>include $mtBlogURL.$skinPath.$skin."/header.php";
>
>in /mt/skins/venturaSunset/header.php, I have the following code:
>
>echo "rootPath is ".$rootPath."<br>";
>echo "page is ".$page."<br>";
>echo "pageTitle is ".$pageTitle."<br>";
>?>
><<<< <?=getcwd();?> The output at the top of the page in the browser is as
>follows: rootPath is page is pageTitle is
>/usr/local/psa/home/vhosts/ponder.megalion.org/httpdocs/mt/skins/venturaSun
>s et source code: rootPath is
>page is
>pageTitle is
>I've been going over this for over 2 hours and I can't find any reason why
>the header.php thinks all my variables are empty. I even did a test where
>I created http://ponder.megalion.org/test.php that had <? $test = "This is
>a test"; include "include.php"; ?> and created also
>http://ponder.megalion.org/include.php that simply has <?=$test?> and it
>works. The include.php file is able to see php variables set in the
>calling file. So why is header.php unable to see variables set in
>index_photoskin.html? Btw I have php processing enabled for html files via
>the apache config file but I don't see that making a difference as I
>copied test.php as test.html and http://ponder.megalion.org/test.html
>works just as well as the other. I'm racking my brain as to what's going
>on... as some of you may recognize... this is my installation of the
>Movable Type blog software and I'm attempting to make it skinnable. Thanks
>Megalion -- PHP General Mailing List (http://www.php.net/) To unsubscribe,
>visit: http://www.php.net/unsub.php

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

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148270.ezm"

Message-Id: <4.2.0.58.20030520021217.0228c770megalion.org>
Date: Tue, 20 May 2003 02:15:01 -0700
To: php-generallists.php.net
From: Megalion <phpmegandodson.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; formatowed
Subject: RE: [PHP] disappearing php variables?

EUREKA!!!

I kept dwelling on why the whole $GLOBALS array disappeared within
header.php and it has to do with how I called header.php

At one point in wrestling with writing the proper paths to the includes, I
entered in an absolute path to header.php... since I was using $mtBlogURL
instead of $rootPath ... that meant I was translating from
http://ponder.megalion.org as if it were from a remote site.

Got it all fixed now... thanks Mohit, you made me keep thinking about the
$GLOBALS array which turned out to lead me to the answer!

Megalion

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148249.ezm"

Message-ID: <20030520072545.26406.qmailpb1.pair.com>
To: php-generallists.php.net
From: "HPS" <hpsquareyahoo.com>
Date: Tue, 20 May 2003 15:25:39 +0800
Subject: problem in fopen

Dear all,

i tried to get some data from a remote website by using fopen().

         $data_path = http://www.mysite.com/data.txt";
         $fp = fopen ($data_path, "r");

The script works fine if the remove site (http://www.mysite.com/data.txt) is
up and accessible.
However, the script take a very long time to run if the server is down.

Is it possible to add any time constraint in the script such that the
fopen() operation will abort, say, after 10 seconds ?
Or any alternative suggestion?

thx a lot~~~
HPS

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148256.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: Jason Wong <php-generalgremlins.biz>
Reply-To: php-generallists.php.net
To: php-generallists.php.net
Date: Tue, 20 May 2003 15:49:03 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201549.04016.php-generalgremlins.biz>
Subject: Re: [PHP] problem in fopen

On Tuesday 20 May 2003 15:25, HPS wrote:

> i tried to get some data from a remote website by using fopen().
>
> $data_path = http://www.mysite.com/data.txt";
> $fp = fopen ($data_path, "r");
>
> The script works fine if the remove site (http://www.mysite.com/data.txt)
> is up and accessible.
> However, the script take a very long time to run if the server is down.
>
> Is it possible to add any time constraint in the script such that the
> fopen() operation will abort, say, after 10 seconds ?
> Or any alternative suggestion?

Try changing default_socket_timeout. See manual > Filesystem functions for
details.

--
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
------------------------------------------
/*
UNIX is hot. It's more than hot. It's steaming. It's quicksilver
lightning with a laserbeam kicker.
                -- Michael Jay Tucker
*/

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148282.ezm"

Date: Tue, 20 May 2003 15:43:28 +0400
From: =?ISO-8859-1?B?wO3y7u0=?= <antonartprom.ru>
Reply-To: =?ISO-8859-1?B?wO3y7u0=?= <antonartprom.ru>
Message-ID: <5036633468.20030520154328artprom.ru>
To: Jason Wong <php-generallists.php.net>
CC: php-generallists.php.net
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Subject: Re[2]: [PHP] problem in fopen

Hi

JW> On Tuesday 20 May 2003 15:25, HPS wrote:

>> i tried to get some data from a remote website by using fopen().
>>
>> $data_path = http://www.mysite.com/data.txt";
>> $fp = fopen ($data_path, "r");
>>
>> The script works fine if the remove site (http://www.mysite.com/data.txt)
>> is up and accessible.
>> However, the script take a very long time to run if the server is down.
>>
>> Is it possible to add any time constraint in the script such that the
>> fopen() operation will abort, say, after 10 seconds ?
>> Or any alternative suggestion?

I would recommend you to use curl functions

--
Regards

Anton

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148250.ezm"

Date: Tue, 20 May 2003 15:30:05 +0800
From: Osman Omar <osmansem.my.sony.com.sg>
To: PHP <php-generallists.php.net>
Message-Id: <20030520153005.1e6a611d.osmansem.my.sony.com.sg>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Subject: store $PHP_SELF into session variable

Hi,

How do I store $PHP_SELF into session variable?
I try but only manage to get part of it.

eg. I try to store "edit_status?id79" but when I recall I only get "edit_status"

code: rpage = $PHP_SELF;
       session_register("rpage");

thanks

--
Ehrman's Commentary:
        (1) Things will get worse before they get better.
        (2) Who said things would get better?

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148252.ezm"

Date: Tue, 20 May 2003 00:35:31 -0700 (PDT)
From: Rasmus Lerdorf <rasmuslerdorf.com>
To: Osman Omar <osmansem.my.sony.com.sg>
cc: PHP <php-generallists.php.net>
Message-ID: <Pine.LNX.4.44.0305200034080.1231-100000thinkpad.lerdorf.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: Re: [PHP] store $PHP_SELF into session variable

$PHP_SELF doesn't include the get-method data. You would need to either
use $REQUEST_URI or you could append $QUERY_STRING to the end of
$PHP_SELF.

-Rasmus

On Tue, 20 May 2003, Osman Omar wrote:

> Hi,
>
> How do I store $PHP_SELF into session variable?
> I try but only manage to get part of it.
>
> eg. I try to store "edit_status?id79" but when I recall I only get "edit_status"
>
> code: rpage = $PHP_SELF;
> session_register("rpage");
>
> thanks
>
>
>

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148251.ezm"

Message-ID: <20030520073257.35387.qmailpb1.pair.com>
To: php-generallists.php.net
From: "buttoz" <buttoz012.net.il>
Date: Tue, 20 May 2003 08:29:21 +0200
Subject: how to calculate

hi,

i have 2 fields of date type 00-00-00 00:00:00 , how can calculate the
diffrent of 2 filed

i want the result in minutes

$field1 , $field2

how caculate $field1-$field2 = result in minutes

thanks

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148253.ezm"

Date: Tue, 20 May 2003 00:36:27 -0700 (PDT)
From: Rasmus Lerdorf <rasmuslerdorf.com>
To: buttoz <buttoz012.net.il>
cc: php-generallists.php.net
Message-ID: <Pine.LNX.4.44.0305200035470.1231-100000thinkpad.lerdorf.com>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Subject: Re: [PHP] how to calculate

Convert them to timestamps using strtotime() and then just substract one
from the other and you will get the difference in seconds.

-Rasmus

On Tue, 20 May 2003, buttoz wrote:

> hi,
>
> i have 2 fields of date type 00-00-00 00:00:00 , how can calculate the
> diffrent of 2 filed
>
> i want the result in minutes
>
> $field1 , $field2
>
> how caculate $field1-$field2 = result in minutes
>
> thanks
>
>
>
>

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148254.ezm"

Message-ID: <20030520073735.44823.qmailpb1.pair.com>
To: php-generallists.php.net
From: "Shaun" <shaunmania.plus.com>
Date: Tue, 20 May 2003 08:37:16 +0100
Subject: Extracting HTML from a file

Hi,

using the following code I am extracting any HTML from a file which occurs
between the two tags <!-- beginIsEditable --> and <!-- endIsEditable -->

preg_match_all('|<!-- beginIsEditable -->(.*?)<!-- endIsEditable -->|is',
                 implode('', file('../'.$_GET[file_name])),
                 $matches = array(),
                 PREG_SET_ORDER);
  $script = stripslashes(htmlentities($matches[0][0]));

How can I modify this so that it extracts the HTML between these tags,
rather than the HTML including these tags?

Thanks for your help

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148263.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: Jason Wong <php-generalgremlins.biz>
Reply-To: php-generallists.php.net
To: php-generallists.php.net
Date: Tue, 20 May 2003 16:12:32 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201612.32066.php-generalgremlins.biz>
Subject: Re: [PHP] Extracting HTML from a file

On Tuesday 20 May 2003 15:37, Shaun wrote:

> using the following code I am extracting any HTML from a file which occurs
> between the two tags <!-- beginIsEditable --> and <!-- endIsEditable -->
>
> preg_match_all('|<!-- beginIsEditable -->(.*?)<!-- endIsEditable -->|is',
> implode('', file('../'.$_GET[file_name])),
> $matches = array(),
> PREG_SET_ORDER);
> $script = stripslashes(htmlentities($matches[0][0]));
>
> How can I modify this so that it extracts the HTML between these tags,
> rather than the HTML including these tags?

print_r($matches)

--
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
------------------------------------------
/*
Your mail is being routed through Germany ... and they're censoring us.
*/

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148264.ezm"

Date: Tue, 20 May 2003 17:54:34 +1000
From: Tom Rogers <trogerskwikin.com>
Reply-To: Tom Rogers <trogerskwikin.com>
Message-ID: <1473586558.20030520175434kwikin.com>
To: "Shaun" <shaunmania.plus.com>
CC: php-generallists.php.net
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP] Extracting HTML from a file

Hi,

Tuesday, May 20, 2003, 5:37:16 PM, you wrote:
S> Hi,

S> using the following code I am extracting any HTML from a file which occurs
S> between the two tags <!-- beginIsEditable --> and <!-- endIsEditable -->

S> preg_match_all('|<!-- beginIsEditable -->(.*?)<!-- endIsEditable -->|is',
S> implode('', file('../'.$_GET[file_name])),
S> $matches = array(),
S> PREG_SET_ORDER);
S> $script = stripslashes(htmlentities($matches[0][0]));

S> How can I modify this so that it extracts the HTML between these tags,
S> rather than the HTML including these tags?

S> Thanks for your help

do print_r($matches);

and you should see what you need.
(You will need to look at the source code of the html page)

--
regards,
Tom

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148257.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: Jason Wong <php-generalgremlins.biz>
Reply-To: php-generallists.php.net
To: php-generallists.php.net
Date: Tue, 20 May 2003 15:51:53 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201551.53638.php-generalgremlins.biz>
Subject: Re: [PHP] Re: while....for....problem

On Tuesday 20 May 2003 04:29, Simon wrote:
> Simon <velikankahotmail.com> wrote in message
> news:20030519130110.98345.qmailpb1.pair.com...
>
> I have replace 'for' with another 'while'. So the code looks like:
>
> it is working now as I wanted, but I dont know why it didn't work with
> 'for'

Do you not read the responses that you get? I (and someone else) pointed out
that your for statement is incorrect and suggested a correction. Did you not
try it out?

> :(

Indeed.

--
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
------------------------------------------
/*
Password:
*/

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148258.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: Jason Wong <php-generalgremlins.biz>
Reply-To: php-generallists.php.net
To: php-generallists.php.net
Date: Tue, 20 May 2003 15:56:38 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201556.38032.php-generalgremlins.biz>
Subject: Re: [PHP] Problem with IF..

On Sunday 18 May 2003 01:57, Peter \"Beholder\" Frankenfeldt wrote:

> i have a Problem with the marked (>>>) IF function:
>
> for ($j = 0; $j < 3; $j++) {
> $elem = reset($planeten);
> do {
> $color = ImageColorAllocate($im, 50, 255, 50);
>
> >>> if($j = 2) {
>
> $color = ImageColorAllocate($im, 255, 255, 255);
> } //fi
> imagestring($im, 2, $elem[x] * $sc + ($j * 5), $elem[y] * $sc, $j,
> $color);
> } while($elem = next($planeten)); //elihw od
> }; //rof
>
> When the Array $planeten have more than 126 rows the marked IF function
> don't work and will be ignored.
> I hope, someone can tell me whats wrong..

I can't tell you what's wrong but I'm pretty sure that PHP doesn't just ignore
statements. Did you try *any* debugging? Like printing out all the variables
as you go through the for and do loops?

--
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
------------------------------------------
/*
Work continues in this area.
                -- DEC's SPR-Answering-Automaton
*/

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148259.ezm"

Message-ID: <3EC9DE6C.3080603buyer-brokerage.com>
Date: Tue, 20 May 2003 03:51:08 -0400
From: Leif K-Brooks <eurleifbuyer-brokerage.com>
MIME-Version: 1.0
To: php-generallists.php.net
Content-Type: text/plain; charset=ISO-8859-1; formatowed
Content-Transfer-Encoding: 7bit
Subject: PHPA causing problems?

I was having frequent "out of memory" errors on my site, and Apache
would randomly quit after one or two days of uptime. After disabling
PHPA, everything seems to be working perfectly. Just did a HEAD request
on another site which is known for errors like this, and sure enough,
the X-accelerated-by header is "PHPA/1.3.3r2". Is there some sort of
misconfiguration in PHPA that causes issues like this, or is it simply a
bad product?

--
The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148283.ezm"

Message-ID: <20030520130727.47259.qmailpb1.pair.com>
To: php-generallists.php.net
Date: Tue, 20 May 2003 10:05:54 -0300
From: Manuel Lemos <mlemosacm.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; formatowed
Content-Transfer-Encoding: 7bit
Subject: Re: PHPA causing problems?

Hello,

On 05/20/2003 04:51 AM, Leif K-Brooks wrote:
> I was having frequent "out of memory" errors on my site, and Apache
> would randomly quit after one or two days of uptime. After disabling
> PHPA, everything seems to be working perfectly. Just did a HEAD request
> on another site which is known for errors like this, and sure enough,
> the X-accelerated-by header is "PHPA/1.3.3r2". Is there some sort of
> misconfiguration in PHPA that causes issues like this, or is it simply a
> bad product?

Maybe you are having semaphore leaks. APC had that problem too once in a
while. I think it was being caused by too much Web server restarting.
The solution was remove the lost semaphores by hand with ipcs/ipcrm
commands. That does not mean that PHPA problem is the same. Have you
tried Turck MMCache?

http://www.turcksoft.com/en/e_mmc.htm

--

Regards,
Manuel Lemos

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

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148289.ezm"

Date: Tue, 20 May 2003 10:41:55 -0500
From: Pablo <pablonothing.com>
To: <php-generallists.php.net>
Message-ID: <BAEFB6F3.C9934%pablonothing.com>
Mime-version: 1.0
Content-type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit
Subject: Re: [PHP] Re: PHPA causing problems?

> On 05/20/2003 04:51 AM, Leif K-Brooks wrote:
>
>> I was having frequent "out of memory" errors on my site, and Apache
>> would randomly quit after one or two days of uptime. After disabling
>> PHPA, everything seems to be working perfectly. Just did a HEAD request
>> on another site which is known for errors like this, and sure enough,
>> the X-accelerated-by header is "PHPA/1.3.3r2". Is there some sort of
>> misconfiguration in PHPA that causes issues like this, or is it simply a
>> bad product?

I experienced a similar problem with PHPA 1.3.3r2. Downgrading to 1.3.3r1
helped.

Pablo

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148260.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: Jason Wong <php-generalgremlins.biz>
Reply-To: php-generallists.php.net
To: php-generallists.php.net
Date: Tue, 20 May 2003 16:02:33 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201602.33792.php-generalgremlins.biz>
Subject: Re: [PHP] execute and write, or execute or write

On Tuesday 20 May 2003 05:15, chrisantharia.com wrote:
> another question, to write a file via PHP, regardless of the method (lets
> just say doing a file upload), will I need write and execute, or just
> either write or execute.

Depends.

In all cases you need to have execute permission on all directories in the
path leading up to (or down to if you prefer) and including the directory
that you're trying to write the file in.

If you're overwriting an existing file (and you have write permission for that
file) then the above is all you need.

If you're writing new files then in addition to the above you also need write
permission for the directory that you're writing the file in.

--
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
------------------------------------------
/*
Fatal error right in front of screen
*/

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148265.ezm"

Message-ID: <20030520083301.2884.qmailpb1.pair.com>
To: php-generallists.php.net
From: "Shaun" <shaunmania.plus.com>
Date: Tue, 20 May 2003 09:33:15 +0100
Subject: Append to begining of a String

Hi,

how can I add something to the beginning of a string?

Thanks for your help

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148268.ezm"

From: "Dana Freer" <dana.freervirgin.net>
To: "Shaun" <shaunmania.plus.com>,
        <php-generallists.php.net>
Date: Tue, 20 May 2003 09:46:19 +0100
Message-ID: <LAEHKIELFLJJNKPFDHPLCEPKCJAA.dana.freervirgin.net>
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: RE: [PHP] Append to begining of a String

How about...

        $mystring = 'something at the beginning' . $mystring;

        // '.' is the concatenation operator

Hope this helps.

-----Original Message-----
From: Shaun [mailto:shaunmania.plus.com]
Sent: 20 May 2003 09:33
To: php-generallists.php.net
Subject: [PHP] Append to begining of a String

Hi,

how can I add something to the beginning of a string?

Thanks for your help

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

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148274.ezm"

Date: Tue, 20 May 2003 13:34:58 +0400
From: =?Windows-1251?B?wO3y7u0=?= <antonartprom.ru>
Reply-To: =?Windows-1251?B?wO3y7u0=?= <antonartprom.ru>
Message-ID: <3028923281.20030520133458artprom.ru>
To: "Shaun" <shaunmania.plus.com>
CC: php-generallists.php.net
MIME-Version: 1.0
Content-Type: text/plain; charset=Windows-1251
Content-Transfer-Encoding: 8bit
Subject: Re: [PHP] Append to begining of a String

Hi

S> Hi,

S> how can I add something to the beginning of a string?

S> Thanks for your help

$string = "blablabla";
$string = "something".$string;

--
Regards

Anton

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148266.ezm"

Message-ID: <841D90E489448A4F804E1D1B95768BF7D46090lis-exchange3.lmu.ac.uk>
From: "Ford, Mike [LSS]" <M.Fordlmu.ac.uk>
To: 'Steve Keller' <skellerhealthtvchannel.org>,
        php-generallists.php.net
Date: Tue, 20 May 2003 09:31:54 +0100
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Subject: RE: [PHP] Array Logic

> -----Original Message-----
> From: Steve Keller [mailto:skellerhealthtvchannel.org]
> Sent: 19 May 2003 18:51
>
>
> Perhaps there's a function for this, but I've been unable to
> find it, and
> none of the key word searches I've done on the archive have
> turned up the
> response I'm looking for.
>
> The question is this, what's the easiest way to add an element to the
> middle of an array with numeric keys and shift all of the
> other elements
> down one?
>
> For example, I create an array called $a
>
> Array
> (
> [0] => lime
> [1] => coconut
> [2] => rum
> [3] => ice
> )
>
> And I want to add "seltzer" as element 2 and shift the others
> down 1. So
> now my array looks like:
>
> Array
> (
> [0] => lime
> [1] => coconut
> [2] => seltzer
> [3] => rum
> [4] => ice
> )
>
> I've looked, but couldn't find a function to do this.

Try array_splice():

   array_splice($a, 2, 0, "seltzer");

should do what you want.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordlmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148271.ezm"

Message-ID: <841D90E489448A4F804E1D1B95768BF7D46091lis-exchange3.lmu.ac.uk>
From: "Ford, Mike [LSS]" <M.Fordlmu.ac.uk>
To: 'Michael Timinger' <metiminger.net>, php-generallists.php.net
Date: Tue, 20 May 2003 10:12:07 +0100
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Subject: RE: [PHP] composed variables

> -----Original Message-----
> From: Michael Timinger [mailto:metiminger.net]
> Sent: 19 May 2003 22:08
> To: php-generallists.php.net
> Subject: Re: [PHP] composed variables
>
>
> hello Jay!
> The idea behind is to have an universal script, which can
> handle different
> forms, which have a different amount of variables to post, based on a
> database. I get back the amount of fields needed (same amount as the
> database fields). Because I do not know the amount of
> variables out of the
> form I want to perform that while ... which gives back
> $var1=$_POST["val1"]; to $varx ...
> Better description?
> Thanx for your help!
> Mike
> "Jay Blanchard" <jay.blanchardniicommunications.com> schrieb
> im Newsbeitrag
> news:C8F323573C030A448F3E5A2B6FE2070B02A142nemesis...
> [snip]
> I am trying to create a composed variable:
> I get from a form the amount of variables back, eg. 4
> I need now a way to perform something like
> while ($i >= $anzVar) {
> ...
> which creates variables: $var1, $var2 and so on.
> [/snip]

Would a simple foreach($_POST as $key=>$val) not be sufficient for your
needs?

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.fordlmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148280.ezm"

Date: Tue, 20 May 2003 14:42:04 +0400
From: =?ISO-8859-1?B?wO3y7u0=?= <antonartprom.ru>
Reply-To: =?ISO-8859-1?B?wO3y7u0=?= <antonartprom.ru>
Message-ID: <5732949390.20030520144204artprom.ru>
To: "Ford, Mike [LSS]" <M.Fordlmu.ac.uk>
CC: php-generallists.php.net
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Subject: Re[2]: [PHP] composed variables

Hi
>
>> hello Jay!
>> The idea behind is to have an universal script, which can
>> handle different
>> forms, which have a different amount of variables to post, based on a
>> database. I get back the amount of fields needed (same amount as the
>> database fields). Because I do not know the amount of
>> variables out of the
>> form I want to perform that while ... which gives back
>> $var1=$_POST["val1"]; to $varx ...
>> Better description?
>> Thanx for your help!
>> Mike
>> "Jay Blanchard" <jay.blanchardniicommunications.com> schrieb
>> im Newsbeitrag
>> news:C8F323573C030A448F3E5A2B6FE2070B02A142nemesis...
>> [snip]
>> I am trying to create a composed variable:
>> I get from a form the amount of variables back, eg. 4
>> I need now a way to perform something like
>> while ($i >= $anzVar) {
>> ...
>> which creates variables: $var1, $var2 and so on.
>> [/snip]

My advise is to use something about this:

<form method="POST">
      <input type="text" name="$vars[Firstname]">
      <input type="text" name="$vars[Secondname]">
      ...
</form>

and php script:

foreach ($_POST['vars'] as $key=>$value)
{
        print "$key=>$value<br>";
}

this script will print something about

Firstname: Jack
Secondname: Smith
...

--
Regards

Anton

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148272.ezm"

Content-Type: text/plain;
  charset="us-ascii"
From: John Wards <j.wardssportnetwork.net>
To: php-generallists.php.net
Date: Tue, 20 May 2003 10:36:09 +0100
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201036.09970.j.wardssportnetwork.net>
Subject: Seriously screwed php install.

Morning folks....

I have seriously fecked up my PHP install on my new server.

This is the error I get when I restart apache:

http://www.sportnetwork.net/httpd_errors.txt

Its so feckin long i had to put it in its own file....

I am bloody lost. I have tried to reinstal, reconfig etc PHP lots of times but
nothing. I thought about reinstalling Apache and starting from scratch but it
was installed using RPMs and when I tried to uninstall it it moaned about 5
other packages needing it so I gave up on that route.

Any ideas folks?

To help the cause here is my httpd.conf file:
http://rack.sportnetwork.net/httpd.conf

And the output from php_info()
http://rack.sportnetwork.net/jontest.php

Cheers
John

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148278.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: Jason Wong <php-generalgremlins.biz>
Reply-To: php-generallists.php.net
To: php-generallists.php.net
Date: Tue, 20 May 2003 18:35:37 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201835.37501.php-generalgremlins.biz>
Subject: Re: [PHP] Seriously screwed php install.

On Tuesday 20 May 2003 17:36, John Wards wrote:

> I have seriously fecked up my PHP install on my new server.

[snip]

> I am bloody lost. I have tried to reinstal, reconfig etc PHP lots of times
> but nothing. I thought about reinstalling Apache and starting from scratch
> but it was installed using RPMs and when I tried to uninstall it it moaned
> about 5 other packages needing it so I gave up on that route.

[snip]

Your best bet for Apache+PHP is to either stick with an all-RPM installation
or an all-source one. Mixing rpm and source is more trouble than it's worth.
If you're having trouble removing the Apache rpms try asking on the mailing
list for your particular distro.

--
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
------------------------------------------
/*
"Life, loathe it or ignore it, you can't like it."
-- Marvin the paranoid android
*/

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148279.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: John Wards <j.wardssportnetwork.net>
To: php-generallists.php.net
Date: Tue, 20 May 2003 11:53:52 +0100
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305201153.52850.j.wardssportnetwork.net>
Subject: Re: [PHP] Seriously screwed php install.

On Tuesday 20 May 2003 11:35 am, Jason Wong wrote:
> Your best bet for Apache+PHP is to either stick with an all-RPM
> installation or an all-source one. Mixing rpm and source is more trouble
> than it's worth. If you're having trouble removing the Apache rpms try
> asking on the mailing list for your particular distro.

Yup its looking like that.......cheers for your help

John

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148275.ezm"

From: David Otton <phpmailjawbone.freeserve.co.uk>
To: Mukta Telang <muktadarya.nio.org>
Cc: php <php-generallists.php.net>
Date: Tue, 20 May 2003 11:06:40 +0100
Message-ID: <unujcvsilpm08ousj45406e0pbvod3lmbv4ax.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP] faster output from php and postgres --please help!

On Mon, 19 May 2003 16:13:31 +0000, you wrote:

>I am dealing with a database with many-to-many relation and have a php
>script that joins these tables and displays the output.
>But the problem is that after entering some 50 records the output is
>very slow!
>I can count till 50 before the script produces the output!

Note: this is a pure SQL problem, not PHP. You should submit it in a more
appropriate place next time.

>Three tables: paper,author and author_paper
>
>"A paper has many authors and an author has many papers."
>In this way there is many to many relation.
>
>The attributes of paper are: paper_id (primary key),title,journal,year
>etc
>
>The attributes of author are: author_id(primary key) and name
>
>The attributes of author_paper are: author_id ,paper_id and level
>( author with levelis the main author of the paper )

That's fine - your database is normalised. I'd add

author_paper primary key(author_id, paper_id)

but that's just me.

>php part:

>For an author:
>1. get author_id from author table
>2. select all paper_ids from author_paper table
>3. For each of the above selected paper_ids:
> a. print all the attributes of paper
> b. select all authors of the paper and print their names in the order
>of their "level"

What does your SQL statement look like? It sounds like you're doing multiple
SELECTs for each record...

SELECT [attributes of paper], author.author_id
        FROM author, author_paper, paper
        WHERE author.author_id = author_paper.author_id
                AND author_paper.paper_id = paper.paper_id
                AND author.name = "John Smith"

will cover 1, 2 and 3a in a single SQL statement.

Ask someone on a database-specific mailing list, and they'll show you how to
do everything in a single statement (either with a sub-select or a left
outer join[?], depending which DB you use).

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148276.ezm"

Message-ID: <20030520100706.91747.qmailpb1.pair.com>
To: php-generallists.php.net
From: "John" <johntamaresyahoo.com>
Date: Tue, 20 May 2003 18:06:59 +0800
Subject: Control Browser

Hello...

Is there any way of controlling the user brower from PHP...

eg. Removing of status bar and address bar, resize window, no scroll bars,
no max/min window...

Problem... i have morethan 200 pages that will do the page calling and
suddenly need to update it with this set of rules....

I know this can be utilized by javascripts but should be done with the
calling page...

Any idea will be apprciated

Thanks...
JOHN

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148284.ezm"

Message-ID: <3ECA41FF.5000404triculture.com>
Date: Tue, 20 May 2003 07:55:59 -0700
From: Rolf Brusletto <rolf-listtriculture.com>
MIME-Version: 1.0
To: John <johntamaresyahoo.com>
CC: php-generallists.php.net
Content-Type: text/plain; charset=us-ascii; formatowed
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP] Control Browser

*This message was transferred with a trial version of CommuniGate(tm) Pro*
John - PHP is a server side language and therefore has no interactions
with the clients browser. Javascript would be the best for this..

Rolf Brusletto
PHP / MySQL Coder
http://www.phpexamples.net

John wrote:

>*This message was transferred with a trial version of CommuniGate(tm) Pro*
>Hello...
>
>Is there any way of controlling the user brower from PHP...
>
>eg. Removing of status bar and address bar, resize window, no scroll bars,
>no max/min window...
>
>Problem... i have morethan 200 pages that will do the page calling and
>suddenly need to update it with this set of rules....
>
>I know this can be utilized by javascripts but should be done with the
>calling page...
>
>Any idea will be apprciated
>
>Thanks...
>JOHN
>
>
>
>
>

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148277.ezm"

Message-ID: <20030520100041.84588.qmailpb1.pair.com>
To: php-generallists.php.net
From: "Mostafa Afifi" <mosafifiuk.ibm.com>
Date: Tue, 20 May 2003 10:59:54 +0100
Subject: syscall and rexec

Hi,

I'm having some problems in using php's system calls, (system, exec,
passthru, and even popen) to run the following command.

rexec <machine> ls

That fails with no output. I know what username apache uses to run the php
script, and despite being able to rexec from the command line using that
user id, apache seems to have trouble when it comes to running it self.

Even though I can rexec from the command line I've still confirmed that the
correct username and password are inside the .netrc file, and as a final
confirmation I've checked that no environment variables are set, no -n in
the command line or username and password specified.

Has anyone has been able to get this to work, or knows a little about how
the system call and exec call work inside php that might aid me in getting
this script to work?

Many thanks,

Mostafa

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148281.ezm"

Date: Tue, 20 May 2003 07:40:15 -0400
From: Lowell Allen <lalowellallen.com>
To: PHP <php-generallists.php.net>
Message-ID: <BAEF8C5E.18BC4%lalowellallen.com>
Mime-version: 1.0
Content-type: text/plain; charset="US-ASCII"
Content-transfer-encoding: 7bit
Subject: Re: [PHP] Generating a Static HTML Page from PHP

> From: Mike Papper <m.papperfantastic.com>
>
> Is there a PHP function or some way to cause the HTML output from a PHP
> page to be sent directly to a file instead of the client (browser)?

I do something like this in content management systems to create the public
pages. When administrators are satisfied with the look of an updated page
(whatever.php), they generate a new static page (whatever.html):

$src_url = "http://". $SERVER_NAME . "/whatever.php";
$temp_filename = "temp_whatever.html";
$target_filename = "whatever.html";
unlink($temp_filename);
$script_page = fopen($src_url, 'r');
$html_data = fread($script_page, 1024*1024);
fclose($script_page);
$temp_file = fopen($temp_filename, 'w');
fwrite($temp_file, $html_data);
fclose($temp_file);
$ok = copy($temp_filename, $target_filename);
unlink($temp_filename);
if ($ok) { // report success, allow use }

--
Lowell Allen

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148285.ezm"

From: "Patrick Ahler" <patrickvikus.com>
To: "Php-General" <php-generallists.php.net>
Date: Tue, 20 May 2003 10:08:47 -0400
Message-ID: <ABEKJILKOKKGGDJKHKDFAEGNCBAA.patrickvikus.com>
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: php4 and apache

Hi, I have php4.2.2/apache/linux. I can use regular php fine, I have
multiple websites written in php that have no problem... but I downloaded
squirrelmail and that was written entirely in php4 and it would not run. I
checked httpd.conf and found nothing in there about php and then I checked
php.ini and also found nothing. I am guessing apache is not configured to
use php4... but I'm a bit lost.

Help?

Thanks,
-Patrick

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148294.ezm"

Content-Type: text/plain;
  charset="iso-8859-1"
From: Jason Wong <php-generalgremlins.biz>
Reply-To: php-generallists.php.net
To: php-generallists.php.net
Date: Wed, 21 May 2003 00:08:32 +0800
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Message-Id: <200305210008.32469.php-generalgremlins.biz>
Subject: Re: [PHP] php4 and apache

On Tuesday 20 May 2003 22:08, Patrick Ahler wrote:
> Hi, I have php4.2.2/apache/linux. I can use regular php fine, I have
> multiple websites written in php that have no problem... but I downloaded
> squirrelmail and that was written entirely in php4 and it would not run. I
> checked httpd.conf and found nothing in there about php and then I checked
> php.ini and also found nothing. I am guessing apache is not configured to
> use php4... but I'm a bit lost.

You would get better help if you asked on the Squirrelmail mailing list.

However before you ask you should read the Squirrelmail installation
instructions (if you haven't already done so) and also the FAQ.

And when you are ready to ask, instead of just saying it doesn't run, you
should state _what happens_ when you (try to) run it.

--
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
------------------------------------------
/*
The 80's -- when you can't tell hairstyles from chemotherapy.
*/

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148286.ezm"

Message-ID: <000501c31ee0$6d5c9f00$30f0e818fibertel.com.ar>
From: "Alberto Brea" <estudiobreafibertel.com.ar>
To: <php-generallists.php.net>
Date: Tue, 20 May 2003 11:59:29 -0300
MIME-Version: 1.0
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Subject: Truncated values in update form

I made an update form where I would like to show the values to be updated.
However, the values e.g. $fname and $lname truncate at the first space.
How can I do to show the whole value?
TIA
Alberto Brea
http://estudiobrea.com

My code so far is this:

[UPDATE_FORM.PHP]
<?php
// RETRIEVE VALUES FOR THE UPDATE FORM
$sqlvalues="SELECT * FROM contacts
 WHERE id='$id'";
$result=mysql_query($sqlvalues);

// DISPLAY FORM (showing truncated values)
while($row = mysql_fetch_array($result)):
 $id = $row["id"];
 $fname = $row["fname"];
 $lname = $row["lname"];
 print("<form method='post' action='updatedrecords.php'><br>" .
 "Name<input type=text nameame value=$fname><br>" .
 "Surname<input type=text name=lname value=$lname><br>" .
 "etc");
endwhile;
echo("</form>");
?>

--mfmofpoocpajbinggeem
Content-Type: message/rfc822
Content-Disposition: inline; filename="php-general_148287.ezm"

Message-ID: <004601c31ee0$8680c740$0d00a8c0NETONWAVE>
From: "Alex Ciurea" <alexnetonwave.com>
To: "php mailing" <php-generallists.php.net>,
        "Alberto Brea" <estudiobreafibertel.com.ar>
Date: Tue, 20 May 2003 18:00:15 +0300
MIME-Version: 1.0
Content-Type: text/plain;
        charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP] Truncated values in update form

hello Alberto,

try to use some quotes at the 'value' attribute:

instead of this:

> "Name<input type=text nameame value=$fname><br>" .
> "Surname<input type=text name=lname value=$lname><br>" .

try this:

> "Name<input type=text nameame value="$fname"><br>" .
> "Surname<input type=text name=lname value="$lname"><br>" .

Have a better day!!!

----- Original Message -----
From: "Alberto Brea" <estudiobreafibertel.com.ar>
To: <php-generallists.php.net>
Sent: Tuesday, May 20, 2003 5:59 PM
Subject: [PHP] Truncated values in update form

> I made an update form where I would like to show the values to be updated.
> However, the values e.g. $fname and $lname truncate at the first space.
> How can I do to show the whole value?
> TIA
> Alberto Brea
> http://estudiobrea.com
>
> My code so far is this:
>
> [UPDATE_FORM.PHP]
> <?php
> // RETRIEVE VALUES FOR THE UPDATE FORM
> $sqlvalues="SELECT * FROM contacts
> WHERE id='$id'";
> $result=mysql_query($sqlvalues);
>
> // DISPLAY FORM (showing truncated values)
> while($row = mysql_fetch_array($result)):
> $id = $row["id"];
> $fname = $row["fname"];
> $lname = $row["lname"];
> print("<form method='post' action='updatedrecords.php'><br>" .
> "Name<input type=text nameame value=$fname><br>" .
> "Surname<input type=text name=lname value=$lname><br>" .
> "etc");
> endwhile;
> echo("</form>");
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php