php-general Digest 3 Feb 2005 11:23:30 -0000 Issue 3265

Topics (messages 207942 through 207979):

newbie question ; calling php script with parrameters from html
        207942 by: Sagaert Johan
        207945 by: Chris W. Parker
        207946 by: Mirco Blitz

Re: How to make binary strings useful?
        207943 by: Jerry Miller
        207947 by: Chris
        207948 by: Jason Wong
        207949 by: Jerry Miller
        207950 by: DvDmanDT
        207951 by: Jason Wong
        207952 by: DvDmanDT
        207953 by: DvDmanDT

Re: Need help with ereg regular expression
        207944 by: Jason Wong
        207975 by: Jochem Maas
        207976 by: Jochem Maas
        207977 by: Jochem Maas
        207978 by: Jason Wong
        207979 by: Jochem Maas

Using SELECT IN with arrays
        207954 by: W Luke
        207955 by: Jason Wong
        207959 by: W Luke

problems with session timeout
        207956 by: Pedro Henrique Calais
        207958 by: Jason Wong

Is there a function to c if a php function exists
        207957 by: Ben Edwards (lists)
        207960 by: The Disguised Jedi
        207961 by: Jason Barnett

Headers already sent error
        207962 by: Tim Burgan
        207963 by: Robby Russell
        207968 by: Chris

Re: What's wrong with this rewrite rule?
        207964 by: Matthew Weier O'Phinney

Re: Multiline data Insert Into table from a generated form?
        207965 by: Alp

Re: Multiline data Insert - Resolved
        207966 by: Alp

Reading a .doc or .rtf file in php
        207967 by: sunil

Re: PEAR::SOAP returns objects instead of associative arrays
        207969 by: Jochem Maas

Howto disable echo back in windows?
        207970 by: Unreal HSHH
        207974 by: Jochem Maas

Hoe does that work -> http://www.domainname.con/?var=lakjhd (instead of 
http://www.domainname.con/file.php?var=lakjhd)?
        207971 by: symbulos partners
        207972 by: Unreal HSHH
        207973 by: Chris Ramsay

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
can i use this kind of construction in my html code ?

<a href="test.php?selection=high">Select high</a>


if yes , how do i retrieve the passed string in the php code

Johan

--- End Message ---
--- Begin Message ---
Sagaert Johan <mailto:[EMAIL PROTECTED]>
    on Wednesday, February 02, 2005 2:38 AM said:

> can i use this kind of construction in my html code ?
> 
> <a href="test.php?selection=high">Select high</a>

Yes.

> if yes , how do i retrieve the passed string in the php code

<?php

        $value = $_GET['selection'];

?>

Be sure to validate the data first though.



Chris.

--- End Message ---
--- Begin Message ---
Hi,
There are multiple Ways of getting that string.
If your PHP-Server has globals=on in php ini you will recive that string in
$selection variable.

If not you recive it in $_GET["selection"]

So I use a function to handle POST and GET Variabels.

   function getpost_ifset($test_vars)
    {
        $return = FALSE;
          if (!is_array($test_vars)) 
          {$test_vars = array($test_vars);}
                                
        foreach($test_vars as $test_var) {
            if (isset($_POST[$test_var])) {
                global $$test_var;
                $$test_var = $_POST[$test_var];
                                                                $return =
TRUE;
            } elseif (isset($_GET[$test_var])) {
                global $$test_var;
                $$test_var = $_GET[$test_var];
                                                                $return =
TRUE;
            }
        }
                                return $return;
    } 

If i now want to get a ariable i either POST or GET from an URL i don't care
if POST or GET.
I just do

getpost_ifset("selection");

and then I have a variable called $selection in my code with the given
value.

You could also do something like this.

if(getpos_ifset("selection"))
{
        echo "Selection variable is there with value: ".$selection;
}
else
{
        echo "No Selection Variable givin in Link";
}

Hope that helps.
Mirco Blitz
-----Ursprüngliche Nachricht-----
Von: Sagaert Johan [mailto:[EMAIL PROTECTED] 
Gesendet: Mittwoch, 2. Februar 2005 11:38
An: php-general@lists.php.net
Betreff: [PHP] newbie question ; calling php script with parrameters from
html

can i use this kind of construction in my html code ?

<a href="test.php?selection=high">Select high</a>


if yes , how do i retrieve the passed string in the php code

Johan

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

--- End Message ---
--- Begin Message ---
There's a FAQ section entitled "PHP and Other Languages,"
C isn't even listed among them!

--- End Message ---
--- Begin Message --- I've written complete file parsers in PHP, and the only snag I've run into is dealing Signed integers (and larger).


Jerry Miller wrote:

Is there an example of the UNIX od utility written
in PHP?  Is such a useful task even possible??
From what I've seen of strings, they're completely
opaque, so what good does it do to be able to read
binary-safe strings from a file???


the pack() and unpack() functions are used to remove data from and place data into binary strings.

Even the deprecated
(why????) $str{$inx} notation apparently results in
another string, because trying to printf it with the
"%02x" format always comes out with "00."  (Maybe
that's why -- it's useless!)

$str{$inx} does return a single character string, in order to get the numerical value, try using ord()

As an experienced C
programmer, I'm finding PHP to be as counter-intuitive
for low-level work as Perl is.

I need to convert binary
dumps of data structures into database table rows, and
MySQL on my server doesn't support queries from C.

I thought about writing a CGI script (in C) that
would generate the hard-coded PHP output for
each instance, but a URL that ends in ".cgi" is
never intercepted by the PHP interpreter.  Worse
yet, the <SCRIPT LANGUAGE="" SRC="">
that works perfectly well with JavaScript is
likewise ignored if the language is PHP!  Finally,
I'm not aware of a Content-type such as "text/php."
What exactly was the purpose of designing yet
another inflexible language?!




Chris

http://www.php.net/pack
http://www.php.net/unpack
http://www.php.net/ord
http://www.php.net/chr

--- End Message ---
--- Begin Message ---
On Thursday 03 February 2005 07:00, Jerry Miller wrote:
> There's a FAQ section entitled "PHP and Other Languages,"
> C isn't even listed among them!

Neither is Prolog, Pascal, ADA, ...,

The point you seem to be missing is that PHP is geared mainly towards creating 
web pages, that's why ASP, Perl, and Cold Fusion are listed.

-- 
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
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
That should help.  Thanks.

"Chris" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I've written complete file parsers in PHP, and the only snag I've run
> into is dealing Signed integers (and larger).
>
>
> Jerry Miller wrote:
>
> >Is there an example of the UNIX od utility written
> >in PHP?  Is such a useful task even possible??
> >>From what I've seen of strings, they're completely
> >opaque, so what good does it do to be able to read
> >binary-safe strings from a file???
> >
>
> the pack() and unpack() functions  are used to remove data from and
> place data into binary strings.
>
> >Even the deprecated
> >(why????) $str{$inx} notation apparently results in
> >another string, because trying to printf it with the
> >"%02x" format always comes out with "00."  (Maybe
> >that's why -- it's useless!)
> >
> $str{$inx} does return a single character string, in order to get the
> numerical value, try using ord()
>
> >As an experienced C
> >programmer, I'm finding PHP to be as counter-intuitive
> >for low-level work as Perl is.
> >
> >I need to convert binary
> >dumps of data structures into database table rows, and
> >MySQL on my server doesn't support queries from C.
> >
> >I thought about writing a CGI script (in C) that
> >would generate the hard-coded PHP output for
> >each instance, but a URL that ends in ".cgi" is
> >never intercepted by the PHP interpreter.  Worse
> >yet, the <SCRIPT LANGUAGE="" SRC="">
> >that works perfectly well with JavaScript is
> >likewise ignored if the language is PHP!  Finally,
> >I'm not aware of a Content-type such as "text/php."
> >What exactly was the purpose of designing yet
> >another inflexible language?!
> >
> >
> >
>
> Chris
>
> http://www.php.net/pack
> http://www.php.net/unpack
> http://www.php.net/ord
> http://www.php.net/chr

--- End Message ---
--- Begin Message ---
It's a pretty big difference, so there's logic for that.. You can't really
compare them.. Not in my opinion anyway..

-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
"Jerry Miller" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> There's a FAQ section entitled "PHP and Other Languages,"
> C isn't even listed among them!

--- End Message ---
--- Begin Message ---
On Thursday 03 February 2005 05:46, Jerry Miller wrote:
> Here's the code (with the domain name removed)
> that doesn't work, "despite" the poor documentation
> of the variable types:

>         $filename = sprintf ("%s%s", $dir, $file);

Wouldn't

  $filename = $dir . $file;

be easier?

>         printf ("%02x %02x %02x %02x", $cont{0}, $cont{1}, $cont{2},
> $cont{3});

What is happening here is that (as stated in the manual) the format code '%x' 
will treat the argument ($cont{1}) as an integer and display in hex format. 
Because $cont{x} is a string, PHP's auto type conversion kicks in. So for 
example $cont{1} is 'E', coverting to integer makes it 0 (zero), hence what 
you are seeing.

> Here's the output of "od -c glance_date" up to the fourth byte:
>
> 0000000 177   E   L   F
>
> All four bytes are non-zero!

What you need is something like:

  printf ("%02x %02x %02x %02x", ord($cont{0}), ord($cont{1}), ord($cont{2}), 
ord($cont{3}));

Also check out unpack().

-- 
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
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
You should use ord() on each of the $cont{} ones..

         printf ("%02x %02x %02x %02x", ord($cont{0}), ord($cont{1}),
ord($cont{2}), ord($cont{3}));

That'll probably work much better..

..

PHP != C++, or C for that matter.. C was designed to be as close as possible
to ASM, but high-level.. PHP is designed to be an easy to use web
application language.. One char in PHP is a string with the length of 1, not
a small integer.. Meaning that 'a' != 67 in php.. In C they would be equal..
Strings will be converted to integers by php, but you won't get the ascii
code, you'll get something like the results of atoi() or something like
that..
-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
"Jerry Miller" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Here's the code (with the domain name removed)
> that doesn't work, "despite" the poor documentation
> of the variable types:
>
> <?
>         $dir = "/home/<domain_name>/www/binary/";
>         $dh = opendir ($dir);
>         do
>         {
>                 $file = readdir ($dh);
>         }
>         while (!strncmp ($file, ".", 1));
>         $filename = sprintf ("%s%s", $dir, $file);
>         $fh = fopen ($filename, "r");
>         $cont = fread ($fh, 4);
>         echo "file:<BR>";
>         echo $filename;
>         echo "<BR>cont:<BR>";
>         printf ("%02x %02x %02x %02x", $cont{0}, $cont{1}, $cont{2},
> $cont{3});
>         fclose ($fh);
>         closedir ($dh);
> ?>
>
> Here's the output of "od -c glance_date" up to the fourth byte:
>
> 0000000 177   E   L   F
>
> All four bytes are non-zero!

--- End Message ---
--- Begin Message ---
PHP files can be named whatever you want.. Just know that they are parsed on
the serverside, not the client side.. Therefore, text/php would be pretty
stupid to do.. And I don't know what you mean be that <script> thing, you
probably don't even understand what PHP is when you make that statement..

There's no problem with PHP.. I've done lots of binary work with it without
problems.. And I do have some experience with C as well.. And with C++.. You
probably just don't understand the idea of PHP.. The idea is definitly not
to be another C or C++.. It's to be an easy, but powerful, webscripting
language.. And it is..

-- 
// DvDmanDT
MSN: dvdmandt¤hotmail.com
Mail: dvdmandt¤telia.com
"Jerry Miller" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> Is there an example of the UNIX od utility written
> in PHP?  Is such a useful task even possible??
> From what I've seen of strings, they're completely
> opaque, so what good does it do to be able to read
> binary-safe strings from a file???  Even the deprecated
> (why????) $str{$inx} notation apparently results in
> another string, because trying to printf it with the
> "%02x" format always comes out with "00."  (Maybe
> that's why -- it's useless!)  As an experienced C
> programmer, I'm finding PHP to be as counter-intuitive
> for low-level work as Perl is.  I need to convert binary
> dumps of data structures into database table rows, and
> MySQL on my server doesn't support queries from C.
>
> I thought about writing a CGI script (in C) that
> would generate the hard-coded PHP output for
> each instance, but a URL that ends in ".cgi" is
> never intercepted by the PHP interpreter.  Worse
> yet, the <SCRIPT LANGUAGE="" SRC="">
> that works perfectly well with JavaScript is
> likewise ignored if the language is PHP!  Finally,
> I'm not aware of a Content-type such as "text/php."
> What exactly was the purpose of designing yet
> another inflexible language?!

--- End Message ---
--- Begin Message ---
On Thursday 03 February 2005 03:44, KHS wrote:

> >On the other hand, I think you could safely do:
> >
> >$regex = "^#include(.*)$";
> >
> >and get what you want by using trim on the captured expression.
>
> no this would leave me with <, >, and " marks.

Then string replace those characters. Or am I missing something terribly 
obvious?

-- 
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
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message --- John Nichel wrote:
Arrrrrgggggghhhhhhh....return receipts!!!!


indeed - I believe there was an informal decision that everyone should actually return the requested reciept - the idea being that 1000+ reciepts will probably make said person change their ways.....

I notice that KHS (the OP) didn't seem to have return reciepts on on his subsequent posts ;-)
--- End Message ---
--- Begin Message --- Mikey wrote:
Arrrrrgggggghhhhhhh....return receipts!!!!


I just mailed the guy and gave him a friendly nod - they are off now :-)

damn ;-) I was hoping a barrage of RRs would be what made him turn them off. oh well on to the next victim ;-)


Mikey


--- End Message ---
--- Begin Message --- Jason Wong wrote:
On Thursday 03 February 2005 02:18, John Nichel wrote:

Arrrrrgggggghhhhhhh....return receipts!!!!


Use a *real* mail client -- one that ignores those stupid things.


Jason, I use Thunderbird - AFAICT its pretty real, BUT I have to have allow return reciepts because of other things/work I do - turning them off is not an option for me - this may also be the case for others, of course if you are using Outlook out of your own free will (as opposed to having it forced on you by corporation suits) then I guess your point sticks :-).

--- End Message ---
--- Begin Message ---
On Thursday 03 February 2005 18:08, Jochem Maas wrote:

> Jason, I use Thunderbird - AFAICT its pretty real, BUT I have to have
> allow return reciepts because of other things/work I do - turning them off
> is not an option for me

I can understand it if it's to enable scheduling features. However if it's to 
inform people that you've received their mail, or read their mail, or (gasp) 
deleted their mail without reading it (because you've already read in the 
preview pane) then that is totally dumb (with a capital D (& U & M & B & A 
& ...))

-- 
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
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message --- Jason Wong wrote:
On Thursday 03 February 2005 18:08, Jochem Maas wrote:


Jason, I use Thunderbird - AFAICT its pretty real, BUT I have to have
allow return reciepts because of other things/work I do - turning them off
is not an option for me


I can understand it if it's to enable scheduling features. However if it's to inform people that you've received their mail, or read their mail, or (gasp) deleted their mail without reading it (because you've already read in the preview pane) then that is totally dumb (with a capital D (& U & M & B & A & ...))


well actually in my case its company policy to honour read reciepts to a number of clients..... they are:

a, rich - and we want their business (telling them to turn that shit off is not 
an option)
b, they have no f***** idea about setting up their apps/system properly

but then again I kind of take pleasure in returning a read reciept to
someone who has sent an email to a mailing list - the vision of them recieving 
1000s
of receipts I find very amusing :-)

as a side note - how come your [EMAIL PROTECTED] address always bounces?
--- End Message ---
--- Begin Message ---
Hi.

I'm trying to execute a query which does a SELECT IN on an
array...here's how it stands:

$doms = implode( "','", $domarray );

$d=$_GET['d']

$qmailsql = "SELECT mq.id,
mq.user,
mq.domain,
mq.sender,
mq.arrive_time,
mq.subject,
mq.body_preview,
mq.relay
FROM mail_quarantine AS mq
WHERE  //??
ORDER BY mq.arrive_time DESC LIMIT 50";

$doms is a "master array" of a user's domains.  $d is a
comma-seperated and unexploded list of domains to filter the SELECT
down with.  (error checking is already in place)

So basically I need to find *all* domains in $d (dom1.com,dom2.net)
which appear in $doms, then extract all the other info
(mq.user,mq.sender etc).

I've spent all day trying to work it out, but I think my *logic* is
wrong...any ideas much appreciated

Thanks
-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

--- End Message ---
--- Begin Message ---
On Thursday 03 February 2005 07:58, W Luke wrote:

> $doms is a "master array" of a user's domains.  $d is a
> comma-seperated and unexploded list of domains to filter the SELECT
> down with.  (error checking is already in place)

1) make both $d and $doms into array
2) use array_intersect() to find the $d's that match $doms
3) convert the matches into a comma separated string with single quotes around 
the individual values
4) SELECT blah WHERE domain IN(comma separated string with single quotes 
around the individual values)

> So basically I need to find *all* domains in $d (dom1.com,dom2.net)
> which appear in $doms, 
>
> then extract all the other info 
> (mq.user,mq.sender etc).

-- 
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
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
On Thu, 3 Feb 2005 08:37:44 +0800, Jason Wong <[EMAIL PROTECTED]> wrote:

> > $doms is a "master array" of a user's domains.  $d is a
> > comma-seperated and unexploded list of domains to filter the SELECT
> > down with.  (error checking is already in place)
> 
> 1) make both $d and $doms into array
> 2) use array_intersect() to find the $d's that match $doms
> 3) convert the matches into a comma separated string with single quotes around
> the individual values
> 4) SELECT blah WHERE domain IN(comma separated string with single quotes
> around the individual values)

Wicked - thanks Jason

-- 
Will   The Corridor of Uncertainty   http://www.cricket.mailliw.com/
 - Sanity is a madness put to good use -

--- End Message ---
--- Begin Message ---
hey everybody,

I'm with the following problem:
my PHP scripts takes a very long time to execute (about 3 hours) because 
it has has system call to a perl script that is very time consuming.

in IE (haven't noticed this in Mozilla or Konqueror) the execution of
the PHP script doesn't finish, due to session expiry I think.

I've searched on the net and I've found some PHP
functions, like set_time_limit, but all of them
DON'T consider external time, like I/O time
or a system call time. So increasing this 
time wouldn't help me.

Can anyone help?

Thanks,
______________________________________
Pedro Henrique Calais - [EMAIL PROTECTED]
Ciźncia da Computaēćo / UFMG - 5° perķodo
e-Speed / DCC / UFMG

--- End Message ---
--- Begin Message ---
On Thursday 03 February 2005 10:05, Pedro Henrique Calais wrote:

> I'm with the following problem:
> my PHP scripts takes a very long time to execute (about 3 hours) because
> it has has system call to a perl script that is very time consuming.
>
> in IE (haven't noticed this in Mozilla or Konqueror) the execution of
> the PHP script doesn't finish, due to session expiry I think.

I believe IE has a hard-coded timeout limit, nothing you can do about it. You 
could try to circumvent it by having your script output something (anything) 
at a regular interval. But that may not be possible if your php script itself 
is locked up waiting for the perl script.

> I've searched on the net and I've found some PHP
> functions, like set_time_limit, but all of them
> DON'T consider external time, like I/O time
> or a system call time. So increasing this
> time wouldn't help me.

Checkout ignore_user_abort().

-- 
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
------------------------------------------
New Year Resolution: Ignore top posted posts

--- End Message ---
--- Begin Message ---
I have been implementing a system on a different ISP than I normally use
and have got:-

Fatal error: Call to undefined function: cal_days_in_month()
in 
/home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php 
on line 134

I found a reference to this an the web and it seems PHP is not compiled
with calender support.

"recompile php with the "--enable-calendar" option."

Cant see being able to get the to re-compile PHP so I guess I am going
to have to disable the feature.  I seem to remember a while ago seeing a
function to test weather a function exists in PHP.  That way I can have
the relevant validation skipped if the function is missing (I will tell
the client if they get decent hosting it will start working).

So something like 

  function_exists(  cal_days_in_month() )

Anyone know what the function is called.

Ben
-- 
Ben Edwards - Poole, UK, England
If you have a problem sending me email use this link
http://www.gurtlush.org.uk/profiles.php?uid=4
(email address this email is sent from may be defunct)

Attachment: signature.asc
Description: This is a digitally signed message part


--- End Message ---
--- Begin Message ---
The function is called function_exists.  Honestly, just look at the
manual dude....


On Tue, 01 Feb 2005 20:33:11 +0000, Ben Edwards (lists)
<[EMAIL PROTECTED]> wrote:
> I have been implementing a system on a different ISP than I normally use
> and have got:-
> 
> Fatal error: Call to undefined function: cal_days_in_month()
> in 
> /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php
>  on line 134
> 
> I found a reference to this an the web and it seems PHP is not compiled
> with calender support.
> 
> "recompile php with the "--enable-calendar" option."
> 
> Cant see being able to get the to re-compile PHP so I guess I am going
> to have to disable the feature.  I seem to remember a while ago seeing a
> function to test weather a function exists in PHP.  That way I can have
> the relevant validation skipped if the function is missing (I will tell
> the client if they get decent hosting it will start working).
> 
> So something like
> 
>   function_exists(  cal_days_in_month() )
> 
> Anyone know what the function is called.
> 
> Ben
> --
> Ben Edwards - Poole, UK, England
> If you have a problem sending me email use this link
> http://www.gurtlush.org.uk/profiles.php?uid=4
> (email address this email is sent from may be defunct)
> 
> 
> 


-- 
The Disguised Jedi
[EMAIL PROTECTED]

PHP rocks!
"Knowledge is Power.  Power Corrupts.  Go to school, become evil"

Disclaimer: Any disclaimer attached to this message may be ignored.
This message is Certified Virus Free

--- End Message ---
--- Begin Message ---
Ben Edwards wrote:
...

So something like

function_exists( cal_days_in_month() )

http://www.php.net/manual/en/function.function-exists.php

And to check if a specific extension is enabled:

http://www.php.net/manual/en/function.extension-loaded.php


-- Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://www.php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
--- End Message ---
--- Begin Message ---
Hello,


I'm receiving an error "Cannot modify header information - headers already sent by XXX".

In my php, I have a heap of code, then use header("Location: blah.php"); to redirect the user. I get this error on the webhost, but not on my local host.

I've searched and found that this can be caused by spaces after the closing php tag, but I don't have any.

What could this be?


Tim
--- End Message ---
--- Begin Message ---
On Thu, 2005-02-03 at 12:59 +1030, Tim Burgan wrote:
> Hello,
> 
> 
> I'm receiving an error "Cannot modify header information - headers 
> already sent by XXX".
> 
> In my php, I have a heap of code, then use header("Location: blah.php"); 
> to redirect the user. I get this error on the webhost, but not on my 
> local host.
> 
> I've searched and found that this can be caused by spaces after the 
> closing php tag, but I don't have any.
> 
> What could this be?
> 
> 
> Tim
> 

try adding:

ob_start();

to the top of your file

-Robby

-- 
/***************************************
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
* --- Now hosting PostgreSQL 8.0! ---
****************************************/

--- End Message ---
--- Begin Message ---
Tim Burgan wrote:

Hello,


I'm receiving an error "Cannot modify header information - headers already sent by XXX".

In my php, I have a heap of code, then use header("Location: blah.php"); to redirect the user. I get this error on the webhost, but not on my local host.

I've searched and found that this can be caused by spaces after the closing php tag, but I don't have any.

What could this be?


Tim

Rest assured, *something* is getting output before you try that header() call. Anything outside of PHP tags (carriage rturns/line feeds/spaces) any echo or print.

To help you figure it out, try doing something like exit('STARTOFBODY'); instead of the header call. Then view the source of the ouput and see what precedes that

Chris
--- End Message ---
--- Begin Message ---
* Michael <[EMAIL PROTECTED]>:
> Chris W. Parker wrote:
> > and it's driving me insane. I've got plenty of other rewrite rules
> > working perfectly. Here is the rule in question.
> > 
> > RewriteRule ^detail\.asp\?product_id=([\w-]+)$ product.php?id=$1
>
> You're insisting that the path to rewrite start with d. It's not going 
> to start with d, it's going to start with /. As in "/detail.asp"...

Actually, that's not always the case. I was recently working on some
rewrite rules, under the assumption that they would start with '/' -- an
erroneous assumption as it turned out. RewriteLog showed me why...

-- 
Matthew Weier O'Phinney           | mailto:[EMAIL PROTECTED]
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

--- End Message ---
--- Begin Message ---
Hi Mike,

PHP returns a parse error indicating the line number for the while (.....) !
Code now is:
function add_to_database( $tourid, $dayno, $fromto, $bld, $descrip,
&$dberror)
 {
 //user connection section--begin
 $username="root";
 $password="";
 $database="nazardane";
 $link = mysql_pconnect("localhost", $username, $password);
 if ( ! $link )
  {
  $dberror = "Couldn't connect to MySQL server";
  return false;
  }
 if ( ! mysql_select_db( $database, $link))
  {
  $dberror = mysql_error();
  return false;
  }
 while ($c=0;$c<count($_POST['tourid']):$c++) {
  if ($_POST['tourid'][$c]!="" && $_POST['dayno'][$c]!="" &&
$_POST['fromto'][$c]!="" && $_POST['bld'][$c]!="" &&
$_POST['descrip'][$c]!=""){
   $sql = "INSERT INTO tour_details ('tour_id'. 'dayno', 'fromto', 'bld',
'descrip') VALUES ('{$_POST['tourid'][$c]}'. '{$_POST['dayno'][$c]}',
'{$_POST['fromto'][$c]}', '{$_POST['bld'][$c]}',
'{$_POST['descrip'][$c]}')\n";
  }
  if (! mysql_query($sql, $link))
   {
   $dberror = mysql_error();
   return false;
   }
 }
 $lastinsertid = mysql_insert_id();

 return true;
 }

Actually the form is posted to itself. What could be the problem now?

Thanks in advance.

Alp

"Mike Smith" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > Code:
> >  print '<table width="545" border="0" cellspacing="0" cellpadding="0"
> > align="center"><tr>';
> >  print '<form action="test1.php" method="POST">';
> >  $i = 1;
> >  while ($i <= $tour_days) {
> >   print '<input type="hidden" name="tourdays" value="'.$tour_days.'">';
> >   print '<input type="hidden" name="tourid'.$i.'"
value="'.$tour_id.'">';
> >   $days = ("Day&nbsp;0".$i);
> >   print $days;
> >   print '<input type="hidden" name="dayno'.$i.'" value="'.$days.'">';
> >   print '</td>';
> >   print '<input type="text" name="fromto'.$i.'" size="50"></td>';
> >   print '<input type="text" name="bld'.$i.'" size="10"></td></tr>';
> >   print '<tr><td colspan="3">';
> >   print '<textarea name="descrip'.$i.'" rows="5" cols="80"
> > wrap="virtual"></textarea></td></tr>';
> >   $i++;
> >   }
> >  print '</table>';
> >  print "<input type=\"submit\" value=\"submit!\">\n</form>\n";
>
> Change the field names to arrays (i.e. "tourid".$i becomes tourid[]
>
> When you POST loop through the array:
>
> while($c=0;$c<count($_POST['tourid']):$c++){
>     If($_POST['tourid'][$c]!=""...){
>         $sql = "INSERT INTO reservations ('tourid'...) VALUES
> ('{$_POST['tourid'][$c]}'...)\n";
>     }
> }

--- End Message ---
--- Begin Message ---
Hi Mike,

Resolved it. Well, actually your code is a 'for' rather than a 'while' which
I realized a bit late. :-) And there were two fullstops that needed to be a
comma. Now it works.

Thanks a lot for your guidance.

Alp

"Alp" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi Mike,
>
> PHP returns a parse error indicating the line number for the while (.....)
!
> Code now is:
> function add_to_database( $tourid, $dayno, $fromto, $bld, $descrip,
> &$dberror)
>  {
>  //user connection section--begin
>  $username="root";
>  $password="";
>  $database="nazardane";
>  $link = mysql_pconnect("localhost", $username, $password);
>  if ( ! $link )
>   {
>   $dberror = "Couldn't connect to MySQL server";
>   return false;
>   }
>  if ( ! mysql_select_db( $database, $link))
>   {
>   $dberror = mysql_error();
>   return false;
>   }
>  while ($c=0;$c<count($_POST['tourid']):$c++) {
>   if ($_POST['tourid'][$c]!="" && $_POST['dayno'][$c]!="" &&
> $_POST['fromto'][$c]!="" && $_POST['bld'][$c]!="" &&
> $_POST['descrip'][$c]!=""){
>    $sql = "INSERT INTO tour_details ('tour_id'. 'dayno', 'fromto', 'bld',
> 'descrip') VALUES ('{$_POST['tourid'][$c]}'. '{$_POST['dayno'][$c]}',
> '{$_POST['fromto'][$c]}', '{$_POST['bld'][$c]}',
> '{$_POST['descrip'][$c]}')\n";
>   }
>   if (! mysql_query($sql, $link))
>    {
>    $dberror = mysql_error();
>    return false;
>    }
>  }
>  $lastinsertid = mysql_insert_id();
>
>  return true;
>  }
>
> Actually the form is posted to itself. What could be the problem now?
>
> Thanks in advance.
>
> Alp
>
> "Mike Smith" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > > Code:
> > >  print '<table width="545" border="0" cellspacing="0" cellpadding="0"
> > > align="center"><tr>';
> > >  print '<form action="test1.php" method="POST">';
> > >  $i = 1;
> > >  while ($i <= $tour_days) {
> > >   print '<input type="hidden" name="tourdays"
value="'.$tour_days.'">';
> > >   print '<input type="hidden" name="tourid'.$i.'"
> value="'.$tour_id.'">';
> > >   $days = ("Day&nbsp;0".$i);
> > >   print $days;
> > >   print '<input type="hidden" name="dayno'.$i.'" value="'.$days.'">';
> > >   print '</td>';
> > >   print '<input type="text" name="fromto'.$i.'" size="50"></td>';
> > >   print '<input type="text" name="bld'.$i.'" size="10"></td></tr>';
> > >   print '<tr><td colspan="3">';
> > >   print '<textarea name="descrip'.$i.'" rows="5" cols="80"
> > > wrap="virtual"></textarea></td></tr>';
> > >   $i++;
> > >   }
> > >  print '</table>';
> > >  print "<input type=\"submit\" value=\"submit!\">\n</form>\n";
> >
> > Change the field names to arrays (i.e. "tourid".$i becomes tourid[]
> >
> > When you POST loop through the array:
> >
> > while($c=0;$c<count($_POST['tourid']):$c++){
> >     If($_POST['tourid'][$c]!=""...){
> >         $sql = "INSERT INTO reservations ('tourid'...) VALUES
> > ('{$_POST['tourid'][$c]}'...)\n";
> >     }
> > }

--- End Message ---
--- Begin Message ---
I have got a task of reading a .doc(word document) using php.
But while reading doc file, some meta character like boxes and some other 
characters also appears. 

I will be highly obliged to you if you send me the code for reading a .doc file 
using php.

Any help appriciated.

--- End Message ---
--- Begin Message --- William Lovaton wrote:
Hello,

I just found out that since version 0.7, PEAR::SOAP returns stdClass
objects instead of associative arrays.
http://pear.php.net/package-changelog.php?pacid=87&release=0.7.3

What is the reason for this? I _need_ to get associative arrays, how do
I revert to the old behavior?

lets say that you have a return value from PEAR::SOAP in the variable $a.... does the following give you what you need?:

$a = (array) $a;




-William


--- End Message ---
--- Begin Message ---
I need to get data from stdin, but i don't know how to disable echo
back in windows.
There is "stty -echo" in unix like OS, but what about windows?

--- End Message ---
--- Begin Message --- Unreal HSHH wrote:
I need to get data from stdin, but i don't know how to disable echo
back in windows.
There is "stty -echo" in unix like OS, but what about windows?


not strictly php related but....I think what your looking for is to start your batch script with:

@echo off
--- End Message ---
--- Begin Message ---
How do you activate / allow the behavious

http://www.domainname.con/?var=lakjhd

instead of the more traditional

http://www.domainname.con/file.php?var=lakjhd
-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

--- End Message ---
--- Begin Message ---
Rename the file.php to your web server default index file name, such
as index.php.
Or make a rewrite for it


On Thu, 03 Feb 2005 09:42:45 +0000, symbulos partners
<[EMAIL PROTECTED]> wrote:
> How do you activate / allow the behavious
> 
> http://www.domainname.con/?var=lakjhd
> 
> instead of the more traditional
> 
> http://www.domainname.con/file.php?var=lakjhd
> --
> symbulos partners
> -.-
> symbulos - ethical services for your organisation
> http://www.symbulos.com
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
[snip]
How do you activate / allow the behavious

http://www.domainname.con/?var=lakjhd

instead of the more traditional

http://www.domainname.con/file.php?var=lakjhd

[snip]

Are you using Apache? ->
http://httpd.apache.org/docs-2.0/mod/mod_dir.html
 || 
http://httpd.apache.org/docs-2.0/mod/core.html#directory

Chris Ramsay
Web Developer - The Danwood Group Ltd.
Tel #: +44 (0)1522 882 288
DDI #: +44 (0)1522 834 482
Fax #: +44 (0)1522 884 488
Email: [EMAIL PROTECTED]
Web  : http://www.danwood.co.uk

--- End Message ---

Reply via email to