OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 18 Feb 2004 23:52:24 -0000 Issue 2598

php-general-digest-helplists.php.net
Date: Wed Feb 18 2004 - 17:52:24 CST


php-general Digest 18 Feb 2004 23:52:24 -0000 Issue 2598

Topics (messages 178092 through 178193):

Re: PDF
        178092 by: Enda Nagle
        178094 by: Juan Torres

[Newbie Guide] For the benefit of new members
        178093 by: Ma Siva Kumar

XSL-FO
        178095 by: Juan Torres

mbstring and writing into file with fwrite
        178096 by: Torsten Rosenberger

DCOM , PHP on Linux
        178097 by: Conrad Strydom
        178099 by: pete M
        178125 by: Raditha Dissanayake

Re: FTP (via firewall)
        178098 by: Jason Wong
        178124 by: Raditha Dissanayake

Re: post variables
        178100 by: julian haffegee

Re: how to deal with http and https directory structures?
        178101 by: memoimyself.yahoo.com.br
        178139 by: Chris W. Parker

Re: PHP (and optionally MySQL) textbook
        178102 by: memoimyself.yahoo.com.br

Warning: main(): Failed opening '' for inclusion (include_path='.:/usr/lib/php')
        178103 by: Andrew Judge
        178105 by: Stuart

Crappy results from query
        178104 by: Ryan A
        178106 by: Stuart
        178112 by: Ryan A
        178113 by: Ryan A
        178116 by: Michael Nolan

Re: [PHP-XML-DEV] PHP5: ext/dom: Namespace & Prefix unexpected behavior
        178107 by: Rob Richards

PDF - Coords
        178108 by: Juan Torres
        178110 by: Jay Blanchard
        178160 by: Jyry Kuukkanen

Finding orphan functions
        178109 by: Al
        178111 by: Gareth Williams
        178115 by: pete M
        178118 by: Gareth Williams

Weird question - environment data from windows
        178114 by: Martin
        178130 by: Gryffyn, Trevor

PHP Header to stimulate a POST method or POST string????
        178117 by: Scott Fletcher
        178123 by: Chris Shiflett
        178127 by: Scott Fletcher
        178145 by: Scott Fletcher
        178159 by: Chris Shiflett
        178163 by: Scott Fletcher
        178165 by: Chris Shiflett
        178172 by: Scott Fletcher
        178173 by: Scott Fletcher
        178176 by: Chris Shiflett
        178177 by: Scott Fletcher
        178180 by: Scott Fletcher

Re: PHP Login Page Issues
        178119 by: Pushpinder Singh
        178138 by: Chris W. Parker

Re: PHP REDIRECT
        178120 by: Raditha Dissanayake
        178128 by: Chris Shiflett

Question about the manual content
        178121 by: janbro.web.de

Re: Browser Detection another page
        178122 by: Gryffyn, Trevor

Re: About Classes and Scope
        178126 by: Phillip Jackson

Getting age from yyyy-mm-dd
        178129 by: Ryan A
        178137 by: Chris W. Parker
        178143 by: John W. Holmes

'
        178131 by: Diana Castillo
        178132 by: Gerard Samuel
        178133 by: Ford, Mike [LSS]
        178134 by: Adam Voigt
        178184 by: Justin Patrin

Ideas on modifying array keys
        178135 by: Gerard Samuel
        178136 by: Ben Ramsey
        178140 by: Gerard Samuel
        178141 by: Michal Migurski
        178142 by: Ben Ramsey
        178146 by: Gerard Samuel
        178185 by: Justin Patrin

Custom Error Handler
        178144 by: Stuart
        178147 by: John W. Holmes
        178149 by: Stuart
        178169 by: Manuel Lemos

PHP, Cache Control and Mac IE
        178148 by: Roger Spears
        178151 by: Gareth Williams

include (byname.php?lang=fr");
        178150 by: John Taylor-Johnston
        178154 by: John W. Holmes
        178175 by: John Taylor-Johnston

boolean type function ?
        178152 by: Mike Mapsnac
        178155 by: Richard Davey
        178156 by: Ford, Mike [LSS]
        178157 by: John W. Holmes

CSV download
        178153 by: Roberts, Mark (Tulsa)
        178158 by: Robby Russell
        178166 by: Roberts, Mark (Tulsa)
        178168 by: John Herren

Figuring out how to use a class with no documentation
        178161 by: Paul Furman

Re: SOLVED: Getting age from yyyy-mm-dd
        178162 by: Ryan A

SWFShape HOW TO DRAW ELLIPSE????
        178164 by: Rostislav Kerey

Re: [Q] Howto go directly to a URL?
        178167 by: Michael T. Peterson

Going a bit nuts with php/mysql structure......(maybe 0T)
        178170 by: Ryan A
        178174 by: Chris W. Parker

fopen errors
        178171 by: admin
        178188 by: Paul Furman

How to detect session expiry
        178178 by: Radek Zajkowski (Mac)

Is it posible to embed scripts from other server?
        178179 by: The PHP Newbie

Re: Recursive Select Box
        178181 by: Justin Patrin

Nested Loops
        178182 by: Alex Hogan
        178186 by: Alex Hogan
        178187 by: Chris W. Parker
        178189 by: Alex Hogan

Re: htmlspecialchars... or...?
        178183 by: Justin Patrin

functions and session variables
        178190 by: craig
        178193 by: Vail, Warren

rewrite rule not working
        178191 by: Chris W. Parker

checking users have the latest version of a file
        178192 by: daniel.electroteque.org

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

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

attached mail follows:


Juan,

Try doing something like this:

define('DOLLAR',chr(36));

Just replace the DOLLAR and the chr value with the chatacter number and
reference the variables in the PDF...

Regards

Enda
--

-----Original Message-----
From: Juan Torres [mailto:jto_staryahoo.es]
Sent: 18 February 2004 10:54
To: php-generallists.php.net
Subject: [PHP] PDF

Hi,

How can I write special characters (á, ö, ñ, ç,...) in a pdf document?

I'm using pdflib.

Greetings.

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

attached mail follows:


Thank you

attached mail follows:


=======================================
This message is for the benefit of new
subscribers and those new to PHP. 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/en first. You
can download a copy and use it offline also.

Please also try
http://www.php.net/manual/faq.php
for answers to frequently answered questions
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching
for "php YOUR QUERY" may fetch you relevant
information within the first 10 results.

3. There is a searchable archive of the
mailing list discussion at
http://phparch.com/mailinglists. Many of the
common topics are discussed repeatedly, and
you may get answer to your query from the
earlier discussions.

For example: One of the repeatedly discussed
question in the list is "Best PHP editor".
Everyone has his/her favourite editor.
You can get all the opinions by going through
the list archives. If you want a chosen list
try this link :
http://phpeditors.linuxbackup.co.uk/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want
find out what extensions are available to
you?

Just put the following code into a file with
a .php extension and access it through your
webserver:

<?php
        phpinfo();
?>

If PHP is installed you will see a page with
a lot of information on it. If PHP is not
installed (or not working correctly) your
browser will try to download the file.

(contributed by Teren and reworded by Chris W
Parker)

5. 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.

6. PHP is a server side scripting language.
Whatever processing PHP does takes place
BEFORE the output reaches the client.
Therefore, it is not possible to access
users' computer related information (OS,
screen size etc) using PHP. Nor can you
modify any the user side settings. You need
to go for JavaScript and ask the question in
a JavaScript list.

On the other hand, you can access the
information that is SENT by the user's
browser when a client requests a page from
your server. You can find details about
browser, OS etc as reported by
this request. - contributed by Wouter van
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line.
Avoid general subjects like "Help!!", "A
Question" etc. Especially avoid blank
subjects.

8. When you want to start a new topic, open a
new mail composer and enter the mailing list
address php-generallists.php.net instead of
replying to an existing thread and replacing
the subject and body with your message.

9. It's always a good idea to post back to
the list once you've solved your problem.
People usually add [SOLVED] to the subject
line of their email when posting solutions.
By posting your solution you're helping the
next person with the same question.
[contribued by Chris W Parker]

10. Ask smart questions
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

Hope you have a good time programming with
PHP.

Best regards,
--
Integrated Management Tools for leather
industry
----------------------------------
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

attached mail follows:


Hi,

Does PHP allow parser a XML with a XSL-FO and create a PDF?

Greetings.
Juan Torres.

attached mail follows:


Hello

I have two servers on with SuSe 8.2 and PHP 4.3.1
and a new one with SuSE 9.0 and Php 4.3.3

i trie to write some data on the new server into a file.
(characters are german ö ä ü)
in the file the data are encoded !?

I trid to find out what mbstring does. no luck
I disabled mbstring in the php.ini but nothing changed.

how is it possible to get the same string into the file as send by
submit?

as i have seen the string is sometimes UTF-8 encoded but utf8decode only
change it to iso08859-1. and i need more character sets.

BR/Torsten

attached mail follows:


Hi there guys,

We have a PHP application on a remote linux machine that needs to
interoperate with a COM based interface on a windows machine.

If both where on the same win32 machine things would have been easy ,
but unfortunately they aren't.

What are the possible solutions available to me , i'm thinking one way
would be to wrap the COM calls in a webservice on the linux side (SOAP?)
, but that sounds like a lot of work.

Are there any easy ways out? Anyone familiar with EntireX? Is there a
way I can use that? My concern is that even if I get the linux box to
chat DCOM , how does PHP know about it?

Regards
Conrad Strydom

attached mail follows:


Which EntireX

pete

onrad Strydom wrote:
> Hi there guys,
>
> We have a PHP application on a remote linux machine that needs to
> interoperate with a COM based interface on a windows machine.
>
> If both where on the same win32 machine things would have been easy ,
> but unfortunately they aren't.
>
> What are the possible solutions available to me , i'm thinking one way
> would be to wrap the COM calls in a webservice on the linux side (SOAP?)
> , but that sounds like a lot of work.
>
> Are there any easy ways out? Anyone familiar with EntireX? Is there a
> way I can use that? My concern is that even if I get the linux box to
> chat DCOM , how does PHP know about it?
>
> Regards
> Conrad Strydom

attached mail follows:


>
> What are the possible solutions available to me , i'm thinking one way
> would be to wrap the COM calls in a webservice on the linux side
> (SOAP?) , but that sounds like a lot of work.

not if you use a tool kit / class library that is already be available.
How about switching to java instead?

>
> Are there any easy ways out? Anyone familiar with EntireX? Is there a
> way I can use that? My concern is that even if I get the linux box to
> chat DCOM , how does PHP know about it?
>
> Regards
> Conrad Strydom
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


On Wednesday 18 February 2004 18:27, Tommi Virtanen wrote:

> This is simple, but I have firewall.... How to enter firewall ip....

Either I am stupid or you're not explaining the problem clearly enough.

For starters:

- what is the firewall doing?
- what are you trying to do?

--
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
------------------------------------------
/*
I never met a man I didn't want to fight.
                -- Lyle Alzado, professional football lineman
*/

attached mail follows:


>- what is the firewall doing?
>- what are you trying to do?
>
>
>
cant' resist a me too post.

- what is the firewall doing?
- what are you trying to do?

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


Hi Chris

print_r($_REQUEST); (is this what you mean by HTTP Request?)
print_r($_POST);
print_r($_GET);

all give Array()

its apache release 10327100 (is that what you mean?)

If I change the form method to GET works, and we get

REQUEST: Array ( [username] => aa [password] => aa )
_GET: Array ( [username] => aa [password] => aa )
_POST: Array ( )

> Do you have a way to capture the raw HTTP? I'd like to see:
>
> 1. The HTTP Request
> 2. The output of print_r($_POST)
> 3. What Web server you're using (and version)
>
> With this, I feel certain that we can figure something out.
>
> Chris

attached mail follows:


Hello Chris,

On 17 Feb 2004 at 15:39, Chris W. Parker wrote:

> anyone have any thoughts on this? am i making this more complicated
> than it is? ;)

Well, yes and no. You're trying to organize your files so that each set is only accessed
via one protocol (http or https), which makes pretty good sense from an administrative
point of view. On the other hand, you're not necessarily *required* to do that: unless
your web server somehow directs all https traffic to a separate branch of your web
directory structure, users can access any file on the server via either http or https
(provided, of course, that your web server is properly configured).

What this means is that you can have a user access a certain page via https by simply
providing a link containing "https://" as the prefix. The down side of this solution is that
users will be free to *not* use https by typing the path to the page directly into the
browser without the "https://" prefix.

Am I making this even more confusing?

:o)

Erik

attached mail follows:


memoimyselfyahoo.com.br <mailto:memoimyselfyahoo.com.br>
    on Wednesday, February 18, 2004 6:03 AM said:

> What this means is that you can have a user access a certain page via
> https by simply providing a link containing "https://" as the prefix.
> The down side of this solution is that users will be free to *not*
> use https by typing the path to the page directly into the browser
> without the "https://" prefix.
>
> Am I making this even more confusing?

maybe to someone that doesn't know what you mean. ;)

as for me, i understand what you are saying and that's something i want
to avoid. so yes i *could* make the root of my https site the same as
the root of my http site, but like you pointed it would allow someone to
use http instead of https. but i'd prefer to pick and choose which pages
are https and which pages are not.

chris.

attached mail follows:


On 17 Feb 2004 at 21:24, Chris wrote:

> I am looking for suggestions for a textbook for an undergraduate class
> introducing PHP and MySQL (using PHP, not MySQL administration). Right now
> I am using the McCarty book "PHP 4 A Beginner's Guide" but there might be
> new and/or better books out there?
>
> The text is critical because these students will be taking a self-paced,
> independent learning course using the text, web site, in consultation with
> a distant faculty member... so it is a bit different than a text I would
> use in a face-to-face class... and these are true beginners!
>
> Any recommendations would be helpful. Thanks!

You can't go wrong with Luke Welling and Laura Thomson's "PHP and MySQL Web
Development".

Erik

attached mail follows:


I have an os X 10.3 server with a page that gives me this error. I have
the same site on a red hat machine that does not give me this error.
The way the page is:

Warning: main(): Failed opening '' for inclusion
(include_path='.:/usr/lib/php') in /Library/WebServer/html/services.php
on line 65

line 65 if the $page variable as below

<?
include "header.inc";
include "functions.php";
?>
<html>
text
<? include "$page"; ?>

</html>

<?
include "footer.inc";
?>

The page is called with an href page.php?page=content.php
with the content.php page in the web root (both pages are in the web
root).

The header, functions and footer are all okay, the content.php is where
the error is.

Does anyone know from the info above what is causing this?

Any help appreciated.

Best regards,

Andrew Judge

attached mail follows:


Andrew Judge wrote:
> Warning: main(): Failed opening '' for inclusion
> (include_path='.:/usr/lib/php') in /Library/WebServer/html/services.php
> on line 65
>
> line 65 if the $page variable as below
<snip>
> <? include "$page"; ?>
<snip>
> The page is called with an href page.php?page=content.php
> with the content.php page in the web root (both pages are in the web
> root).

I'd put money on you having register_globals off - which is good.
Replace your include with...

<? include $_GET['page']; ?>

and it should work. Also, please look into the security implications of
what you are doing here. I'd also put money on this being a massive
great hole in your servers security.

--
Stuart

attached mail follows:


Hey,
Cant really understand this, can someone point out where I'm going wrong
please?

The idea is simple, I have 3+ names of clients in the database, each client
has multiple records
with the same order_id and name (because they are registered with multiple
products):
eg:
order_id Name Product
565454 Ryan 211
565454 Ryan 11
565454 Ryan 617
845874 susan 44
845874 susan 857
698457 Jacob 211

The idea is to present just one unique name in the control panel. Since I am
paginating I am getting
the correct COUNT of 3, but when I display it...it shows me something like:
Ryan
Ryan
susan

As you can see its repeating the first one twice and not displaying "Jacob"

Since you cant read my mind ( unfortunately :-p ) heres the code that I am
using:

***** start code ****

// for the paginator (am using a class)
$num_rows = mysql_result(mysql_query("SELECT COUNT(DISTINCT(order_id)) FROM
".$tcname."_h2o"),0);

$a =& new Paginator($_GET['page'],$num_rows);
$a->set_Limit(10); // Records to be displayed.
$a->set_Links(4);
$limit1 = $a->getRange1();
$limit2 = $a->getRange2();

// for the control panel display
$result=mysql_query("SELECT distinct(order_id),name,status,total FROM
".$tcname."_h2o LIMIT $limit1, $limit2");

// if($result)
while($row = mysql_fetch_row($result))
 {
$up_name=ucwords($row[1]);
echo <<<something2
  <tr>
    <td>$up_name</td>
    <td nowrap>$row[4]</td>
    <td nowrap>$the_status</td>
    <td NOWRAP><div align="center">Edit ::</div></td>
    <td><div align="center">Options</div></td>
  </tr>
something2;

 } // End of while

***** end code ****

The above part is just the main parts of course, if you want the whole page
tell me and I'll
give it too you offlist and I dont like getting attachments on list and I am
pretty sure I'm not
the only one.

Any ideas where I am going wrong?

Thanks,
-Ryan

attached mail follows:


Ryan A wrote:
> $result=mysql_query("SELECT distinct(order_id),name,status,total FROM
> ".$tcname."_h2o LIMIT $limit1, $limit2");

The distinct keyword applies to the whole row. Since you're including
other fields that will be different even though the name is the same,
MySQL does not consider them duplicate rows.

--
Stuart

attached mail follows:


On 2/18/2004 3:32:31 PM, Duncan Hill (dhillcricalix.net) wrote:
> On Wednesday 18 February 2004 14:21, Ryan A wrote:
> > Hey,
> > Cant really understand this, can someone point out where I'm going wrong
> > please?
> >
> > The idea is simple, I have 3+ names of clients in the database, each
client
> > has multiple records
> > with the same order_id and name (because they are registered with
multiple
> > products):
> > eg:
> > order_id Name Product
> > 565454 Ryan 211
> > 565454 Ryan 11
> > 565454 Ryan 617
> > 845874 susan 44
> > 845874 susan 857
> > 698457 Jacob 211
>
> Yuck? :)
>
> Table customers:
> customerid int
> fname char
> lname char
> .
> .
>
> Table orders
> orderid int
> ref_customerid int
> product int
> quantity int
>
> select distinct customerid, fname from customers, orders where
> customerid=ref_customerid;
>
> Should work. Totally untested of course. This approach lets you fix
customer
> names etc without having to fix all records in the orders db.

Hi,
Thanks for replying.

Logically, customers would be in one table and orders in another,
unfortunatly I was
not called from the beginning for this project and have to work with data
thats already
there in these tables...:-(
Given the present state of data in the tables...what do you suggest I do to
get those results
in that way?

Thanks,
-Ryan

attached mail follows:


> >
> $result=mysql_query("SELECT distinct(order_id),name,status,total FROM
> > ".
> $tcname."_h2o LIMIT $limit1, $limit2");
>
> The distinct keyword applies to the whole row. Since you're including
> other fields that will be different even though the name is the same,
> MySQL does not consider them duplicate rows.
>
> --
> Stuart

Hey Stuart,
Thanks for replying.

So what can I do to make sure I get only order_id distinct? possible?

Thanks,
-Ryan

attached mail follows:


Ryan A wrote:

>>$result=mysql_query("SELECT distinct(order_id),name,status,total FROM
>>
>>>".
>>
>>$tcname."_h2o LIMIT $limit1, $limit2");
>>
>>The distinct keyword applies to the whole row. Since you're including
>>other fields that will be different even though the name is the same,
>>MySQL does not consider them duplicate rows.
>>
>>--
>>Stuart
>
>
> Hey Stuart,
> Thanks for replying.
>
> So what can I do to make sure I get only order_id distinct? possible?
>
> Thanks,
> -Ryan
>

SELECT DISTINCT order_id FROM ...

Then loop through the results and run another query to find out details
of each order.

HTH,

Mike

attached mail follows:


> I thought that setting $root->prefix will set the prefix and the
> namespaceUri to the other domain... but it seems to me that the parser
> doesn't see the "xmlns:anotherprefix" as a prefix-declaration?
> maybe i just misunderstood something, so please correct me if so.

The current behavior is wrong (fix currently being discussed), however your
expectations are also incorrect.

Setting the prefix does not change a nodes namespace uri. Once a node is
created, it is permanently bound to the namespace URI (per specs).

Changing the prefix only changes the prefix of the current namespace on that
element, which may result in a new namespace definition on that node (if
namespace is inherited) or it may fail as in your case there would be
namespace collision due to 2 namespaces with the same prefix (which imo
should error out rather than allow it).

Rob

attached mail follows:


Hi,

How can I know the currents coordenades of my pdf document?

Thanks.

attached mail follows:


[snip]
How can I know the currents coordenades of my pdf document?
[/snip]

Use a GPS?
http://catb.org/~esr/faqs/smart-questions.html

HTH!

attached mail follows:


On Wed, 18 Feb 2004, Jay Blanchard wrote:

> [snip]
> How can I know the currents coordenades of my pdf document?
> [/snip]
>
> Use a GPS?
> http://catb.org/~esr/faqs/smart-questions.html
>
> HTH!

¹Hola!

Maybe Señor Torres wanted to know the current position of drawing text or
an image, that is not really possible - as far as I know - in producing
PDF document.

Juan, could you specify the actual problem you are facing? That might lead
you to get the answer for your question.

--
Hienoja terveisiä
--Jyry
C|:-( C|:-/ C|========8-O C|8-/ C|:-(

attached mail follows:


Anyone have a suggestion for how I can determine if I have any orphan
functions in a function file?

I have a include file with about 30 functions that I have been adding to
for several months. No doubt some have been superseded, etc. and are
now obsolete.

I could laboriously trace every path in my code and find the orphans;
but, it would be nice to be able to automate the job a bit.

Is there a neat way to run my applications and record which functions
are used?

Thanks....

attached mail follows:


Well if you are a unix/linux/os x user, drop to the command line, go to
the directory with all the php files, and type in:

grep <function_name> php

or if your php files are scattered around a load of sub-directories,
then go to a directory which sits above all your php files, and type
in:

grep -r <function_name> *

if your function is only declared and not used, you will only get one
line back (plus a line for each comment line which might have the
function name in it.

On 18 Feb 2004, at 15:58, Al wrote:

> Anyone have a suggestion for how I can determine if I have any orphan
> functions in a function file?
>
> I have a include file with about 30 functions that I have been adding
> to for several months. No doubt some have been superseded, etc. and
> are now obsolete.
>
> I could laboriously trace every path in my code and find the orphans;
> but, it would be nice to be able to automate the job a bit.
> Is there a neat way to run my applications and record which functions
> are used?
>
> Thanks....
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Wicked - that's the best tip I've seen for a long time... TA

Gareth Williams wrote:
>
> Well if you are a unix/linux/os x user, drop to the command line, go to
> the directory with all the php files, and type in:
>
> grep <function_name> php
>
> or if your php files are scattered around a load of sub-directories,
> then go to a directory which sits above all your php files, and type in:
>
> grep -r <function_name> *
>
> if your function is only declared and not used, you will only get one
> line back (plus a line for each comment line which might have the
> function name in it.
>
>
>
> On 18 Feb 2004, at 15:58, Al wrote:
>
>> Anyone have a suggestion for how I can determine if I have any orphan
>> functions in a function file?
>>
>> I have a include file with about 30 functions that I have been adding
>> to for several months. No doubt some have been superseded, etc. and
>> are now obsolete.
>>
>> I could laboriously trace every path in my code and find the orphans;
>> but, it would be nice to be able to automate the job a bit.
>> Is there a neat way to run my applications and record which functions
>> are used?
>>
>> Thanks....
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

attached mail follows:


No probs.

On 18 Feb 2004, at 16:34, pete M wrote:

> Wicked - that's the best tip I've seen for a long time... TA
>
>
> Gareth Williams wrote:
>> Well if you are a unix/linux/os x user, drop to the command line, go
>> to the directory with all the php files, and type in:
>> grep <function_name> php
>> or if your php files are scattered around a load of sub-directories,
>> then go to a directory which sits above all your php files, and type
>> in:
>> grep -r <function_name> *
>> if your function is only declared and not used, you will only get one
>> line back (plus a line for each comment line which might have the
>> function name in it.
>> On 18 Feb 2004, at 15:58, Al wrote:
>>> Anyone have a suggestion for how I can determine if I have any
>>> orphan functions in a function file?
>>>
>>> I have a include file with about 30 functions that I have been
>>> adding to for several months. No doubt some have been superseded,
>>> etc. and are now obsolete.
>>>
>>> I could laboriously trace every path in my code and find the
>>> orphans; but, it would be nice to be able to automate the job a bit.
>>> Is there a neat way to run my applications and record which
>>> functions are used?
>>>
>>> Thanks....
>>>
>>> --
>>> 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
>
>

attached mail follows:


When you've stopped laughing - is it at all possible to pass Windows
environment data from a Windows workstation to an PHP application
running on a Linux server?

attached mail follows:


> -----Original Message-----
> From: Martin [mailto:martin.skjoldebrandforumsyd.se]
> Sent: Wednesday, February 18, 2004 10:26 AM
> To: php-generallists.php.net
> Subject: [PHP] Weird question - environment data from windows
>
> When you've stopped laughing - is it at all possible to pass Windows
> environment data from a Windows workstation to an PHP application
> running on a Linux server?

You might be able to use Javascript to get some information off of the
client browser and maybe populate some form elements or something, but I
don't know of any way to automatically send environment information to
your linux server. I know Javascript has functions built into it for
getting screen height and width and such. Probably other things as
well.

On the server itself you can use the $_ENV superglobal to get it's
environment information (see the listing in phpinfo()), but getting it
from the browser is a little trickier.

Some things can be obtained in other ways. For example, a
hack/workaround for getting a user's login name on a Windows network
(with a Windows server) is to put this into your code:

  $ipaddress = $_SERVER["REMOTE_ADDR"];
  $nbtstat = "nbtstat -A ". $ipaddress;
  exec ($nbtstat,$result);

  foreach ($result as $row) {
    if (strpos($row,"<03>")) $username = strtok($row," ");
  }

Basically this uses the IP address of the client, does an "nbtstat" on
it and parses all the entries containing "<03>" to get the username.
This works ok.. Unless the person is logged into more than one machine
at a time, then you usually get the machine name instead. Not great,
but if it's your only way of snagging a username, then so be it.

Maybe if you tell us what environment information you're trying to pass
to the server, someone has a workaround like this specifically for that
variable. If it's for just some userset variable, then I'm really not
sure how you'd do that. If you do find a way, please share! Could be
useful to lots of people.

Good luck!

-TG

attached mail follows:


Hi!

    I am wonder if it is possible to use the header("Location:
https://www.blah.net") while stimulating it as a POST method/string.
Because I need to hide the get/post string as you would with a HTML form's
POST method.

   What I have here is header("Location:
https://www.blah.net?PHPSESSID=".$salt) for example, so to treat it as a
POST like would be ...

        header("Location: https://www.blah.net");
        header(" ??? "); //for PHPSESSID and other post strings...

Thanks,
   Scott F.

attached mail follows:


--- Scott Fletcher <scottabcoa.com> wrote:
> I am wonder if it is possible to use the header("Location:
> https://www.blah.net") while stimulating it as a POST method/string.

It is not, and if you think about that for a minute, you should be glad.

You cannot force the user to submit a POST request to any URL, but you can
submit a POST request yourself and then show the content of the response
to the user.

There are PEAR classes that can help you with this (most of the HTTP_*
ones), the cURL extension can do it, and you can also do it yourself
manually with fopen():

http://shiflett.org/hacks/php/http_post

Hope that helps.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


Whoa!! I never thought about that. Now, I'm beginning to understand
this... Fortunately, I have Mozilla, so I found out about the "Live HTTP
header" extension, not releted to the keywords while Google searching just
recently so I installed it and saw that it is different than I thought. I
saw no "Location:" feature, now your comments surely would be of a help.
Thanks a million! Now I'll have to decide which one to use..

Scott F.

"Chris Shiflett" <shiflettphp.net> wrote in message
news:20040218160155.32726.qmailweb14302.mail.yahoo.com...
> --- Scott Fletcher <scottabcoa.com> wrote:
> > I am wonder if it is possible to use the header("Location:
> > https://www.blah.net") while stimulating it as a POST method/string.
>
> It is not, and if you think about that for a minute, you should be glad.
>
> You cannot force the user to submit a POST request to any URL, but you can
> submit a POST request yourself and then show the content of the response
> to the user.
>
> There are PEAR classes that can help you with this (most of the HTTP_*
> ones), the cURL extension can do it, and you can also do it yourself
> manually with fopen():
>
> http://shiflett.org/hacks/php/http_post
>
> Hope that helps.
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
> Coming mid-2004
> HTTP Developer's Handbook - Sams
> http://httphandbook.org/
> PHP Community Site
> http://phpcommunity.org/

attached mail follows:


Groan!!! I get permission denied error for fsockopen()..... I looked
around on the Internet and it narrow down to the temporary directory like
"/tmp" for unix. I don't believe that is the problem because the $_SESSION
feature work great without a problem. The file permission doesn't seem to
be the problem because the directory folder is already at "dr-xr-xr-x", so
not sure what the problem is exactly...

Scott F.
"Chris Shiflett" <shiflettphp.net> wrote in message
news:20040218160155.32726.qmailweb14302.mail.yahoo.com...
> --- Scott Fletcher <scottabcoa.com> wrote:
> > I am wonder if it is possible to use the header("Location:
> > https://www.blah.net") while stimulating it as a POST method/string.
>
> It is not, and if you think about that for a minute, you should be glad.
>
> You cannot force the user to submit a POST request to any URL, but you can
> submit a POST request yourself and then show the content of the response
> to the user.
>
> There are PEAR classes that can help you with this (most of the HTTP_*
> ones), the cURL extension can do it, and you can also do it yourself
> manually with fopen():
>
> http://shiflett.org/hacks/php/http_post
>
> Hope that helps.
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
> Coming mid-2004
> HTTP Developer's Handbook - Sams
> http://httphandbook.org/
> PHP Community Site
> http://phpcommunity.org/

attached mail follows:


--- Scott Fletcher <scottabcoa.com> wrote:
> Groan!!! I get permission denied error for fsockopen().

Do you know what allow_url_fopen is set to?

You should be able to use this to check:

http://www.php.net/ini_get

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


It said it is set to 1 from ini_get(), it also said "on" from php.ini...

Scott F.

"Chris Shiflett" <shiflettphp.net> wrote in message
news:20040218185127.22025.qmailweb14311.mail.yahoo.com...
> --- Scott Fletcher <scottabcoa.com> wrote:
> > Groan!!! I get permission denied error for fsockopen().
>
> Do you know what allow_url_fopen is set to?
>
> You should be able to use this to check:
>
> http://www.php.net/ini_get
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
> Coming mid-2004
> HTTP Developer's Handbook - Sams
> http://httphandbook.org/
> PHP Community Site
> http://phpcommunity.org/

attached mail follows:


--- Scott Fletcher <scottabcoa.com> wrote:
> It said it is set to 1 from ini_get(), it also said "on" from php.ini.

In that case, you should be able to do this. Can you restate exactly what
you tried (perhaps a small sample script?) and what the error message was?

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


Sample code is $fp = fsockopen("www.whatever.com", 443, $errno, $errmsg);

Error message is $errno --> 13 and $errmsg --> Permission denied...

I think I understand the problem. I'm using the self-created certificate
without having it be signed by certificate authority. When I tried the
cURL, it refuse to work and give an SSL error.. Problem is the self-created
certificate is only temporary until the website development is ready for
production where I can then get a real SSL certificate with Certificate
Authority.

So, the question is how to get fsockopen to work with temporary certificate
if this is the problem.

Scott F

"Chris Shiflett" <shiflettphp.net> wrote in message
news:20040218194010.31421.qmailweb14307.mail.yahoo.com...
> --- Scott Fletcher <scottabcoa.com> wrote:
> > It said it is set to 1 from ini_get(), it also said "on" from php.ini.
>
> In that case, you should be able to do this. Can you restate exactly what
> you tried (perhaps a small sample script?) and what the error message was?
>
> Chris
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
> Coming mid-2004
> HTTP Developer's Handbook - Sams
> http://httphandbook.org/
> PHP Community Site
> http://phpcommunity.org/

attached mail follows:


That's not the one, I tried it with port 80 and still get the error message,
so ssl have nothing to do with it.

Scott F.
"Scott Fletcher" <scottabcoa.com> wrote in message
news:20040218210111.83980.qmailpb1.pair.com...
> Sample code is $fp = fsockopen("www.whatever.com", 443, $errno, $errmsg);
>
> Error message is $errno --> 13 and $errmsg --> Permission denied...
>
> I think I understand the problem. I'm using the self-created certificate
> without having it be signed by certificate authority. When I tried the
> cURL, it refuse to work and give an SSL error.. Problem is the
self-created
> certificate is only temporary until the website development is ready for
> production where I can then get a real SSL certificate with Certificate
> Authority.
>
> So, the question is how to get fsockopen to work with temporary
certificate
> if this is the problem.
>
> Scott F
>
> "Chris Shiflett" <shiflettphp.net> wrote in message
> news:20040218194010.31421.qmailweb14307.mail.yahoo.com...
> > --- Scott Fletcher <scottabcoa.com> wrote:
> > > It said it is set to 1 from ini_get(), it also said "on" from php.ini.
> >
> > In that case, you should be able to do this. Can you restate exactly
what
> > you tried (perhaps a small sample script?) and what the error message
was?
> >
> > Chris
> >
> > =====
> > Chris Shiflett - http://shiflett.org/
> >
> > PHP Security - O'Reilly
> > Coming mid-2004
> > HTTP Developer's Handbook - Sams
> > http://httphandbook.org/
> > PHP Community Site
> > http://phpcommunity.org/

attached mail follows:


--- Scott Fletcher <scottabcoa.com> wrote:
> Sample code is $fp = fsockopen("www.whatever.com", 443, $errno,
> $errmsg);
>
> Error message is $errno --> 13 and $errmsg --> Permission denied

I'd recommend forgetting the SSL bit for now and trying this with a
regular Web server.

I'm not sure what permission denied is about. You should get a connection
refused message if there is any networking problem or firewall preventing
the connection. Can you try this script:

<?
echo ini_get('allow_url_fopen');
$fp = fsockopen('www.google.com', 80, $errno, $errmsg);
echo "[$errno] [$errmsg]";
?>

Maybe this will reveal something. You can also want to manually test this:

telnet www.google.com 80

Just to see if you can connect from the host where this script is running.

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


This is what I get...

--snip--
1
Warning: fsockopen() [function.fsockopen]: php_hostconnect: connect failed
in /home/website/emarket/www/zz_test.php on line 4

Warning: fsockopen() [function.fsockopen]: unable to connect to
www.google.com:80 in /home/website/emarket/www/zz_test.php on line 4
[13] [Permission denied]
--snip--

"Chris Shiflett" <shiflettphp.net> wrote in message
news:20040218214406.54115.qmailweb14310.mail.yahoo.com...
> --- Scott Fletcher <scottabcoa.com> wrote:
> > Sample code is $fp = fsockopen("www.whatever.com", 443, $errno,
> > $errmsg);
> >
> > Error message is $errno --> 13 and $errmsg --> Permission denied
>
> I'd recommend forgetting the SSL bit for now and trying this with a
> regular Web server.
>
> I'm not sure what permission denied is about. You should get a connection
> refused message if there is any networking problem or firewall preventing
> the connection. Can you try this script:
>
> <?
> echo ini_get('allow_url_fopen');
> $fp = fsockopen('www.google.com', 80, $errno, $errmsg);
> echo "[$errno] [$errmsg]";
> ?>
>
> Maybe this will reveal something. You can also want to manually test this:
>
> telnet www.google.com 80
>
> Just to see if you can connect from the host where this script is running.
>
> Chris
>
>
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
> Coming mid-2004
> HTTP Developer's Handbook - Sams
> http://httphandbook.org/
> PHP Community Site
> http://phpcommunity.org/

attached mail follows:


P.S. The telnet part, it said...

--snip--
Trying....
Connected to www.google.akadns.net
--snip--

When I exited, I get HTML codes dumped on screen along with bad request...

Scott F.
"Chris Shiflett" <shiflettphp.net> wrote in message
news:20040218214406.54115.qmailweb14310.mail.yahoo.com...
> --- Scott Fletcher <scottabcoa.com> wrote:
> > Sample code is $fp = fsockopen("www.whatever.com", 443, $errno,
> > $errmsg);
> >
> > Error message is $errno --> 13 and $errmsg --> Permission denied
>
> I'd recommend forgetting the SSL bit for now and trying this with a
> regular Web server.
>
> I'm not sure what permission denied is about. You should get a connection
> refused message if there is any networking problem or firewall preventing
> the connection. Can you try this script:
>
> <?
> echo ini_get('allow_url_fopen');
> $fp = fsockopen('www.google.com', 80, $errno, $errmsg);
> echo "[$errno] [$errmsg]";
> ?>
>
> Maybe this will reveal something. You can also want to manually test this:
>
> telnet www.google.com 80
>
> Just to see if you can connect from the host where this script is running.
>
> Chris
>
>
>
> =====
> Chris Shiflett - http://shiflett.org/
>
> PHP Security - O'Reilly
> Coming mid-2004
> HTTP Developer's Handbook - Sams
> http://httphandbook.org/
> PHP Community Site
> http://phpcommunity.org/

attached mail follows:


Hello again,

    I was wondering if anyone had a chance to take a quick peek at this
code. Thanks again guys !

-Pushpinder

On Tuesday, February 17, 2004, at 10:49 AM, Pushpinder Singh wrote:

> Hello Everyone,
>
> I am making use of the following login module. However, it tells the
> user to login at least twice even if the username and password are
> correct. The data flow model is explained below :
>
> The first 'correct' attempt will result in the user being redirected
> to the "logged_in.php" page.
> The "logged_in.php" page is a intermediate page, which checks if a
> session 'validuser' exists and redirects the client to the welcome
> page. if the session does not exist then the user is redirected to the
> "Error Page" where he needs to login again.
>
> The glitch in the above code is that in spite of entering the correct
> login and password, the user is redirected to the error page (via
> logged_in.php script ) EVERY TIME ON THE FIRST TRY. Each subsequent
> attempt (again assuming the correct username and password are entered)
> allows the users to get to the welcome screen.
>
> Register_Globals is ON on the remote host, I would really appreciate
> any pointers on this one. Thanks in advance.
>
>
> regards
> Pushpinder Singh
>
> ============================ START OF CODE ============================
>
> <? session_start();
>
> error_reporting(E_ALL);
>
> if ( (isset($_POST['validuser'])) && (isset($_POST['pass'])) ) {
>
> mysql_connect( 'localhost', 'name', 'pwd' )
> or die ( 'Unable to connect to server.' );
>
> // Select database on MySQL server
> mysql_select_db( 'crm' )
> or die ( 'Unable to select database' );
>
> // Formulate the query
> $sql1 = "SELECT * from `admin` where user =
> '{$_POST['validuser']}' AND pwd = '{$_POST['pass']}'";
>
> $result1 = mysql_query($sql1)
> or die ( 'ERROR ::: Database Error has occured');
>
> $num_results = mysql_num_rows($result1);
>
>
> if ($num_results == 1 ) {
>
> if(!isset($_SESSION['validuser'])){
> $_SESSION['validuser'] = $_POST['validuser'];
> }
> }
>
> else {
> echo "<br><br><strong><font color=\"#ff2233\" size=\"1\"
> face=\"Verdana, Arial, Helvetica, sans-serif\">WRONG PASSWORD::</
> strong> Please re-enter your login and
> password.<br><br><br>";
> }
> }
>
>
>
> ?>
>
> <html>
> <head>
> <title>ADMIN-LOGIN</title>
> </head>
>
> <?
>
> if (isset($_SESSION['validuser']))
> {
> //ob_start(); // buffer output
> //echo "You are already logged into the system !!!";
> //header ("Location: http://psg.local/~psgarcha/logged_in.php");
> //ob_end_flush(); // flush output
> echo "<meta http-equiv=\"refresh\"
> content=\"0;url=http://psg.local/~psgarcha/CRM/logged_in.php\">";
> exit;
>
> }
>
> else {
>
> if ( (!isset($_POST['validuser'])) || (!isset($_POST['pass'])) ) {
> echo "<br><br><strong><font color=\"#ff2233\" size=\"1\"
> face=\"Verdana, Arial, Helvetica, sans-serif\">NOTE::</strong> You
> need to enter the login and password fields. Both the fields are
> case-sensitive.<br><br><br>";
> }
>
> echo "
> <body bgcolor=\"aaaaaa\">
> <form name=\"form1\" method=\"post\" action=\"login.php\">
> <table width=\"707\" border=\"1\" cellpadding=\"2\"
> cellspacing=\"3\" bordercolor=\"#FFFFFF\" bgcolor=\"#FFFFFF\">
> <tr bgcolor=\"99ccff\">
> <td colspan=\"2\"><div align=\"center\"><strong><font
> color=\"#FFFFFF\" size=\"2\" face=\"Verdana, Arial, Helvetica,
> sans-serif\"><br>
> Please enter your Username and Password <br>
> <br>
> </font></strong></div></td>
> </tr>
> <tr bgcolor=\"#E7E7E7\">
> <td width=\"214\"><strong><font color=\"#666666\" size=\"1\"
> face=\"Verdana, Arial, Helvetica,
> sans-serif\">Login</font></strong></td>
> <td width=\"549\"><font size=\"1\">
> <input name=\"validuser\" type=\"text\" id=\"validuser\"
> size=\"20\">
> </font></td>
> </tr>
> <tr bgcolor=\"#E7E7E7\">
> <td><strong><font color=\"#666666\" size=\"1\" face=\"Verdana,
> Arial, Helvetica, sans-serif\">Password</font></strong></td>
> <td><font size=\"1\">
> <input name=\"pass\" type=\"password\" id=\"password\"
> size=\"15\">
> </font></td>
> </tr>
> <tr bgcolor=\"#E7E7E7\">
> <td height=\"24\" colspan=\"2\"><div align=\"center\">
> <input type=\"submit\" name=\"Submit\" value=\"Submit\">
> <input type=\"reset\" name=\"Submit2\" value=\"Reset\">
> </div></td>
> </tr>
> </table>
> </form>
> ";
>
> }
> ?>
>
> </body>
> </html>

attached mail follows:


Pushpinder Singh <mailto:pgarchaadelphia.net>
    on Wednesday, February 18, 2004 7:46 AM said:

> I was wondering if anyone had a chance to take a quick peek at
> this code. Thanks again guys !

yes. but it's hard to read, so i just skipped it considering i haven't
had a lot of time to spend in the mailing list lately.

you say it always happens on the SECOND time you authenticate?

do an experiment for me. fill in your form correctly and click submit.
then press refresh. see if the page will give you the expected results
after refreshing.

chris.

attached mail follows:


Hi Chris.
You have done a better job describing that situation than i did. Thank you.

best regards
raditha

Chris Shiflett wrote:

>--- Raditha Dissanayake <jabberraditha.com> wrote:
>
>
>>It's not often that i disagree with the other chris but one occaision
>>where meta refresh turns out to be the only solution is when working
>>with some payment gateways where instead of doing a simple old post to
>>your return page they include it inside their own thank you page so the
>>headers will not work.
>>
>>Lame? well some of the best known gateways are doing it.
>>
>>
>
>You're right, but I don't think this means that we must disagree. :-)
>
>In my opinion, this simply falls into the narrow category for which the
>http-equiv attribute was created. If you want to specify an HTTP header in
>the content, it's your only option. This is such a case. Because the
>payment processor is the one acting as the Web client, it is they who
>receive your HTTP response. They only display the content of this response
>to the end user, so any headers you set are probably discarded (or maybe
>the payment processor is redirected?).
>
>However, this has lead to people using this same approach in the 99% of
>situations where it is not necessary. If the user's Web client is
>receiving your HTTP response in its entirety (the usual situation), you
>can set any HTTP header you want the "right" way.
>
>I don't have the URL handy, but there is a site somewhere that has been
>conducting extensive tests to determine which headers have good http-equiv
>support among various browsers. While Refresh is pretty well supported,
>
>

--
Raditha Dissanayake.
------------------------------------------------------------------------
http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 150 KB | with progress bar.

attached mail follows:


--- Raditha Dissanayake <jabberraditha.com> wrote:
> You have done a better job describing that situation than i did. Thank
> you.

No problem. :-)

I found that URL I mentioned (with the browser tests). The author claims
that it's all being rewritten, but most of them are listed here:

http://www.hixie.ch/tests/tesremas/listsuites.pl?suite=WBT

The tests I was thinking about were this one on meta Refresh:

http://www.hixie.ch/tests/evil/mixed/refresh1.html

And this one on HTTP Refresh:

http://www.hixie.ch/tests/evil/mixed/refresh1.http.html

The results are here:

http://www.hixie.ch/tests/tesremas/listresults.pl

Chris

=====
Chris Shiflett - http://shiflett.org/

PHP Security - O'Reilly
     Coming mid-2004
HTTP Developer's Handbook - Sams
     http://httphandbook.org/
PHP Community Site
     http://phpcommunity.org/

attached mail follows:


<html><style>p {margin: 0px}</style><body style='font-size:9pt; font-family:Verdana; font-family: Verdana' ><P>Hi List,</P><P>I have a little problem I posted a couple of times now. The PHP Manual gave me the idea that the clibpdf library seemed to work with php. Well I tried some things they didn't seem to work.</P><P>Well I thought I'd ask the list, maybe somebody could help me out. But what&nbsp; a thought, nobody even answered it is not possible, or look there. I know this is not one of these how do I make a select from mysql questions, but is everyone on vacation?<BR><BR>If it is not possible or nobody uses it anymore, which I totally understand why, then why is it still in the manual? I know I'm not the first to ask the questions I asked and I'm not the first not to receive an answer on this, but if it's not working why is it still in the f** manual?</P><P>I'm especially talking about the point of a picture not showing with ClibPDf which somebody asked 2000 (he didn't get an answer either)</P><P>This is getting sort of frusttrating, so I apolpgize for letting some steam out here. But I just can't believe there is nobody out there who has a clue.</P><P>thx Jan</P></body></html>
______________________________________________________________________________
Extra-Konto: 2,50 %* Zinsen p. a. ab dem ersten Euro! Nur hier mit 25
Euro-Tankgutschein & ExtraPrämie! https://extrakonto.web.de/?mc=021110

attached mail follows:


> mycb> Sure, but why would a user want to fake their browser signature?
>
> They might do it without even knowing. Opera will identify itself as
> IE6 for example if you select that in the Preferences. Other
> browsers/packages can do it as standard. Although I can't give a
> specific example, I bet there are some firewalls out there that filter
> this information out too.

When I ran Opera, I all but HAD to set it as "IE5" (Opera 6.05 I think
was the last version I ran) because if I didn't, many websites would,
for lack of a better term, discriminate against the non IE header info
and pass you to a page that was very stripped of features and layout and
sometimes was barely thrown together, much less 'developed'. And if you
went to a site like Hotmail.com, you lost a LOT of functionality.
Assuming that Microsoft didn't do this out of spite, the basic
assumption was "Oh, you're not running Internet Explorer.. You must not
be capable of doing CSS or whatever". Opera functioned just fine on
these sites if you told it to impersonate IE.

> >> I saw a response letting you know how to do this, but I would
> >> recommend not sending people to different pages based on which
> >> browser/OS they're using.
>
> mycb> Why not? Isn't that what most of the big web sites do?
>
> Actually yes, lots of them do. So I agree with you here :)

Many big sites do this, but as illustrated in the example I gave above,
it's not always justified or welcome. I personally hate designing too
many different pages to suit all the needs of the browsers, so I try to
work with what most of the browsers will handle right off. True, that's
not going to take into account Lynx users or whatever, but if I don't
OVER design what I'm working on, then it still shouldn't turn out too
bad. There are always exceptions though. Thankfully, designing
primarily for an internal corporate environment right now, I have some
insight into what people are using and some control over what they NEED
to use in order to make use of the functions that I implement.

> mycb> What about obsolete browsers that don't handle CSS too
> well (or not at all)? We
>
> I think his point was that there are other ways to handle browser
> display issues besides 2 versions of a site and a user_agent test.

True. You know.. Browsers really need to be able to talk more to
scripts to let them know what their capabilities are. You can do this
to some degree, but I think we should be able to ask the browser itself
if it knows tag <xxxxx> and it can respond 'yea' or 'nay'. Then, if
there's a known issue with the implementation of that tag in that
browser (glitches, bugs and such) then we can use the browser
identification to decide if it's worth using that tag or not. Handle it
all programatically. No sense having 95% functional HTML and having 5%
blow up when we can toggle the use of that 5% via PHP depending on
certain conditions.

Ok, I'm rambling.. Excuse me. I'm making like 3 or 4 different points
at once.

-TG

attached mail follows:


ummmm NOPE...
i don't believe that nick was looking for a constant - which cannot be
changed once defined.

there are a few ways to do this - for one, you can declare $var global
inside of the function in your class:

class myclass{

  function myclass(){
    global $var;
    //do some stuff
  }
}

when you invoke a class instance with a function that shares the same name
as the calling class it executes automatically. by declaring this $var
global it should be accessible to the rest of the functions.

another way to do this without declaring the $var as a global is to pass it
to the function explicitly:

function myclass($var){
  //do stuff with $var
}

~Phillip Jackson

"Nick Wilson" <nickstylesheet.org> wrote in message
news:20040218093115.GA24334stylesheet.org...
>
> * and then Nick Wilson declared....
> > <?php
> > $myconfig=TRUE;
> >
> > class myclass {
> >
> > if($myconfig) {
> > var $something=1;
> > }
> > }
> >
> > I know that that is not the way it should be done though. What is the
> > best way to do this?
>
> On a hunch, i think i've found the answer:
> http://www.php.net/manual/en/language.constants.php
>
> Right?
>
> --
> Nick W

attached mail follows:


Hi,
I'm working on a set of scripts not written by me.

Theres a "date_of_birth" field there that has the values in this format
YYYY-MM-DD, the client wants me to
print out the age of the person from that...looking in the manual
(http://se.php.net/manual/en/function.date.php)
I think I will need to use mktime....but how??

Any help appreciated, in URL form, hints or PHP manual references.

Thanks,
-Ryan

attached mail follows:


Ryan A <mailto:ryancoinpass.com>
    on Wednesday, February 18, 2004 8:19 AM said:

> I think I will need to use mktime....but how??
>
> Any help appreciated, in URL form, hints or PHP manual references.

well i think the idea is to convert the date/time of the person's
birthday into a unix timestamp and then subtract that from the current
date/time. then you can convert the difference back into a readable
format.

i think the unix timestamp is in seconds??? so if you end up with 5000
as the difference you can...

5000/60 = $minutes
$minutes/60 = $hours
$hours/24 = $days
etc.

hthaihinw*,
chris.

* Hope This Helps And I Hope I'm Not Wrong :)

attached mail follows:


From: "Ryan A" <ryancoinpass.com>

> Theres a "date_of_birth" field there that has the values in this format
> YYYY-MM-DD, the client wants me to
> print out the age of the person from that...looking in the manual
> (http://se.php.net/manual/en/function.date.php)
> I think I will need to use mktime....but how??

Assuming you mean a database field, you can do this in your query to get the
age:

SELECT YEAR(CURRENT_DATE) -YEAR(dob) -
(IF(DAYOFYEAR(dob)>DAYOFYEAR(CURRENT_DATE),1,0)) AS age FROM table ...

Where "dob" is the date of birth column.

You could do the same thing in PHP by using strtotime() on the YYYY-MM-DD
formatted date to get a Unix timestamp. Then either subtract that from the
current timestamp and do the division to figure out years, or use something
like the above query. date('Y',$current) - date('Y',$dob), then subtract one
if the birthday day of year hasn't arrived yet.

I'm sure there are a host of other ways, too.

---John Holmes...

attached mail follows:


How do I convert &apos; to ' before displaying it in HTML?
Thanks,

--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 ext 214
Fax : 00-34-915228673
email: dianahotelkey.com
Web : http://www.hotelkey.com
      http://www.destinia.com

attached mail follows:


On Wednesday 18 February 2004 11:24 am, Diana Castillo wrote:
> How do I convert &apos; to ' before displaying it in HTML?
> Thanks,
>

You could leave it as it is, and the browser would convert it to ' if its an
HTML page...

attached mail follows:


On 18 February 2004 16:24, Diana Castillo contributed these pearls of
wisdom:

> How do I convert &apos; to ' before displaying it in HTML?

You don't. That's the browser's job.

Cheers!

Mike

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

attached mail follows:


$string = str_replace('&apos;','\'',$string);

You don't need to, but if you want to, thats how you could do it.

Adam Voigt
adamkotisprop.com

On Wed, 2004-02-18 at 11:24, Diana Castillo wrote:
> How do I convert &apos; to ' before displaying it in HTML?
> Thanks,
>
>
> --
> Diana Castillo
> Global Reservas, S.L.
> C/Granvia 22 dcdo 4-dcha
> 28013 Madrid-Spain
> Tel : 00-34-913604039 ext 214
> Fax : 00-34-915228673
> email: dianahotelkey.com
> Web : http://www.hotelkey.com
> http://www.destinia.com

attached mail follows:


Mike Ford wrote:

> On 18 February 2004 16:24, Diana Castillo contributed these pearls of
> wisdom:
>
>
>>How do I convert &apos; to ' before displaying it in HTML?
>
>
> You don't. That's the browser's job.
>
> Cheers!
>
> Mike
>

But if you still want to do it:
$text = html_entity_decode($text);

--
paperCrane <Justin Patrin>

attached mail follows:


Im looking for the fastest way to modify array keys.
For example, changing ->
$foo['hello_world'] = 'HELLO WORLD';
to
$foo['hello'] = 'HELLO WORLD';

The only way I can think of is to loop through the array,
copying array values to new keys, and unsetting the old key.

Thanks for any insight you may provide...

attached mail follows:


You might be able to create some function that uses a combination of
array_keys(), array_values(), and array_combine() to do what you want.
Check the manual at http://www.php.net/array for more information on
these functions.

Gerard Samuel wrote:
> Im looking for the fastest way to modify array keys.
> For example, changing ->
> $foo['hello_world'] = 'HELLO WORLD';
> to
> $foo['hello'] = 'HELLO WORLD';
>
> The only way I can think of is to loop through the array,
> copying array values to new keys, and unsetting the old key.
>
> Thanks for any insight you may provide...

attached mail follows:


On Wednesday 18 February 2004 12:03 pm, Ben Ramsey wrote:
> You might be able to create some function that uses a combination of
> array_keys(), array_values(), and array_combine() to do what you want.
> Check the manual at http://www.php.net/array for more information on
> these functions.
>

True, but I was looking to see if I could avoid running a loop, of which I
would still have to loop over the result of array_keys() to modify its
content.
So for now, Im running ->
function modify_key($array)
{
    $array = (array)$array;

    foreach($array as $key => $value)
    {
        if (FALSE === ($pos = $strpos($key, '.')))
        {
            continue;
        }

        $new_key = substr($key, $pos + 1);
        $array[ $new_key ] = $value;
        unset( $array[ $key ] );
    }

    return $array;
}

attached mail follows:


>The only way I can think of is to loop through the array, copying array
>values to new keys, and unsetting the old key.

Yeah, that's pretty much it:

        foreach(array_keys($array) as $old_key) {
                $array[new_key($old_key)] = $array[$old_key];
                unset($array[$old_key]);
        }

---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html

attached mail follows:


I know that it may be somewhat irrelevant to solving the problem at hand
(and, in fact, I think your current method is probably the best method),
but I was just wondering why you needed to change the names of your keys
at all. Why is it not programmed so that the keys already have the
names you want them to have?

Gerard Samuel wrote:

> On Wednesday 18 February 2004 12:03 pm, Ben Ramsey wrote:
>
>>You might be able to create some function that uses a combination of
>>array_keys(), array_values(), and array_combine() to do what you want.
>>Check the manual at http://www.php.net/array for more information on
>>these functions.
>>
>
>
> True, but I was looking to see if I could avoid running a loop, of which I
> would still have to loop over the result of array_keys() to modify its
> content.
> So for now, Im running ->
> function modify_key($array)
> {
> $array = (array)$array;
>
> foreach($array as $key => $value)
> {
> if (FALSE === ($pos = $strpos($key, '.')))
> {
> continue;
> }
>
> $new_key = substr($key, $pos + 1);
> $array[ $new_key ] = $value;
> unset( $array[ $key ] );
> }
>
> return $array;
> }

attached mail follows:


On Wednesday 18 February 2004 12:38 pm, Ben Ramsey wrote:
> I know that it may be somewhat irrelevant to solving the problem at hand
> (and, in fact, I think your current method is probably the best method),
> but I was just wondering why you needed to change the names of your keys
> at all. Why is it not programmed so that the keys already have the
> names you want them to have?
>

In a nutshell
1. My problem is with current SQLite:
http://marc.theaimsgroup.com/?l=php-db&m=107705406519266&w=2

2. I posted a question to the SQLite mailing list, and got these replies
"Yes, this is the correct behavior, without the table 'prefix' if you have
common column names in the result set the data would lost."

AND

"The old PHP interface did strchr() on the column names in order to 'strip'
the
any data (table name) before the column name. This is rather inefficient and
should not be done and thus was removed."

So to have my DB abstraction class stay compliant with other DBs, I have to
modify the returned keys from an SQLite query...

Life sucks, so I deal with it... :(

attached mail follows:


Gerard Samuel wrote:

> On Wednesday 18 February 2004 12:38 pm, Ben Ramsey wrote:
>
>>I know that it may be somewhat irrelevant to solving the problem at hand
>>(and, in fact, I think your current method is probably the best method),
>>but I was just wondering why you needed to change the names of your keys
>>at all. Why is it not programmed so that the keys already have the
>>names you want them to have?
>>
>
>
> In a nutshell
> 1. My problem is with current SQLite:
> http://marc.theaimsgroup.com/?l=php-db&m=107705406519266&w=2
>
> 2. I posted a question to the SQLite mailing list, and got these replies
> "Yes, this is the correct behavior, without the table 'prefix' if you have
> common column names in the result set the data would lost."
>
> AND
>
> "The old PHP interface did strchr() on the column names in order to 'strip'
> the
> any data (table name) before the column name. This is rather inefficient and
> should not be done and thus was removed."
>
> So to have my DB abstraction class stay compliant with other DBs, I have to
> modify the returned keys from an SQLite query...
>
> Life sucks, so I deal with it... :(

You could try using PEAR DB or MDB... They already do all of that stuff.

--
paperCrane <Justin Patrin>

attached mail follows:


I have a custom error handler class that's working well. My problem is
that I can't find a way to find out whether a particular error has been
suppressed using the prefix. Is there a way to do this with a custom
handler?

--
Stuart

attached mail follows:


From: "Stuart" <listssharedserver.net>

> I have a custom error handler class that's working well. My problem is
> that I can't find a way to find out whether a particular error has been
> suppressed using the prefix. Is there a way to do this with a custom
> handler?

Next time start here
http://us2.php.net/manual/en/function.set-error-handler.php
and read everything.

You'll notice this if you do:
-----
It is important to remember that the standard PHP error handler is
completely bypassed. error_reporting() settings will have no effect and your
error handler will be called regardless - however you are still able to read
the current value of error_reporting and act appropriately. Of particular
note is that this value will be 0 if the statement that caused the error was
prepended by the error-control operator.
-----

---John Holmes...

attached mail follows:


John W. Holmes wrote:
> You'll notice this if you do:
> -----
> It is important to remember that the standard PHP error handler is
> completely bypassed. error_reporting() settings will have no effect and your
> error handler will be called regardless - however you are still able to read
> the current value of error_reporting and act appropriately. Of particular
> note is that this value will be 0 if the statement that caused the error was
> prepended by the error-control operator.
> -----

Oops. Thanks John.

--
Stuart

attached mail follows:


Hello,

On 02/18/2004 02:50 PM, Stuart wrote:
> I have a custom error handler class that's working well. My problem is
> that I can't find a way to find out whether a particular error has been
> suppressed using the prefix. Is there a way to do this with a custom
> handler?

If you suppress the errors with , you disable errors.

Anyway, here you may find an error handler function that you can use
with set_error_handler() to not only the errors but also dump the
backtrace of all the function calls that lead to this, including file
names and lines as well function argument values.

This is part of a package of a class that can be used to watch
periodically the PHP error log file and send the latest error lines that
were added. I use this to be warned immediately about errors that
occured in my sites, probably due to problems in my code, so I can take
immediate action.

http://www.phpclasses.org/logwatcher

--

Regards,
Manuel Lemos

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

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

attached mail follows:


Hello List,

I am using the following in a PHP script:

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

Most browsers will prompt the visitor to reload the data, but if a
visitor is using IE 5.? on a Mac OS X machine, their browser's back
button still shows them the original page from cache. At the top of the
page, in HTML, I've also added (along with the above headers):

<META HTTP-EQUIV="Cache-Control" CONTENT="no-store, no-cache,
must-revalidate">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="0">

and still, the browser pulls from the cache.

I'm guessing this is a bug, but I'm wondering if any one has a work around?

TIA,
Roger

attached mail follows:


Hello Roger,

If you find a solution, I would also be interested to to see it. I
have tried almost everything to get Mac IE to not use the cache. It
just doesn't seem to accept anything.

On 18 Feb 2004, at 18:58, Roger Spears wrote:

> Hello List,
>
> I am using the following in a PHP script:
>
> header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
> header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
> header("Cache-Control: no-store, no-cache, must-revalidate");
> header("Cache-Control: post-check=0, pre-check=0", false);
> header("Pragma: no-cache");
>
> Most browsers will prompt the visitor to reload the data, but if a
> visitor is using IE 5.? on a Mac OS X machine, their browser's back
> button still shows them the original page from cache. At the top of
> the page, in HTML, I've also added (along with the above headers):
>
> <META HTTP-EQUIV="Cache-Control" CONTENT="no-store, no-cache,
> must-revalidate">
> <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
> <META HTTP-EQUIV="Expires" CONTENT="0">
>
> and still, the browser pulls from the cache.
>
> I'm guessing this is a bug, but I'm wondering if any one has a work
> around?
>
> TIA,
> Roger
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


I want to create a language option, so the resulting html is in French or English, depending. But passing variables like this doesn't work:

&