php-general Digest 12 Aug 2003 17:27:18 -0000 Issue 2232
Topics (messages 159240 through 159303):
Re: Screen Resoultion
159240 by: Greg Beaver
159241 by: daniel.electroteque.org
159243 by: Leif K-Brooks
159244 by: Leif K-Brooks
159245 by: daniel.electroteque.org
159247 by: Leif K-Brooks
159250 by: Leif K-Brooks
159251 by: Leif K-Brooks
Re: what is %s %d
159242 by: Mike Migurski
159275 by: CPT John W. Holmes
imap slow
159246 by: andu
Re: [PEAR-DOC] standardize @throws for phpdocumentor 2.0?
159248 by: Alexander Merz
Re: MSN Explorer & PHP Sessions failing
159249 by: Justin French
setting file_uploads on a per-directory basis
159252 by: Demian Turner
159254 by: Justin French
159268 by: Ford, Mike [LSS]
Determine OS and Java Ver
159253 by: Alexandru-Vlad Badut
159255 by: Kae Verens
Re: GD 2.0.15
159256 by: Vijay
Strange problem in class creation
159257 by: Fabio Rotondo
159262 by: Mukul Sabharwal
159266 by: Fabio Rotondo
159272 by: Mukul Sabharwal
Re: Pls Help-Looking for PHP Product for Articles
159258 by: Alexandru COSTIN
Re: [Newbie Guide] For the benefits of new members
159259 by: David
159265 by: Ford, Mike [LSS]
159270 by: Mike Brum
Cannot add header information - headers already sent
159260 by: frederik feys
159263 by: frederik feys
159267 by: Fabio Rotondo
159269 by: Marek Kilimajer
Session does not end when browser is closed.
159261 by: Lee Hanxue
159264 by: John Manko
159274 by: CPT John W. Holmes
File ordering
159271 by: Katherine Barry
159273 by: Lowell Allen
159276 by: Ford, Mike [LSS]
159280 by: Curt Zirzow
image button problem
159277 by: Abdul-wahid Paterson
159278 by: CPT John W. Holmes
159279 by: Jackson Miller
159283 by: Abdul-wahid Paterson
159284 by: CPT John W. Holmes
Forms
159281 by: Kris Reid
159282 by: Robert Cummings
Re: dbx
159285 by: Ray Hunter
Cache Question
159286 by: Tony Tzankoff
delete line
159287 by: Rodney Green
159289 by: Robert Cummings
159290 by: Chris Boget
how to regenerate your own session id
159288 by: treeml
159295 by: Curt Zirzow
Regex help appreciated
159291 by: David Pratt
How do I manipulate a date variable to a specific date array?
159292 by: Donpro
libxml in PHP 5
159293 by: Analysis & Solutions
How to Authenitcate using PHP (RH9, PHP 4.3.2, MySQL 4)
159294 by: Matt Babineau
159301 by: Mukul Sabharwal
How do I call a function in a Class from another function in the same class
159296 by: Donpro
159297 by: Chris Boget
Re: [PROBLEM] Killed sshd, want to start it via PHP script.
159298 by: Simon Fredriksson
prob. with function parameter with "&"
159299 by: Mirek Novak
159303 by: Mukul Sabharwal
Reading remote, script-generated files
159300 by: Matt Daleo
159302 by: Jay Blanchard
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 ---
Use JS to set the value of a hidden form-field and then have it
immediately submit the form and it can be passed to php. Not impossible.
Greg
--
phpDocumentor
http://www.phpdoc.org
[EMAIL PROTECTED] wrote:
how is it possible to send a jscript variable to php thats impossible
You can do so with JavaScript and have that pass the information onto
your PHP scripts to do whatever it is that you want.
-M
-----Original Message-----
From: Uma Shankari T. [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 12:12 AM
To: PHP
Subject: [PHP] Screen Resoultion
Hello,
Can anyone pls tell me is it possible to get the screen resoultion
using
php script ??
Regards,
Uma
--
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
--- End Message ---
--- Begin Message ---
oh right sure thats easy done , i assumed u meant the variable itself
document.formname.fieldname.value=somevar;
> Use JS to set the value of a hidden form-field and then have it
> immediately submit the form and it can be passed to php. Not
> impossible.
>
> Greg
> --
> phpDocumentor
> http://www.phpdoc.org
>
> [EMAIL PROTECTED] wrote:
>> how is it possible to send a jscript variable to php thats impossible
>>
>>
>>>You can do so with JavaScript and have that pass the information onto
>>>your PHP scripts to do whatever it is that you want.
>>>
>>>-M
>>>
>>>-----Original Message-----
>>>From: Uma Shankari T. [mailto:[EMAIL PROTECTED]
>>>Sent: Tuesday, August 12, 2003 12:12 AM
>>>To: PHP
>>>Subject: [PHP] Screen Resoultion
>>>
>>>
>>>
>>>Hello,
>>>
>>> Can anyone pls tell me is it possible to get the screen resoultion
>>> using
>>>php script ??
>>>
>>>Regards,
>>>Uma
>>>
>>>
>>>--
>>>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
>>
>>
>>
>>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
how is it possible to send a jscript variable to php thats impossible
It would look something like this (unfinished, using comments instead of
real code in a few places:
<?php
if(!isset($_GET['height'])){
?>
<script type="text/javascript">
<!--
var height = //resolution height
var width = //resolution width
document.location.href = document.location.href + "?height=" + height +
"&width=" + width;
-->
</script>
<?php
}else{
echo 'Your resolution is ', $_GET['height'], 'x', $_GET['width'], '.';
}
?>
--
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.
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
oh right sure thats easy done , i assumed u meant the variable itself
document.formname.fieldname.value=somevar;
Well, ASP can't do any more in that area than PHP can, nor should it be
able to.
--
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.
--- End Message ---
--- Begin Message ---
umm sorry i wouldnt know i've never sold my soul to the devil
> [EMAIL PROTECTED] wrote:
>
>>oh right sure thats easy done , i assumed u meant the variable itself
>>
>>document.formname.fieldname.value=somevar;
>>
> Well, ASP can't do any more in that area than PHP can, nor should it be
> able to.
>
> --
> 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.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
umm sorry i wouldnt know i've never sold my soul to the devil
"lol jscript dude , dont get the boyz and girlz started , it would be
nice if php could do client stuff like asp" --You
--
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.
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
yeh i'm saying it would be nice , i didnt say can it, i built an image
uploader progress bar class , it had to use javascript with flash as php
has no way of working out how much a file has uploaded where asp can
Luckily, ASP doesn't work by magic. PHP (thankfully) doesn't have
automatic features for doing everything, but it can be used for
everything ASP can.
--
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.
--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
i didnt understand a word of that , please rephrase ??
ASP doesn't do an upload meter by magic. PHP can do anything ASP can do,
it simply doesn't have built-in features for anything unessential.
--
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.
--- End Message ---
--- Begin Message ---
>They are codes for date formatting.
>
>Specifically:
>%s represents seconds with leading zeros.
>%d represents day of the month with leading zeros
They can also be codes for the printf family of functions:
%s represents string
%d represents number
See http://php.net/sprintf
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html
--- End Message ---
--- Begin Message ---
From: "Jackson Miller" <[EMAIL PROTECTED]>
> They are codes for date formatting.
>
> Specifically:
> %s represents seconds with leading zeros.
> %d represents day of the month with leading zeros
>
> so
> date("%s %d",mktime());
> would equal something like
> 59 08
Actually you'd get:
%59 %08
because date() does not use percent signs in the formatting. However, and I
think this is what you're thinking about, DATE_FORMAT() in MySQL does use
the percent signs like you've demonstrated.
---John Holmes...
--- End Message ---
--- Begin Message ---
Why are imap(pop3) functions so slow? I am working on a webmail and it
takes foreer to get 12 headers. I also looked at other php webmails and
they are just as bad. I tested a pop3 function library I found on the
net and it retrievs all 12 messages in no time.
--
Regards, Andu Novac
--- End Message ---
--- Begin Message ---
Greg Beaver wrote:
@throws:pear would be a sub-tag of @throws, so that we could have a
loose spec for @throws (allowing constant or classname or
classname::constant) and a rigid spec for @throws:pear (only
classname::constant)
+-0
I see the advantage, but the problem here is "the learning by
example"-stuff. If i talk about phpdoc, i say to the people "take a look
on PEAR to see how the doc comments works". Having a different syntax
for PEAR could confuse users.
--- End Message ---
--- Begin Message ---
On Tuesday, August 12, 2003, at 02:30 PM, Lindsey Simon wrote:
Unfortunately, I've been unable to duplicate this problem on my own
machine with MSN 8 (win2k), but I have users of my software who use the
MSN explorer browser complaining at me. It appears that sessions are
not
being properly initialized, because my PHP software is failling at a
point where it
should be reading a $_SESSION var. My host runs PHP 4.2.2. Anyhow, I'm
just looking for a lead on what might be the issue here and how I might
rectify it.
Lindsey,
For starters,
Does your session code rely on cookies being enabled on the client side?
Or do you pass the session around in the URL?
If < 4.2.0, was PHP compiled with enable_trans_sid
Or is it >= 4.2.0?
I have no idea what MSN8 is -- I thought MSIE was up to about 6, but
I'm a mac user, so maybe you're talking about something else?
My *guess* is that you're on php < 4.2, and you're relying on cookies
for sessions.
For any user with cookies turned off, the session will break.
Justin
--- End Message ---
--- Begin Message ---
In an effort to improve security on a server that has many sites, I was hoping
to disable http_uploads in php.ini then enable it in one site with either an
.htaccess:
php_value http_uploads on
or in httpd.conf with
<Directory "/path/to/dir">
php_value http_uploads on
</Directory>
however neither of these are successfully overriding the php.ini value.
Any ideas?
apache 1.3.23
php 4.1
linux 2.4.16, redhat 7.3
cheers
Demian
--- End Message ---
--- Begin Message ---
php_flag rather than php_value ???
this is a part of my htaccess file:
<IfModule mod_php4.c>
php_flag register_globals off
php_flag magic_quotes_runtime on
php_value include_path '/Users/justinfrench/Documents/htdocs/joel/'
</IfModule>
Justin French
On Tuesday, August 12, 2003, at 06:06 PM, Demian Turner wrote:
In an effort to improve security on a server that has many sites, I
was hoping to disable http_uploads in php.ini then enable it in one
site with either an .htaccess:
php_value http_uploads on
or in httpd.conf with
<Directory "/path/to/dir">
php_value http_uploads on
</Directory>
however neither of these are successfully overriding the php.ini value.
Any ideas?
apache 1.3.23
php 4.1
linux 2.4.16, redhat 7.3
cheers
Demian
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
[This E-mail scanned for viruses]
--- End Message ---
--- Begin Message ---
On 12 August 2003 09:07, Demian Turner wrote:
> In an effort to improve security on a server that has many sites, I
> was hoping to disable http_uploads in php.ini then enable it in one
> site with either an .htaccess:
>
> php_value http_uploads on
>
> or in httpd.conf with
>
> <Directory "/path/to/dir">
> php_value http_uploads on
> </Directory>
Ummm -- I can find no documentation for an "http_uploads" directive, not even in the
php.ini-dist file. Are you perchance thinking of the file_uploads setting?
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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--- End Message ---
--- Begin Message ---
Hya,
Can someone give me a hand on how to determine if the client (the visitor)
is java & java enabled and the os he's using in php?
thank you,
Alexandru
--- End Message ---
--- Begin Message ---
Alexandru-Vlad Badut wrote:
Hya,
Can someone give me a hand on how to determine if the client (the visitor)
is java & java enabled and the os he's using in php?
couldn't you just get the Java to request a PHP file with it's version
as a GET parameter? that, along with the IP address, should tell you
which browser is doing the reading (except behind large firewalls...),
and allow you to set a variable in your database, or however you're
doing it.
the OS is usually included in the browser identification string.
Kae
--- End Message ---
--- Begin Message ---
Hi Friends,
What should I do configure GD 2 support in my solaris 2.7 server, with Apache
1.3.27,PHP 4.3.1
Sincerely
Vijay
--- End Message ---
--- Begin Message ---
Hi all,
I have encountered a "tricky" problem with PHP 4.3.1 (installed with
SuSE 8.2).
I don't know if it is a bug or not. Maybe is just me missing something.
What I'd like to do is to pass a reference of "base_class" instance to the
constructor of "second_class" (so that the newly created "second_class"
instance can
call methods from the "base_class" instance.
It seems that if "base_class" constructor directly calls its method
"create()" (that is
responsible of creating the "second_class" instance, passing _$this_ as
constructor
argument) the second_class gets a "copy" of "base_class" instance and
not the real thing.
To test it, I have added an array ($arr) in the base_class and set a
value into it.
If "second_class" really have a reference to the "real" base_class
instance, it should be
able to print its contents, but this just doesn't work.
Please, notice that if in the following code you remove the line
"$this->create()"
in the base_class constructor and add the commented line in the main
body, everything
works fine.
What I am really missing?
Please, help!
Ciao,
Fabio
---- CODE STARTS HERE ------------------------------------------
<?php
class base_class
{
var $arr;
var $class;
function base_class ()
{
$this->arr = array ();
$this->class = false;
// it seems to create another "instance" of base_class
$this->create (); // this line does not work
}
function set ( $val )
{
$this->arr [] = $val;
}
function create ()
{
$this->class = new second_class ( $this );
}
function test ()
{
$this->class->dump ();
}
}
class second_class
{
function second_class ( & $main_class )
{
$this->main_class = & $main_class;
}
function dump ()
{
print_r ( $this->main_class->arr );
}
}
$b = new base_class ();
// $b->create (); // This line works as expected
$b->set ( "ciao" );
$b->test ();
print "<br />";
print_r ( $b->arr );
?>
---- END CODE ---------------------------------------------
--- End Message ---
--- Begin Message ---
>From the looks of it, if i were to do the same, I
would rather make second class the one I initiate and
"return" it, but that would require a third.
And the error is strange because you're doing
something strange!
What do you want to do ? Be able to access base_class
stuff from second_class ? If so :
<?php
class base_class {
function base_class() { do something ... ; }
var $some = 200;
};
class second_class {
var $foo;
function second_class(&$oref) //constructor
{
$this->foo = &$oref;
}
};
$base = new base_class;
$second = new second_class($base);
$second->foo->some = 100;
// here it is, base_class' some is accessible
?>
HTH
Mukul Sabharwal
> From: "Fabio Rotondo" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, August 12, 2003 2:38 AM
> Subject: [PHP] Strange problem in class creation
>
> Hi all,
>
> I have encountered a "tricky" problem with PHP 4.3.1
(installed with
> SuSE 8.2).
> I don't know if it is a bug or not. Maybe is just me
missing something.
>
> What I'd like to do is to pass a reference of
"base_class" instance to the
> constructor of "second_class" (so that the newly
created "second_class"
> instance can
> call methods from the "base_class" instance.
> It seems that if "base_class" constructor directly
calls its method
> "create()" (that is
> responsible of creating the "second_class" instance,
passing _$this_ as
> constructor
> argument) the second_class gets a "copy" of
"base_class" instance and
> not the real thing.
>
> To test it, I have added an array ($arr) in the
base_class and set a
> value into it.
> If "second_class" really have a reference to the
"real" base_class
> instance, it should be
> able to print its contents, but this just doesn't
work.
>
> Please, notice that if in the following code you
remove the line
> "$this->create()"
> in the base_class constructor and add the commented
line in the main
> body, everything
> works fine.
>
> What I am really missing?
>
> Please, help!
>
> Ciao,
>
> Fabio
>
> ---- CODE STARTS HERE
------------------------------------------
> <?php
> class base_class
> {
> var $arr;
> var $class;
>
> function base_class ()
> {
> $this->arr = array ();
> $this->class = false;
>
> // it seems to create another
"instance" of base_class
> $this->create (); //
this line does not work
> }
>
> function set ( $val )
> {
> $this->arr [] = $val;
> }
>
> function create ()
> {
> $this->class = new second_class (
$this );
> }
>
> function test ()
> {
> $this->class->dump ();
> }
> }
>
> class second_class
> {
> function second_class ( & $main_class )
> {
> $this->main_class = & $main_class;
> }
>
> function dump ()
> {
> print_r ( $this->main_class->arr );
> }
> }
>
> $b = new base_class ();
> // $b->create (); // This line works
as expected
> $b->set ( "ciao" );
> $b->test ();
> print "<br />";
> print_r ( $b->arr );
>
> ?>
> ---- END CODE
---------------------------------------------
>
=====
Mukul Sabharwal ([EMAIL PROTECTED])
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--- End Message ---
--- Begin Message ---
Mukul Sabharwal wrote:
And the error is strange because you're doing
something strange!
I don't think I'm doing anything strange. What I have exposed here is a
simplification of my own class loader. I have the main class that must
load (include and then instance) other PHP classes.
The problem is that if I do instance other classes in the loader
constructor they get a "copy" of the loader instance and not the real
instance reference.
[some your code snipped]
$base = new base_class;
$second = new second_class($base);
$second->foo->some = 100;
// here it is, base_class' some is accessible
I know. If you give a closer look to my own code, you'll see that there
is a line (commented) doing almost the same thing as you. But I need
something else.
Infact, look at the end of my code, there are these two lines:
$b = new base_class ();
// $b->create (); // This line works
if I instance the base_class and outside the constructor i do the create
(as shown in the second line) everything works. And I am actually just
sending ($this) as the argument (look inside the create method code),
in exactly the same way I was doing in the base_class constructor.
The problem is that inside the constructur THE SAME CODE DOES NOT WORK.
I think it's a bug. I have worked around it by doing the two calls, but
I would like to know if it is a real bug or just me doing something wrong.
Ciao,
Fabio
--- End Message ---
--- Begin Message ---
>
> > And the error is strange because you're doing
> > something strange!
>
> I don't think I'm doing anything strange. What I
> have exposed here is a simplification of my own
> class loader. I have the main class that must
> load (include and then instance) other PHP classes.
> The problem is that if I do instance other classes
> in the loader > constructor they get a "copy" of the
> loader instance and not the real
> instance reference.
That code (looked closely) confirms you're doing
something strange :)
A constructor cannot call (or rather should not call)
"itself" while being constructed. It leads to
"unexpected" results.
So technically in some cases you might be able to get
it, but on most occassions you won't, it depends on
how your class is made. And yours recurses, I'm
presuming you wanted that for some reason (??)
On almost all times your data will be still pointing
to your base class (second_class).
So i'm afraid your method is not reliable, dangerous
none the less.
The reliable and correct way of doing it is after your
constructor has finished your class and made it ready
(guaranteed), then you can do what you want to.
=====
Mukul Sabharwal ([EMAIL PROTECTED])
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--- End Message ---
--- Begin Message ---
Hello Steve,
> I've been reading about KompleteLite, but it looks like you have to
install the
> Kyrsalis Enterprise server before being able to use KompleteLite,
This is not true - (where have you read this?). You just have to install
Krysalis Foundation (open) to be able to install Komplete Lite.
> and I don't
> think I'll be able to get that through our IT people.
Please download it and try installing it - actually Krysalis Foundation
is integrated in Komplete and we know that the installer is build for easy
installation (you could try installing on a Windows machine for maximum
installation speed, as on Linux you might need to install some modules to
PHP - and this means compiling them)
Alexandru
> Any other ideas for how
> to create a page structured like this:
http://www.php.net/manual/en/ref.dbx.php
> (with an article at the top and comments below...)
>
> Thanks,
>
> Steve
>
> Alexandru Costin wrote:
>
> > Hello,
> > You could take a look at Komplete Lite - allows you to publish
articles
> > and associate forums on them.
> >
> > Even if the user roles are not very powerful in the open version -
> > basically you will have what you want.
> >
> > http://www.interakt.ro/products/KompleteLite/
> >
> > Alexandru
> >
> > --
> > Alexandru COSTIN
> > Chief Operating Officer
> > http://www.interakt.ro/
> > +4021 312 5312
> > "Stephen Toutonghi" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Hi,
> > >
> > > I'm looking for a product that will help me create a documentation
> > > system. I'd like to be able to post individual articles on an
intranet,
> > > and have user's create comments on the articles that become part of
the
> > > article. And editor could then review the comments and add to the
> > > article where appropriate, remove comments where appropriate. A good
> > > example of what I'm looking for is the kind of format used on this
page:
> > >
> > > http://www.php.net/manual/en/ref.dbx.php
> > >
> > > where there's an article, and comments below it.
> > >
> > > Any ideas?
> > >
> > > Thanks,
> > >
> > > Steve
> > >
>
--- End Message ---
--- Begin Message ---
I believe in community and helping people out, if someone is struggling
then I try to help.
When you have been developing for several years it is much easier to produce
code as you have the experience and also the tools. Someone who is just
starting to learn a language it is hard to understand what to do, and
probably scared of trying new things. To have someone provide a bit of code
to help, gives someone confidence to move on. I also have to product code
quickly and sometimes I do not know where to start, manuals are a start, but
usually they do not give the code to do specific things.
My process is: -
Look in a manual
Search the web
PHP websites and newgroups
Then post on a newsgroup
My thought is someone out there has had a simular problem, and solved it,
then hopefully they will share the solution.
David
Anagram Systems
http://www.anagram-sys.co.uk/
http://www.web-planets.com/davec/techsitedb/
"Mike Brum" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
While sometimes a new perspective is extremely useful on a topic, I think
the problem is that a huge percentage of people don't try for themselves. If
they've done all the steps in the proposed message, then it tells you to
send a message explaining where you're at to the list.
While it can be pretentious to send someone to the manual if they say "I
read the manual, I can't figure it out", if they haven't even tried doing it
for themselves yet, then it's a very viable first recommendation.
Not to mention that there's MANY different points of views on many different
topics in the list archives that very few people seem to search.
Someone should always try to help themselves first before they start asking
other people to do the work for them. It's just laziness to not even try
before asking.
My suggestion would be to have that message sent to a person just after
signing up once, instead of to everyone on a regular basis though.
my $.02
-M
-----Original Message-----
From: Van Andel, Robbert [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 1:08 PM
To: PHP Mailing List
Subject: RE: [PHP] [Newbie Guide] For the benefits of new members
Personally, I think one of the worst replies someone on the list can do when
someone new asks a question is send only a link to the manual. It's
presumption that everyone will understand the way the manual is worded.
There have been times when it's confused me and I needed another perspective
on the topic. If you find the question juvenile or unworthy of anything
more than a link to the manual, don't reply to it.
Robbert van Andel
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 5:44 AM
To: PHP Mailing List
Subject: [PHP] [Newbie Guide] For the benefits of new members
I have been following this list for the past 1 year. I find it very useful.
Just by following the discussions for a couple of months one can understand
a
great deal about PHP.
What I proposed to do is to send this mail to the list every week. Those who
do not want to be bothered just filter out the [Newbie Guide] mails. Please
feel free to add more points and send to the list.
====================================================
1. If you have any queries/problems about PHP try http://www.php.net/manual
first. You can download a copy and use it offline also.
2. If you can not get answer here try http://www.google.com next. Try
searching for "php YOUR QUERY" and you may be lucky to get an answer within
the first 10 results.
3. Glancing through the list archive at http://www.php.net/archives, should
answer almost all common problems.
4. If you are stuck with a script and do not understand what is wrong,
instead
of posting the whole script, try doing some research yourself. One useful
trick is to print the variable, sql query using print or echo command and
check whether you get what you expected.
After diagnosing the problem, send the details of your efforts (following
steps 1,2 & 3) and ask for help in the list.
5. Provide a clear descriptive subject line. Avoid general subjects like
"Help!!", "A Question" etc.
6. When you want to start a new topic, open a new mail and enter the mailing
list address [EMAIL PROTECTED] instead of replyting to an existing
thread and replacing the subject and body with your message.
Hope you have a good time programming with PHP.
Best regards,
--
Ma Siva Kumar,
================================================
INTEGRATED MANAGEMENT TOOLS FOR LEATHER INDUSTRY
BSG LeatherLink,
Chennai.
Ph: +91 44 55191757
URL : http://www.leatherlink.net
--
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
--- End Message ---
--- Begin Message ---
On 11 August 2003 18:08, Van Andel, Robbert wrote:
> Personally, I think one of the worst replies someone on the
> list can do when
> someone new asks a question is send only a link to the manual. It's
> presumption that everyone will understand the way the manual
> is worded.
> There have been times when it's confused me and I needed
> another perspective
> on the topic. If you find the question juvenile or unworthy
> of anything
> more than a link to the manual, don't reply to it.
The best way to combat this is to *say* that you've RTFM and don't
understand it -- this should stop you getting simple RTFM answers. If you
can be fairly precise about what's confusing you, then you should get good,
focussed answers. You might even get a manual editor tuning in who can
improve the manual in the light of your comments.
If I respond with a link to the manual, it's usually because I think the
manual says it as well as (or better than) I can -- not through laziness.
But, yes, I have over 20 years' experience of reading (and writing!)
manuals, and sometimes I may overestimate the usefulness of a manual page to
a beginner -- so I won't be offended if you come back from RTFM-ing and say
something like "I read that, but I don't understand x because y -- could you
explain a bit further, please?".
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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--- End Message ---
--- Begin Message ---
And don't forget, the user-added notes at the bottom of the functions pages
are extremely useful to see actual code usage along with tips or potential
conflicts on various systems!
Those alone offer countless user-generated examples that are usually similar
to content that people on the list might generate.
-M
-----Original Message-----
From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 12, 2003 5:23 AM
To: 'Van Andel, Robbert'; PHP Mailing List
Subject: RE: [PHP] [Newbie Guide] For the benefits of new members
<snip>
If I respond with a link to the manual, it's usually because I think the
manual says it as well as (or better than) I can -- not through laziness.
But, yes, I have over 20 years' experience of reading (and writing!)
manuals, and sometimes I may overestimate the usefulness of a manual page to
a beginner -- so I won't be offended if you come back from RTFM-ing and say
something like "I read that, but I don't understand x because y -- could you
explain a bit further, please?".
Cheers!
Mike
--- End Message ---
--- Begin Message ---
Hi all,
I’m stuck with this one:
I have an checkout procedure: when people come to the overview page(step
2), they get:
Warning: Cannot add header information - headers already sent by (output
started at
/usr/local/www/vhosts/aurelis.org/htdocs/header_aurelis.php:95) in
/usr/local/www/vhosts/aurelis.org/htdocs/store/includes/functions/get_ca
rtID.php on line 14
header_aurelis.php is where actual html output starts (template)
i had a similar problem in my cart. I solved this by adding at the top
of my script:
$cookie = GetCartId();
This doesn’t do the trick now :-(
For your convenience i put the code here:
http://www.aurelis.org/store/checkout_form.txt
and a handler file:
http://www.aurelis.org/store/checkout_form_handler.txt
Can anyone shed some light on this?
Thanks!
Fré
--- End Message ---
--- Begin Message ---
Hi ermelir,
Thanks for your quick response!
The http://www.aurelis.org/store/checkout_form.txt file shows in the
browser with an empty first line: It may be an browser glitch. There's
actually no space in the php file, i.e. it starts at line 1 with <?.
I still receive the error. Any other thoughts?
Thanks
Fré
-----Original Message-----
From: ermelir [mailto:[EMAIL PROTECTED]
Sent: dinsdag 12 augustus 2003 11:03
To: frederik feys
Subject: Re: [PHP] Cannot add header information - headers already sent
Hi,
the problem is your empty first line:
HTML header will be send if you call a function that send code to client
browser (ex echo or print function) or if you have a empty line between
php
tags. for ex if you have
--------- begin code
<?php
...
?>
-------- end code
the empty first line is send to browser, so the HTML headers are send
to;
remove this line, you won't have errors any more
----- Original Message -----
From: "frederik feys" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 12, 2003 10:59 AM
Subject: [PHP] Cannot add header information - headers already sent
Hi all,
I'm stuck with this one:
I have an checkout procedure: when people come to the overview page(step
2), they get:
Warning: Cannot add header information - headers already sent by (output
started at
/usr/local/www/vhosts/aurelis.org/htdocs/header_aurelis.php:95) in
/usr/local/www/vhosts/aurelis.org/htdocs/store/includes/functions/get_ca
rtID.php on line 14
header_aurelis.php is where actual html output starts (template)
i had a similar problem in my cart. I solved this by adding at the top
of my script:
$cookie = GetCartId();
This doesn't do the trick now :-(
For your convenience i put the code here:
http://www.aurelis.org/store/checkout_form.txt
and a handler file:
http://www.aurelis.org/store/checkout_form_handler.txt
Can anyone shed some light on this?
Thanks!
Fré
--- End Message ---
--- Begin Message ---
Frederik Feys wrote:
Hi Frederik,
Warning: Cannot add header information - headers already sent by (output
started at
/usr/local/www/vhosts/aurelis.org/htdocs/header_aurelis.php:95) in
/usr/local/www/vhosts/aurelis.org/htdocs/store/includes/functions/get_ca
rtID.php on line 14
Can anyone shed some light on this?
You already have had the right answer, but I think you could consider
adding this line at the top of your PHP script:
ob_start( "ob_gzhandler" );
this enables HTML compression (on browsers that support it) and allows a
much more flexible headers handling because text is sent back to the
browser when your page is complete.
Ciao,
Fabio
--- End Message ---
--- Begin Message ---
output started at
/usr/local/www/vhosts/aurelis.org/htdocs/header_aurelis.php:95
says it all. Look into the file at line 95.
frederik feys wrote:
Hi all,
I’m stuck with this one:
I have an checkout procedure: when people come to the overview page(step
2), they get:
Warning: Cannot add header information - headers already sent by (output
started at
/usr/local/www/vhosts/aurelis.org/htdocs/header_aurelis.php:95) in
/usr/local/www/vhosts/aurelis.org/htdocs/store/includes/functions/get_ca
rtID.php on line 14
header_aurelis.php is where actual html output starts (template)
i had a similar problem in my cart. I solved this by adding at the top
of my script:
$cookie = GetCartId();
This doesn’t do the trick now :-(
For your convenience i put the code here:
http://www.aurelis.org/store/checkout_form.txt
and a handler file:
http://www.aurelis.org/store/checkout_form_handler.txt
Can anyone shed some light on this?
Thanks!
Fré
--- End Message ---
--- Begin Message ---
Hi,
I am using $_SESSION and each php page has session_start() Session
Handling is working fine, except for one problem: when I close my
browser and re-open it again, I am still logged in.
I tested the log in and log out functions and they work fine.
How can I terminate a session when the user closes the browser?
All the while I thought a new session will be initiated when a new
instance of the browser is used to access a page.
Hanxue
--- End Message ---
--- Begin Message ---
make sure the process has terminated.
Lee Hanxue wrote:
Hi,
I am using $_SESSION and each php page has session_start() Session
Handling is working fine, except for one problem: when I close my
browser and re-open it again, I am still logged in.
I tested the log in and log out functions and they work fine.
How can I terminate a session when the user closes the browser?
All the while I thought a new session will be initiated when a new
instance of the browser is used to access a page.
Hanxue
--- End Message ---
--- Begin Message ---
From: "Lee Hanxue" <[EMAIL PROTECTED]>
> I am using $_SESSION and each php page has session_start() Session
> Handling is working fine, except for one problem: when I close my
> browser and re-open it again, I am still logged in.
>
> I tested the log in and log out functions and they work fine.
>
> How can I terminate a session when the user closes the browser?
>
> All the while I thought a new session will be initiated when a new
> instance of the browser is used to access a page.
check that the session.cookie_lifetime hasn't been extended in php.ini,
.htaccess, or your scripts.
---John Holmes...
--- End Message ---
--- Begin Message ---
I am doing a 'readdir' on a subdirectory. I did my file naming counting on
it ordering based on numbering... But when I do the readdir it isn't doing
it. My naming convention 002_2003_66.jpg would indicate the 66th picture for
the month of Feb in 2003. This gave me automatic sorting. So I thought. But
it doesn't seem to be doing it. The server is a linux server
((IStop/Doncaster consulting) and I don't see why the ordering is screwing
up. I checked the create dates and that isn't the ordering choosen (I have
pictures from July showing up between pictures from March).
Thoughts, suggestions?
Katherine
This is the clip of code(srcdir being passed in):
$imgdir = "$srcdir/images";
$txtdir = "$srcdir/txt";
$imgdh = opendir($imgdir);
$txtdh = opendir($txtdir);
while($file = readdir($imgdh)) {
if(substr($file,-3)=="jpg") {
$imgFiles[] = $file;
$textFileName = substr($file,0,-3)."txt";
$textFiles[] = $textFileName;
}
}
--- End Message ---
--- Begin Message ---
> I am doing a 'readdir' on a subdirectory. I did my file naming counting on
> it ordering based on numbering... But when I do the readdir it isn't doing
> it. My naming convention 002_2003_66.jpg would indicate the 66th picture for
> the month of Feb in 2003. This gave me automatic sorting. So I thought. But
> it doesn't seem to be doing it. The server is a linux server
> ((IStop/Doncaster consulting) and I don't see why the ordering is screwing
> up. I checked the create dates and that isn't the ordering choosen (I have
> pictures from July showing up between pictures from March).
>
> Thoughts, suggestions?
>
> Katherine
>
> This is the clip of code(srcdir being passed in):
>
> $imgdir = "$srcdir/images";
> $txtdir = "$srcdir/txt";
> $imgdh = opendir($imgdir);
> $txtdh = opendir($txtdir);
>
> while($file = readdir($imgdh)) {
> if(substr($file,-3)=="jpg") {
> $imgFiles[] = $file;
> $textFileName = substr($file,0,-3)."txt";
> $textFiles[] = $textFileName;
> }
> }
Just sort the $imgFiles array.
--
Lowell Allen
--- End Message ---
--- Begin Message ---
On 12 August 2003 12:50, Katherine Barry wrote:
> I am doing a 'readdir' on a subdirectory. I did my file naming
> counting on it ordering based on numbering... But when I do the
> readdir it isn't doing it. My naming convention 002_2003_66.jpg would
> indicate the 66th picture for the month of Feb in 2003. This gave me
> automatic sorting. So I thought. But it doesn't seem to be doing it.
> The server is a linux server ((IStop/Doncaster consulting) and I
> don't see why the ordering is screwing up.
You can't predict what order the files will be presented in when you do a
readdir -- you'll probably find they're in the same order you get when you
do a raw 'ls' command with no sorting options, which depends on how the OS
allocates space to store directory information (which almost certainly isn't
in the order files are created!). To get them in the order you want, just
sort them in PHP.
The filename format you've chosen is also not good for sorting -- it may be
ok for this year, but when you start creating files in 2004, you'll probably
get an order like:
001_2003_01
001_2003_02
001_2004_01
001_2004_02
002_2003_01
002_2003_02
002_2004_01
002_2004_02
etc.
(i.e. all files for January, subsorted by year, subsubsorted by image
number; then files for February, by year, by image no.; then March, etc.).
I would recommend a format more like yyyy_mm_nn (e.g. 2003_08_66 for 66th
image in August 2003).
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: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
--- End Message ---
--- Begin Message ---
* Thus wrote Katherine Barry ([EMAIL PROTECTED]):
> I am doing a 'readdir' on a subdirectory. I did my file naming counting on
> it ordering based on numbering... But when I do the readdir it isn't doing
> it. My naming convention 002_2003_66.jpg would indicate the 66th picture for
> the month of Feb in 2003. This gave me automatic sorting. So I thought. But
hmm.. this wont sort properly:
002_2003_66.jpg
002_2004_66.jpg
003_2003_66.jpg
Use YEAR_MONTH_NUMBER.jpg
also,
002_2003_123.jpg
002_2003_66.jpg
Isn't entirely what you want.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
Hi,
I am trying to create an HTML form that has several image buttons on it
and the resulting action depends on which button is pressed.
I first tried using <input type="image" name="test" src="...."> but from
IE on the PHP side I only get $_POST['test_x'] and $_POST['test_y']
defined. I therefore don't know which of the buttons on the form was
actually pressed.
I then tried using the <button type="submit" name="test"
value="mytest"><img src="..."></button>
The buttons render fine but when pressed I get $_POST['test'] being the
HTML code between the <button></button> tags and not the value="mytest"
that I defined. (In Mozilla I get the result as expected).
Is there are a better way of doing this? All I want is to know which
button has been clicked on the form. (The form has to be method=POST)
Regards,
--
Abdul-Wahid Paterson
Lintrix Networking & Communications ltd.
Web: http://www.lintrix.net/
Tel: +44 20 8904 2348
Email/Jabber: [EMAIL PROTECTED]
--------------------------------------------------------------------
Web-Hosting | Development | Security | Consultancy | Domains
--------------------------------------------------------------------
--- End Message ---
--- Begin Message ---
From: "Abdul-wahid Paterson" <[EMAIL PROTECTED]>
> I am trying to create an HTML form that has several image buttons on it
> and the resulting action depends on which button is pressed.
>
> I first tried using <input type="image" name="test" src="...."> but from
> IE on the PHP side I only get $_POST['test_x'] and $_POST['test_y']
> defined. I therefore don't know which of the buttons on the form was
> actually pressed.
What do you mean you don't know what button was pressed? You have 'test_x'
and 'test_y' so you know the "test" button was pressed. If you give the
other buttons a different name, you'll have different _x and _y variable
names, so you can still tell which one was pressed.
---John Holmes...
--- End Message ---
--- Begin Message ---
On Tuesday 12 August 2003 8:45, Abdul-wahid Paterson wrote:
[snip]
> Is there are a better way of doing this? All I want is to know which
> button has been clicked on the form. (The form has to be method=POST)
<input type="image" name="test1" src="...">
<input type="image" name="test2" src="...">
Then on the form processing script:
if ($test1_x > -1 && $test1_y > -1) {
// the test1 button was clicked
} else if ($test2_x > -1 && $test2_y > -1) {
// the test2 button was clicked
}
// It should be -1 and not 0 to account for people pressing enter with the
button submitted.
HTH
-Jackson
>
> Regards,
>
> --
> Abdul-Wahid Paterson
>
> Lintrix Networking & Communications ltd.
> Web: http://www.lintrix.net/
> Tel: +44 20 8904 2348
> Email/Jabber: [EMAIL PROTECTED]
> --------------------------------------------------------------------
> Web-Hosting | Development | Security | Consultancy | Domains
> --------------------------------------------------------------------
--
jackson miller
cold feet creative
615.321.3300 / 800.595.4401
[EMAIL PROTECTED]
cold feet presents Emma
the world's easiest email marketing
Learn more @ http://www.myemma.com
--- End Message ---
--- Begin Message ---
Hi,
> What do you mean you don't know what button was pressed? You have 'test_x'
> and 'test_y' so you know the "test" button was pressed. If you give the
> other buttons a different name, you'll have different _x and _y variable
> names, so you can still tell which one was pressed.
Yes, I should have specified more accurately. I have quite a few of
these buttons on one page (approx 30) and really wanted to have the same
name="" for each one and only the value change. The reasoning for that
is most parts of the page are generated from cached content due to heavy
processing requirements on making the whole page.
It is therefore quite difficult for me to change it to something like a
series of name="test1" and name="test2" for all the buttons as the form
being POST'd to would have a hard job trying to work out which names
were valid for the POSTing form.
Regards,
AW
--
Abdul-Wahid Paterson
Lintrix Networking & Communications ltd.
Web: http://www.lintrix.net/
Tel: +44 20 8904 2348
Email/Jabber: [EMAIL PROTECTED]
--------------------------------------------------------------------
Web-Hosting | Development | Security | Consultancy | Domains
--------------------------------------------------------------------
signature.asc
Description: This is a digitally signed message part
--- End Message ---
--- Begin Message ---
From: "Abdul-wahid Paterson" <[EMAIL PROTECTED]>
>> What do you mean you don't know what button was pressed? You have
'test_x'
>> and 'test_y' so you know the "test" button was pressed. If you give the
>> other buttons a different name, you'll have different _x and _y variable
>> names, so you can still tell which one was pressed.
> Yes, I should have specified more accurately. I have quite a few of
> these buttons on one page (approx 30) and really wanted to have the same
> name="" for each one and only the value change. The reasoning for that
> is most parts of the page are generated from cached content due to heavy
> processing requirements on making the whole page.
>
> It is therefore quite difficult for me to change it to something like a
> series of name="test1" and name="test2" for all the buttons as the form
> being POST'd to would have a hard job trying to work out which names
> were valid for the POSTing form.
Diffucult? bah...
<form method="GET" action="page.php">
<input type="image" name="image[button1]" src="pic.gif">
<input type="image" name="image[button2]" src="pic.gif">
<input type="image" name="image[button3]" src="pic.gif">
</form>
Then, on page.php, to figure out what button was chosen, you simply use:
$button = each($_GET['image']);
Now, $button[0] or $button['key'] (whichever you want to use) will have one
of the values of "button1", "button2", or "button3" from your form.
Adapt to your needs.
---John Holmes...
--- End Message ---
--- Begin Message ---
I'm having trouble explaining this so please bare with me.
Say there is a form hosted on server A on a web page
Something simple like
<form action="submit.php" method="post" onSubmit="window.onunload=null;">
<input name="data" size="25" value="" /></td>
<input type="submit" value="submit" />
</form>
I have the data on server B in a mysql database that needs to be inserted via that
form.
I have written a script that will grab one record and submit it via the form.
The only problem is I have to keep going back and refreshing my web page to get it to
submit another record.
Is there a way of doing this? Please note I have no access to Server A so I can't just
edit there database. Does this make sense? :)
Thanks
Kris
--- End Message ---
--- Begin Message ---
If I understand your question correctly it sounds like you want to
populate a database on Server A with data residing in a database on
server B via a form hosted on server A *grin*. Obviously this is
tedious, and if there are a lot of entries then I would suggest writing
a script to populate and submit the form automatically. If you are lucky
everything will be done via HTML GET method (URL parameters); however,
it is more likely that it uses the POST method. You can do some reading
into posting data via HTML request headers, or you can look and see if
there is a class that does what you want in PEAR or PHP Classes.
HTH,
Rob.
On Tue, 2003-08-12 at 10:18, Kris Reid wrote:
> I'm having trouble explaining this so please bare with me.
>
> Say there is a form hosted on server A on a web page
> Something simple like
>
> <form action="submit.php" method="post" onSubmit="window.onunload=null;">
> <input name="data" size="25" value="" /></td>
> <input type="submit" value="submit" />
> </form>
>
>
>
> I have the data on server B in a mysql database that needs to be inserted via that
> form.
> I have written a script that will grab one record and submit it via the form.
> The only problem is I have to keep going back and refreshing my web page to get it
> to submit another record.
>
> Is there a way of doing this? Please note I have no access to Server A so I can't
> just edit there database. Does this make sense? :)
>
> Thanks
>
> Kris
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
--- End Message ---
--- Begin Message ---
Not sure i understand fully the question...however, you can set up your
own error handling and that will allow you to do what you like with all
errors. You can also trigger your own errors (however, this is limited
to a certain type).
http://us2.php.net/manual/en/ref.errorfunc.php
--
BigDog
On Mon, 2003-08-11 at 18:24, [EMAIL PROTECTED] wrote:
> hi there , i am interested to know more about dbx, especially the error
> handling
>
> $link = dbx_connect(DBX_MYSQL, "localhost", "db", "username", "password")
> or die ("Could not connect");
>
> is there such an error feature where it can die to the screen with a custom
> error message instead of doing the error checking for every single query
> and connection ?
>
> and there is also no example of how to get a list of results like
>
> while ($row = $result->fetchRow()) {
>
> }
>
>
--- End Message ---
--- Begin Message ---
I have a webpage written in the latest version of PHP and need a little bit
of help with a rather pesky cache issue. Part of the source code is as
follows:
page.php
<?
echo "<meta http-equiv=pragma content=no-cache>";
echo "<meta http-equiv=expires content='-1'>";
.
.
.
echo "<embed src=filename.mp3 autostart=true>";
?>
The page does not cache (which is good), but the MP3 file does (which is
bad). Is there a way to NOT cache the MP3 file? I would like to keep the
file embedded within the page, if possible. Thanks!
--- End Message ---
--- Begin Message ---
I've been looking and haven't found anything on this. How do you open a file
then select a line and delete that line?
Thanks,
Rod
--- End Message ---
--- Begin Message ---
If your file isn't too large then you can use:
$lineArray = file( $pathToYourFile );
unset( $lineArray[$lineNum - 1] );
if( ($fl = fopen( $pathToYourFile, "w+" )) !== false )
{
foreach( $lineArray as $line )
{
fputs( $fl, $line );
}
fclose( $fl );
}
Note that the above has not been tested. If your file is quite large,
you will probably be better off reading in each line one at a time and
writing out the line to a temporary file when it isn't the line your are
trying to omit. Then replace the original file with the temporary file.
HTH,
Rob.
On Tue, 2003-08-12 at 11:38, Rodney Green wrote:
> I've been looking and haven't found anything on this. How do you open a file
> then select a line and delete that line?
>
> Thanks,
> Rod
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
.---------------------------------------------.
| Worlds of Carnage - http://www.wocmud.org |
:---------------------------------------------:
| Come visit a world of myth and legend where |
| fantastical creatures come to life and the |
| stuff of nightmares grasp for your soul. |
`---------------------------------------------'
--- End Message ---
--- Begin Message ---
> I've been looking and haven't found anything on this. How do you open a file
> then select a line and delete that line?
Warning: untested. This is just to give you a general idea.
$fileName = "blah.txt";
$lineToDelete = "Delete this line";
$fileArray = file( $fileName );
if(( $lineNum = array_search( $lineToDelete, $fileArray )) && ( $lineNum > 0 )) {
$firstPartArray = array_slice( $fileArray, 0, $lineNum );
$secondPartArray = array_slice( $fileArray, $lineNum + 1 );
$fileArray = array_merge( $firstPartArray, $secondPartArray );
$fp = fopen( $fileName, w+ );
fwrite( $fp, implode( '\n', $fileArray ));
}
I'm not too sure if the array_merge() is going to work. I am not sure if
the array_slice() maintains the current key in the new array. If it doesn't,
then you'll end up with jumbled file contents. If this is the case, then
you'll just need to iterate through both new arrays in turn and store the
values in a new array.
$newFileArray = array();
foreach( $firstPartArray as $value ) {
$fileArray[] = $value;
}
foreach( $secondPartArray as $value ) {
$fileArray[] = $value;
}
There might be a better way to do this, but that's the only way that I can
think of personally.
Chris
--- End Message ---
--- Begin Message ---
There is a function called, session_regenerate_id, for php4.3.2 and above.
Right now, it just creates a random id. Is there a way to specify the value
of the regenerated session_id? So I can record the SID before I send out
every time.
I tried,
session_id('id_generated_me');
session_start();
This code does write a new SID, but it also resets the session. Which means
I can't get the data set in the previous session.
I also tried,
session_start();
setcookie(session_name(), SID_generated_by_me );
believe it or not, this just puts another cookie in the client browser with
same "session_name". (I didn't even know that 2 cookies from the same
domain, with same session name is possible, I thought one would just replace
the other) And the session is still reading from the old cookie with the old
SID.
I search through the doc, but have no luck. Any suggestion appreciated.
Thanks.
Tree
--- End Message ---
--- Begin Message ---
* Thus wrote treeml ([EMAIL PROTECTED]):
>
> There is a function called, session_regenerate_id, for php4.3.2 and above.
> Right now, it just creates a random id. Is there a way to specify the value
> of the regenerated session_id? So I can record the SID before I send out
> every time.
>
> I tried,
>
> session_id('id_generated_me');
> session_start();
>
> This code does write a new SID, but it also resets the session. Which means
> I can't get the data set in the previous session.
> I also tried,
Yes, the problem being that you will always start a new session
this way. You'll have to check to see if the session id already has
been setup.
if (! $_COOKIE['id_generated_me']) {
session_id('id_generated_me');
}
Although technically you can record the SID after the session_start.
session_start();
record_the_session(session_id());
>
> session_start();
> setcookie(session_name(), SID_generated_by_me );
>
> believe it or not, this just puts another cookie in the client browser with
> same "session_name". (I didn't even know that 2 cookies from the same
> domain, with same session name is possible, I thought one would just replace
> the other) And the session is still reading from the old cookie with the old
> SID.
Yes this legal, yet it is up to the client to determain what cookie
value to use. and very unpredictable.
HTH,
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--- End Message ---
--- Begin Message ---
I am trying to get a regex to extract the "Some" and "more text"
between the para elements below in a single pass for style attribute of
heading 2
<para font-size="12" font-family="Arial" style="heading 2">Some<anchor
type="bkmrk"/>more text-</para>
<para font-size="12" font-family="Arial" style="heading 2"><inline
caps="false">Some text</inline>more text</para>
Tried something like this for first bit but grabbing the anchor tag
with the text.
|<para(.*)style=\"heading 2\"">(([a-zA-Z0-9/-/_/&\s]+)?)([<anchor
type="bkmrk" name="[a-zA-Z0-9/_]+"/>])?(.*)</para>|
Help much appreciated.
Thanx
--- End Message ---
--- Begin Message ---
Hi,
I use the getdate() function to return today's date in an array. I do this
as I need to separate the day/month/year as to display them in a drop down
combo box in my form. I would like to manipulate my array as such.
1) Find the next Monday (if not already Monday); set the array to this date
2) Add 4 weeks to the above Monday and set another array to this date
any ideas?
Thanks,
Don
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003
--- End Message ---
--- Begin Message ---
Hey Folks:
I'm starting to use PHP 5 on my development machine. The primary XML
parser is changing from expat to libxml. I was curious about the change,
so sought documentation of the new libxml stuff on the PHP site but
haven't been able to find any.
Perhaps someone can steer me toward such documentation and/or answer a
question.
I was thinking that the new XML parser would necessitate scripts use
different function calls. Or will the main functions and behavior remain
the same, but only the library be changed?
If the functions will indeed be different, is there some place to find
docs about these new procedures? They don't have to be great, just give
me an idea of how to start hacking something simple.
Thanks,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
--- End Message ---
--- Begin Message ---
Hi All-
I was wondering if anyone had any suggestions on how to properly
authenticate users using redhat php and mysql. Currently we are using
.htaccess files, but I was thinking it may be easier to manage this via
a php/mysql admin interface... I imagine plenty of authentication
schemes have been put in place but which one might be the best?
Opinions?
Thanks,
Matt
--- End Message ---
--- Begin Message ---
Hello,
I have a class that just does that ::
http://www.devhome.org/php/scripts/authlib.html
----- Original Message -----
From: "Matt Babineau" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, August 12, 2003 8:30 AM
Subject: [PHP] How to Authenitcate using PHP (RH9, PHP
4.3.2, MySQL 4)
> Hi All-
>
> I was wondering if anyone had any suggestions on how
to properly
> authenticate users using redhat php and mysql.
Currently we are using
> .htaccess files, but I was thinking it may be easier
to manage this via
> a php/mysql admin interface... I imagine plenty of
authentication
> schemes have been put in place but which one might
be the best?
> Opinions?
>
> Thanks,
> Matt
>
>
=====
Mukul Sabharwal ([EMAIL PROTECTED])
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--- End Message ---
--- Begin Message ---
Hi,
I have two functions in a class where one calls the other. When creating my
object I get an error:
"Call to undefined function"
I dont understand why the function can't be seen?
Thanks,
Don
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.507 / Virus Database: 304 - Release Date: 8/4/2003
--- End Message ---
--- Begin Message ---
> I have two functions in a class where one calls the other. When creating my
> object I get an error:
> "Call to undefined function"
> I dont understand why the function can't be seen?
You'll need to prepend "$this->" to the function call.
class bob {
function firstFunction() {
}
function secondFunction() {
$this->firstFunction();
}
}
Chris
--- End Message ---
--- Begin Message ---
Apache not running as root is a good thing, but probably is... Since
it appears you are not the admin of the box, ask them to install
Webmin (http://www.webmin.org/webmin) and to give your userid access
to the ssh component.
Webmin is installed, it's just not turned on. I am the administrator of
the machine.
I think he wants to do it from Apache /only/, instead of dragging a
monitor/keyboard to the computer. But Apache is not running as root.
Yes! I want to do a php script that somehow login as root (since apache
is not running as root). Then I want it to start sshd.
I wonder how you can kill ssh. I ssh to my computer 24/7 and never
have I killed it.
I changed some settings and used "killall -HUP sshd" like I've done many
times before. Sure the session is killed, but I've been able to connect
it again... just not this time.
//Simon
--- End Message ---
--- Begin Message ---
Hi everybody,
I have defined function
function func ($var,$val,&$struct){
// do something
}
if I call this function following way
func('a','b',NULL);
(because sometimes I don't need to set $struct)
apache process (php) crashes without saying word into log...
So, is it bug or feature.
in fact 'func' is method of class and when it's called via :: it uses
$struct otherwise not
php is compiled into httpd
apache is 1.3.27
info of my php follows
PHP Version 4.3.2
'./configure' '--with-config-file-path=/net/etc/conf'
'--with-apache=../apache' '--enable-sockets' '--enable-ftp'
'--with-freetype-dir=/usr' '--with-mysql=/usr' '--enable-gd-native-ttf'
'--with-gd' '--enable-exif' '--with-jpeg-dir=/usr' '--with-png-dir=/usr'
'--with-zlib' '--enable-inline-optimization' '--enable-sysvsem'
'--enable-sysvshm' '--with-xpm-dir=/usr' '--enable-dbx'
PHP API 20020918
PHP Extension 20020429
EXT: ... ionCube PHP Accelerator v1.3.3r2, Copyright (c) 2001-2002, by
Nick Lindridge
BTW: it would be perfect to have function overloading ...
--
Mirek Novak
jabberID: [EMAIL PROTECTED]
ICQ: 119499448
--- End Message ---
--- Begin Message ---
You cannot pass NULL, where a 'reference' was
exptected, it is not legal. Just as any other
constant.
NULL is a constant.
function myfunc(&$p) { ... }
$v = NULL; // passing NULL
myfunc($x);
Mukul Sabharwal
http://www.devhome.org
----- Original Message -----
From: "Mirek Novak" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Tuesday, August 12, 2003 12:06 PM
Subject: [PHP] prob. with function parameter with "&"
> Hi everybody,
>
> I have defined function
>
> function func ($var,$val,&$struct){
> // do something
> }
>
> if I call this function following way
>
> func('a','b',NULL);
>
=====
Mukul Sabharwal ([EMAIL PROTECTED])
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--- End Message ---
--- Begin Message ---
I'm attempting to read a remote file and parse it for data. The problem I've
having is that the file seems to be generated by Perl
(http://alert.dot.pima.gov/scripts/1brpssd.pl) and when I read it the
script-generated portion is not available. When I view the page with a
browser it is displayed just fine. I've tried using the built-in PHP
commands (file, fget, fopen, fsockopen) as well as the Snoopy "fetch"
classes (http://snoopy.sourceforge.net). Any ideas?
Thanks.
MD
--- End Message ---
--- Begin Message ---
[snip]
I'm attempting to read a remote file and parse it for data. The problem
I've
having is that the file seems to be generated by Perl
(http://alert.dot.pima.gov/scripts/1brpssd.pl) and when I read it the
script-generated portion is not available. When I view the page with a
browser it is displayed just fine. I've tried using the built-in PHP
commands (file, fget, fopen, fsockopen) as well as the Snoopy "fetch"
classes (http://snoopy.sourceforge.net). Any ideas?
[/snip]
Try cURL http://us2.php.net/curl
Have a pleasant and productive day
--- End Message ---