php-general Digest 22 Sep 2002 00:31:52 -0000 Issue 1599

Topics (messages 117087 through 117125):

256colour PNG?? WHY?!
        117087 by: -=| Julien Bonastre |=-
        117091 by: Rasmus Lerdorf

Re: Attack of the ghost double slash??
        117088 by: Gerard Samuel

Editor
        117089 by: Bryan McLemore
        117090 by: Brad Bonkoski
        117094 by: Todd Pasley
        117102 by: Sascha Cunz
        117106 by: Chris Shiflett
        117107 by: nicos.php.net
        117114 by: Paul Nicholson
        117122 by: Liam MacKenzie

testing post
        117092 by: Kleshchevnikov Alexander

Hi all!
        117093 by: Kleshchevnikov Alexander

Re: question about taking post to session
        117095 by: Todd Pasley

algorythm question
        117096 by: BarżĢ
        117100 by: bob parker

accessing session variables
        117097 by: Murat ÷.
        117103 by: Sascha Cunz
        117104 by: Murat ÷.
        117105 by: Murat ÷.

checking if an array is empty
        117098 by: electroteque
        117101 by: Sascha Cunz

PHP "Cannot redeclare class" problem
        117099 by: Paul Maine
        117108 by: Paul Maine

Re: session & cookies
        117109 by: Jeff Bluemel
        117110 by: Chris Shiflett

Best Practice
        117111 by: Ashley M. Kirchner
        117112 by: Chris Shiflett
        117115 by: Paul Roberts

Users authentication with Apache and PHP on Novell
        117113 by: Milan Reznicek

debug function - string to variable conversion?
        117116 by: Marco Siegl

FTP Uploading?
        117117 by: Stephen Craton
        117123 by: Liam MacKenzie

Re: php_xslt.dll
        117118 by: Marco Siegl

Help sending IMAP mail
        117119 by: Jeff Schwartz

Re: UDP socket_read() problem
        117120 by: Martin

ERROR
        117121 by: Georgie Casey
        117124 by: Liam MacKenzie

sessions
        117125 by: Pablo Oliva

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 ---
Hmm.. Interesting problem I seem to have stumbled upon


I am running apache2.0.36 and php4.2.2 (i am using gd1.6.2)

Now the catch is.. I just want to output a few diff image types directly to browser..

I can do JPEG's fine.. BMP's don't work because of using a older gdlib.. that's no big 
deal though.. i just wanted jpeg and hopefully PNG..

Thing is.. PNG's well.. it loads them fine.. but they end up 256colour palette in the 
browser.. it actually creates the new image from the original true colour (~24KB 
original) and instead spits out a 256colour ~4KB version.. since the palette's been 
reduced involuntarily this is not the desired effect..

I run the img resource through imagecolorstotal($img) to get the colour palette. sure 
enough.. it returns 256.. and yet i open the PNG in Photoshop and its a truecolour PNG 
and without discolouration..


It's definitely freaking me out since I have no idea why it's doing it. I started 
reading the docs' more closely to see if it was a known issue and that the png func's 
are supposed to return 256 colour images.. but to no avail..


Below is the code of the very simple (as can be seen) test php page:
<?
header("Content-type: image/png");
//header("Content-Disposition: image; filename=test");
$img=imagecreatefrompng("./news/n1d1.png");
//imageinterlace($img,1);
imagepng($img);
?>



As can be seen.. It's very simple.. hehe.. I was just using it to test the principle 
but even at these early stages the plan fell apart due to this wacky problem..



Thanks for any ideas/advice..

:) greatly appreciated..

------oOo---------------oOo------

 Julien Bonastre [The_RadiX]
 The-Spectrum Network CEO
 [EMAIL PROTECTED]
 www.the-spectrum.org

------oOo---------------oOo------

--- End Message ---
--- Begin Message ---
gd1 is limited to 256 colours.  Use gd2.

On Sat, 21 Sep 2002, -=| Julien Bonastre |=- wrote:

> Hmm.. Interesting problem I seem to have stumbled upon
>
>
> I am running apache2.0.36 and php4.2.2 (i am using gd1.6.2)
>
> Now the catch is.. I just want to output a few diff image types directly to browser..
>
> I can do JPEG's fine.. BMP's don't work because of using a older gdlib.. that's no 
>big deal though.. i just wanted jpeg and hopefully PNG..
>
> Thing is.. PNG's well.. it loads them fine.. but they end up 256colour palette in 
>the browser.. it actually creates the new image from the original true colour (~24KB 
>original) and instead spits out a 256colour ~4KB version.. since the palette's been 
>reduced involuntarily this is not the desired effect..
>
> I run the img resource through imagecolorstotal($img) to get the colour palette. 
>sure enough.. it returns 256.. and yet i open the PNG in Photoshop and its a 
>truecolour PNG and without discolouration..
>
>
> It's definitely freaking me out since I have no idea why it's doing it. I started 
>reading the docs' more closely to see if it was a known issue and that the png func's 
>are supposed to return 256 colour images.. but to no avail..
>
>
> Below is the code of the very simple (as can be seen) test php page:
> <?
> header("Content-type: image/png");
> //header("Content-Disposition: image; filename=test");
> $img=imagecreatefrompng("./news/n1d1.png");
> //imageinterlace($img,1);
> imagepng($img);
> ?>
>
>
>
> As can be seen.. It's very simple.. hehe.. I was just using it to test the principle 
>but even at these early stages the plan fell apart due to this wacky problem..
>
>
>
> Thanks for any ideas/advice..
>
> :) greatly appreciated..
>
> ------oOo---------------oOo------
>
>  Julien Bonastre [The_RadiX]
>  The-Spectrum Network CEO
>  [EMAIL PROTECTED]
>  www.the-spectrum.org
>
> ------oOo---------------oOo------
>
>

--- End Message ---
--- Begin Message ---
Thanks much, that made all the difference in the world.
The function would be get_magic_quotes_gpc()

Chris Shiflett wrote:

> Gerard,
>
> The most likely reason is a php.ini configuration called magic_quotes. 
> When enabled, PHP will automatically add slashes to single and double 
> quotes, as well as slashes themselves (to escape them). This is 
> helpful in some environments to help protect against attacks that can 
> be used to execute arbitrary database commands. However, this 
> particular setting is one of the more annoying ones, in my opinion, 
> because it makes it more difficult to write portable code.
>
> Hopefully this answers your question, and you can just check your 
> php.ini. If you need to dynamically check the configuration, there is 
> a function that will give you the setting of magic_quote. A quick 
> reference in the manual will give it to you.
>
> Oh, also, you cannot disable this per script, because the slashes are 
> added perior to the data being given to PHP, hence prior to your 
> script's execution.
>
> Happy hacking.
>
> Chris
>
> Gerard Samuel wrote:
>
>> A few months ago, I wrote a bit of code to stripslash() 
>> "PATH_TRANSLATED" on a w2k box, because,
>> php was reporting it with double slashes like C:\\winnt\\some_dir
>>
>> Today I noticed that the code is broken because PATH_TRANSLATED is 
>> now reported with one slash like C:\winnt\some_dir
>> Does anyone know when paths contain double slashes on a w2k box, so 
>> that I can anticipate for them??
>>
>> Thanks for any insight you may provide.
>
>
>
>
>
>

-- 
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/



--- End Message ---
--- Begin Message ---
Hi guys, just wondering if anyone could recomend a good editor that is based on 
windows.  Thanks, Bryan
--- End Message ---
--- Begin Message ---
I like textpad, because it will write files in a Unix friendly way, i.e. none of that 
annoying ^M at the
end of lines! :-)

Bryan McLemore wrote:

> Hi guys, just wondering if anyone could recomend a good editor that is based on 
>windows.  Thanks, Bryan

--- End Message ---
--- Begin Message ---
You can get vi/vim for windows, without a doubt the best editor of all time
if you can be bothered learning the commands.

Todd.

> -----Original Message-----
> From: Bryan McLemore [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, 21 September 2002 11:16 PM
> To: PHP GEN LIST
> Subject: [PHP] Editor
>
>
> Hi guys, just wondering if anyone could recomend a good editor
> that is based on windows.  Thanks, Bryan
>

--- End Message ---
--- Begin Message ---
Newest gvim for windows acts in most cases just like any other editor, too. 
You can mark text with the mouse, scroll over with the scrollbars etc. etc. 
It even got a nice menu. This is the best you can get - and it does 
everything.

I even switched from VC++'s IDE to gvim, now ;-)

Am Samstag, 21. September 2002 16:16 schrieb Todd Pasley:
> You can get vi/vim for windows, without a doubt the best editor of all time
> if you can be bothered learning the commands.
>
> Todd.
>
> > -----Original Message-----
> > From: Bryan McLemore [mailto:[EMAIL PROTECTED]]
> > Sent: Saturday, 21 September 2002 11:16 PM
> > To: PHP GEN LIST
> > Subject: [PHP] Editor
> >
> >
> > Hi guys, just wondering if anyone could recomend a good editor
> > that is based on windows.  Thanks, Bryan

--- End Message ---
--- Begin Message ---
http://www.ultraedit.com/

Bryan McLemore wrote:

>Hi guys, just wondering if anyone could recomend a good editor that is based on 
>windows.
>

--- End Message ---
--- Begin Message ---
The best IS EditPlus. Get it at www.download.com.

--

Nicos - CHAILLAN Nicolas
[EMAIL PROTECTED]
www.WorldAKT.com - Hťbergement de sites Internet

"Bryan McLemore" <[EMAIL PROTECTED]> a ťcrit dans le message de news:
004901c26170$fc6fc510$[EMAIL PROTECTED]
Hi guys, just wondering if anyone could recomend a good editor that is based
on windows.  Thanks, Bryan



--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey,
I use PHPCoder on my windoze machines.....thats when I have to use windows;)
Search google for "r2p3setup.exe" to get a copy.
~Pauly

On Saturday 21 September 2002 09:15 am, Bryan McLemore wrote:
> Hi guys, just wondering if anyone could recomend a good editor that is
> based on windows.  Thanks, Bryan

- -- 
~Paul Nicholson
Design Specialist @ WebPower Design
"The web....the way you want it!"
[EMAIL PROTECTED]

"It said uses Windows 98 or better, so I loaded Linux!"
Registered Linux User #183202 using Register Linux System # 81891
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE9jNeaDyXNIUN3+UQRAuLpAKCJyZIYfoy2CcsLrBwct8eARzKt+wCfcign
9nwQhWebxfmPExHhFqcKuHI=
=qL86
-----END PGP SIGNATURE-----
--- End Message ---
--- Begin Message ---
Editplus, all the way.
www.editplus.com

Small, fast, very configurable, lots of features, project support, direct
FTP upload....

Give it a shot, it's the best  :-)


Liam


----- Original Message -----
From: "Bryan McLemore" <[EMAIL PROTECTED]>
To: "PHP GEN LIST" <[EMAIL PROTECTED]>
Sent: Saturday, September 21, 2002 11:15 PM
Subject: [PHP] Editor


Hi guys, just wondering if anyone could recomend a good editor that is based
on windows.  Thanks, Bryan




--- End Message ---
--- Begin Message ---
Hi all!


--- End Message ---
--- Begin Message ---
Testing post!


--- End Message ---
--- Begin Message ---
Sure you can, however,

1) u prob. want $_SESSION['name'] = $_POST['name'];
2) remember that if you are calling this within the scope of a function you
will have to use $GLOBALS to declare $name as a global before you utilise
session_register.

Todd.

> -----Original Message-----
> From: Randy Johnson [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, 21 September 2002 5:10 PM
> To: Chris Shiflett; Ramesh Nagendra Pillai
> Cc: [EMAIL PROTECTED]
> Subject: [PHP] question about taking post to session
>
>
> hello,
>
> how could i take all the variables in $_POST[""] and move them to
> $_SESSION[""]?
>
> example
>
> $_POST["name"]=$_SESSION["name"]
>
>
> Thanks in advance
>
>
> Randy
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
consider there are categories and these have IDs like
below:
1, 2, 4, 8, 16, 32, 64...

if some data belongs to more than 1 category for
exemple 4 and 32, its category ID will be 36, the sum
of cat. IDs. 
i guess this is used widely in programming. so, how
can i resolve the original IDs. i mean what kind of
script can tell me what+what1+what2...whatN = 79?

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
--- End Message ---
--- Begin Message ---
On Sun, 22 Sep 2002 01:10, you wrote:
> consider there are categories and these have IDs like
> below:
> 1, 2, 4, 8, 16, 32, 64...
>
> if some data belongs to more than 1 category for
> exemple 4 and 32, its category ID will be 36, the sum
> of cat. IDs.
> i guess this is used widely in programming. so, how
> can i resolve the original IDs. i mean what kind of
> script can tell me what+what1+what2...whatN = 79?

1. To do that you should 'or' the categories when the ID's are
to be in more than one category, not add them
eg $category = $cat1 | $cat2;

2. To extract the categories within a compounded category
use the 'and' operator '&'

eg

for ($mask=1; $mask <= 64; /*or whatever*/ $mask *= 2; ) {
        if ( $mask & $category ) {
                print "Yes $mask is in $category\n";
        }
} 
--- End Message ---
--- Begin Message ---
hi,

page1.php creates a session and its variables in it in  successfully. the
variables and values are created like
$_SESSION['x']='abc'

 page1.php sends the SID information to page2.php via GET method. how can i
access the those variables with SID information in page2.php?

thanks


--- End Message ---
--- Begin Message ---
Just use the session_start() in the second page and they will be magically 
there where you've put them in the first page.

Sascha

Am Samstag, 21. September 2002 17:01 schrieb Murat ÷.:
> hi,
>
> page1.php creates a session and its variables in it in  successfully. the
> variables and values are created like
> $_SESSION['x']='abc'
>
>  page1.php sends the SID information to page2.php via GET method. how can i
> access the those variables with SID information in page2.php?
>
> thanks

--- End Message ---
--- Begin Message ---
i tried but it didn't work.
i wrote in page2.php:

<?php
session_start();
echo $_SESSION['isim'];
?>

and i was noticed: "Undefined index: isim in ....."

but i have written $_SESSION['isim']='murat' in page1.php



"Sascha Cunz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Just use the session_start() in the second page and they will be magically
there where you've put them in the first page.

Sascha

Am Samstag, 21. September 2002 17:01 schrieb Murat ÷.:
> hi,
>
> page1.php creates a session and its variables in it in  successfully. the
> variables and values are created like
> $_SESSION['x']='abc'
>
>  page1.php sends the SID information to page2.php via GET method. how can
i
> access the those variables with SID information in page2.php?
>
> thanks


--- End Message ---
--- Begin Message ---
i have written

ini_set("session.name", "SID");

before, in page1.php. and i've added it on page2.php before session_start
and it works.

thanks..



"Murat ÷." <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> i tried but it didn't work.
> i wrote in page2.php:
>
> <?php
> session_start();
> echo $_SESSION['isim'];
> ?>
>
> and i was noticed: "Undefined index: isim in ....."
>
> but i have written $_SESSION['isim']='murat' in page1.php
>
>
>
> "Sascha Cunz" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Just use the session_start() in the second page and they will be magically
> there where you've put them in the first page.
>
> Sascha
>
> Am Samstag, 21. September 2002 17:01 schrieb Murat ÷.:
> > hi,
> >
> > page1.php creates a session and its variables in it in  successfully.
the
> > variables and values are created like
> > $_SESSION['x']='abc'
> >
> >  page1.php sends the SID information to page2.php via GET method. how
can
> i
> > access the those variables with SID information in page2.php?
> >
> > thanks
>
>


--- End Message ---
--- Begin Message ---
how can i check if an array is currently empty , for instance i have a file
input field with an array name for multiple images, i need to check if there
was no file uploaded in that field name and ignore it in the loop


--- End Message ---
--- Begin Message ---
There are many different states, in which an array would be empty. Can you 
post the output of a "var_dump($array);" in that special case you want to 
check?

In general:

1. the variable may not have been set:
   if (!isset($myarray)) echo 'error';

2. the variable is set, but ain't an array:
   if (!isarray($myarray) echo 'error';

3. the variable is set and is an array, but contains no data:
   if (array_count($myarray) == 0) echo 'error';

I think the 3rd case could apply to your problem, but only a print_r or 
var_dump of the $_POST['myarray'] can show this.

Sascha

Am Samstag, 21. September 2002 17:13 schrieb electroteque:
> how can i check if an array is currently empty , for instance i have a file
> input field with an array name for multiple images, i need to check if
> there was no file uploaded in that field name and ignore it in the loop

--- End Message ---
--- Begin Message ---
When I call the function batch_delayed_capture(see below), I issue the
"$this->delayed_capture($d);" statement. Both batch_delayed_capture and
delayed_capture are in the same include file. The statement works fine the
first time through the loop but gives the following error "Cannot redeclare
class pfp_class"(see below). I added some echo statements to help identify
where the problem was occuring.

Your assistance is greatly appreciated.

Paul
PHP,MySQL
****************************************************************************
*
Array element 0= 21203749pnref= xxxx Made it to delayed capture Just after
delayed capyure Array element 1= 21203748pnref= xxxx1
Fatal error: Cannot redeclare class pfp_class in
/var/www/html/shop/modules/checkout/lib/_class.pfp.php on line 76
****************************************************************************
*
function batch_delayed_capture(&$d) {

   global $auth,
   $ps_vendor_id;

   if ($d) {
     //echo "Inside POST\n";
     while (list($lvar, $lvalue) = each($d)) {
       if (ereg ("^d_c_arr", $lvar, $throwaway)) {
           $batch_d_c[]=$d["$lvar"];
       }
     }
   }

   $dbresponse = new ps_DB;


    for($i = 0; $i < sizeof($batch_d_c); $i++){

      echo " Array element $i= " . $batch_d_c[$i];

      $qr = "SELECT pnref from transaction_response WHERE result='0' ";
      $qr .= "AND order_id=$batch_d_c[$i] AND delay_capture IS NULL";
      $dbresponse->query($qr);
      $dbresponse->next_record();
      $d["pnref"]=$dbresponse->f("pnref");
      echo "pnref= " . $d["pnref"];

      $this->delayed_capture($d);
      echo "Just after delayed capyure";
    }


    return True;

 }
****************************************************************************
**

--- End Message ---
--- Begin Message ---
I was able to solve the problem by using the "require_once " statement.

Thank You

-----Original Message-----
From: Paul Maine [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 10:23 AM
To: PHP PHP
Subject: [PHP] PHP "Cannot redeclare class" problem


When I call the function batch_delayed_capture(see below), I issue the
"$this->delayed_capture($d);" statement. Both batch_delayed_capture and
delayed_capture are in the same include file. The statement works fine the
first time through the loop but gives the following error "Cannot redeclare
class pfp_class"(see below). I added some echo statements to help identify
where the problem was occuring.

Your assistance is greatly appreciated.

Paul
PHP,MySQL
****************************************************************************
*
Array element 0= 21203749pnref= xxxx Made it to delayed capture Just after
delayed capyure Array element 1= 21203748pnref= xxxx1
Fatal error: Cannot redeclare class pfp_class in
/var/www/html/shop/modules/checkout/lib/_class.pfp.php on line 76
****************************************************************************
*
function batch_delayed_capture(&$d) {

   global $auth,
   $ps_vendor_id;

   if ($d) {
     //echo "Inside POST\n";
     while (list($lvar, $lvalue) = each($d)) {
       if (ereg ("^d_c_arr", $lvar, $throwaway)) {
           $batch_d_c[]=$d["$lvar"];
       }
     }
   }

   $dbresponse = new ps_DB;


    for($i = 0; $i < sizeof($batch_d_c); $i++){

      echo " Array element $i= " . $batch_d_c[$i];

      $qr = "SELECT pnref from transaction_response WHERE result='0' ";
      $qr .= "AND order_id=$batch_d_c[$i] AND delay_capture IS NULL";
      $dbresponse->query($qr);
      $dbresponse->next_record();
      $d["pnref"]=$dbresponse->f("pnref");
      echo "pnref= " . $d["pnref"];

      $this->delayed_capture($d);
      echo "Just after delayed capyure";
    }


    return True;

 }
****************************************************************************
**


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

--- End Message ---
--- Begin Message ---
I responded to this in a private email to you, and not on the forum...  I
did respond.  I will post here again so there is no question;


>I want to force it to use a cookie that points to a transparent SID on
>my system.

what I mean by this is it was my understanding when reading the sessions
doc's that there was a way to for the system to use a stored system ID
stored in an SID, but the information wouldn't be sent to the browser, but
be stored in a cookie.

>With use_trans_sid set, PHP is going to append the session ID to the URL
>of links, etc., on:

I tried setting the user_trans_sid = 0, but it still will not use a cookie.
it doesn't appear to change anything when I play with these settings.

"Chris Shiflett" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> You've already posted this, and you never answered the questions that
> were asked. Thus, your question is every bit as unclear as the previous
> time.
>
> Perhaps if you put forth a little effort, we might also.
>
> Just a helpful suggestion,
>
> Chris
>
> Jeff Bluemel wrote:
>
> >still looking for some solutions on this - anybody else have any
> >suggestions?
> >
>


--- End Message ---
--- Begin Message ---
Jeff,

My apologies then. Somehow your response never arrived. It is still best 
to always "reply all" for things like this. You get the benefit of 
hearing several people's perspectives, and you also potentially help 
others who have the same question now or who may have it in the future 
(and check the list archives).

Anyway, back to your problem ...

Jeff Bluemel wrote:

>what I mean by this is it was my understanding when reading the sessions
>doc's that there was a way to for the system to use a stored system ID
>stored in an SID, but the information wouldn't be sent to the browser, but
>be stored in a cookie.
>

Cookies are stored on the client, so they are also sent to the browser.

Basically, the unique identifier (e.g., PHPSESSID) must be provided by 
the Web client in order for it to be associated with previous requests. 
The two most common methods of this are for it to send this information 
in a cookie (there is a Cookie header in the HTTP request) or as part of 
the query string in a URL (such as 
http://www.example.org/index.php?PHPSESSID=123456789) that it is requesting.

>>With use_trans_sid set, PHP is going to append the session ID to the URL
>>of links, etc., on:
>>    
>>
>I tried setting the user_trans_sid = 0, but it still will not use a cookie.
>it doesn't appear to change anything when I play with these settings.
>

Right. I was explaining (poorly looking back) what the use_trans_sid 
does. Basically, the idea is that the developer doesn't have to worry 
about how the unique identifier is passed back. This is the "easiest" 
way to use session management, because it is transparent for the most 
part. PHP will try both cookie and URL methods to maintain the unique 
identifier, and it will use only a cookie once it can determine that the 
client supports them.

You are having a problem, it sounds like, with the Web client *not* 
sending back the cookie in subsequent requests. Thus, use_trans_sid will 
append the unique identifier to the URL every time, as it believes the 
client to not be supporting cookies (which might just be your problem). 
When you combine this with use_only_cookies (sp?), you are basically 
telling PHP to ignore the unique identifier if it is sent on the URL. 
Thus, it is not receiving the cookie, and it is being instructed to not 
use the URL variable. It has no way to identify the client and maintain 
state.

Your problem boils down to one thing: the cookie is not getting passed 
back. Focus on this initially. Make sure your Web browser is accepting 
the cookie (you can configure most browsers to warn you before accepting 
a cookie, so that you can be certain it is being set), and try to make 
sure your PHP script is receiving the cookie like it thinks it should 
be. For example, if the cookie is named PHPSESSID, try this:

<?
echo "cookie is [" . $_COOKIE["PHPSESSID"] . "]<br>";
?>

If ths cookie is blank (e.g., "cookie is []"), you have identified your 
problem. Hopefully this will help you solve it.

Happy hacking.

Chris

--- End Message ---
--- Begin Message ---

    I'm working on converting several static (price) pages on our site into dynamic 
pages, with the data stored in an MySQL database and PHP to pull the data out, with 
CSS to build the page and present it.  At the same time, I would also like to have a 
'printer friendly' link on each page that visitors can click on and get the same page 
re-rendered for easy printing.  What's the best way to get the data converted from one 
form to another?  Should I be querying the database again to get the same data to 
reformat?  Should I store the data in sessions and reformat based on the CSS?  I would 
think having to query twice for the same thing would be a degradation in performance, 
right?  So what's the best practice?

--
H | "Life is the art of drawing without an eraser." - John Gardner
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  Director of Internet Operations / SysAdmin    .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave, #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.



--- End Message ---
--- Begin Message ---
Ashley,

This is difficult to answer, as you are actually the best person to 
decide. Consider some of the following things:

1. How often do you anticipate people will use the "printer-friendly" link?
2. How much data do you anticipate, on average, to be contained in the 
results of these queries?
3. How much traffic do you anticipate?
4. How much memory does your Web server have?
5. Are you maintaining sessions anyway, or would this be the only thing 
to require them?

My (uneducated) guess would be that querying again is the best approach. 
You're basically talking about a separate request anyway, and the 
overhead of maintaining state might not be worth it, as you may end up 
with many of these result sets stored in the session, and the client may 
never use them.

Happy hacking.

Chris

Ashley M. Kirchner wrote:

>I'm working on converting several static (price) pages on our site into dynamic 
>pages, with the data stored in an MySQL database and PHP to pull the data out, with 
>CSS to build the page and present it.  At the same time, I would also like to have a 
>'printer friendly' link on each page that visitors can click on and get the same page 
>re-rendered for easy printing.  What's the best way to get the data converted from 
>one form to another?  Should I be querying the database again to get the same data to 
>reformat?  Should I store the data in sessions and reformat based on the CSS?  I 
>would think having to query twice for the same thing would be a degradation in 
>performance, right?  So what's the best practice?
>

--- End Message ---
--- Begin Message ---
just use css to define separate styles for each media
e.g.
<style type="text/css" media="screen,projection">
<!--
// screen style
-->
</style>
<style type="text/css" media="print">
<!--
// print style
-->
</style>

then the print style will be applied when the user clicks print.

Paul Roberts
http://www.paul-roberts.com
[EMAIL PROTECTED]
++++++++++++++++++++++++

----- Original Message ----- 
From: "Ashley M. Kirchner" <[EMAIL PROTECTED]>
To: "PHP-General List" <[EMAIL PROTECTED]>
Sent: Saturday, September 21, 2002 7:51 PM
Subject: [PHP] Best Practice



    I'm working on converting several static (price) pages on our site into dynamic 
pages, with the data stored in an MySQL database and PHP to pull the data out, with 
CSS to build the page and present it.  At the same time, I would also like to have a 
'printer friendly' link on each page that visitors can click on and get the same page 
re-rendered for easy printing.  What's the best way to get the data converted from one 
form to another?  Should I be querying the database again to get the same data to 
reformat?  Should I store the data in sessions and reformat based on the CSS?  I would 
think having to query twice for the same thing would be a degradation in performance, 
right?  So what's the best practice?

--
H | "Life is the art of drawing without an eraser." - John Gardner
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:[EMAIL PROTECTED]>   .   303.442.6410 x130
  Director of Internet Operations / SysAdmin    .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave, #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.




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




--- End Message ---
--- Begin Message ---
Hi Everybody,
        I have my Apache 1.3.26 with PHP 4.2.2 running on WinNT 4.0 and need 
to authenticate 
users to have access to some web pages. The computer with apache is a part of 
Novell NetWare Network and I need to that only users which are from this 
network have access to the web pages. Does anybody know how to authenticate 
the users using PHP. Thanks for your advice.
                        

                                Bye Milan

--- End Message ---
--- Begin Message ---
hi there,
i was thinking of a 2 ways to write a new debug function, ...

1. debug all variables in php script, e.g. "function debug( all )"

which should parse the whole source code of a particular php-script for all
occuring variables and treat them corresponding to their variable type, e.g.

- simple one-dimensional variables like int, float, string,... should be
printed as key = value pairs.
- arrays could be printed with the built-in print_r function
- etc...

=> has anybody done this already? do you have any conclusions?


2. debug specified variable(s) only, e.g. "function debug( var, var2, var3,
... )"

But the problem is to pass the parameters in the right way to get the needed
information and afterwards treat the passed function input to dynamically
print the output.

when i tried to pass, e.g. the variable $_SERVER['SERVER_NAME'] to my debug
function, it was totally confusing, if the variable should be

a) passed as $param, without using any quoting, like:
debug($_SERVER_[SERVER_NAME])
b) passed as string, using single ticks, like:
debug('$_SERVER_[SERVER_NAME]')
c) passed as string, using double quotes, like:
debug("$_SERVER_[SERVER_NAME]")

and on the other hand, how to retrieve the passed function input, to write
output, like e.g.
$_SERVER['SERVER_NAME'] = www.remslakecity.de

every time i tried, my only output was,
$_SERVER['SERVER_NAME'] = $_SERVER['SERVER_NAME']
or
www.remslakecity.de = www.remslakecity.de

=> where can i see the source-code of the phpinfo() function, maybe there is
hint of how to do it?
=> is there a "conversion from string to variable", if "$var" was passed as
string?
=> after passing "$var" as variable it is evaluated on-the-fly, so i can' t
get the $key (varname)

afterall, if my explanation was too confusing, ....
i only want to write the varname once, like debug (var) and to retrieve the
$var = value pair !!!

thanks a lot for helping me out,... me, myself & i, we completely lost our
nerves...
please mailto:[EMAIL PROTECTED]

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

I was just wondering, how do you FTP files in PHP? I can't seem to find
it in any of my PHP books so could someone kindly give me a rundown on
how they work? Thanks!

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us


--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/ref.ftp.php

You'll need FTP support compiled into PHP.
do a phpinfo() and search for FTP

Cheers,
Liam

----- Original Message ----- 
From: "Stephen Craton" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 22, 2002 7:27 AM
Subject: [PHP] FTP Uploading?


Hello,

I was just wondering, how do you FTP files in PHP? I can't seem to find
it in any of my PHP books so could someone kindly give me a rundown on
how they work? Thanks!

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us



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






--- End Message ---
--- Begin Message ---
hi larry,
please explain, what in particular is wrong with your php-xslt installation?

maybe you can first of all try http://www.dependencywalker.com to check if all needed 
.dlls are there. if you still need the new libexpat.dll you have to go to 
http://sourceforge.net/projects/expat/ - it's james clarks expat page on sourceforge, 
and there you can get the new libexpat.dll in the latest expat archive.

you can also view php source code of my running xslt processing script, if you go to 
http://www.remslakecity.de/source.php?url=/xslt/xp.php

i wish you all the best,
- marco

<mail>[EMAIL PROTECTED]</mail>
<url>http://www.remslakecity.de</url>
  ----- Original Message ----- 
  From: larryv 
  To: [EMAIL PROTECTED] 
  Sent: Saturday, September 21, 2002 10:26 PM
  Subject: php_xslt.dll


  Did you get XSLT to work?

  I'm having the same problem.




  > I get this 'module not found'-errors all the time and could not find a
  > solution up to now.
  > i tried everything this group recommends, but the problem gets weirder and
  > weirder.
  > I even tried DependencyMaker and it says a libexpat.dll is missing. This
  dll
  > is not included to the php-4.2.3-distribution. (somebody suggested
  expat.dll
  > will do - NOT on my machine)
  >
  > > i found a rersolution to the php_xslt.dll extension installting problem
  >
  > you're lucky!
  >
  > > in your php.ini, you have to write: extension_dir = c:/php/extensions
  >
  > would be d:/php/extensions on my machine. does NOT solve the problem.
  >
  > > copy the 4 following .dll's to your windows/system32 directory
  > > - php/php4ts.dll
  > > - php/extensions/php_xslt.dll
  > > - php/dlls/expat.dll
  > > - php/dlls/sablot.dll
  >
  > all done. does NOT solve the problem.
  >
  > I am using IIS 5 on WIN2000/SP3 . But this is definitely not a
  > server-related problem i think.
  > To me it seems very much as a bug in the php-module-implementation or in
  the
  > php_xslt.dll itself.
  >
  > Btw: is there somehing like an official installation procedure?
  >
  > any help would be very appreciated.
  > [EMAIL PROTECTED]
  >
  >
  >
  >
  >



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

--- End Message ---
--- Begin Message ---

The IMAP documentation on the php site says that you can create an IMAP message using 
imap_mail_compose but fails to say how to send it.

I've tried using imap_mail but it gives me a parameter count error.

Does anyone know how to send the message?

Thanks,

Jeff

 

 



---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
--- End Message ---
--- Begin Message ---
> Try using SO_TCP.

The problem is that I'm making a server application, and all the clients were made by 
someone else and are much more difficult to modify, and are already using UDP.

> There are issues using TO_UDP with
> internet/LANs..... many ppl mention
> them from time to time, however, it
> 'should' work over a LAN.... TCP is
> usually eaiser and a nice alternative
> if you can't resolve issues.

Ok, if I can't get it to work with UDP, I think I'll switch to TCP.

Thanks,

Martin

--- End Message ---
--- Begin Message ---
I'm getting a:
Parse error: parse error, unexpected $ in
/home/virtual/site264/fst/var/www/html/include/paypal.php on line 126

in my script. the script only has 126 lines, and I cant find any $ that
might be causing it. But there's a lot of loops to close in the script so
I'm thinking one of these could be to blame. So my question is, does PHP
return this error when some loops aren;t closed??



--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***************************
http://www.filmfind.tv
Online Film Production Directory
***************************


--- End Message ---
--- Begin Message ---
Yes.

If you've done something like this:

if(!empty($var)){echo"Blah!";

It'll root up your script and give an error at the end of the file.
Make sure all {'s are closed.

Cheers,
Liam

----- Original Message ----- 
From: "Georgie Casey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, September 22, 2002 9:38 AM
Subject: [PHP] ERROR


I'm getting a:
Parse error: parse error, unexpected $ in
/home/virtual/site264/fst/var/www/html/include/paypal.php on line 126

in my script. the script only has 126 lines, and I cant find any $ that
might be causing it. But there's a lot of loops to close in the script so
I'm thinking one of these could be to blame. So my question is, does PHP
return this error when some loops aren;t closed??



--
Regards,
Georgie Casey
[EMAIL PROTECTED]

***************************
http://www.filmfind.tv
Online Film Production Directory
***************************



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






--- End Message ---
--- Begin Message ---
I have read that in order to account for browsers/users who do not have
cookies enabled, that you should append the session id to the url (query
string).  Now, if I do do that,
www.site.com?phpsessid=gafklgjr952344afgfa, do I have to do anything so
that I force php to recognize the session id in the query string?  To
clarify my question, does php recognize the session id in the query
string by default if cookies are dissabled?
--- End Message ---

Reply via email to