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 15 Jul 2003 15:39:18 -0000 Issue 2177

php-general-digest-helplists.php.net
Date: Tue Jul 15 2003 - 10:39:18 CDT


php-general Digest 15 Jul 2003 15:39:18 -0000 Issue 2177

Topics (messages 155217 through 155294):

activex and PHP on linux
        155217 by: Jeremy

Older Version problems
        155218 by: ed.homes2see.com
        155221 by: Ray Hunter

Re: php4_module is already loaded
        155219 by: Ray Hunter

Re: console script html tags?
        155220 by: Ray Hunter

Re: any danger in overwriting $_GET ?
        155222 by: Justin French
        155226 by: Curt Zirzow
        155270 by: Wendell Brown
        155272 by: Wendell Brown

Re: Is it possible to test an uploaded file to check the type?
        155223 by: Joel Rees

Re: Looking for experienced PHP programmer in the Memphis, TN area
        155224 by: Joel Rees

Sessions and objects
        155225 by: Matt Silva

Searching a test file...
        155227 by: Lloyd Bayley
        155234 by: Mike Migurski
        155262 by: Burhan Khalid

Using a drop down box with an udetermined field amount
        155228 by: Ron Allen
        155248 by: sven

Re: Missing php.ini file
        155229 by: Chris Blake
        155246 by: Joel Rees
        155260 by: Chris Blake

textarea rich replacement?
        155230 by: Justin French
        155258 by: Marek Kilimajer

Re: Code and Good Design Methods
        155231 by: Joel Rees
        155282 by: Hardik Doshi

Antwort: RE: [PHP] Grabbing info from other Sites
        155232 by: SLanger.spirit21.de

Re: numberformat
        155233 by: Nadim Attari

Re: Capturing Windows Login Details
        155235 by: Ha¹ko Juraj

Check if php file is an included file?
        155236 by: John Manko
        155237 by: Jason Wong
        155238 by: Student4

Re: Replacing newlines (\n) with smething else
        155239 by: Joel Rees

ANY ONE CAN TELL ME WHAT PORT mssql_connect uses?
        155240 by: Nabil
        155255 by: Burhan Khalid
        155274 by: Michael Sims

headers already sent-cookie-ob_flush()
        155241 by: frederik feys

socket programming
        155242 by: Michael P. Carel
        155253 by: David Nicholson
        155278 by: Step Schwarz
        155280 by: Simon Fredriksson

Re: Grabbing info from other Sites
        155243 by: Joel Rees
        155251 by: Joel Rees
        155263 by: Joel Rees
        155266 by: Ow Mun Heng

headers already sent and cookie problem
        155244 by: frederik feys
        155247 by: Ryan Gibson
        155256 by: Ford, Mike [LSS]

Re: BigEndian to integer
        155245 by: Joel Rees
        155268 by: Tom Rogers
        155291 by: Gerard Samuel
        155292 by: Gerard Samuel

Re: How To Ask Questions - Some List Guidelines
        155249 by: Joel Rees

Re: Moving Files/ Temporary Names
        155250 by: Ford, Mike [LSS]
        155254 by: caspar kennerdale

Re: Text file manipulation question.
        155252 by: Ford, Mike [LSS]

Re: So in summary this can't be done due to permission problems?
        155257 by: Joel Rees

Re: Problem getting phpMyAdmin to work on localhost
        155259 by: Richard White
        155294 by: Richard Baskett

Carrying a variable
        155261 by: Ron Allen
        155264 by: Ford, Mike [LSS]
        155265 by: Kristin Schesonka

fake .php extension
        155267 by: Nabil
        155269 by: Maria Garcia Suarez
        155271 by: Jason Wong
        155276 by: Robert Hawke

mail() sending mails twice to the e-mails addresses at BCC
        155273 by: Maria Garcia Suarez

variable sized arrays & global vars - another newbie question
        155275 by: bob pilly
        155277 by: Marek Kilimajer
        155279 by: Dirk Kredler
        155286 by: bob pilly
        155287 by: David Nicholson

Re: timestamp problem !!
        155281 by: Chris Boget

Re: Easier queries?
        155283 by: Dean E. Weimer

Re: Authentication system
        155284 by: Justin French

Re: Mp3 Conversion, using PHP
        155285 by: Jay Blanchard

Re: elegant way of doing something else the last time through a loop? SOLVED
        155288 by: Petre Agenbag
        155289 by: Jason Wong

Re: elegant way of doing something else the last time through a loop?
        155290 by: Paul Chvostek

Re: Templates...
        155293 by: Pete Morganic

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:


I'm running a website (www.revitcity.com) on linux/PHP/MySQL and the site is
for architecture components. The compenents or objects called famlies are
uploaded by users and shared freely. The program these objects are used in
is Revit, a windows only program. So here's my question.

Currenly users must render the object and upload an image along with the
object itself. However using activex controls, windows can access an
imbedded thumbnail in the files. Can I access these imbedded thumbnails on a
PHP/Linux system so that our users don't have to render and upload the
images as well?

Jeremy

attached mail follows:


 I'm moving some scripts to a new server but the PHP installation on the
new server is actually older than the version I currently have installed
on the production server. I'm moving from 4.2.3 to 4.1.2.

 In my file upload scripts I can't seem to get any $_FILES values out of
my upload. The scripts don't error out and the file appears to transfer.
I've enabled E_ALL and logging. Uploads are on and max upload size is
sufficient. When I check $_FILES['filename']['tmp_name'] or ['size'] or
['name'] or ['type'] they are all empty.

 Did I miss something in the ini file somewhere? I'd really hate to
upgrade at this time as this came from a Red Hat 7.3 install and I'd hate
to lose all the functions that are already pre-compiled into it (gd,
mysql, etc)

Thanks,

Ed

attached mail follows:


Have you checked that the files are indeed getting to the directory that
is specified by the upload_dir setting in php.ini?

Also check your tmp dirs to see if they are getting there too. If they
are not getting to the tmp dir then there are some issues.

--
BigDog

On Mon, 2003-07-14 at 21:19, edhomes2see.com wrote:
> I'm moving some scripts to a new server but the PHP installation on the
> new server is actually older than the version I currently have installed
> on the production server. I'm moving from 4.2.3 to 4.1.2.
>
> In my file upload scripts I can't seem to get any $_FILES values out of
> my upload. The scripts don't error out and the file appears to transfer.
> I've enabled E_ALL and logging. Uploads are on and max upload size is
> sufficient. When I check $_FILES['filename']['tmp_name'] or ['size'] or
> ['name'] or ['type'] they are all empty.
>
> Did I miss something in the ini file somewhere? I'd really hate to
> upgrade at this time as this came from a Red Hat 7.3 install and I'd hate
> to lose all the functions that are already pre-compiled into it (gd,
> mysql, etc)
>
> Thanks,
>
> Ed
>
>

attached mail follows:


Most likely your php is a core module that does not require the load
module in your httpd.conf file...

you can verify if it is core (static not DSO) with

httpd -l

--
BigDog

On Mon, 2003-07-14 at 21:01, CDitty wrote:
> I just updated my 4.2.x to 4.3.2 and when I restart the apache, I get the
> error [warn] module php4_module is already loaded, skipping.
>
> Can anyone offer any suggestions? I searched the archives, but didn't see
> anything that would help. Apache/PHP seem to be running ok, but I would
> like to get rid of the error.
>
> Thanks
>
> Chris
>

attached mail follows:


Turn the html errors off in your php.ini file or write a function that
handles all your errors for you and u dont echo out html tags.

http://us3.php.net/manual/en/function.set-error-handler.php

--
BigDog

On Mon, 2003-07-14 at 21:32, Curt Zirzow wrote:
> Larry Brown <larry.browndimensionnetworks.com> wrote:
> > How can I rid myself of the html tags around error messages when writing
> > console scripts? (Besides avoiding errors)
>
> You can set up another system or user php.ini for the php binary to read
> then pass the location of the php.ini to the php binary:
> php -c /path/to/other/php.ini inputfile.php
>
>
> >
> > Larry S. Brown
> > Dimension Networks, Inc.
> > (727) 723-8388
> >
> >
>
> HTH
>
> Curt
> --
>

attached mail follows:


On Tuesday, July 15, 2003, at 01:24 PM, Curt Zirzow wrote:

> Have you tried running the script to see if $_GET['myNewKey'] actually
> is filled out? You'll find that it is.

of course I tried it, and yes it works, but that doesn't mean it's
smart/safe :)

> Using the special name space variable rather defeats the purpose of why
> php now has register_globals to off. The $_GET variable should be used
> to ensure that the variable did indead come in from the GET request.
> Also malicous users can attempt to set variables that they shouldn't be
> setting.

I'm fully aware of the reasons why one would use $_GET['foo'] over
$foo, but as stated in the OP, i'm interested in using
search-engine-friendly URLs like:

        http://example.com/article.php/cooking/154

...rather than:

        http://example.com/article.php?cat=cooking&id=154

In either instance, it is possible for the end user to modify the URL
to change the values, so I don't see a difference in the perceived
security level of each method. Both methods require the programmer to
check/validate the values, both methods pass values to a script via the
URL, both methods can be 'hacked' by evil people, and both methods have
limitations as to what is a valid URL.

The only difference I can see is that one set of values gets placed
into the $_GET superglobal array, and the other does not.

My *aim* was to port the expected values in the URL (/cooking/154) into
the $_GET superglobal array (eg $_GET['cat'] = 'cooking', $_GET['id'] =
154), resulting in:

- less modifications to existing scripts (ie, I can still refer to the
$_GET array)
- more familiarity in the way the pages are coded

I can't see any reason why I should not do this, and it seems to work,
but I was hoping someone might have a good reason why I shouldn't...

Justin

attached mail follows:


Justin French <justinindent.com.au> wrote:
> On Tuesday, July 15, 2003, at 01:24 PM, Curt Zirzow wrote:
> [...]
> I'm fully aware of the reasons why one would use $_GET['foo'] over
> $foo, but as stated in the OP, i'm interested in using
> search-engine-friendly URLs like:

Good, I was just making sure that you were aware of it.

>
> http://example.com/article.php/cooking/154
>
> ...rather than:
>
> http://example.com/article.php?cat=cooking&id=154
>

I do the something similar with almost all my applications I build.

> In either instance, it is possible for the end user to modify the URL
> to change the values, so I don't see a difference in the perceived
> security level of each method. Both methods require the programmer to
> check/validate the values, both methods pass values to a script via the
> URL, both methods can be 'hacked' by evil people, and both methods have
> limitations as to what is a valid URL.

Yeah, didn't mention the security hole only when there is lack of code
integrety. I was sort of under the impression that you wanted to set
variables in the $_GET var to pass around for other php files to use.

>
> The only difference I can see is that one set of values gets placed
> into the $_GET superglobal array, and the other does not.
 
yes, global statments all over the place does make the code a bit messy.

>
> My *aim* was to port the expected values in the URL (/cooking/154) into
> the $_GET superglobal array (eg $_GET['cat'] = 'cooking', $_GET['id'] =
> 154), resulting in:
>
> - less modifications to existing scripts (ie, I can still refer to the
> $_GET array)
> - more familiarity in the way the pages are coded
>
> I can't see any reason why I should not do this, and it seems to work,
> but I was hoping someone might have a good reason why I shouldn't...
 
I can't either.

>
> Justin
>

Curt
--

attached mail follows:


On Tue, 15 Jul 2003 14:52:36 +1000, Justin French wrote:

>My *aim* was to port the expected values in the URL (/cooking/154) into
>the $_GET superglobal array (eg $_GET['cat'] = 'cooking', $_GET['id'] =
>154), resulting in:

If you are on Apache, you can use mod rewrite to do this for you with
NO script changes. I use this on a couple of sites, the /1/2 gets
converted into "?vara=1&varb=2 in the call. Neither the search engine
nor the script can tell the difference. :)

attached mail follows:


On Tue, 15 Jul 2003 07:28:37 -0500, Wendell Brown wrote:

>If you are on Apache, you can use mod rewrite to do this for you with
>NO script changes. I use this on a couple of sites, the /1/2 gets
>converted into "?vara=1&varb=2 in the call. Neither the search engine
>nor the script can tell the difference. :)

Check out this message for more info:

http://marc.theaimsgroup.com/?l=php-general&m=105370319925172&w=2

attached mail follows:


> Is it possible to check a file in $_FILES['userfile']['tmp_name'] to
> make sure it is of a certain format? I want to allow a user to only
> upload jpegs or mpegs, and want to check what format the file is in.

If there are only a few types, and you know what those types should look
like, it shouldn't be too hard. Maybe.

For instance, you could try having ypur application open the putative
jpeg with the GIMP, and if the GIMP fails to open it or bombs, then your
application rejects the upload. ;-P

(If you actually did use the GIMP for this, however, you don't want to
call the GIMP directly from PHP/Apache. Not only would it bog your web
app down, but it would potentially open your site up to secure attacks
against a piece of software that is not known to be secure. What you'd
want is something like a cron job to look at the upload directory for
new uploads and pass them to a script that would call the GIMP to do the
check. That way, if the GIMP dies, there is no open shell connected to
an IP port. The cron job would also want to call something to clean up
any dead processes left around.)

I think there are dedicated jpeg validation libraries floating around.
Not sure about MPEG. If it's a simple format, you may be able to write
your own parser (regex?) for it, in which case, maybe you only need to
check the first 100 or 1000 or so bytes.

Checking to make sure a file was _not_ an MS-DOS executable used to be
fairly easy.

Anyway, whether you parse or let the user tell you (MISE) depends on how
careful you need to be (i. e., what your application is going to do with
the upload).

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


> This position requires strong technical knowledge in a server-side
> scripting technology such as PHP (preferred) /JSP/Perl/ASP. Knowledge
> of SQL queries, stored procedures and database design required. Must
> have experience in HTML/CSS and familiarity with HTTP and networking
> concepts. Graphic design and user-interface skills are desired.
> Experience with CVS and Linux/Unix shell environments a plus.

Telecommuting from Japan okay?

;->

attached mail follows:


I create a new object and then assign it to a session var

$customer = new Customer($_GET['facilityID'], $_GET['customerID']);
$_SESSION['acceptPayment']['customer'] = $customer;

but later when I access that session var [in the the same file but in a different function and different instance], php gives me
an error saying:

"The script tried to execute a methode or access a property of an incomplete object. Pleas ensure that the class definition
lt;bgt;customerlt;/bgt; of the object you are trying to operate on was loaded _before_ the session was started
at <filepath>/acceptPayment.php line 103"

I did a little reading (rtfm) on php.net and saw that if session.auto_start is turned on, you couldn't use Objects with
sessions. Well I checked my ini and the session.auto_start was set to 0, so I am now scratching my head in confusion.

I require_once the Customer class and start the session after the requires and includes, so then I thought ok require_once
so I change it to require and then it doesn't load the class the for some reasone (sigh). Any Ideas?

Thanks for your help in advance
Matt

attached mail follows:


Hi people, back again...

Got some help this today (tnx Curt) from the list but for another chunk of
the code I'm doing...

Now, I can't seem to get the following code to work...
Have included some sample lines from the datafile (acc.txt)

No matter what I do, it always returns "not here" even if there is a
match....very frustrating!

Any ideas?

Lloyd. :-)

---- Code Begin -----

<?php

$name_to_write = "user1";
$names = file("acc.txt");

if (in_array($name_to_write, $names))
{
echo "hello";
}
else
{
echo "not here";
}
?>

---- Code Finish ----

--- Sample Data Begin ---

user1 26:48:59 6 logins 4:28:09 hrs/login
user2 19:07:50 33 logins 0:34:46 hrs/login
user3 12:12:04 18 logins 0:40:40 hrs/login

--- Sample Data End ---

attached mail follows:


>No matter what I do, it always returns "not here" even if there is a
>match....very frustrating!
>
>Any ideas?

-snip-

Looks like you are attempting to match 'user1' to "user1 26:48:59 6 logins
4:28:09 hrs/login\n", which will come up false. You'll need to either do
some postprocessing on the file, to extract just the user id, or you'll
need to replace your in_array() check with a loop or array_map() that
compares the name you want against just the relevant portions of the line,
perhaps using a function such as strstr() or preg_match() or
reset(explode()).

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

attached mail follows:


On Tuesday, July 15, 2003, 9:08:25 AM, Lloyd wrote:

[ snip ]

LB> No matter what I do, it always returns "not here" even if there is a
LB> match....very frustrating!

LB> Any ideas?

Echoing what Mike said (about the preprocessing), here is some code to
help you out :

$search = "user1";
if (!($names = file("acc.txt"))) { die("Could not open acc.txt"); }
while (list($key,$val) = each($names)) {
      $bits = explode(" ",$val);
      while(list(,$line) = explode($bits)) {
         if ($line == $search) {
            echo "here";
         } else { echo "whoops ... MIA"; }
      }
}

--
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

attached mail follows:


What I want to do:
Have a person input information about individuals into a database. One of
the fields in the database will be Unit.
On a form one of my drop down menu's will be Unit. I would like to have the
PHP page poll the Unit field in the database and send all the different Unit
results to the drop down box.

Unit:<td><INPUT SIZE=6 NAME="Unit" value="">

This would be an example of the information that would be an entered
H Co
H Co
B Co
A Co
K Co

This should be the results
H Co
B Co
A Co
K Co

Any help would be appreciated!

attached mail follows:


hi ron,

there are 2 steps to do this:

1. get data from mysql
   (you can use 'group by' in your select-query for doubles, maybe some kind
of sort)
2. create your '<select>'
   for each mysql-row create your '<option value="$var1">$var2</option>'
   (if you like, add some logic for 'selected')
   close you '</select>'

ciao SVEN

Ron Allen wrote:
> What I want to do:
> Have a person input information about individuals into a database.
> One of the fields in the database will be Unit.
> On a form one of my drop down menu's will be Unit. I would like to
> have the PHP page poll the Unit field in the database and send all
> the different Unit results to the drop down box.
>
> Unit:<td><INPUT SIZE=6 NAME="Unit" value="">
>
> This would be an example of the information that would be an entered
> H Co
> H Co
> B Co
> A Co
> K Co
>
> This should be the results
> H Co
> B Co
> A Co
> K Co
>
> Any help would be appreciated!

attached mail follows:


Greetings again,

Did as Ralph suggested...here is the output :
------------
[rootcblake php]# find / -name php.ini -print
/home/chris/Documents/Mein Stuph/PHP 4
Package/php-4.3.1/pear/tests/php.ini
find: /mnt/floppy: Input/output error
find: /mnt/cdrom: Input/output error
/mnt/ClientWebs/knowledgeTree/etc/php.ini
/mnt/Users/CBlake/Backup/Documents/Mein Stuph/PHP 4
Package/php-4.3.1/pear/tests
/php.ini
/usr/local/Zend/bin/php.ini
-----------

With the exception of the .ini located in the last entry, all others are
merely blank files....

I then copied the php.ini-dist to /etc as suggested, renamed it and all
is OK now....

Thanks to everyone who helped out on this one....muchly appreciated.

Regards

Chris

On Mon, 2003-07-14 at 23:22, Ralph Guzman wrote:
> Chris,
>
> Not sure how you went about searching for php.ini, but you can type in
> the following find command in your command prompt and it will search
> your entire system:
>
> find / -name php.ini -print
>
> You may also want to look for php.in in /usr/local/lib. This is where
> php install php.ini by default.
>
> If phpinfo() is showing php.ini in /etc and you can't find it, simply
> look for a copy of the original php.ini-dist in the php source directory
> and copy it to /etc. Just be sure to rename it from php.ini-dist to
> php.ini.
>
> To copy, in your php source directory type:
>
> cp php.ini-dist /etc/php.ini
>
> Hope this helps.
>
> -----Original Message-----
> From: Chris Blake [mailto:cblakepbpc.co.za]
> Sent: Monday, July 14, 2003 3:30 AM
> To: PHP Mailing List
> Subject: [PHP] Missing php.ini file
>
> Greetings learned PHP(eople),
>
> My php.ini file has gone awol, how or why I don`t know....
>
> The only php.ini file I can find on my system (MDK 9.1) is located in
> '/usr/local/ZEND/bin' and only contains the following entries :
> =======
> zend_extension=/usr/local/Zend/lib/ZendDebuggerLocal.so
> zend_debugger.allow_hosts=127.0.0.1/32
> session.save_path=/tmp
> =======
>
> I did phpinfo() on a test page and it reports the following..
>
> -----------------------------------
> Configuration File (php.ini) Path /etc
>
> Scan this dir for additional .ini files /etc/php
>
> additional .ini files parsed /etc/php/23_gd.ini, /etc/php/26_imap.ini,
> /etc/php/27_ldap.ini, /etc/php/34_mysql.ini, /etc/php/41_readline.ini
> ------------------------------------
>
> Could the file be hidden in one of these directories....I`m kinda new to
> both MDK and php, so would appreciate any ideas if you have some as to
> how I can get my php.ini file back....
>
> Do I need to re-install/recompile PHP ?
>
> Many thanks....
> --
> Chris Blake
> Office : (011) 782-0840
> Cell : 083 985 0379
>
> Just because the message may never be received does not mean it is
> not worth sending.

attached mail follows:


> Greetings again,
>
> Did as Ralph suggested...here is the output :
> ------------
> [rootcblake php]# find / -name php.ini -print

sudo is your friend.

> /home/chris/Documents/Mein Stuph/PHP 4
> Package/php-4.3.1/pear/tests/php.ini
> find: /mnt/floppy: Input/output error
> find: /mnt/cdrom: Input/output error
> /mnt/ClientWebs/knowledgeTree/etc/php.ini
> /mnt/Users/CBlake/Backup/Documents/Mein Stuph/PHP 4
> Package/php-4.3.1/pear/tests
> /php.ini
  ^^^^^^^^ What was that?

> /usr/local/Zend/bin/php.ini
> -----------
>

attached mail follows:


On Tue, 2003-07-15 at 11:05, Joel Rees wrote:
> ..here is the output :
> > ------------
> > [rootcblake php]# find / -name php.ini -print
>
> sudo is your friend.
Not knowing much about Linux, at the moment sudo is very confusing, but
I`ll be looking into it :)
>
> > /home/chris/Documents/Mein Stuph/PHP 4
> > Package/php-4.3.1/pear/tests/php.ini
> > find: /mnt/floppy: Input/output error
> > find: /mnt/cdrom: Input/output error
> > /mnt/ClientWebs/knowledgeTree/etc/php.ini
> > /mnt/Users/CBlake/Backup/Documents/Mein Stuph/PHP 4
> > Package/php-4.3.1/pear/tests
> > /php.ini
> ^^^^^^^^ What was that?
Just a blank file.......

--
Chris Blake
Office : (011) 782-0840
Cell : 083 985 0379

The greatest of faults is to be conscious of none.

attached mail follows:


Hi all,

I've looked at both editize(.com) and HTMLArea, both of which are
in-browser Rich Text editor replacements (written in java) for the
standard <textarea>.

Unfortunately, they both allow far too much control... at most I only
want to offer H1, H2, P, B, A and I -- no colors, no images and please
please please no tables :)

Is anyone familiar with such a product?

It doesn't have to be open source at all -- quite prepared to pay for
something if it works.

Regards,
Justin

attached mail follows:


Just remove the appropriate buttons.

Justin French wrote:

> Hi all,
>
> I've looked at both editize(.com) and HTMLArea, both of which are
> in-browser Rich Text editor replacements (written in java) for the
> standard <textarea>.
>
> Unfortunately, they both allow far too much control... at most I only
> want to offer H1, H2, P, B, A and I -- no colors, no images and please
> please please no tables :)
>
> Is anyone familiar with such a product?
>
> It doesn't have to be open source at all -- quite prepared to pay for
> something if it works.
>
>
> Regards,
> Justin
>
>

attached mail follows:


> Let's be honest, XSL is is one big logic step itself -- moreover it's a
> whole other language to learn.

<ramble>
I wouldn't call it a _big_ step. It only looks big when you look down.
8-)

I would tend rather to encourage the use of XSL, myself. If you can
pick up php okay, you ought to have few problems with XSL. (My biggest
problem with XSL is remembering to let the application language handle
the hard logic. Don't try to calculate the company budget in XSL, except
as a logic game to amuse yourself while riding the train home.)

You have your data in the database, and a filter (ergo, PHP code) to
extract the data, dress it up a bit and add XML tags. Then you have an
XSL filter to munge the XML into HTML. And the nice thing about XSL is
that the web page layout is all determined by the XSL.

Of course, it does work out to be a bit messier than it sounds, but the
benefits are definite.

To the OP -- don't focus on the code, don't focus on the coding style
either, focus on the problem. The object is not to avoid mixing PHP and
HTML, and the object is not to use (or not use) objects. Rather, it is
to separate processes that are more related to the business side of
things from processes that are more related to the presentation side.

My comments on XSL aside, you can program both business and presentation
in PHP. HTML will mostly be in the presentation side, but not
necessarily always. For instance, on the business side, you may
sometimes want to provide a table of the projected monthly profits for
the next year as a complete table wrapped in tags, rather than providing
the raw numbers to the presentation side.

If the design is in someone else's hands, you'll want a template engine.
The basic concept is that the designer designs the template, putting
template tags in where the data should go. The presentation code picks
up the data and the template, replaces the tags with the data, and spits
the result out at the viewer's browser.

Some template engines are better at actually conforming to that model
than others (particualarly in relation to your app), and XSL can
definitely be used in ways that don't conform to that model. That's no
big deal, just part of what makes life interesting.

(And if you get into Javaland, you'll hear a lot about MVC and
frameworks. That's a slightly more refined, uhm, model.)
</ramble>

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


Hi Joel,

Thanks for nice comments on the XML, XSL.

I want to know more about it. can you please send me
some article, links and tutorials?

Thanks

Hardik

--- Joel Rees <joelalpsgiken.gr.jp> wrote:
> > Let's be honest, XSL is is one big logic step
> itself -- moreover it's a
> > whole other language to learn.
>
> <ramble>
> I wouldn't call it a _big_ step. It only looks big
> when you look down.
> 8-)
>
> I would tend rather to encourage the use of XSL,
> myself. If you can
> pick up php okay, you ought to have few problems
> with XSL. (My biggest
> problem with XSL is remembering to let the
> application language handle
> the hard logic. Don't try to calculate the company
> budget in XSL, except
> as a logic game to amuse yourself while riding the
> train home.)
>
> You have your data in the database, and a filter
> (ergo, PHP code) to
> extract the data, dress it up a bit and add XML
> tags. Then you have an
> XSL filter to munge the XML into HTML. And the nice
> thing about XSL is
> that the web page layout is all determined by the
> XSL.
>
> Of course, it does work out to be a bit messier than
> it sounds, but the
> benefits are definite.
>
> To the OP -- don't focus on the code, don't focus on
> the coding style
> either, focus on the problem. The object is not to
> avoid mixing PHP and
> HTML, and the object is not to use (or not use)
> objects. Rather, it is
> to separate processes that are more related to the
> business side of
> things from processes that are more related to the
> presentation side.
>
> My comments on XSL aside, you can program both
> business and presentation
> in PHP. HTML will mostly be in the presentation
> side, but not
> necessarily always. For instance, on the business
> side, you may
> sometimes want to provide a table of the projected
> monthly profits for
> the next year as a complete table wrapped in tags,
> rather than providing
> the raw numbers to the presentation side.
>
> If the design is in someone else's hands, you'll
> want a template engine.
> The basic concept is that the designer designs the
> template, putting
> template tags in where the data should go. The
> presentation code picks
> up the data and the template, replaces the tags with
> the data, and spits
> the result out at the viewer's browser.
>
> Some template engines are better at actually
> conforming to that model
> than others (particualarly in relation to your app),
> and XSL can
> definitely be used in ways that don't conform to
> that model. That's no
> big deal, just part of what makes life interesting.
>
> (And if you get into Javaland, you'll hear a lot
> about MVC and
> frameworks. That's a slightly more refined, uhm,
> model.)
> </ramble>
>
> --
> Joel Rees, programmer, Kansai Systems Group
> Altech Corporation (Alpsgiken), Osaka, Japan
> http://www.alpsgiken.co.jp
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

attached mail follows:


Hello

Webservices is the use of SOAP over HTTP to bring a Service to the web.
There are a lot more technologies involved like WSDL and UDDI but
basically it is a way of providing the functionality of a
programm/application to the web over a well defined interface. Since it is
an additional layer between the app and the web which is pretty light
weight it is an easy way to bring services to the web. And since SOAP is
XML based it is language independend. There are SOAP Clients for Perl,
PHP, Java, .NET (VB, C#, ASP) etc...

Hope that clears things up

Regards
Stefan Langer

attached mail follows:


> Is there a way, to define an integer number e.g. 7, to be defined as 07?

07 = 7

But 09 != 9 (Well 9 isn't in the set but the '0' in front will make the
number octal)
09 is an octal number

Dunno what you gonna do with this formatting.. but think again ...
Nadim Attari

attached mail follows:


Hi,

I use windows built-in identification with PHP & IIS. You can capture only user-name this way. IMHO, it's impossible to catch windows passwords.

Juraj

> -----Original Message-----
> From: Curt Zirzow [mailto:curtzirzow.dyndns.org]
> Sent: Monday, July 14, 2003 11:26 PM
> To: php-generallists.php.net
> Subject: Re: [PHP] Capturing Windows Login Details
>
>
> Jonathan Wilkes <jonathancallview.com> wrote:
> > Why would you want to do this ?
> >
> >
> >
> > -----Original Message-----
> > From: Gary Ogilvie [mailto:gary.ogilviewbpdata.com]
> > Sent: 11 July 2003 13:35
> > To: php-generallists.php.net
> > Subject: [PHP] Capturing Windows Login Details
> >
> >
> > Hi All,
> >
> > I need to capture the username and password used to login to Windows
> > 2000/XP with PHP. Does anybody know how to do this?
>
> I sure hope that this isn't possible.
>
> >
> > Many thanks
> >
> > Gary Ogilvie
> >
> >
>
> Curt
> --
>
>

attached mail follows:


If have file1.php that includes file2.php, is there any way
to check, from file2.php, if it is indeed included. In other words,
I don't want file2.php to display (rather redirect to file1.php) if it's
not being requested as a file1.php include file.

did I confuse you?

 

attached mail follows:


On Tuesday 15 July 2003 15:25, John Manko wrote:
> If have file1.php that includes file2.php, is there any way
> to check, from file2.php, if it is indeed included. In other words,
> I don't want file2.php to display (rather redirect to file1.php) if it's
> not being requested as a file1.php include file.

get_included_files()

--
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
------------------------------------------
/*
There is nothing more satisfying that having someone take a shot at you, and
miss
                -- Murphy's Military Laws n97
*/

attached mail follows:


i think we checking in file2.php that
it is included by file1.php by using
defining constatnta the code something like this

file1.php
....
define('__FOO_BAR',1)
include('file2.php');
.....

file2.php
if (!defined('__FOO_BAR')){
  doredirect('file1.php');
}
//your code goes by here
.....

-----Original Message-----
From: John Manko [mailto:xeridadelphia.net]
Sent: Tuesday, July 15, 2003 2:26 PM
To: php-generallists.php.net
Subject: [PHP] Check if php file is an included file?

If have file1.php that includes file2.php, is there any way
to check, from file2.php, if it is indeed included. In other words,
I don't want file2.php to display (rather redirect to file1.php) if it's
not being requested as a file1.php include file.

did I confuse you?

 

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

attached mail follows:


> But what if say I want to replace a newline with something else, say
> </p><p>. How would I do that?

(with apologies for the lack of imagination :-P)
------------------------------------------------
<?php

$George = "Hello\n\tall\nyou\nfriendly people";
echo 'George: ' . $George . "\n";

$Henry = str_replace( "\n", "</p>\n<p>", $George );
$Henry = '<p>' . $Henry . "</p>\n";
echo 'Henry: ' . $Henry . "\n";

$Helen = "Kindest\r\tgreetings\nto all\r\nyou\n\rwonderful people";
echo 'Helen: ' . $Helen . "\nSee what that \\r does?\n\n";

$Marion = str_replace( "\r", "\n", $Helen );
$Marion = str_replace( "\n\n", "\n", $Marion );
$Marion = str_replace( "\n", "</p>\n<p>", $Marion );
$Marion = '<p>' . $Marion . "</p>\n";
echo 'Marion: ' . $Marion . "\n";

$Juliet = preg_replace( '/([^\r\n]*)(\r\n|\n\r|\r|\n)/',
            "<p>\${1}</p>\n", $Helen );
$Juliet = preg_replace( '/([^\r\n]+$)/',
            "<p>\${1}</p>\n", $Juliet );
echo 'Juliet: ' . $Juliet . "\n";

?>
------------------------------------------------

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


WHAT PORTS PHP USE WHEN COMUNICATING WITH MSSQL SERVER OVER THE NETWORK?
IS THERE ANY SECURITY HALLS USING THIS PORTS??

I have an Linux server running Apache/PHP/MySQL.
and I need to connect to another server running MSSQL server 7

THE POINT IS the only way I have to connect is throu ODBC connection
because the network administrator only allowed me to connect thru port 1433
that ODBC uses..

I tried to make it direct connection, but this way uses many ports that the
firewall won't allowed..
He said for security reasons that he can't open those ports to prevents
hackers to use them ... do u think this is a true ? any advice what port the
direct connection uses??? does it uses NetBIOS?

if he was right ... so I have to change to ODBC
I heard about FreeDTS and iODBC, but I need some advice and notes to make it
easy for me..

Please HELP.. and your valuable comments will be appreciated..

Nabil

attached mail follows:


On Tuesday, July 15, 2003, 11:00:27 AM, Nabil wrote:

N> I have an Linux server running Apache/PHP/MySQL.
N> and I need to connect to another server running MSSQL server 7

N> THE POINT IS the only way I have to connect is throu ODBC connection
N> because the network administrator only allowed me to connect thru port 1433
N> that ODBC uses..

I know from personal experience that MSSQL only allows "trusted"
connections over the network. Maybe it was my MSSQL Server install,
but I couldn't get it to connect over the net natively (without using
ODBC). However, I am not a MSSQL expert by any stretch.

N> I tried to make it direct connection, but this way uses many ports that the
N> firewall won't allowed..
N> He said for security reasons that he can't open those ports to prevents
N> hackers to use them ... do u think this is a true ? any advice what port the
N> direct connection uses??? does it uses NetBIOS?

As far as hackers are concerned, if they are determined enough, they
will find some way to hack. However, blocking unused ports is just
common sense security.

N> if he was right ... so I have to change to ODBC
N> I heard about FreeDTS and iODBC, but I need some advice and notes to make it
N> easy for me..

Have you looked at the PEAR DB class? It provides connectivity for
almost every database that can understand SQL.

--
Regards,
Burhan Khalid
phplist[at]meidomus[dot]com
http://www.meidomus.com

attached mail follows:


On Tue, 15 Jul 2003 11:00:27 +0300, you wrote:

>WHAT PORTS PHP USE WHEN COMUNICATING WITH MSSQL SERVER OVER THE NETWORK?

I only have experience with MS SQL Server 7. It listens on TCP port
1433.

>I have an Linux server running Apache/PHP/MySQL.
>and I need to connect to another server running MSSQL server 7
>
>THE POINT IS the only way I have to connect is throu ODBC connection
>because the network administrator only allowed me to connect thru port 1433
>that ODBC uses..

If it's SQL version 7 then you can use this same port for a "direct"
connection. I know, my companies public web site connects via this
port to an SQL server behind our firewall, and has done so for well
over a year without issue.

>I tried to make it direct connection, but this way uses many ports that the
>firewall won't allowed..

Not with version 7.

>I heard about FreeDTS and iODBC, but I need some advice and notes to make it
>easy for me..

FreeTDS works like a charm, it's what we use...

attached mail follows:


Hi all,
 
This is what i get:
"Warning: Cannot add header information - headers already sent by
(output started at /home/u/r/html/store/cart.php:188) in
/home/u/r/html/store/includes/functions/get_cartID.php on line 14"
 
I know that the problem is the reading of the cookie and then after some
sripting outputting page HTML.
 
I started my code
ob_start()
and do an ob_flush() within a function(show_cart) (?might that be a
problem?)
 
Can anyone shed some light on this?
 
Thanks!
Fred

attached mail follows:


Hi to all,

Is it possible to run php in the web running in a specified port without
installing apache in Linux?

Can anyone give a sample code for this? I'm searching this for a week but i
really can find one. Please help us.

Regards,

Mike

attached mail follows:


Hello,

This is a reply to an e-mail that you wrote on Tue, 15 Jul 2003 at 09:33,
lines prefixed by '>' were originally written by you.
> Hi to all,
> Is it possible to run php in the web running in a specified port
> without
> installing apache in Linux?
> Can anyone give a sample code for this? I'm searching this for a week
> but i
> really can find one. Please help us.

You could use inetd and the command line PHP binary. How to do it varies
between linuz distros, basically it allows you to assign a port number to
any program in the system and all the program has to do is send it's
output to the standard output (use echo in the case of PHP).

David.

--
phpmachine :: The quick and easy to use service providing you with
professionally developed PHP scripts :: http://www.phpmachine.com/

          Professional Web Development by David Nicholson
                    http://www.djnicholson.com/

    QuizSender.com - How well do your friends actually know you?
                     http://www.quizsender.com/
                    (developed entirely in PHP)

attached mail follows:


I'm afraid I don't know the answer to your question, Mike, but you may want
to check out this month's php|architect. I just started reading through it
and the cover story is about socket programming:
http://www.phparchitect.com/

Hope this helps, -Step

> Hi to all,
>
> Is it possible to run php in the web running in a specified port without
> installing apache in Linux?
>
> Can anyone give a sample code for this? I'm searching this for a week but i
> really can find one. Please help us.
>
>
>
> Regards,
>
> Mike

attached mail follows:


Michael P. Carel wrote:
> Hi to all,
>
> Is it possible to run php in the web running in a specified port without
> installing apache in Linux?
>
> Can anyone give a sample code for this? I'm searching this for a week but i
> really can find one. Please help us.
>
>
>
> Regards,
>
> Mike
>
Do you mean to host websites with ONLY php and without webserver? Or do
you mean using PHP for something else then web, to make it listen for
incomming connections?

If the second, you might want to look here:
http://se.php.net/manual/en/ref.sockets.php

Maybe that helps.

//Simon

attached mail follows:


> The site really does
> need Login.
>
> The thing is this, I'm developing for an internal site, (My dept) but I need
> to access other dept's site to get info but unfortunately They won't give me
> access to query the db directly. Prefering me to go through the site and
> input accordingly to grab the data.
>
> I just find this to be "SO" troublesome as I need to get this data
> for every week. Week In.. Week Out and for a lot of items..

Screen scraping for fun and profit! Anything you can type into a form in
a web browser, you can throw at the server with a program (if you have
enough time to write the program).

In perl, there are LWP::UserAgent, HTTP::Request, HTTP::Cookies,
HTTP::Response, URI, etc.

In php, I don't see anything right offhand. But, there's always Pear,
which is becoming php's CPAN, and pear has at least these two:

    http://www.pear.php.net/package-info.php?package=HTTP_Request
    http://www.pear.php.net/package-info.php?package=HTTP_Client

and they look somewhat promising.

You'll probably need ssl related classes for the https stuff; it looks
like there's some support in Pear's encryption stuff. I'm sure the php
community would appreciate it if you would build and share anything
that's missing. ;->

> But I will take a look at SNOOPY. (hey.. isn't the name snoopy
> copyrighted??)

Trademarked, but only in relation to a cartoon character of a beagle and
products based on the character, I think.

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


> In php, I don't see anything right offhand.

    http://www.php.net/curl

<blush/>

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


Ow Mun Heng wrote,
> Mind my ignorance but what is webservices??

    http://www-106.ibm.com/developerworks/webservices/library/ws-starthere.html

You don't really need to use http/HTML when talking machine-to-machine.
XML is convenient and has some standards, but is also not necessary.

Write a DTD that reveals the data you need. Write a little server script
that reveals the data you want. Since you can't access the real data,
use stubs for the access methods and hard code the data in your
mock-server. Write a little client script that grabs the data from your
mock-server script and passes it to your application. When that's
running, encrypt the data stream from the server and decrypt in in the
client. Brew up a little (encrypted) login-logout routine to increase
their confidence level, then give all three to the other department and
ask if they could either fill in the blanks or build their own version
of the server.

Then they control their side of the interface, both you and they control
the DTD/encryption/login/logout together, and all you have to worry
about is your client.

> ...
> -----Original Message-----
> From: SLangerspirit21.de [mailto:SLangerspirit21.de]
> Sent: Monday, July 14, 2003 3:28 PM
> To: php-generallists.php.net
> Subject: Re: [PHP] Grabbing info from other Sites
>
>
> Hello
> The only way I can imageine is using curl and doing standard post get
> requests. But this will put you at the mercy of the other dep. since a
> change in design may force a change in your logic.
> If you can, try to build a separate interface for your app which you can
> use to interface the backend of the other deps. You might even consider
> Webservices. This way you are independend of the design of the site.

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


Thanks for the info. It's a lot to digest for someone's who's just starting
out. I always thought Pear was only a Fruit.. now I know better.

        I'll look through it and IF (& that's a big IF) i come up with
something, of course I'll share it.

        Open Source all the way...

Cheers,
Mun Heng, Ow
H/M Engineering
Western Digital M'sia
DID : 03-7870 5168

-----Original Message-----
From: Joel Rees [mailto:joelalpsgiken.gr.jp]
Sent: Tuesday, July 15, 2003 4:36 PM
To: Ow Mun Heng; php-generallists.php.net
Subject: Re: [PHP] Grabbing info from other Sites

> The site really does
> need Login.
>
> The thing is this, I'm developing for an internal site, (My dept) but I
need
> to access other dept's site to get info but unfortunately They won't give
me
> access to query the db directly. Prefering me to go through the site and
> input accordingly to grab the data.
>
> I just find this to be "SO" troublesome as I need to get this data
> for every week. Week In.. Week Out and for a lot of items..

Screen scraping for fun and profit! Anything you can type into a form in
a web browser, you can throw at the server with a program (if you have
enough time to write the program).

In perl, there are LWP::UserAgent, HTTP::Request, HTTP::Cookies,
HTTP::Response, URI, etc.

In php, I don't see anything right offhand. But, there's always Pear,
which is becoming php's CPAN, and pear has at least these two:

    http://www.pear.php.net/package-info.php?package=HTTP_Request
    http://www.pear.php.net/package-info.php?package=HTTP_Client

and they look somewhat promising.

You'll probably need ssl related classes for the https stuff; it looks
like there's some support in Pear's encryption stuff. I'm sure the php
community would appreciate it if you would build and share anything
that's missing. ;->

> But I will take a look at SNOOPY. (hey.. isn't the name snoopy
> copyrighted??)

Trademarked, but only in relation to a cartoon character of a beagle and
products based on the character, I think.

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


Hi all,
 
This is what i get:
"Warning: Cannot add header information - headers already sent by
(output started at /home/u/r/html/store/cart.php:188) in
/home/u/r/html/store/includes/functions/get_cartID.php on line 14"
 
I know that the problem is the reading of the cookie and then after some
sripting outputting page HTML.
 
I started my code
ob_start()
and do an ob_flush() within a function(show_cart) (?might that be a
problem?)
 
Can anyone shed some light on this?
 
Thanks!
Fred
 

attached mail follows:


You cannot send any page information before you send headers (ie setting a
cookie), that means there should be no html before the php that sets the
cookie, also any function that are called before you set the cookie cannot
output to the browser.

Ry

On 15/7/03 9:45 am, "frederik feys" <frederikfeyspandora.be> wrote:

> Hi all,
>
>
>
> This is what i get:
>
> ³Warning: Cannot add header information - headers already sent by (output
> started at /home/u/r/html/store/cart.php:188) in
> /home/u/r/html/store/includes/functions/get_cartID.php on line 14²
>
>
>
> I know that the problem is the reading of the cookie and then after some
> sripting outputting page HTML.
>
>
>
> I started my code
>
> ob_start()
>
> and do an ob_flush() within a function(show_cart) (?might that be a problem?)
>
>
>
> Can anyone shed some light on this?
>
>
>
> Thanks!
>
> Fred
>
>
>
>

Ryan Gibson
-----------
ryan_gibsonjmp-partnerhip.co.uk

attached mail follows:


> -----Original Message-----
> From: frederik feys [mailto:frederikfeyspandora.be]
> Sent: 15 July 2003 09:45
>
> This is what i get:
> "Warning: Cannot add header information - headers already
> sent by (output started at /home/u/r/html/store/cart.php:188)
> in /home/u/r/html/store/includes/functions/get_cartID.php on line 14"

This says that on line 188 of store/cart.php you started outputting your HTML page, but you can't do that before the attempt to send headers on line 14 of store/includes/functions/get_cartID.php. Take a good look at line 188 of store/cart.php to see what you can do so that it is not starting HTML output, or move the header calls above the point where it is included/required.

> I know that the problem is the reading of the cookie and then
> after some sripting outputting page HTML.

No, other way around.

> I started my code
> ob_start()
> and do an ob_flush() within a function(show_cart) (?might
> that be a problem?)

Actually, that should be a preventer for the problem, so long as the ob_start() is executed before output is started -- perhaps your ob_start() should occur earlier in your script?

Cheers!

Mike

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

attached mail follows:


> > http://www.php.net/pack
>
> A little background on what Im doing. Im attempting to read realaudio
> files for their metadata, so Im reading from a binary string,
> and Im currently using unpack() (Im new to using this function, so I may
> be wrong with its usage) to unpack the data, along with ord(),
> and the result is something like what I posted before -> 0 0 0 18 (I
> put the spaces in there so we know that each number is a byte)
> So Im not exactly sure how the pack() function would play a role in this.

Just in case you're still groggy when you wake up this morning, the page
for pack() lists an 'N' format for unsigned long big endian byte order
for pack() and unpack(). I think what you probably want to do most is
use the 'N' format when you unpack.

(The other responses were amusing, was it a full moon last night? ;-))

--
Joel Rees, permanently jetlagged programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


Hi,

Tuesday, July 15, 2003, 7:00:33 PM, you wrote:
>> > http://www.php.net/pack
>>
>> A little background on what Im doing. Im attempting to read realaudio
>> files for their metadata, so Im reading from a binary string,
>> and Im currently using unpack() (Im new to using this function, so I may
>> be wrong with its usage) to unpack the data, along with ord(),
>> and the result is something like what I posted before -> 0 0 0 18 (I
>> put the spaces in there so we know that each number is a byte)
>> So Im not exactly sure how the pack() function would play a role in this.

JR> Just in case you're still groggy when you wake up this morning, the page
JR> for pack() lists an 'N' format for unsigned long big endian byte order
JR> for pack() and unpack(). I think what you probably want to do most is
JR> use the 'N' format when you unpack.

JR> (The other responses were amusing, was it a full moon last night? ;-))

JR> --
JR> Joel Rees, permanently jetlagged programmer, Kansai Systems Group
JR> Altech Corporation (Alpsgiken), Osaka, Japan
JR> http://www.alpsgiken.co.jp

Trying to use unpack by itself on large binary streams with variable packet
sizes and content buried in them can become a nightmare. Try to
unscramble an excel file using unpack() :)

--
regards,
Tom

attached mail follows:


Joel Rees wrote:

>Just in case you're still groggy when you wake up this morning, the page
>for pack() lists an 'N' format for unsigned long big endian byte order
>for pack() and unpack(). I think what you probably want to do most is
>use the 'N' format when you unpack.
>
>(The other responses were amusing, was it a full moon last night? ;-))
>
Thanks for the heads up. Ill give it a try...

attached mail follows:


Tom Rogers wrote:

>Trying to use unpack by itself on large binary streams with variable packet
>sizes and content buried in them can become a nightmare. Try to
>unscramble an excel file using unpack() :)
>
Yeah, not exactly the most exciting thing to do. As long as I have some
specs on the format, its hasn't been
too bad with mp3 and realaudio files so far...

attached mail follows:


> > Next thing, please add a reply-to header that has the lists mailing
> > address.
>
> This is a topic of debate, and many people (including myself) would urge people
> to ignore this advice. Mangling mail headers can have bad consequences, and
> there is very little reason to do so.

Yeah, but I think the OP was not talking about mangling headers. The
subject was how to ask questions, not how to set up the list server.

The question is whether or not a person wants personal replies, I think.

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


> -----Original Message-----
> From: caspar kennerdale [mailto:casparpushingtheboundary.com]
> Sent: 14 July 2003 21:05
>
>
> If you want the file to go into a holding location until your
> administrator
> can approve it and move it to its real final location, then
> the holding
> location should be the target of the move_uploaded_file().
> This makes it up
> to you to decide what you want the structure of your holding
> location to be,
> and how you want to keep track of any files currently populating it.
>
> - I'm a little confused. The files are already in there real
> location.

Ah -- this wasn't clear before. Then these are no longer uploaded files --
only the temp file created by the original form submission is truly an
uploaded file in the sense that is_uploaded_file() will be true and you can
move_uploaded_file() it. Once you have used move_uploaded_file() on it, the
new file is just a regular file, not an uploaded one.

> It is
> just that someone may want to change that location at a later date.
> e.g. they upload an image to a folder and two months later
> decide it is
> better placed in a different folder.

Then you just want rename() -- http://www.php.net/rename

Cheers!

Mike

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

attached mail follows:


Thanks for everyones help

-----Original Message-----
From: Ford, Mike [LSS] [mailto:M.Fordlmu.ac.uk]
Sent: 15 July 2003 10:19
To: 'caspar kennerdale'; Php-General
Subject: RE: [PHP] Moving Files/ Temporary Names

> -----Original Message-----
> From: caspar kennerdale [mailto:casparpushingtheboundary.com]
> Sent: 14 July 2003 21:05
>
>
> If you want the file to go into a holding location until your
> administrator
> can approve it and move it to its real final location, then
> the holding
> location should be the target of the move_uploaded_file().
> This makes it up
> to you to decide what you want the structure of your holding
> location to be,
> and how you want to keep track of any files currently populating it.
>
> - I'm a little confused. The files are already in there real
> location.

Ah -- this wasn't clear before. Then these are no longer uploaded files --
only the temp file created by the original form submission is truly an
uploaded file in the sense that is_uploaded_file() will be true and you can
move_uploaded_file() it. Once you have used move_uploaded_file() on it, the
new file is just a regular file, not an uploaded one.

> It is
> just that someone may want to change that location at a later date.
> e.g. they upload an image to a folder and two months later
> decide it is
> better placed in a different folder.

Then you just want rename() -- http://www.php.net/rename

Cheers!

Mike

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

attached mail follows:


> -----Original Message-----
> From: Lloyd Bayley [mailto:lloydspeednet.com.au]
> Sent: 15 July 2003 00:21
>
> I'm still in the learning stages of PHP and require some help
> with a small
> problem.
>
> I need to take a text file which looks like this (and no I
> can't get it
> output in CSV - damn and blast!)
>
> user1 26:48:59 6 logins 4:28:09 hrs/login
> user2 19:07:50 33 logins 0:34:46 hrs/login
> user3 12:12:04 18 logins 0:40:40 hrs/login
> user4 9:48:58 9 logins 1:05:26 hrs/login
>
>
> What I want to do (in PHP) is read the list in and search for
> a username,
> then display the associated statistics for that user.
> I'm hoping to get the logistics right first before wrapping
> it in a form.
> Breaking it up into a list works well, except for the fact
> that the spaces
> between elements are not necessarily the same. (bother!)
>
> Any suggestions, like for example to convert a string of
> spaces (greater
> than 1) to a comma perhaps to facilitate easier list building?

Try

   preg_split('/ +/', $line);

to get an array of the values on a single line. You could easily do this to
each line of the file and build an array of arrays to give you the full data
structure. With a bit of judicious manipulation, you could even use the
usernames as the key of the outer array.

Cheers!

Mike

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

attached mail follows:


> As part of a CMS I wanted to get the user to:
> 1) Create a new recordset via a form (with a uniqueid).
> 2) Press submit whereupon php gets the ID of the record just created in
> the DB, writes a new page to the server with that unique id and saves it
> as a filename determined by the user.

Seriously, aren't you really just trying to re-invent sessions?

A cookie tracks your session id, your php uses the session id to
maintain persistent data on the visitor, you use the persistent data to
customize the page that gets presented. You don't need to know about
file permissions beyond setting up apache and php.

If you want more than sessions can give you, then you probably want to
set up a directory that is not underneath your web root (maybe under /var
somewhere?) and is only accessible to your apache user. The functions to
read and write files in that directory should be declared in include
files, which should also not be underneath your web root.

If you want to really tighten the lid down, you can set up a separate
server process and communicate with it through local sockets instead of
IP. Or you could install a database and configure the database to not listen
to anything coming in over the network.

--
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp

attached mail follows:


"Shena Delian O'Brien" <shenadarklock.com> wrote in message
news:3F12F5F7.9060206darklock.com...
> What's your:
>
> $cfg['PmaAbsoluteUri']
> $cfg['Servers'][$i]['host']
>
> ? Should be something like :
>
> $cfg['Servers'][$i]['host'] = 'http://localhost/phpMyAdmin';
> $cfg['Servers'][$i]['host'] = 'localhost';
>
> Post other config entries that you've changed...? What authentication
> method are you using, etc? Sounds like maybe just maybe your
> authentication isn't working...

Hi Shena,

Just in case it made a difference, I upgraded to V2.5.2 of phpMyAdmin.

My entries (ie. those I've changed) are:-

$cfg['PmaAbsoluteUri'] = 'http://127.0.0.1/phpMyAdmin-2.5.2-rc2/';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['controluser'] = 'root';
$cfg['Servers'][$i]['controlpass'] = '...';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '...';
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'PMA_bookmark';
$cfg['Servers'][$i]['relation'] = 'PMA_relation';
$cfg['Servers'][$i]['table_info'] = 'PMA_table_info'
$cfg['Servers'][$i]['table_coords'] = 'PMA_table_coords'
$cfg['Servers'][$i]['pdf_pages'] = 'PMA_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'PMA_column_info';
$cfg['Servers'][$i]['history'] = 'PMA_history';

http://127.0.0.1/ is configured in Apache to be development directory on C:
(ie. C:\...\...\development)

The {phpmyadmin} directory is thus
C:\...\...\development\phpmyadmin

Apache is working, PHP is working and MySQL is working. phpMyAdmin is
working too, with the exception of this feature.

On phpMyAdmin screens, I see:-
"Error
The additional Features for working with linked Tables have been
deactivated. To find out why click here."

Any ideas on the cause of the problem?

PS: I get the same results running phpMyAdmin in Netscape.

Thanks in advance,
Richard

attached mail follows:


Fr one, you'll probably want to make a symbolic link to make your url look a
little prettier and make it easy on you for upgrades. So for example if you
make a symbolic link from phpMyAdmin-2.5.2-rc2 to phpMyAdmin then every
single time you upgrade you just ungzip your directory, then recreate the
symbolic link and there you have it.

Now if you want to get rid of that error just set this variable:

$cfg['PmaNoRelation_DisableWarning'] = TRUE;

And that should take care of it!

Cheers!

Rick

"The only way to have a friend is to be one." - Ralph Waldo Emerson

> From: "Richard White" <whitermailops.com>
> Organization: (none)
> Reply-To: "Richard White" <whitermailops.com>
> Date: Tue, 15 Jul 2003 10:45:00 +0100
> To: php-generallists.php.net, php-windowslists.php.net
> Subject: [PHP] Re: Problem getting phpMyAdmin to work on localhost
>
>
> "Shena Delian O'Brien" <shenadarklock.com> wrote in message
> news:3F12F5F7.9060206darklock.com...
>> What's your:
>>
>> $cfg['PmaAbsoluteUri']
>> $cfg['Servers'][$i]['host']
>>
>> ? Should be something like :
>>
>> $cfg['Servers'][$i]['host'] = 'http://localhost/phpMyAdmin';
>> $cfg['Servers'][$i]['host'] = 'localhost';
>>
>> Post other config entries that you've changed...? What authentication
>> method are you using, etc? Sounds like maybe just maybe your
>> authentication isn't working...
>
> Hi Shena,
>
> Just in case it made a difference, I upgraded to V2.5.2 of phpMyAdmin.
>
> My entries (ie. those I've changed) are:-
>
> $cfg['PmaAbsoluteUri'] = 'http://127.0.0.1/phpMyAdmin-2.5.2-rc2/';
> $cfg['Servers'][$i]['host'] = 'localhost';
> $cfg['Servers'][$i]['controluser'] = 'root';
> $cfg['Servers'][$i]['controlpass'] = '...';
> $cfg['Servers'][$i]['auth_type'] = 'config';
> $cfg['Servers'][$i]['user'] = 'root';
> $cfg['Servers'][$i]['password'] = '...';
> $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
> $cfg['Servers'][$i]['bookmarktable'] = 'PMA_bookmark';
> $cfg['Servers'][$i]['relation'] = 'PMA_relation';
> $cfg['Servers'][$i]['table_info'] = 'PMA_table_info'
> $cfg['Servers'][$i]['table_coords'] = 'PMA_table_coords'
> $cfg['Servers'][$i]['pdf_pages'] = 'PMA_pdf_pages';
> $cfg['Servers'][$i]['column_info'] = 'PMA_column_info';
> $cfg['Servers'][$i]['history'] = 'PMA_history';
>
> http://127.0.0.1/ is configured in Apache to be development directory on C:
> (ie. C:\...\...\development)
>
> The {phpmyadmin} directory is thus
> C:\...\...\development\phpmyadmin
>
> Apache is working, PHP is working and MySQL is working. phpMyAdmin is
> working too, with the exception of this feature.
>
> On phpMyAdmin screens, I see:-
> "Error
> The additional Features for working with linked Tables have been
> deactivated. To find out why click here."
>
>
> Any ideas on the cause of the problem?
>
> PS: I get the same results running phpMyAdmin in Netscape.
>
> Thanks in advance,
> Richard
>
>
>
>
>
>
>
>
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

attached mail follows:


I am using PHP 4.3.0
The way that I usually carry variables from one page to another is
$Unit = ($_GET['Unit']);

This is the page that is referencing it!
<?PHP
echo "<br><br>";
$DBName = "SIGO";
$table1 = "sigo";
include 'drop.php';

$db = mysql_connect("$DBhost","$DBuser","$DBpass") or die("Problem
connecting");
mysql_select_db("$DBName") or die("Problem selecting database");
$query = "SELECT distinct (Unit) FROM $table1";
$result = mysql_query($query) or die ("Query failed");
//let's get the number of rows in our result so we can use it in a for loop
$numofrows = mysql_num_rows($result);
echo "<FORM METHOD=POST ACTION=basefull.php>";
echo "<center>";
echo "<select name=Unit>";
for($i = 0; $i < $numofrows; $i++) {
    $row = mysql_fetch_array($result); //get a row from our result set
    echo "<option>".$row['Unit']."\n";
}
echo "</select>";
echo "<BR><br>";
echo "<INPUT TYPE=submit value=Submit>";
echo "</center>";
?>

Oviously this isn't working.....any clues as to why I can't carry the
variable?

attached mail follows:


> -----Original Message-----
> From: Ron Allen [mailto:Ronald.Allenbondsteel2.areur.army.mil]
> Sent: 15 July 2003 10:55
>
> I am using PHP 4.3.0
> The way that I usually carry variables from one page to another is
> $Unit = ($_GET['Unit']);
>
> This is the page that is referencing it!
> <?PHP
> echo "<br><br>";
> $DBName = "SIGO";
> $table1 = "sigo";
> include 'drop.php';
>
> $db = mysql_connect("$DBhost","$DBuser","$DBpass") or die("Problem
> connecting");
> mysql_select_db("$DBName") or die("Problem selecting database");
> $query = "SELECT distinct (Unit) FROM $table1";
> $result = mysql_query($query) or die ("Query failed");
> //let's get the number of rows in our result so we can use it
> in a for loop
> $numofrows = mysql_num_rows($result);
> echo "<FORM METHOD=POST ACTION=basefull.php>";

METHOD="GET" => $_GET
METHOD="POST" => $_POST

Cheers!

Mike

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

attached mail follows:


Hi :)

It's really simpel
//$Unit = ($_GET['Unit']);
//...
//echo "<FORM METHOD=POST ACTION=basefull.php>";
You use "post" as method and then you want to read your value with $_GET -
that couldnt't work - you must use $_POST.

->$Unit = ($_POST['Unit']);

Greetings from Germany

Kristin Schesonka

> I am using PHP 4.3.0
> The way that I usually carry variables from one page to another is
> $Unit = ($_GET['Unit']);
>
> This is the page that is referencing it!
> <?PHP
> echo "<br><br>";
> $DBName = "SIGO";
> $table1 = "sigo";
> include 'drop.php';
>
> $db = mysql_connect("$DBhost","$DBuser","$DBpass") or die("Problem
> connecting");
> mysql_select_db("$DBName") or die("Problem selecting database");
> $query = "SELECT distinct (Unit) FROM $table1";
> $result = mysql_query($query) or die ("Query failed");
> //let's get the number of rows in our result so we can use it in a for
loop
> $numofrows = mysql_num_rows($result);
> echo "<FORM METHOD=POST ACTION=basefull.php>";
> echo "<center>";
> echo "<select name=Unit>";
> for($i = 0; $i < $numofrows; $i++) {
> $row = mysql_fetch_array($result); //get a row from our result set
> echo "<option>".$row['Unit']."\n";
> }
> echo "</select>";
> echo "<BR><br>";
> echo "<INPUT TYPE=submit value=Submit>";
> echo "</center>";
> ?>
>
> Oviously this isn't working.....any clues as to why I can't carry the
> variable?
>
>

attached mail follows:


How can confugure Apache to execute a real php files but with fake extention
like .foo or .pl or even .html?

Regards
Nabil

attached mail follows:


Hi there!

--- Nabil <nabil.attaraws-syria.com> wrote:
> How can confugure Apache to execute a real php files
> but with fake extention
> like .foo or .pl or even .html?

I don't have any Apache around right now but you have
to search inside httpd.conf for the "php" string, one
of the entries is the one defining which files should
be processed by php before giving the results to
Apache. Just add .html, .whatever to the .php that is
already listed there.

Kisses,
Maria

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

attached mail follows:


On Tuesday 15 July 2003 20:04, Nabil wrote:
> How can confugure Apache to execute a real php files but with fake
> extention like .foo or .pl or even .html?

  AddType application/x-httpd-php .php4 .php3 .phtml .php .foo .bar .pl .asp

--
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
------------------------------------------
/*
America's best buy for a quarter is a telephone call to the right person.
*/

attached mail follows:


- simply go into the apache config file
- search for php
- somewhere it should say at the end of the line .php .phtml .

- no just add your extension

"Nabil" <nabil.attaraws-syria.com> schrieb im Newsbeitrag
news:20030715120442.70253.qmailpb1.pair.com...
> How can confugure Apache to execute a real php files but with fake
extention
> like .foo or .pl or even .html?
>
> Regards
> Nabil
>
>

attached mail follows:


Hi there!

As I explained yesterday I am developing a group of
pages to let users send mails from them. For that I am
using the mail() function.

The problem I face is that the addresses I write at
the BCC field receive mails twice (not the one at the
To: field, just the ones at the BCC:).

It only happens when I use mail(). Following the
advice of the people on the list I installed
phpmailer. Using it I don't have that problem, it only
happens when I use mail() alone.... And it only
happens with the addresses at BCC.

I've checked the logs of the mail server and I see how
the pages send the RCPT TO so many times... so it's
not a problem of the mail server.

I am using Windows ME with PHP Version 4.3.1. Do you
know if it's a bug of that version?

Also, is there any way to keep track of what PHP is
doing? To make it display on the pages or somewhere
else what on earth is it doing to send those mails
twice.... Thanks..........

Kisses,
Maria

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

attached mail follows:


Hi all, yet again im struggling with php syntax after to many years with c.
If anyone can help or point me to some good doc's i'd would really appreciate it! My two questions are:
 
Can i declare an array that doesnt have a fixed size? Basically i want to assign the results of a query to the array but obviously the query results can change. Something along the lines of:
while($temp=mssql_fetch_array($tmresult)){
brandnew array = $temp["fieldname"];
}
this doesnt work for me, any ideas?
Also is it possible to have global variables within php? I have noticed that if i create a function i cant write to what i thought were global variables(declared outside the function). Im not trying to pass variables between pages, just use a global counter within a single page?
 
Thanks for any help in advance!

---------------------------------
Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

attached mail follows:


Every array does not have a fixed size:
while($temp=mssql_fetch_array($tmresult)){
  $array[] = $temp["fieldname"]; // ads an element at the end
  // or
  $array[$temp["id"]]= $temp["fieldname"]; // the table id is the key
}

You can access global variables in functions or class methods by:
1. declaring variable as global:
function f(){
   global $var;
}
2. using $GLOBALS['var']

bob pilly wrote:

> Hi all, yet again im struggling with php syntax after to many years with c.
> If anyone can help or point me to some good doc's i'd would really appreciate it! My two questions are:
>
> Can i declare an array that doesnt have a fixed size? Basically i want to assign the results of a query to the array but obviously the query results can change. Something along the lines of:
> while($temp=mssql_fetch_array($tmresult)){
> brandnew array = $temp["fieldname"];
> }
> this doesnt work for me, any ideas?
> Also is it possible to have global variables within php? I have noticed that if i create a function i cant write to what i thought were global variables(declared outside the function). Im not trying to pass variables between pages, just use a global counter within a single page?
>
> Thanks for any help in advance!
>
>
> ---------------------------------
> Want to chat instantly with your online friends? Get the FREE Yahoo!Messenger

attached mail follows:


Am Dienstag, 15. Juli 2003 14:39 schrieb bob pilly:
> Can i declare an array that doesnt have a fixed size? Basically i want to
> assign the results of a query to the array but obviously the query results
> can change. Something along the lines of:

$myarray= array();

> while($temp=mssql_fetch_array($tmresult)){
> brandnew array = $temp["fieldname"];

$myarray[]= $temp["fieldname"];

> }

> this doesnt work for me, any ideas?
> Also is it possible to have global variables within php? I have noticed
> that if i create a function i cant write to what i thought were global
> variables(declared outside the function). Im not trying to pass variables
> between pages, just use a global counter within a single page?

$globalvar= 'Hi there';

function afunction() {
  global $globalvar;

 echo($globalvar);

}

attached mail follows:


Thanks for the reply!
 
I must admit i and confused by the answer to the global variables question.
Can i ask another question? What if i want to increment a global counter from within a function. at the moment i am trying to declare the variable normally:
 
$counter=0;
then within the function:
function (){
global $counter;
$counter++;
}
 
but then when i go to echo $counter outside of the function its value hasnt changed?
Yet again any help would be appreciatted!

Dirk Kredler <dirkcomputication.net> wrote:
Am Dienstag, 15. Juli 2003 14:39 schrieb bob pilly:
> Can i declare an array that doesnt have a fixed size? Basi