[PHP] mysql + PHP

2006-06-15 Thread weetat

Hi all,

  I have SQL query , for example , Select country , name from 
tbl_chassis order by country.


 The problem of the sql statement is that , if there are empty value in 
country field , it be sorted first .


How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

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



Re: [PHP] order of include on include()

2006-06-15 Thread Richard Lynch
On Wed, June 14, 2006 3:23 pm, blackwater dev wrote:
 If I have a file:

 /code/folder1/test.php

 and in that file, it has these includes:

 include_once(../../file1.php);
 include_once(../../file2.php);
 include_once(../../file3.php);

../ is just gonna give you headaches, sooner or later.

Just fix your include_path and be done with it.

 I then have another file:

 /code/test2.php

 That file pulls in test.php.

 include_once(folder1/test.php);

 Why do I get errors on the includes?

I don't think include_once is THAT smart...

Or maybe it just assumes you are using include_path in a sane way and
not doing this in the first place... :-)

include and include_once have nothing to do with the current file.

They ONLY look at your include_path.

Your include_path MIGHT (and probably should, in many applications)
have '.' as one of the directories in it.

But even then, I believe '.' simply means current working directory,
so unless you are dinking around with http://php.net/chdir (which you
probably shouldn't, usually) then it's just gonna be the ONE directory
of the very first PHP file loaded, no matter where all the other files
are.

Hope that helps.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: Simulating a POST

2006-06-15 Thread David Dorward
Man-wai Chang wrote:
 I hit the script by http://server/netgeo.post.php?ip=192.168.1.1
 
 But the script entered an endless loop. What's wrong?

Either there is a bug in the script, or you put in unexpected data, or both.

(Since server isn't a host we can access, and since you haven't shown us
the script, that's all that can really be said).

-- 
David Dorward   http://blog.dorward.me.uk/   http://dorward.me.uk/
 Home is where the ~/.bashrc is

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 ?!?!?!?!?!?!

I hope youi used str_repeat() to generate that.


 seriously though, have you tried it?

 that said your [probably] better off just doing 1 query:

  UPDATE members SET member_name = 'N/A' WHERE member_name = '';

 that said your [probably] better off leaving the name empty or setting it
 NULL if
 it's unknown and showing 'N/A' in whatever output screen it's relevant for
 any
 names that are found to be empty.

 Thanks

 -afan

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



Re: [PHP] Checking for empty()

2006-06-15 Thread Richard Lynch
If you just want to disallow strings of only whitespace,
http://php.net/trim them first.

The ideal sanitization, however, lists all the characters you DO want
to allow, rather than attempting (and probably failing) to try to
consider all the ways a user might (intentionally or not) screw up.

$CLEAN['name'] = preg_replace('/[^a-z0-9\',\\. -]/i', '?',
$_REQUEST['name'];

might be an example that would cover virtually all names.

At least for Latin1 character set languages...

You're on your own if you need Unicode and all that...

Though the above would be not much worse than attempting to render
UTF-16 as Latin1 anyway, so there ya go.

NOTE:
An Apple developer from the 80s was named 'Bo3b'
And that 3 is not a typo.
Hippie parents.
That is why I intentionally allow 0-9.
Anybody who poked around on a Fat Mac [*] will remember the hidden
files with 'bo3b' as part of their name or resource type.  Yup.  That
was him.
YMMV
NAIAA
IANAL

* Fat Mac: 128K RAM!  And you could copy Mac Floppies with only a
couple floppy swaps!  Whoo Hooo!!!  Those were the days.  Lode Runner
totally rocked, though. :-)

On Wed, June 14, 2006 1:09 pm, Ashley M. Kirchner wrote:

 I have a form with various fields on it that I want to make sure
 aren't empty or the user didn't just hit the space bar or return (in a
 text field).  What's the best way to do this?  Seems empty() will fail
 on a textarea if the user simply hits a space or return and submits
 the
 form.

 --
 W | It's not a bug - it's an undocumented feature.
   +
   Ashley M. Kirchner mailto:[EMAIL PROTECTED]   .   303.442.6410
 x130
   IT Director / SysAdmin / Websmith . 800.441.3873
 x130
   Photo Craft Laboratories, Inc.. 3550 Arapahoe Ave.
 #6
   http://www.pcraft.com . .  ..   Boulder, CO 80303,
 U.S.A.

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] declaring a class as stdClass?

2006-06-15 Thread Richard Lynch
On Wed, June 14, 2006 1:08 pm, Mariano Guadagnini wrote:
 I hace an existencial doubt: i've seem many scripts declaring classes
 as
 stdClass. In the documentation (for PHP5 and also for 4), it says that
 this class is internal of php, and should't be used. By the manner I
 saw
 it's being used, i guess that it can be handy to create a 'generic' or
 so class, and append members when needed on the fly, without the need
 for a formal class declaration, but i could't find any good source
 explaining that. Has somebody some info about?

When you do:

class foo { };

I believe that, down in the guts, foo is a subclass of stdClass.

Now, assuming you want to be all loosy-goosy and not really hard-core
other-language purist OOP...

$foo = new stdClass;

is not really significantly different from:

class foo { }; $foo = new foo;

So, put it this way:  If your OOP inhibitions are loose enough to want
to use stdClass in the first place, and then start throwing data into
it like:

$foo-undeclared_member_variable = 42;

Then, really, I don't think using stdClass is gonna be a Big Issue,
compared to what you are already doing.

This is merely my opinion, and is not meant to reflect the Documented
Featureset, and certainly not the current direction Internals seems to
be taking with OOPurism.

Since I never actually use class (much) in the first place, I don't
really care either way. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-15 Thread Satyam

perhaps this will work:

Select country , name from tbl_chassis order by ifnull(country,'')

didn't try it.


- Original Message - 
From: weetat [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Thursday, June 15, 2006 8:14 AM
Subject: [PHP] mysql + PHP



Hi all,

  I have SQL query , for example , Select country , name from 
tbl_chassis order by country.


 The problem of the sql statement is that , if there are empty value in 
country field , it be sorted first .


How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

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



Re: [PHP] declaring a class as stdClass?

2006-06-15 Thread Richard Lynch
On Wed, June 14, 2006 1:26 pm, D. Dante Lorenso wrote:
 Mariano Guadagnini wrote:
 Hi list,
 I hace an existencial doubt: i've seem many scripts declaring
 classes
 as stdClass. In the documentation (for PHP5 and also for 4), it says
 that this class is internal of php, and should't be used. By the
 manner I saw it's being used, i guess that it can be handy to create
 a
 'generic' or so class, and append members when needed on the fly,
 without the need for a formal class declaration, but i could't find
 any good source explaining that. Has somebody some info about?

 Also, along the lines of this same question, I can do this in PHP very
 easily:

 ?php
 $data = array('apple' = 'red', 'banana' = 'yellow', 'plum' =
 'purple');
 $data = (object) $data;
 print_r($data);
 ?

 And my object is magically created for me as an instance of stdClass.
 Is there a way to cast as some other type of class?

 ?php
 $data = array('apple' = 'red', 'banana' = 'yellow', 'plum' =
 'purple');
 $data = (MyCustomClass) $data;
 print_r($data);
 ?

 I ask this because the cast in my first example, the (object) cast is
 WAY faster than using the manual approach of:

 ?php
 $data = array('apple' = 'red', 'banana' = 'yellow', 'plum' =
 'purple');
 $MYCLASS = new MyCustomClass();
 foreach ($data as $key = $value)
$MYCLASS-$key = $value;
 }
 ?

In the earliest days of PHP OOP, a class (or its instance, if you
prefer) was little more than a glorified struct for those of you who
know C.

So, really, typecasting from an object to an array or vice-versa,
didn't really involve much of a change.

While I am sure class/object has change a lot internally, there is
still legacy code (and dinosaur coders like me) who never quite catch
up to the new school

You're probably gonna see this for awhile, and unless it's a
documented backwards-compatibility breaking change, it is unlikely to
change.

And, actually, the whole SPL library seems to delight in blurring the
distinction between object/array.

Then there's the funky-ass internal DOM / XML thingie that blurs it so
badly, it breaks var_dump()... :-(

At a wild guess, there are probably 1 in a zillion legitimate lines of
code where a typecast from object to array or vice versa is Good Code,
about 10,000 places it's arguable, and (zillion - 10,000 - 1) places
where it's just an abuse of the feature.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread Richard Lynch
On Wed, June 14, 2006 12:37 pm, Alex Major wrote:
 I've been (very slowly) working my way through some basic php, and
 putting it into my html site. However recently (after trying things
 out such
 as cookies or redirects where they have to be set before any page
 output)
 I've found that the combination or certainly the way that I'm using
 php and
 html together dosn't seem to go too well.

You have stumbled into the (unoriginal, I'm afraid) concept of
separating business logic (PHP) from presentation (HTML)

There are about a thousand sub-schools of this, including all kinds of
acronyms (MVC springs to mind).

You COULD spend the rest of your life studying and never write another
line of code...

There are also a variety of PHP Template Libraries (such as Smarty)
which more-or-less lead you by the nose (and sometimes force) you to
separate your Business Logic (PHP) from your Presentation (HTML).

There are also some schools of thought where *SOME* of the PHP is
actually NOT really businees logic, but is, in fact, part of the
presentation.

Consider, for example, the simple concept of a date.

Ignoring for the moment the various different calendaring systems, and
historical re-vampings, and sticking to the most rudimentary
representation of Unix timestamp such as that used by
http://php.net/date function...

It could be argued that, really, the decision to display:
6/15/2006 versus 15-06-2006 versus June 16, 2006, is really not
business logic per se, but merely a Presentation Detail.

So *some* developers prefer that the minutiae of that particular
decision not be FORCED to be in the Business Logic by some external
library attempting to separate Business Logic and HTML.

But, I digress...

 I have a question to you experienced PHP developers, how do you mix
 the
 html/php together. When I've looked at things like the PHPBB forums,
 and
 gone through files they will have absolutly no HTML, just php code.
 I'm not
 sure how they manage their page styling, if anyone could explain this
 too
 me.

Errr.  I think perhpas phpBB would not be the first place I'd send a
newbie to try and figure this out, personally...

 At the moment I have things such as
 table ...
 ?php
 Some php code making a page header
 ?
 /table
 table ...
 ?php
 Content...
 ?
 /table

 I'm sure that I'm not doing it the best possible way, so if anyone has
 any
 tips for me.

I would say that, in general, for a SIMPLE web application, and for a
disciplined developer (or one learning to become a disciplined
developer) it would be sufficient to do:

?php
   //bulk of all the tricky code here:
   //  big sql queries, working out what to do with user input
   //  error handling
?
html
  head
!-- Only html stuff below, with an occasional PHP echo snippet: --
title?php echo $title?/title
  /head
  body
  /body
/html

One implication of this is that all your header() calla, and all the
Business Logic to decide what/when to DO your header() calls, goes in
the top bit.

This then takes care of the problem of stray output making header()
calls not work.

I can guarantee that somebody on this list is going to be agahst at
this recommendation of such a crude solution -- But it has served me
well for a decade for SIMPLE WEB APPLICATIONS and is much less effort
and more maintainable simply by scale/scope of code-base for SIMPLE
WEB APPLICATIONS.

If you're attempting to write the next Google or something on that
scale, then this *IS* admittedly a horrible idea.

For a beginner, however, you'll learn a lot more, a lot faster doing
this than trying to stumble through some over-engineered monstrosity
template library.

Now I'd better really get out my flame-retardant undies.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-15 Thread weetat

hi , not working .
The empty value still sorted first.

Thanks.

Satyam wrote:

perhaps this will work:

Select country , name from tbl_chassis order by ifnull(country,'')

didn't try it.


- Original Message - From: weetat [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, June 15, 2006 8:14 AM
Subject: [PHP] mysql + PHP



Hi all,

  I have SQL query , for example , Select country , name from 
tbl_chassis order by country.


 The problem of the sql statement is that , if there are empty value 
in country field , it be sorted first .


How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

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



Re: [PHP] Calculating difference between two days

2006-06-15 Thread Richard Lynch
On Wed, June 14, 2006 11:45 am, [EMAIL PROTECTED] wrote:
 I need to calculate no. of days between two dates, actually between
 date
 stored in DB and today's date.

Almost for sure your best answer is actually in your SQL engine with
something like date_subtract in MySQL.

PHP's date functions are, err, a but unwieldy...

I mean, okay, if you already have the four or five different software
packages installed, and you understand them, I'm sure it's really very
nice, but for the simple usage, for what most people need, the SQL
date-handling is generally sufficient and easier.

 Does anybody has an example I can use?

http://dev.mysql.com/ will have one if you search for date_add, almost
for sure.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Seeking recommendations for use of include()

2006-06-15 Thread Larry Garfield
On Wednesday 14 June 2006 21:48, Dave M G wrote:
 Jochem,

  ::index.php
 
  ?php
  include $_GET['page'];
  ?

 Wouldn't strip_tags() eliminate the ?php ? tags that make this possible?

No, because that's not what the hole is.  YOUR CODE is include $_GET['page'].  
That's an easily exploitable hole, as explained.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] transfer file

2006-06-15 Thread Richard Lynch
On Tue, June 13, 2006 9:55 pm, kristianto adi widiatmoko wrote:
 $remote = fopen(http://B/file.txt,w+);

HTTP just plain ain't gonna let you open a file up for writing --
thank god.

Can you imagine the number of websites that would get hacked? [shudder]

But if you have FTP access to B, you can use http://php.net/ftp

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-15 Thread Satyam
Actually, does the country field contains null or an empty string?   If it 
is an empty string this will nor work.   Try Control Flow Functions:


http://dev.mysql.com/doc/refman/5.0/en/control-flow-functions.html

Satyam

- Original Message - 
From: weetat [EMAIL PROTECTED]

To: php-general@lists.php.net; Satyam [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Thursday, June 15, 2006 8:51 AM
Subject: Re: [PHP] mysql + PHP



hi , not working .
The empty value still sorted first.

Thanks.

Satyam wrote:

perhaps this will work:

Select country , name from tbl_chassis order by ifnull(country,'')

didn't try it.


- Original Message - From: weetat [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Thursday, June 15, 2006 8:14 AM
Subject: [PHP] mysql + PHP



Hi all,

  I have SQL query , for example , Select country , name from 
tbl_chassis order by country.


 The problem of the sql statement is that , if there are empty value in 
country field , it be sorted first .


How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

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



Re: [PHP] Seeking recommendations for use of include()

2006-06-15 Thread Richard Lynch
On Tue, June 13, 2006 9:17 pm, Dave M G wrote:
 Richard Lynch wrote:
 The problem with making it dynamic, is that you've just made it
 AWFULLY easy for some Bad Guy to inject their own PHP file into your
 system...

 Think about that for awhile.
 I have thought about it, and I can only see it as possible if the
 person
 already has the ability to write PHP scripts into my directory. If
 they
 can do that, then the damage is already done and they don't need to
 bother with slipping the name of their file into my include()
 functions.
 They could just write a script and then execute it from the browser
 directly.

 If there is some other way for them to exploit a dynamic include()
 function, then please let me know.

Part of the whole register_globals debacle is based upon the problem
that dynamic includes, if not properly coded 100% of the time, can
have the variable over-written by external data.

Let us also consider, for the moment, that maybe someday you wrap this
thing up with some kind of nifty database solution to track all those
include files -- now the Bad Guy only has to break into your database
to get the files they want loaded.

Also consider that if allow_url_fopen_wrappers thingie is on then
they can include() the source code from THEIR OWN SERVER, not needing
to get it onto your server in the first place.

I'm not saying you can't take precautions and make this reasonably
secure today.

And you maybe even have a process in-place to audit the code and
application next month/year/decade to be sure the feature doesn't
get improved to suddenly not be secure anymore, by some Junior
Developer who gets thrown on the project after your project gets
really big and important...

I'm saying think long and hard about this, and be sure you've
considered all the angles (the above is probably only a subset) before
you go down what is an inherently dangerous path.

So far, our conversation could be likened to:
You: Should I jump out of an airplane?
Me; I dunno.  It's pretty dangerous if you don't know what you're doing.

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-15 Thread Martin Alterisio

2006/6/15, weetat [EMAIL PROTECTED]:


Hi all,

   I have SQL query , for example , Select country , name from
tbl_chassis order by country.

  The problem of the sql statement is that , if there are empty value in
country field , it be sorted first .

How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat

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



Maybe this will do the trick:

select country, name
 from tbl_chassis
order by country = '', country


Re: [PHP] Upgrade to PHP5 on Fedora Core

2006-06-15 Thread nicolas figaro

Dave M G a écrit :

PHP List,

My hosting service allows me enough access to do things like handle my 
own upgrades and full administrative access. Usually, because I am 
more of a web designer than an server administrator, I get their 
support staff to manage upgrades and installations.


However, that does cost money, so I thought this time, if it's easy 
enough, I would try upgrading PHP myself. Currently my hosting service 
is running PHP Version 4.4.2, and I would like to upgrade to the 
latest stable build of PHP 5.



what happens if your upgrade doesn't work ?
At home, I use Ubuntu LTS, and to upgrade to PHP 5 I just used apt-get 
(with the Synaptic GUI) to upgrade. It was very easy.


The hosting machine is using Fedora Core 1. I'm less familiar with Red 
Hat systems, but I do understand that yum is the equivalent of apt-get.



you can find apt packets for RedHat FC1

So, I'm hoping I can just do:

yum install php5

... and be off and running.

But because I don't really want to suffer any downtime, I hoped to get 
confirmation here on this list that this will work, and check if I 
need any other configuration options.



there are also some differences between php 4.2.2 and 5.x.y.
could you try to set up another apache that will use your php5, so you 
can do the basic tests before upgrading ?


you can set up another apache server to listen to another port, so the 
switch to the latest version is easy,

and the switch back in case of an error with php5 is also easy.

do you have any http backup server ?
do you have backups of your http server (if there is no http backup 
server).
If it makes a difference, I'm also running MySQL 5.0 on the system, 
and Apache 2.


Is there anything else I need to know for a smooth upgrade to PHP 5?

Did you ask the hosting service guys for how they manage php upgrades ? 
(I know they won't give you infos you paid for easily).


hope this'll help
N F

--
Dave M G



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



[PHP] Re: Simulating a POST

2006-06-15 Thread Barry
Man-wai Chang schrieb:
 I hit the script by http://server/haha.php?ip=192.168.1.1
 
 But the script entered an endless loop. What's wrong?
 
 
 
 
 
 htmlhead/head
 body onload=document.myform.submit()
This is causing the reload.

It says : everytime page loads submit the form.
And since submitting a form is like reloading a page it will go over and
over again.

-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread Larry Garfield
On Thursday 15 June 2006 01:50, Richard Lynch wrote:

 I can guarantee that somebody on this list is going to be agahst at
 this recommendation of such a crude solution -- But it has served me
 well for a decade for SIMPLE WEB APPLICATIONS and is much less effort
 and more maintainable simply by scale/scope of code-base for SIMPLE
 WEB APPLICATIONS.

 If you're attempting to write the next Google or something on that
 scale, then this *IS* admittedly a horrible idea.

 For a beginner, however, you'll learn a lot more, a lot faster doing
 this than trying to stumble through some over-engineered monstrosity
 template library.

 Now I'd better really get out my flame-retardant undies.

Another recommendation: Do not, under any circumstances, try to write your own 
template engine.  All you'll be doing is writing a syntax parser in PHP for 
another syntax that will give you fewer options, less flexibility, and worse 
performance than well-used native PHP.

There ARE good PHP based template engines out there (Smarty, Flexy, PHPTal, 
etc.), written by people much smarter than you or I and field tested by 
thousands of people on more sites than you've ever used.  If you want to use 
a non-PHP-syntax for your template files, find one.  Don't write it.  You 
will thank yourself later.

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



Re: [PHP] Seeking recommendations for use of include()

2006-06-15 Thread Richard Lynch


No.

He's saying YOUR code is, more or less, not unlike:

?php
include $_GET['page'];
?

Maybe it's more like this:

?php
  include $page;
?

Well, if at some point, you forget to initialize $page, AND IF you
have register_globals on, for some reason, perhaps even because you
later install some 3rd-party software that needs it, and you integrate
their app with your app, *THEN* years down the road, after you've
completely FORGOTTEN this entire thread in PHP-General, *YOUR*
application is now wide open to a hack.

We're warning you that you are about to unlock the door, and even if
you have an armed guard today, that doesn't guarantee that the guard
will always Be There.

Your software will grow and change.

It is exactly the kind of decision you are contemplating now that will
bite you in the butt with a hacked server a couple years from now,
after OTHER problems accrete, in a domino effect, stretched out over
the course of years.

On Wed, June 14, 2006 9:48 pm, Dave M G wrote:
 Jochem,
 ::index.php
 ?php
 include $_GET['page'];
 ?

 Wouldn't strip_tags() eliminate the ?php ? tags that make this
 possible?

 --
 Dave M G

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Simple class declaration returns error

2006-06-15 Thread Jochem Maas
Dave M G wrote:
 PHP List,
 
 Okay, I've upgraded to php 5 on my home machine, and I'm still getting

what version?

 some syntax errors.
 
 Parse error: syntax error, unexpected T_NEW in
 /home/dave/web_sites/thinkingworks.com/web/database.class on line 5
 
 This is the code producing the error:
 
 class database {
 public static $database = new database;


you can only set literal or constant values to properties of the class
in the actual definition. and there is a school of thought that says you
shouldn't be setting any values in the definition:

class database
{
private static $database;

public static function getDB()
{
if (!isset(self::$database))
self::$database = new self;

return self::$database;
}

public function query($sql, $args = array())
{
// query magic here
}
}

// now you can do something like:

database::getDB()-query(SELECT * FROM foo WHERE id=?, array($id));

notice that the static member variable is no longer accessible
from the outside and therefore it is not possible for any code other
that the database class to actually overwrite that variable.

 
 I've also tried:
 
 private static $database = new database;
 
 and:
 
 private static $database = new database;
 
 and:
 
 public static $database = 'database';

this last one should work. as should:

public static $database = array(1,2,3);
public static $database = 1;
public static $database = MY_GLOBAL_CNST;


 
 The last of which I copied directly from the PHP manual.
 
 I'm just starting out with objects this week, so I know I am missing a
 very basic thing. If anyone can nudge me in the right direction, that
 would be fantastic.
 
 Thank you for your advice.
 
 -- 
 Dave M G

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



Re: [PHP] Simple class declaration returns error

2006-06-15 Thread Dave M G

PHP List,

Okay, I've upgraded to php 5 on my home machine, and I'm still getting 
some syntax errors.


Parse error: syntax error, unexpected T_NEW in 
/home/dave/web_sites/thinkingworks.com/web/database.class on line 5


This is the code producing the error:

class database {
public static $database = new database;

I've also tried:

private static $database = new database;

and:

private static $database = new database;

and:

public static $database = 'database';

The last of which I copied directly from the PHP manual.

I'm just starting out with objects this week, so I know I am missing a 
very basic thing. If anyone can nudge me in the right direction, that 
would be fantastic.


Thank you for your advice.

--
Dave M G

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



[PHP] File Download Headers

2006-06-15 Thread Richard Lynch
Can any experts on this list explain to me why, despite the 1,000,000
places that application/octet-stream is documented to work, and has
always worked, since Mosaic 1.0 days, people manage to find these
goofball Content-type: headers that are supposed to work, but only
work in a handful of browsers, and then they write tutorials as if
it's the Right Way, and then those tutorials get past alleged Editors,
and are all you can find from Google?

Anybody?

Cuz I really just don't understand why I'm seeing this same damn
question about 5 times PER DAY between here and IRC ##php

I just do not understand what is the aversion is to:

Content-type: application/octet-stream

IT WORKS!

ALL BROWSERS!

FOR ALL TIME!

TRY IT!!!

Mosaic 1.0, works.
IE, all versions, works.
Netscape/Mozilla/Firefox, all versions, works
Safari, all versions, works.
Lynx, all versions, works.

It JUST WORKS!

Why, oh why, are we endlessly seeing posts and tutorials using other
headers that DO NOT WORK ON ALL BROWSERS.

* Yes, ALL browsers, including Mosaic 1.0, thank you very much.

This post was partially made in the probably futile hope that maybe
somebody will find it and use it so I don't answer this question 5
times again tomorrow.

Thank you.

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Problem with the passthru function

2006-06-15 Thread Richard Lynch
On Wed, June 14, 2006 4:51 am, Venkatesh Babu wrote:
 I have a small php file (test.php) whose code is shown
 below:

 ?php
 $retval=1;
 $command='/bin/ls';
 passthru($command, $retval);
 print(Exit status:  . $retval);
 ?

 This test.php works fine when I execute from command
 prompt as php test.php, but when I access it through
 web browser, it seems not to be working fine, I get an
 exit status of 127 (which means command not found). I
 checked for permissions of ls, gave full path, but
 still it is failing.

 Can anybody help me in indentifying what is the
 potential problem?

That is pretty odd, as you seem to have covered the Usual Mistakes...

I guess my next move would be to try:

if (file_exists('/bin/ls')){
  echo Okay, /bin/ls does exist.br /\n;
}
else{
  echo Hmmm...  PHP says /bin/ls does not exist.br /\n;
}

if (is_executable('/bin/ls')){
   echo Okay, /bin/ls is executable.br /\n;
}
else{
  echo hmmm...  PHP says /bin/ls is not executable.br /\n;
}

and so on...

Try every which way from PHP to check out /bin/ls to see if it is there.

I suppose it's also possible that the default Environment for PHP is
attempting to ls a directory for which you do not have access...

Try using '/bin/ls /full/path/to/your/web/tree' instead.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 1:14 am, weetat wrote:
I have SQL query , for example , Select country , name from
 tbl_chassis order by country.

   The problem of the sql statement is that , if there are empty value
 in
 country field , it be sorted first .

 How to do sorting the empty value last
 ? I can cp() function to do this ? or any mysql function to use?

This is really an SQL question, and the empty values should properly
be called NULL to avoid confusion with '', the empty string...

Unless you have '' in your data for country, which is really just Bad
Data, imho...

The solution for NULL is fairly easy.  There is an SQL function called
'coalesce' which will convert any NULL value to, err, whatever you
want.

So:

select coalesce(country, 'ZZ'), name from ...

would probably be the simplest answer.

If, however, your country values are '', and if you don't want to fix
the application to avoid such a bogus value, you could do:

ORDER BY country = '', country, ...

country = '' should turn into true/false, which should turn into 0/1
which should order by the ones that have something first, and the ones
that are '' last.  You may need to do some kind of 'typecast' on the
country = '' depending on your SQL engine.  You may even be forced to
do:

select country, nane, typecast_function(country = '', bool) as empty
from ...
order by empty, country

if your SQL engine is particularly baroque (MySQL 3.23, I do believe...)

:-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread Richard Lynch
On Wed, June 14, 2006 3:28 pm, BBC wrote:
 I used many functions as template to change the html syntax.
 this is one of the function as a sample:
 ?php
  function
 tabletag($border=0,$width=100%,$height=100%,$cellpadding =
 0,$cellspacing=0,$style=)
  {
   print (table width=\$width\ height =\$height\
 border=\$border\
 cellspacing=\$cellspacing\ cellpadding=\$cellpadding\
 style=\$style\);
  }
 ?

Here are the 'cons' to this solution:

1.
The developer has to remember the attributes in the order you chose.

There is no friggin' way I'm going to remember that you put
cellpadding before cellspacing on a day-to-day basis.  Sorry.

2.
If they want the default border, whatever that is, they have to know
what it is, and provide it, to get the non-default width.

Passing in NULL does not count, as it will not work in PHP5+

3.
You've basically swapped a simple table tag:
table border=0 width=100% ... 
with an almost equally long and complicated function call:
tabletag(0, '100%', ...);

So, really, where's the benefit?...

You can just call the function, or you can just type the table tag.

I see no win' here, personally.

Obviously others do see an added value, of course.

 so I don't need to type table , just call those functions.
 and I don't think it works slowly (cause we just set one function for
 many
 tables)

If you have enough TABLE tags for the performance to be an issue, then
the browser willl choke...

However, assuming you have a function for TR and/or TD, then the
number of rows in a large TABLE could be a serious performance issue.

This is all assuming proper use of TABLE for tabular data and not
layout, thank you very much CSS weenies :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] mysql + PHP

2006-06-15 Thread weetat

Thank all for your inputs.

Yes . the data should be null , really bad data , will try to change 
database structure.


Richard Lynch wrote:

On Thu, June 15, 2006 1:14 am, weetat wrote:

   I have SQL query , for example , Select country , name from
tbl_chassis order by country.

  The problem of the sql statement is that , if there are empty value
in
country field , it be sorted first .

How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?


This is really an SQL question, and the empty values should properly
be called NULL to avoid confusion with '', the empty string...

Unless you have '' in your data for country, which is really just Bad
Data, imho...

The solution for NULL is fairly easy.  There is an SQL function called
'coalesce' which will convert any NULL value to, err, whatever you
want.

So:

select coalesce(country, 'ZZ'), name from ...

would probably be the simplest answer.

If, however, your country values are '', and if you don't want to fix
the application to avoid such a bogus value, you could do:

ORDER BY country = '', country, ...

country = '' should turn into true/false, which should turn into 0/1
which should order by the ones that have something first, and the ones
that are '' last.  You may need to do some kind of 'typecast' on the
country = '' depending on your SQL engine.  You may even be forced to
do:

select country, nane, typecast_function(country = '', bool) as empty
from ...
order by empty, country

if your SQL engine is particularly baroque (MySQL 3.23, I do believe...)

:-)



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



RE: [PHP] Setting headers for file download

2006-06-15 Thread Richard Lynch
Something else is very very very wrong if Content-type:
application/octet-stream does not force a download...

http://pastebin your code or something, and we'll look at it.

On Tue, June 13, 2006 7:19 pm, Peter Lauri wrote:
 Hi, when I do that I do not get any download frame showing up. Can
 that be
 solved?

 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, June 14, 2006 4:58 AM
 To: Peter Lauri
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] Setting headers for file download

 On Tue, June 13, 2006 1:44 am, Peter Lauri wrote:
 This is how I try to push files to download using headers:

 Content-type: application/octet-stream

 Any browser failing to download THAT is seriously broken.

 The Content-Disposition: crap will only work on select browsers -- If
 you really want that filename to work, tack it onto the end of the
 URL.

 The link should be:

 http://example.com/yourscript.php/?php echo $filename?

 --
 Like Music?
 http://l-i-e.com/artists.htm

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



[PHP] Re: File Download Headers

2006-06-15 Thread Barry

Richard Lynch schrieb:

and are all you can find from Google?

O_o


Anybody?

What?!?


I for myself use this:
header(Content-Type: application/force-download);
header(Content-Type: application/octet-stream);
header(Content-Type: application/download);

Never had any problems with any browser.

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] serving video files with php

2006-06-15 Thread Andras Kende
Hello,

 

Is there any drawback servings video files through php downloader script on
high load site?

 

Or just straight link to the videos are more efficient?

 

 

Thank you,

 

Andras Kende

http://www.kende.com

 



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread BBC

Thank Mr.tedd(I guess you are a man)
I think you should check one of my site http://aztec-indianart.com
while you're surfing this site actually you are visiting one page only with
different variable (see url).
I used many data in html, php, inc, txt, css, js and MySQL off course. then
I include them in one page depends on the variable
please give me your opinion about what I did (you know I just learned PHP, 
like I said before)

sorry for my English (I'm Indonesian)


- Original Message - 
From: tedd [EMAIL PROTECTED]

To: BBC [EMAIL PROTECTED]; Alex Major [EMAIL PROTECTED];
php-general@lists.php.net
Sent: Wednesday, June 14, 2006 5:39 PM
Subject: Re: [PHP] Using PHP/HTML effectivly



At 1:28 PM -0700 6/14/06, BBC wrote:

I used many functions as template to change the html syntax.
this is one of the function as a sample:
?php
function tabletag($border=0,$width=100%,$height=100%,$cellpadding =
0,$cellspacing=0,$style=)
{
print (table width=\$width\ height =\$height\ border=\$border\
cellspacing=\$cellspacing\ cellpadding=\$cellpadding\
style=\$style\);
}
?
so I don't need to type table , just call those functions.
and I don't think it works slowly (cause we just set one function for many
tables)


BBC:

Personally, I see what you are trying to do, but I would not be going that
route.

Like many others, I don't work in a shop where one group does php and
another does the designing and such -- I'm just a one man band who has to
do it all and make it work.

For me, I use php/mysql, html, js, and css all together to do stuff --
but, I try to keep them as separate as I can.

CSS helps a LOT because I can use simple html tags like:

table
...
/table

And put the presentation code for the table in css. CSS seldom mixes with
php and it helps reduce the amount of code I have to review. Plus, css
separates look from performance (i.e., php/js/html) -- I can change one
without worrying about the other.

Typically, the amount of html code I have is far less than php. I often
roll html code segments (like header and footer) into php includes and
keep them tucked away so I don't have to look at anything except:

include(header.inc);

Now, there is html code that I have to mix into my php and I usually
separate it by using the method you first suggested, such as:

?php
... bunches of php code
?

bunches of html code

?php
... bunches more of php code
?

To me, that's easy to read and I have no problem mixing stuff that way.

Occasionally, I have to intermix html and php together in the same
statement such as filling text field from a dB, such as:

input type=text size=7 maxlength = 7 name=price value=?php
echo($price); ?

But, it's pretty clear that I'm using php to set what the value is in an
html statement.

Even fewer times, but I still do, I intermix css, js, html, and php all
together, such as:

td class=search_btn
input type=button value=Album
onclick=window.location='search.php?unique_id=?php echo($unique_id);?'

/td

But still, I think it's pretty clear what I'm doing. CSS takes care of how
the button looks; js takes care of what happens when the user clicks; php
provides something from the dB; and html is the glue that holds everything
together. They all work in concert.

One of the things I keep in mind is when I start using a lot of escape
characters (as you did above), then I'm not doing it the best way (IMO)
and I look for another solution.

I would much rather see code

?
table
...
/table
?php

Than to intermix it as you did.

Now, purest would like all languages to be separate and I can't argue with
that -- however -- if this is what it takes to get the job done, then what
choice do you have?  I look at it all like it's one big language and that
works for me -- others mileage may vary.

hth's

tedd

--

http://sperling.com  http://ancientstones.com  http://earthstones.com


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



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread Jochem Maas
Richard Lynch wrote:
 On Wed, June 14, 2006 3:28 pm, BBC wrote:
 I used many functions as template to change the html syntax.
 this is one of the function as a sample:
 ?php
  function
 tabletag($border=0,$width=100%,$height=100%,$cellpadding =
 0,$cellspacing=0,$style=)
  {
   print (table width=\$width\ height =\$height\
 border=\$border\
 cellspacing=\$cellspacing\ cellpadding=\$cellpadding\
 style=\$style\);
  }
 ?
 
 Here are the 'cons' to this solution:
 
 1.
 The developer has to remember the attributes in the order you chose.
 
 There is no friggin' way I'm going to remember that you put
 cellpadding before cellspacing on a day-to-day basis.  Sorry.

which is easily countered if one designs the function better,
something like:

function tabletag($args = array())
{
// default values.
$defaults = array(
'border' = 0,
'width'  = '100%'
// etc  
);

// normalize the args
$args = array_merge($defaults, $args);
$args = array_intersect_key($args, $defaults); // you might not have 
this function

// addition arg sanitation...?

// build a table!!!
}

 
 2.
 If they want the default border, whatever that is, they have to know
 what it is, and provide it, to get the non-default width.
 
 Passing in NULL does not count, as it will not work in PHP5+

did passing NULL is php4 give you the default value defined in the functions
signature declaration? I can't remember it ever doing that?

I always thought it was: pass in NULL, get a NULL [inside the func].

 
 3.
 You've basically swapped a simple table tag:
 table border=0 width=100% ... 
 with an almost equally long and complicated function call:
 tabletag(0, '100%', ...);
 
 So, really, where's the benefit?...
 
 You can just call the function, or you can just type the table tag.
 
 I see no win' here, personally.

one win could be that it enforces consistent HTML output - so no more 
style-de-jour
kind of HTML output.

then again an output filter that uses the Tiny extension will probably do just 
as well :-)

 
 Obviously others do see an added value, of course.
 
 so I don't need to type table , just call those functions.
 and I don't think it works slowly (cause we just set one function for
 many
 tables)
 
 If you have enough TABLE tags for the performance to be an issue, then
 the browser willl choke...
 
 However, assuming you have a function for TR and/or TD, then the
 number of rows in a large TABLE could be a serious performance issue.
 
 This is all assuming proper use of TABLE for tabular data and not
 layout, thank you very much CSS weenies :-)

yhaw! ;-)

 

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



[PHP] Re: Simulating a POST

2006-06-15 Thread Man-wai Chang

body onload=document.myform.submit()

It says : everytime page loads submit the form.
And since submitting a form is like reloading a page it will go over and
over again.


Then how could I make it happen once only? I already had a 
if..then..else to separate the 2 sections of codes.


--
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.16.20
  ^ ^   16:45:02 up 9 days 2:28 0 users load average: 1.07 1.07 1.01
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



[PHP] Re: Simulating a POST

2006-06-15 Thread Man-wai Chang

Here is the new version:

--
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.16.20
  ^ ^   16:48:01 up 9 days 2:31 1 user load average: 1.02 1.04 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk
?php

function getLocationCaidaNetGeo($ip)
{ 
$NetGeoURL = http://netgeo.caida.org/perl/netgeo.cgi?target=.$ip; 
if($NetGeoFP = fopen($NetGeoURL,r))
{ 
ob_start();
fpassthru($NetGeoFP);
$NetGeoHTML = ob_get_contents();
ob_end_clean();
fclose($NetGeoFP);
}
return $NetGeoHTML;
}

if ($HTTP_POST_VARS['btnsubmit']) {
print_r(getLocationCaidaNetGeo($_POST['ip']));
} else {
?
htmlhead/head
body onload=document.myform.submit()
form method=post enctype=multipart/form-data name=myform
input type=text name=ip
input type=submit name=btnsubmit value=submit
/form
/body/html
?php
}
?

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

[PHP] Re: Simulating a POST

2006-06-15 Thread Man-wai Chang


Here is the new version:



--
  .~.   Might, Courage, Vision, SINCERITY. http://www.linux-sxs.org
 / v \  Simplicity is Beauty! May the Force and Farce be with you!
/( _ )\ (Ubuntu 6.06)  Linux 2.6.16.20
  ^ ^   16:48:01 up 9 days 2:31 1 user load average: 1.02 1.04 1.00
news://news.3home.net news://news.hkpcug.org news://news.newsgroup.com.hk

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



[PHP] Re: Simulating a POST

2006-06-15 Thread Barry

Man-wai Chang schrieb:

Here is the new version:


this should work.

Have you tested it?

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Re: Simulating a POST

2006-06-15 Thread Barry

Man-wai Chang schrieb:

Here is the new version:




?php

function getLocationCaidaNetGeo($ip)
{ 
	$NetGeoURL = http://netgeo.caida.org/perl/netgeo.cgi?target=.$ip; 
	if($NetGeoFP = fopen($NetGeoURL,r))
	{ 
		ob_start();

fpassthru($NetGeoFP);
$NetGeoHTML = ob_get_contents();
ob_end_clean();
fclose($NetGeoFP);
}
return $NetGeoHTML;
}

if ($HTTP_POST_VARS['btnsubmit']) {
print_r(getLocationCaidaNetGeo($_POST['ip']));
} else {
?
htmlhead/head
body onload=document.myform.submit()
form method=post enctype=multipart/form-data name=myform
input type=text name=ip
input type=submit name=btnsubmit value=submit
/form
/body/html
?php
}
?


Ah forgot something.

You still are not able to fill out anything because it submittes itself 
automatically.


you have to remove that onload.

Otherwise the post will still be empty and it will reload itself again 
and again.


Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Micky Hulse

Hi,

I am looking for a very simple blog software... I would prefer something 
that functions well with CSS and is standards compliant.


I am getting tired of setting-up the bigger full-featured blogging 
packages for small/quick/simple sites. It would be nice to know what 
others people prefer.


TIA.  :)
Cheers,
Micky

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



[PHP] A tricky little problem

2006-06-15 Thread Ross
I have a multiple choice quiz where the questions  answers are extracted 
from an external file

$q1 = what is the capital of Scotland ; $a1 = Edinburgh; $b1 =Glasgow; 
$c1 =dundee; $d1 =Stirling; $q1_answer = $a1;
$q2 = what is the capital of France; $a2 = Lyon; $b2 =Paris; $c2 
=Carcassonne; $d2 =Madrid; $q2_answer = $b1;

?

These are fed into a page which displays the questions and displays a radio 
button to select the answer, the page is incremnted when a correct answer is 
given

if  ($_POST['x']== $q1_answer) {
$incrementedPage = $page + 1;
header(Location: evaluation.php?page=$incrementedPage);
}

but how can I insert and compare the next question?


table width=292 border=0
  tr
td width=19A:/td
td width=202?=$a1; ?/td
td width=57 align=leftdiv align=left
  input type=radio name=x value=?=$a1; ? /
/div/td
  /tr
  tr
tdB:/td
td?=$b1; ?/td
td align=leftdiv align=left
  input type=radio name=x value=?=$b1; ? /
/div/td
  /tr
  tr
tdC:/td
td?=$c1; ?/td
td align=leftdiv align=left
  input type=radio name=x value=?=$c1; ? /
/div/td
  /tr
  tr
tdD:/td
td?=$d1; ?/td
td align=leftdiv align=left
  input type=radio name=x value=?=$d1; ? /
/div/td
  /tr
  tr
td colspan=2nbsp;/td
td align=leftinput type=submit name=Submit value=Submit 
//td
  /tr
/table

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



[PHP] Re: Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Barry

Micky Hulse schrieb:

Hi,

I am looking for a very simple blog software... I would prefer something 
that functions well with CSS and is standards compliant.


I am getting tired of setting-up the bigger full-featured blogging 
packages for small/quick/simple sites. It would be nice to know what 
others people prefer.


TIA.  :)
Cheers,
Micky
Well if you have that often this case, i would prefer you code one for 
yourself.


Imho the best way :)

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Dave Goodchild

On 15/06/06, Micky Hulse [EMAIL PROTECTED] wrote:


Hi,

I am looking for a very simple blog software... I would prefer something
that functions well with CSS and is standards compliant.

I am getting tired of setting-up the bigger full-featured blogging
packages for small/quick/simple sites. It would be nice to know what
others people prefer.

TIA.  :)
Cheers,
Micky




Use WordPress - clean, css-based, standards-compliant. You can set up a
basic site very quickly. If you want me to walk you through an example
contact me off list ([EMAIL PROTECTED]). I set up two installations,
www.abuddhistpodcast.com and www.mediamasters.co.uk/dg/insp, in less than a
day.

--

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





--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


[PHP] progress monitor in php

2006-06-15 Thread weetat

Hi all ,

  I was using PEAR:HTTP_Upload to upload file in php 4.3.2.
  Is ok , however i need to display some sort of progress monitor to 
the user because some file is very large and took some times to upload.

I need to inform the users to uploading is in progress.

I have search google ,and found megaupload , however the problem of 
megaupload is the filename is rubbish, i need the filename of uploaded 
file because the file is xml , need to convert data from xml to database.


Anybody have any ideas ? Or have any another php upload progress monitor ?

Thanks

- weetat

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



Re: [PHP] Re: File Download Headers

2006-06-15 Thread Jochem Maas
Barry wrote:
 Richard Lynch schrieb:
 and are all you can find from Google?
 O_o
 
 Anybody?
 What?!?

Barry, chances are Richard was already initiating downloads
when you were still eating from a bottle.

 
 
 I for myself use this:
 header(Content-Type: application/force-download);
 header(Content-Type: application/octet-stream);
 header(Content-Type: application/download);

IIRC:
one Content-Type header per request is all your allowed,
php will overwrite the first to 'Content-Type' header calls with
the content

 
 Never had any problems with any browser.

have you ever used/tried Mosiac1.0?

 
 Barry

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



Re: [PHP] Re: File Download Headers

2006-06-15 Thread Barry

Jochem Maas schrieb:

Barry wrote:

Barry, chances are Richard was already initiating downloads
when you were still eating from a bottle.

I don't think so well because the Zuse had no network capability.



I for myself use this:
header(Content-Type: application/force-download);
header(Content-Type: application/octet-stream);
header(Content-Type: application/download);


IIRC:
one Content-Type header per request is all your allowed,
php will overwrite the first to 'Content-Type' header calls with
the content

What?
You can send every header twice, triple. a zillion times if you want.
The browser at the end decides what to do with it.
PHP doesn't interfere here.
And i bet it will never do, because that would be extremely stupid.



Never had any problems with any browser.


have you ever used/tried Mosiac1.0?

Yes. Works fine.
But i don't get what the point is in having a 13 year old browser (which 
hasn't even HTML 2.0 support) beeing able to actually download stuff. Or 
optimize pages for it.


Sorry you would more having a problem actually getting to the download 
than the download itself.


This is such a usless conversation u want to start here.

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



[PHP] [EMAIL PROTECTED]

2006-06-15 Thread Pham Huu Le Quoc Phuc


-Original Message-
From: Jochem Maas [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 15, 2006 5:20 PM
To: Barry
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: File Download Headers

Barry wrote:
 Richard Lynch schrieb:
 and are all you can find from Google?
 O_o
 
 Anybody?
 What?!?

Barry, chances are Richard was already initiating downloads
when you were still eating from a bottle.

 
 
 I for myself use this:
 header(Content-Type: application/force-download);
 header(Content-Type: application/octet-stream);
 header(Content-Type: application/download);

IIRC:
one Content-Type header per request is all your allowed,
php will overwrite the first to 'Content-Type' header calls with
the content

 
 Never had any problems with any browser.

have you ever used/tried Mosiac1.0?

 
 Barry

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



Re: [PHP] Calculating difference between two days

2006-06-15 Thread tedd
On Wed, June 14, 2006 11:45 am, [EMAIL PROTECTED] wrote:
 I need to calculate no. of days between two dates, actually between
 date stored in DB and today's date.

If you want to do this via mysql, see:

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-type-overview.html
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

for php, you might review:

http://www.weberdev.com/get_example-4354.html
http://www.weberdev.com/get_example-3646.html
http://www.weberdev.com/get_example-4330.html

tedd


-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] CMS Typo 3 (Slightly 0T(?))

2006-06-15 Thread Ryan A
Hey all,

Am looking to start working with a CMS for a large
site, after comparing quite a few CMSs Typo3 comes out
looking very very attractive in features and price.

Before I commit my time to using it I would like a
quick review from those of you who have used/use it,
as from the docs it says it has quite a steep learning
curve even for programmers (around a month, as stated
on typo3.org)

How hard was it for you to learn it?
How useful has it been to you?
Support when you hit a programming wall?
Would you recommend it for a first CMS to me?

Feel free to add any advise, notes, suggestions, links
etc

Thanks!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Re: CMS Typo 3 (Slightly 0T(?))

2006-06-15 Thread Barry

Ryan A schrieb:


How hard was it for you to learn it?

It's like a new language...

How useful has it been to you?
Very. Depends on what you. When you get into meodul coding you are very 
near to a extremly useable CMS system.

Support when you hit a programming wall?

The community is quite helpful.

Would you recommend it for a first CMS to me?


Well it's a very hard question.
Example question: learn Basic and get known of simple logic or start 
with C and OO programming.


Both ways have their pros and contras.

Have you ever coded a CMs so that you have slight basic knowledge of it?
That will be helpful.
Top3 is a very big Hammer when you start from scratch.
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] mysql + PHP

2006-06-15 Thread tedd
At 2:14 PM +0800 6/15/06, weetat wrote:
Hi all,

  I have SQL query , for example , Select country , name from tbl_chassis 
 order by country.

 The problem of the sql statement is that , if there are empty value in 
 country field , it be sorted first .

How to do sorting the empty value last
? I can cp() function to do this ? or any mysql function to use?

Thanks
- weetat


From mysql/null:

http://dev.mysql.com/doc/refman/5.0/en/working-with-null.html

If you want to have NULL values presented last when doing an ORDER BY, try 
this:

SELECT * FROM my_table ORDER BY ISNULL(field), field [ ASC | DESC ] 

You can also try other combinations, such as (I haven't tried it):

SELECT country , name FROM tbl_chassis ORDER BY country AND IS NOT NULL

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] readdir problem with white spaces

2006-06-15 Thread Francisco Morales
Hello, I the following problem with readdir 

 

When I read the directory, if the file has more than one white spaces,
readdir only return me 

the file with one space ...

 

so if I have on the file system . ROAD 1  005.JPG  or ROAD1
0005.JPG  php readdir 

return me ROAD 1 005.JPG!!

 

while ($file = readdir ($dirlist))

   {

   if ($file != '.'  $file != '..')

   {   echo FILE: $filebrbr;  - ROAD 1 005.JPG

}

 

-rw-rw-r--  1 seaquist edi  125352 jun 15 12:06 ROAD 1 001.JPG

-rw-rw-r--  1 seaquist edi  157365 jun 15 12:06 ROAD 1 002.JPG

-rw-rw-r--  1 seaquist edi  115891 jun 15 12:07 ROAD 1 004.JPG

-rw-rw-r--  1 seaquist edi  135876 jun 15 12:07 ROAD 1 005.JPG

-rw-rw-r--  1 seaquist edi  103983 jun 15 12:07 ROAD 2  003.JPG

-rw-rw-r--  1 seaquist edi   92410 jun 15 12:07 ROAD 2  006.JPG

-rw-rw-r--  1 seaquist edi   75342 jun 15 12:07 ROAD 3  002.JPG

 

How can I fix this?

 

Thanks a lot

 


Key fingerprint = A232 A22F AEF0 1988 6ACB  99AF A18F A220 BD2E 8CD8

 



Re: [PHP] progress monitor in php

2006-06-15 Thread tedd
At 5:48 PM +0800 6/15/06, weetat wrote:
Hi all ,

  I was using PEAR:HTTP_Upload to upload file in php 4.3.2.
  Is ok , however i need to display some sort of progress monitor to the user 
 because some file is very large and took some times to upload.
I need to inform the users to uploading is in progress.

I have search google ,and found megaupload , however the problem of megaupload 
is the filename is rubbish, i need the filename of uploaded file because the 
file is xml , need to convert data from xml to database.

Anybody have any ideas ? Or have any another php upload progress monitor ?

Thanks

- weetat

weetat:

Been there, tried that. Need js to do it and I haven't seen anything simple.

Instead, I put a wait spin-gif and hope that the file doesn't take too long.

Such as: http://xn--ovg.com/a4.php

Feel free to steal my gif -- I stole it fair and square myself.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] readdir problem with white spaces

2006-06-15 Thread Jay Blanchard
[snip]

When I read the directory, if the file has more than one white spaces,
readdir only return me 

the file with one space ...

 

so if I have on the file system . ROAD 1  005.JPG  or ROAD1
0005.JPG  php readdir 

return me ROAD 1 005.JPG!!
[/snip]


Additional white space is typically ignored in programming languages
that are built to deal with strings, but you may be able to count the
string length and/or use regex to make sure that the white space
remains.
 

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



[PHP] Re: readdir problem with white spaces

2006-06-15 Thread Barry

Francisco Morales schrieb:
Hello, I the following problem with readdir 

 


When I read the directory, if the file has more than one white spaces,
readdir only return me 


the file with one space ...

 


so if I have on the file system . ROAD 1  005.JPG  or ROAD1
0005.JPG  php readdir 


return me ROAD 1 005.JPG!!

 


while ($file = readdir ($dirlist))

   {

   if ($file != '.'  $file != '..')

   {   echo FILE: $filebrbr;  - ROAD 1 005.JPG

}

 


-rw-rw-r--  1 seaquist edi  125352 jun 15 12:06 ROAD 1 001.JPG

-rw-rw-r--  1 seaquist edi  157365 jun 15 12:06 ROAD 1 002.JPG

-rw-rw-r--  1 seaquist edi  115891 jun 15 12:07 ROAD 1 004.JPG

-rw-rw-r--  1 seaquist edi  135876 jun 15 12:07 ROAD 1 005.JPG

-rw-rw-r--  1 seaquist edi  103983 jun 15 12:07 ROAD 2  003.JPG

-rw-rw-r--  1 seaquist edi   92410 jun 15 12:07 ROAD 2  006.JPG

-rw-rw-r--  1 seaquist edi   75342 jun 15 12:07 ROAD 3  002.JPG

 


How can I fix this?

 


Thanks a lot

 



Key fingerprint = A232 A22F AEF0 1988 6ACB  99AF A18F A220 BD2E 8CD8

 




Replace whitespace with nbsp; and the output will be right.

The browser don't outputs every whitespace (which is good!).

This might handle it ;)

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] Re: File Download Headers

2006-06-15 Thread Chris Shiflett

Barry wrote:

You can send every header twice, triple. a zillion
times if you want.


Sure, but you have to know how to use header():

http://php.net/header

By default it will replace, but if you pass in FALSE as the second 
argument you can force multiple headers of the same type.


Regardless, I think Content-Disposition is the header you need, not 
Content-Type.


Hope that helps.

Chris

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



Re: [PHP] Re: File Download Headers

2006-06-15 Thread Barry

Chris Shiflett schrieb:

Barry wrote:

You can send every header twice, triple. a zillion
times if you want.


Sure, but you have to know how to use header():

http://php.net/header

By default it will replace, but if you pass in FALSE as the second 
argument you can force multiple headers of the same type.


Regardless, I think Content-Disposition is the header you need, not 
Content-Type.


Yes. My fault, forgot the false. Sorry for that ;)

Barry

--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread afan
I wonder why this sarcasm? Why so rude?

-afan


 [EMAIL PROTECTED] wrote:
 ?!?!?!?!?!?!

 I hope youi used str_repeat() to generate that.


 seriously though, have you tried it?

 that said your [probably] better off just doing 1 query:

 UPDATE members SET member_name = 'N/A' WHERE member_name = '';

 that said your [probably] better off leaving the name empty or setting
 it
 NULL if
 it's unknown and showing 'N/A' in whatever output screen it's relevant
 for
 any
 names that are found to be empty.

 Thanks

 -afan

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




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



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



Re: [PHP] CMS Typo 3 (Slightly 0T(?))

2006-06-15 Thread Nick Talbott
Hi Ryan

On Thursday 15 June 2006 12:48 pm, Ryan A wrote:
 Am looking to start working with a CMS for a large
 site, after comparing quite a few CMSs Typo3 comes out
 looking very very attractive in features and price.

 Before I commit my time to using it I would like a
 quick review from those of you who have used/use it,
 as from the docs it says it has quite a steep learning
 curve even for programmers (around a month, as stated
 on typo3.org)

 How hard was it for you to learn it?
 How useful has it been to you?
 Support when you hit a programming wall?
 Would you recommend it for a first CMS to me?

Here's a copy of something I put together a while ago in response to a similar 
request.

Typo3 is a hugely capable product and has been in production use here for over 
two years.  We have almost 100 contributing content editors within the 
council and the system currently hosts over 4000 pages of information across 
our Internet and intranet sites.  

Whether it will suit you will depend on a number of things...

1. Because Typo3 is an enterprise level CMS it offers a lot of options in 
how you set it up manage editing permissions what publishing rules you want 
to enforce what workflows you want to set up what special facilities you want 
to enable how you will do user authentication how translation is handled what 
meta-data will be collected and so on. The setup can even support different 
procedures for various parts of the organisation. If your site will have 
large numbers of contributing editors and needs a sophisticated management 
system in order to support your business rules for publishing then Typo3 is 
certainly up to the job. But if there will be just a few people maintaining 
the site (or maybe just yourself) then there are probably large parts of 
Typo3 that you won't need and you may view it as too complex a system for 
this reason.

2. Typo3 is also a software development platform. If you want to use your CMS 
partly as a framework for web applications that link to databases generate 
emails or any other form of online transaction then we find that developing 
plugins for Typo3 is a lot faster than traditional web development. The CMS 
takes care of all the presentation user authentication session management etc 
and allows the web developer to focus on just providing the basic 
functionality. Typo3 is written in PHP so to exploit this you need to have 
(or be able to employ) developers who are experienced in using PHP. But this 
functionality may also be irrelevant for you.

3. Like most CMS systems Typo3 requires you to design templates to define 
presentation. Templating in Typo3 is very sophisticated and has its own 
script language (typoscript). You can use different templates at different 
parts of the page tree and even add rules to fine-tune a base template for 
individual pages. But developing a template is not a trivial task 
particularly if you want to ensure full compliance with W3C standards and 
also in our case Government metadata standards. This is another case where 
Typo3 may either offer just the capabilities you need or may be complete 
overkill.

The people doing content editing generally aren't aware of any the above of 
course and once you have Typo3 set up the way you want then people providing 
content find it easy to use. We have put together our own one-day training 
course and we find that is all people need. Typo3 is popular with users.

We have almost ten years experience using open source applications and we 
support the Typo3 application in-house. However we did initially engage a 
Typo3 consultancy to get their views on how we planned to set the system up 
what hardware to use and so on (addressing those issues raised in point 1 
above). We also bought in some initial training from them to get our 
developers up to speed quickly. There are companies that can offer you a 
range of services including the complete setup of Typo3 to your requirements.

The online support from Typo3 users is also good. The documentation on the 
site is comprehensive and you will usually get a very quick and helpful 
response to asking questions on the Typo3 mail lists (providing you've read 
the FAQs first!).

I would have no hesitation about using an open source CMS providing you either 
have sufficient in-house technical resource to do day-to-day support or can 
set up a good relationship with a software company that can offer whatever 
additional support you think you need.

-- 
Nick Talbott
IT Policy and Planning Manager/Rheolwr Polisi a Chynllunio TGCh
Powys County Council, UK

web:   www.powys.gov.uk

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



Re: [PHP] Calculating difference between two days

2006-06-15 Thread afan
Thanks Ted. Very helpfull.

-afan



 On Wed, June 14, 2006 11:45 am, [EMAIL PROTECTED] wrote:
 I need to calculate no. of days between two dates, actually between
 date stored in DB and today's date.

 If you want to do this via mysql, see:

 http://dev.mysql.com/doc/refman/5.0/en/date-and-time-type-overview.html
 http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

 for php, you might review:

 http://www.weberdev.com/get_example-4354.html
 http://www.weberdev.com/get_example-3646.html
 http://www.weberdev.com/get_example-4330.html

 tedd


 --
 
 http://sperling.com  http://ancientstones.com  http://earthstones.com


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



[PHP] basic php problem

2006-06-15 Thread Ross

I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body $page is 0

Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?


I also get an undefined index notice

Notice: Undefined index: page in 
c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8
page is 1

but I though if I do a if(!isset($_REQUEST['page'])) this is the way to set 
a previously undefined index?

Ross

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread tedd
At 1:14 AM -0700 6/15/06, BBC wrote:
Thank Mr.tedd(I guess you are a man)
I think you should check one of my site http://aztec-indianart.com
while you're surfing this site actually you are visiting one page only with
different variable (see url).
I used many data in html, php, inc, txt, css, js and MySQL off course. then
I include them in one page depends on the variable
please give me your opinion about what I did (you know I just learned PHP, 
like I said before)
sorry for my English (I'm Indonesian)

personal stuff
Just tedd will do. The Mr. was for my past life.

The last time I looked, I was male.

Sorry for my English too (I'm Ozarkian).
/personal stuff

off-topic -- this isn't a site review list

In any event, your site doesn't look bad, but it needs work.

!DOCTYPE should be the first statement with everything following in it's 
proper place.

You should also pass the --

http://validator.w3.org/

-- test.

You can see how it looks on different browsers here:

http://www.browsercam.com/public.aspx?proj_id=260813

As I said, it doesn't look bad -- seems to work on most browsers.

Also, consider this:

http://www.websiteoptimization.com/services/analyze/

and this:

http://webxact2.watchfire.com

and this:

http://www.dnsreport.com/tools/dnsreport.ch?domain=http%3A%2F%2Faztec-indianart.com

When you pass those test, things will be better.

I can't see any php code, but it looks like you're pulling things from the dB 
and putting them on the page good. Don't know what else to say.
/off-topic

hth's

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] basic php problem

2006-06-15 Thread nicolas figaro

Ross a écrit :

I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body $page is 0

Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?


I also get an undefined index notice

Notice: Undefined index: page in 
c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8

page is 1

but I though if I do a if(!isset($_REQUEST['page'])) this is the way to set 
a previously undefined index?


  

you have to check if page exists in $_REQUEST

if (!array_key_exists($_REQUEST,page))
{ $page = 1;
}

why do you wish to add something that's not set to a constant value ?

$page =$_REQUEST['page'] + 1;


NF

Ross

  


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



Re: [PHP] progress monitor in php

2006-06-15 Thread weetat

hi ,

  That gd. However i did not see any upload progress monitor at all.

Anybody have any ideas how to implement it?

Thanks

tedd wrote:

At 5:48 PM +0800 6/15/06, weetat wrote:


Hi all ,

I was using PEAR:HTTP_Upload to upload file in php 4.3.2.
Is ok , however i need to display some sort of progress monitor to the user 
because some file is very large and took some times to upload.
I need to inform the users to uploading is in progress.

I have search google ,and found megaupload , however the problem of megaupload 
is the filename is rubbish, i need the filename of uploaded file because the 
file is xml , need to convert data from xml to database.

Anybody have any ideas ? Or have any another php upload progress monitor ?

Thanks

- weetat



weetat:

Been there, tried that. Need js to do it and I haven't seen anything simple.

Instead, I put a wait spin-gif and hope that the file doesn't take too long.

Such as: http://xn--ovg.com/a4.php

Feel free to steal my gif -- I stole it fair and square myself.

tedd


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



Re: [PHP] basic php problem

2006-06-15 Thread nicolas figaro

nicolas figaro a écrit :

Ross a écrit :

I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body 
$page is 0


Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?



2nd try (did I miss the question at first try ?)
$page is local to your curly brackets if it's not used upper in your code.
try to put $page = 0;  before the if statement.

N F

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



Re: [PHP] basic php problem

2006-06-15 Thread Dave Goodchild

On 15/06/06, Ross [EMAIL PROTECTED] wrote:



I want to set a page number of a page

if(!isset($_REQUEST['page'])) {
$page =$_REQUEST['page'] + 1;
echo page is .$page; // this echos out page is 1


}


The problem is when I try and use $page further down in the body $page is
0

Question ?=$page; ? BR /
? echo page is.$page; ?
?=$question[($page-1)]; ?


I also get an undefined index notice

Notice: Undefined index: page in
c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8
page is 1

but I though if I do a if(!isset($_REQUEST['page'])) this is the way to
set
a previously undefined index?

Ross


Firstly, there is no need to set the page by adding 1 to $_REQUEST['page']

if $_REQUEST['page'] is not set, why not do this:

$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;

(ternary operator)






--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk


Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread afan
Jochem,
You are wrong. I tried and it worked. But, when I asked can I, I meant
Am I allowed to do that. The same as many security or other kind
questions where answer is: Yes, it works - but it's NOT correct.

Yes, I did search php.net but didn't find answer.
Yes, I did search mysql.com but didn't find answer.
(Hm, maybe I had to spend few more days before I'm ALLOWED to post a
question here)

And, please, if you DON'T WANT to help - don't answer at all. Believe me,
your kind of answer REALLY do not help. Contrary, brings this kind of
conversation what this great group really doesn't need.

Thanks.

-afan




 [EMAIL PROTECTED] wrote:
 I wonder why this sarcasm? Why so rude?

 your original question could have been answered by:

 a, trying to run the code provided (thats called testing btw)
 b, reading php.net
 c, reading mysql.com/docs (or where ever they have the docs this week)

 my reply not only contained the blantantly silly suggestion that you
 had to reboot the machine but also seriously asked if you had tried to run
 the code (I can garantee that you had not because then you would have know
 that it did work with out posting here) AND I offered 2 suugestions as to
 why the strategy you were employing for the routine sucked - one
 performance
 related, one with regard to DB/data theory.

 and all you could come up with as a response was '?!?!?!?!?!?!'

 you want spoonfeeding, try kindergarten.


 -afan


 [EMAIL PROTECTED] wrote:
 ?!?!?!?!?!?!
 I hope youi used str_repeat() to generate that.

 seriously though, have you tried it?

 that said your [probably] better off just doing 1 query:

   UPDATE members SET member_name = 'N/A' WHERE member_name = '';

 that said your [probably] better off leaving the name empty or
 setting
 it
 NULL if
 it's unknown and showing 'N/A' in whatever output screen it's
 relevant
 for
 any
 names that are found to be empty.

 Thanks

 -afan

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


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






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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 You are wrong. 

there's a first for everything, heh.

 I tried and it worked. But, when I asked can I, I meant
 Am I allowed to do that. The same as many security or other kind

then say what you mean in future. you already knew that you *can* do it,
you should have asked 'is this wise' - which would have led to a different
response namely:

in general nothing wrong with it, in your particular case it seems INEFFICIENT.

 questions where answer is: Yes, it works - but it's NOT correct.

there is nothing technically incorrect about perform a query whilst
looping the results of a different query btw.

 
 Yes, I did search php.net but didn't find answer.
 Yes, I did search mysql.com but didn't find answer.
 (Hm, maybe I had to spend few more days before I'm ALLOWED to post a
 question here)

your allowed to post whenever you want.

 And, please, if you DON'T WANT to help - don't answer at all. Believe me,
 your kind of answer REALLY do not help. Contrary, brings this kind of
 conversation what this great group really doesn't need.

REALLY I don't care what you think. you control what you post I control what I
post and not vice versa.

 
 Thanks.

for bruising your ego? or for originally giving 2 suggestions as to better
strategies for doing what you *seemed* to be wanting to achieve - 2 suggestions
which you blatantly seemed to ignore in favor of moaning about your bruised ego.

en fin.

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
 I wonder why this sarcasm? Why so rude?

your original question could have been answered by:

a, trying to run the code provided (thats called testing btw)
b, reading php.net
c, reading mysql.com/docs (or where ever they have the docs this week)

my reply not only contained the blantantly silly suggestion that you
had to reboot the machine but also seriously asked if you had tried to run
the code (I can garantee that you had not because then you would have know
that it did work with out posting here) AND I offered 2 suugestions as to
why the strategy you were employing for the routine sucked - one performance
related, one with regard to DB/data theory.

and all you could come up with as a response was '?!?!?!?!?!?!'

you want spoonfeeding, try kindergarten.

 
 -afan
 
 
 [EMAIL PROTECTED] wrote:
 ?!?!?!?!?!?!
 I hope youi used str_repeat() to generate that.

 seriously though, have you tried it?

 that said your [probably] better off just doing 1 query:

UPDATE members SET member_name = 'N/A' WHERE member_name = '';

 that said your [probably] better off leaving the name empty or setting
 it
 NULL if
 it's unknown and showing 'N/A' in whatever output screen it's relevant
 for
 any
 names that are found to be empty.

 Thanks

 -afan

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


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


 

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



Re: [PHP] Re: CMS Typo 3 (Slightly 0T(?))

2006-06-15 Thread Ryan A
Hey!

@Barry, Thanks for the info.
To answer your Q: nope, never coded a CMS but have a
rough (very rough) idea on how it works, I have been
coding for years from C-Java-PHP

 Top3 is a very big Hammer when you start from
 scratch.

Thats what i wanted to know...

@Nick T, Thanks for the huge amount of info, my needs
are basically for point two of what you wrote ( 2.
Typo3 is also a software development platform. )
I can and do program with PHP although my skills with
RegEx and OO still leaves a lot to be desired :o), but
when i do hit a wall the expirts on this list like Jay
and Chris (_just_ two names off the top of my head)
usually point me in the right direction.
Although I didnt mention it in my original post, I was
very curious as to the skill needed to use the typo3
templating part, your post cleared that up too.


Thanks again guys,
-Ryan

--- Barry [EMAIL PROTECTED] wrote:

 Ryan A schrieb:
 
  How hard was it for you to learn it?
 It's like a new language...
  How useful has it been to you?
 Very. Depends on what you. When you get into meodul
 coding you are very 
 near to a extremly useable CMS system.
  Support when you hit a programming wall?
 The community is quite helpful.
  Would you recommend it for a first CMS to me?
 
 Well it's a very hard question.
 Example question: learn Basic and get known of
 simple logic or start 
 with C and OO programming.
 
 Both ways have their pros and contras.
 
 Have you ever coded a CMs so that you have slight
 basic knowledge of it?
 That will be helpful.
 Top3 is a very big Hammer when you start from
 scratch.
 -- 
 Smileys rule (cX.x)C --o(^_^o)
 Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



[PHP] Re: serving video files with php

2006-06-15 Thread Adam Zey

Andras Kende wrote:

Hello,

 


Is there any drawback servings video files through php downloader script on
high load site?

 


Or just straight link to the videos are more efficient?

 

 


Thank you,

 


Andras Kende

http://www.kende.com

 





Yes, there is. The PHP downloader script will have to stay resident in 
memory for the entire duration of the download, plus it's going to take 
up more CPU power than apache's own functionality (even if only 
marginally). If you intend to have multiple simultaneous downloads for 
this, it's going to be a rather large resource drain compared to just 
letting Apache handle the download itself.


Regards, Adam Zey.

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread tedd
At 4:11 PM +0200 6/15/06, [EMAIL PROTECTED] wrote:
Jochem,
You are wrong. I tried and it worked. But, when I asked can I, I meant
Am I allowed to do that. The same as many security or other kind
questions where answer is: Yes, it works - but it's NOT correct.

Yes, I did search php.net but didn't find answer.
Yes, I did search mysql.com but didn't find answer.
(Hm, maybe I had to spend few more days before I'm ALLOWED to post a
question here)

And, please, if you DON'T WANT to help - don't answer at all. Believe me,
your kind of answer REALLY do not help. Contrary, brings this kind of
conversation what this great group really doesn't need.

Thanks.

-afan

-afan:

You should keep this in mind while posting.

People, like Jochem, are here to help you with no reward except that they are 
helping others. They spend their time reading your post and trying to provide 
you with guidance from their experience.

I can't speak for Jochem, but sometimes what we post doesn't come across as 
well as we intended. I know I've pissed-off some people on this list and I 
regret that, even though it was unintentional.

So, try to give those who try to help you a bit slack. Permit them the right to 
tell you to RTFM or whatever else they think will help you. Granted, sometimes 
we don't want to hear what our problem is, but that's what happens when you 
post to a list asking for help.

So, cut us all a bit of slack and we'll all be better for it.

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] can I do this: update table while selecting data from table?

2006-06-15 Thread afan
Yes, you are right, I had to be more carefull about how to write my post.

 Thanks.

 for bruising your ego? or for originally giving 2 suggestions as to better
 strategies for doing what you *seemed* to be wanting to achieve - 2
 suggestions
 which you blatantly seemed to ignore in favor of moaning about your
 bruised ego.

Since you didn't get it, Thanks is part of polite communication between
people.

-afan



 [EMAIL PROTECTED] wrote:
 You are wrong.

 there's a first for everything, heh.

 I tried and it worked. But, when I asked can I, I meant
 Am I allowed to do that. The same as many security or other kind

 then say what you mean in future. you already knew that you *can* do it,
 you should have asked 'is this wise' - which would have led to a different
 response namely:

 in general nothing wrong with it, in your particular case it seems
 INEFFICIENT.

 questions where answer is: Yes, it works - but it's NOT correct.

 there is nothing technically incorrect about perform a query whilst
 looping the results of a different query btw.


 Yes, I did search php.net but didn't find answer.
 Yes, I did search mysql.com but didn't find answer.
 (Hm, maybe I had to spend few more days before I'm ALLOWED to post a
 question here)

 your allowed to post whenever you want.

 And, please, if you DON'T WANT to help - don't answer at all. Believe
 me,
 your kind of answer REALLY do not help. Contrary, brings this kind of
 conversation what this great group really doesn't need.

 REALLY I don't care what you think. you control what you post I control
 what I
 post and not vice versa.


 Thanks.

 for bruising your ego? or for originally giving 2 suggestions as to better
 strategies for doing what you *seemed* to be wanting to achieve - 2
 suggestions
 which you blatantly seemed to ignore in favor of moaning about your
 bruised ego.

 en fin.

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



Re: [PHP] Simple class declaration returns error

2006-06-15 Thread Eric Butera

On 6/14/06, Dave M G [EMAIL PROTECTED] wrote:

I put in a very simple echo statement, just as a place marker
before I put in the real code, and just to make sure that the index.php
file is successfully including the class.


After you fix your parse errors you might take a look at:
http://us2.php.net/require
http://us2.php.net/class_exists

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



[PHP] Accepting File Uploads from CURL

2006-06-15 Thread Brad Bonkoski

Hello All,
I am using PERL to generate an XML file from a database query.  no 
problems there.

I then try to use curl to send it to an upload script.
Essentially the command line looks like this: curl -H 
'Content-Type:text/xml' -d file.xml server/up.php
for my up.php I am just trying to dump stuff out, like the POST and 
FILES arrays

Both those arrays are empty.

Any thoughts on how to debug this, and/or suggestions for handling this?
TIA.
-Brad

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



Re: [PHP] Accepting File Uploads from CURL

2006-06-15 Thread Rabin Vincent

On 6/15/06, Brad Bonkoski [EMAIL PROTECTED] wrote:

Hello All,
I am using PERL to generate an XML file from a database query.  no
problems there.
I then try to use curl to send it to an upload script.
Essentially the command line looks like this: curl -H
'Content-Type:text/xml' -d file.xml server/up.php
for my up.php I am just trying to dump stuff out, like the POST and
FILES arrays
Both those arrays are empty.

Any thoughts on how to debug this, and/or suggestions for handling this?


You're using the wrong cURL arguments. You need the -F argument.
Read the cURL docs. There's also a curl mailing list whose archives you
should search.

Rabin

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



Re: [PHP] File Download Headers

2006-06-15 Thread Jon Anderson

Richard Lynch wrote:

Can any experts on this list explain to me why, despite the 1,000,000
places that application/octet-stream is documented to work, and has
always worked, since Mosaic 1.0 days, people manage to find these
goofball Content-type: headers that are supposed to work, but only
work in a handful of browsers, and then they write tutorials as if
it's the Right Way, and then those tutorials get past alleged Editors,
and are all you can find from Google?

Anybody?
Well, I can't vouch for any goofballs, their editors, nor google, but 
unfortunately sometimes an alternative to application/octet-stream has 
to be used to work around brokenness in certain versions of IE...We used 
octet-stream, and had a small portion of users complaining because they 
couldn't open the file that was downloaded - I can't open 
download.php, hence the workaround.


- We can't use download.php?/filename.ext - (long story, but suffice it 
to say that it can't be done for non-technical reasons.)
- IE doesn't take the Content-Disposition in some cases unless you use a 
different content-type.


Our code basically does this:

if (IE) {
   use wrong content type;
   if (IE 5.5) {
  use broken content disposition;
   } else {
  use normal content disposition;
   }
} else {
   do things in a standard way;
}

jon

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



[PHP] Replacing text with criteria

2006-06-15 Thread Jeff Lewis
I have been working on a script to parse a CSV file and in the process I
clean out a lot of the garbage not needed but I am a bit stumped on one
aspect of this file. It's a list of over 3000 contacts and I'm trying to
mask a lot of the information with *.
 
So as I loop through this list I am checking the array elements as if I find
a phone number (555) 555-1212 (I was searching for the (555)) I want to
convert it to (555) ***-
 
For fields not containing an area code, I wanted any text to be replaced by
an * except for the first and last letter in the element.
 
I'm stumped and was hoping that this may be something horribly simple I'm
overlooking that someone can point out for me.


Re: [PHP] progress monitor in php

2006-06-15 Thread Martin Alterisio

2006/6/15, weetat [EMAIL PROTECTED]:


Hi all ,

   I was using PEAR:HTTP_Upload to upload file in php 4.3.2.
   Is ok , however i need to display some sort of progress monitor to
the user because some file is very large and took some times to upload.
I need to inform the users to uploading is in progress.

I have search google ,and found megaupload , however the problem of
megaupload is the filename is rubbish, i need the filename of uploaded
file because the file is xml , need to convert data from xml to database.

Anybody have any ideas ? Or have any another php upload progress monitor ?

Thanks

- weetat

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



Maybe this will help:
http://uber-uploader.sourceforge.net/


Re: [PHP] basic php problem

2006-06-15 Thread D. Dante Lorenso

Dave Goodchild wrote:

if $_REQUEST['page'] is not set, why not do this:
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
(ternary operator)


// test, numeric read, with default and bounds checking
$page = empty($_REQUEST['page']) ? 1 : intval($_REQUEST['page']);
$page = min(max($page, 1), $MAX_PAGE);

Dante

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread Robert Cummings
On Thu, 2006-06-15 at 03:16, Larry Garfield wrote:

 Another recommendation: Do not, under any circumstances, try to write your 
 own 
 template engine.  All you'll be doing is writing a syntax parser in PHP for 
 another syntax that will give you fewer options, less flexibility, and worse 
 performance than well-used native PHP.
 
 There ARE good PHP based template engines out there (Smarty, Flexy, PHPTal, 
 etc.), written by people much smarter than you or I and field tested by 
 thousands of people on more sites than you've ever used.  If you want to use 
 a non-PHP-syntax for your template files, find one.  Don't write it.  You 
 will thank yourself later.

While I understand where you're coming from with this, I think it
depends on your goals. The smart or as I prefer experienced people
out there that have written complex systems have done so by getting
their feet wet and trying. If you have an idea, the inclination, and the
time then I think it's a great idea to rebuild the wheel. How else would
better wheels come about? :)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] paging results in large resultsets: mysql vs postgresql?

2006-06-15 Thread D. Dante Lorenso

All,

I just discovered this neat little gem in MySQL which makes it easy to 
page large result sets:


   * SELECT SQL_CALC_FOUND_ROWS *
 FROM table
 LIMIT 10, 10

   * SELECT FOUND_ROWS()

The neat thing is that SQL_CALC_FOUND_ROWS will cause MySQL to tally up 
all the rows that WOULD have matched your query if you hadn't used the 
LIMIT and OFFSET clause to shorten your returned results.  The next call 
to FOUND_ROWS() will return that tally. 

When developing paged list/search results this is VERY powerful 
shorthand for generating the prev/next links and figuring out how many 
pages to display.


I can't seem to find the equivalent of it in PostgreSQL!  The only 
options I see are:


  1.

 TWO queries.  The first query will perform a SELECT COUNT(*) ...; and the 
second query performs the actualy SELECT ... LIMIT x OFFSET y;


  2.

 Using PHP row seek and only selecting the number of rows I need.

Here is an example of method number 2 in PHP:

?php
//--
function query_assoc_paged ($sql, $limit=0, $offset=0) {
   $this-num_rows = false;

   // open a result set for this query...
   $result = $this-query($sql);
   if (! $result) return (false);

   // save the number of rows we are working with
   $this-num_rows = @pg_num_rows($result);

   // moves the internal row pointer of the result to point to our
   // desired offset. The next call to pg_fetch_assoc() would return
   // that row.
   if (! empty($offset)) {
   if (! @pg_result_seek($result, $offset)) {
   return (array());
   }
   }

   // gather the results together in an array of arrays...
   $data = array();
   while (($row = pg_fetch_assoc($result)) !== false) {
   $data[] = $row;

   // After reading N rows from this result set, free our memory

   // and return the rows we fetched...
   if (! empty($limit)  count($data) = $limit) {
   pg_free_result($result);
   return ($data);
   }
   }

   pg_free_result($result);
   return($data);
}

//--

?

The next problem I have is that in the migration to PDO, there is no 
'pg_result_seek' function equivalent.  So, I guess that means that in 
the PDO model, there is no option #2.  Does that mean my only 
alternative is to run option #1 in PostgreSQL?


I hate having to write 2 queries to get one set of data ... especially 
when those queries start getting complex.


Dante

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



[PHP] How to run one php app from another?

2006-06-15 Thread tedd
Hi gang:

This seems like so obvious a question, I am reluctant to ask.

In any event, I simply want my php application to run another, like so:

switch (option)
   {
   case a:
   run a.php;
   exit;
   break;

   case b:
   run b.php;
   exit;
   break;

   case c:
   run c.php;
   exit;
   break;
  }

I know that from within an application I can run another php application via a 
user click (.e., button), or from javascript event (onclick), or even from 
cron. But, what if you want to run another application from the results of a 
calculation inside your main application without a user trigger. How do you 
do that?

I have tried header(Location: http://www.example.com/;); ob_start(), 
ob_flush() and such, but I can't get anything to work.

Is there a way?

Thanks.

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: How to run one php app from another?

2006-06-15 Thread Adam Zey

tedd wrote:

Hi gang:

This seems like so obvious a question, I am reluctant to ask.

In any event, I simply want my php application to run another, like so:

switch (option)
   {
   case a:
   run a.php;
   exit;
   break;

   case b:
   run b.php;
   exit;
   break;

   case c:
   run c.php;
   exit;
   break;
  }

I know that from within an application I can run another php application via a user click 
(.e., button), or from javascript event (onclick), or even from cron. But, what if you 
want to run another application from the results of a calculation inside your main 
application without a user trigger. How do you do that?

I have tried header(Location: http://www.example.com/;); ob_start(), 
ob_flush() and such, but I can't get anything to work.

Is there a way?

Thanks.

tedd


See the documentation for include(), include_once(), require(), and 
require_once().


Regards, Adam Zey.

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



[PHP] Re: Replacing text with criteria

2006-06-15 Thread Adam Zey

Jeff Lewis wrote:

I have been working on a script to parse a CSV file and in the process I
clean out a lot of the garbage not needed but I am a bit stumped on one
aspect of this file. It's a list of over 3000 contacts and I'm trying to
mask a lot of the information with *.
 
So as I loop through this list I am checking the array elements as if I find

a phone number (555) 555-1212 (I was searching for the (555)) I want to
convert it to (555) ***-
 
For fields not containing an area code, I wanted any text to be replaced by

an * except for the first and last letter in the element.
 
I'm stumped and was hoping that this may be something horribly simple I'm

overlooking that someone can point out for me.



This will take a string and replace everything but the first and last 
characters.


$string = substr_replace($string, str_repeat(*, strlen($string)-2), 1, 
-1);


It seems like you want to do it based on letters though, so Hello, 
World! would become H**d!, not H***! (which the 
above would do). To do this you'll need to get the positions of the 
first and last letters in the string and use those instead of 1 and -1. 
Off the top of my head I don't recall any functions that can do this, 
strpos and strrpos don't take arrays as parameters. You may be better 
off with regular expressions for the actual replacement unless somebody 
knows of a function to get the positions.


BTW, in functions like substr, specifying -1 for length means keep 
going until the second to last character.


Regards, Adam.

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



Re: [PHP] paging results in large resultsets: mysql vs postgresql?

2006-06-15 Thread tedd
At 11:11 AM -0500 6/15/06, D. Dante Lorenso wrote:
I can't seem to find the equivalent of it in PostgreSQL!  The only options I 
see are:

  1.

 TWO queries.  The first query will perform a SELECT COUNT(*) ...; and the 
 second query performs the actualy SELECT ... LIMIT x OFFSET y;

-snip-

I hate having to write 2 queries to get one set of data ... especially when 
those queries start getting complex.

I do exactly number 1 in http://ancientstones.com/catalog.php

Keep in mind that the first query will tell you how many record are in that 
specific sort and then the second will present just those items. You have to 
work out the pageNumber, maxPageNumber, and numberOfPages and then it's simple.

If you're concerned about the complexity of the query, then it makes sense to 
break it down to simpler steps.

You should see the back-end of my site where if you are give a specific item, 
then where do you place it in a page given the user's search criteria. It made 
for an interesting exorcise.

tedd

-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Micky Hulse

Dave Goodchild wrote:
Use WordPress - clean, css-based, standards-compliant. You can set up a 
basic site very quickly. If you want me to walk you through an example 
contact me off list ( [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED]). I set up two installations, 
www.abuddhistpodcast.com http://www.abuddhistpodcast.com and 
www.mediamasters.co.uk/dg/insp http://www.mediamasters.co.uk/dg/insp, 
in less than a day.


Right on!  :)

Thanks for the suggestion, and I really appreciate your offer of help - 
Hopefully I will be able to get things up-and-running without any need 
to bother anyone with noobie questions. Hehe...


Sounds like the right direction to head. Many thanks Dave.

Cheers,
Micky

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



Re: [PHP] Re: Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Micky Hulse

Barry wrote:
Well if you have that often this case, i would prefer you code one for 
yourself.


Oh, for sure. I completely agree... For the longest time (i.e. the 
college years) I was against using other peoples blog software or 
scripts... I would have never learned anything about PHP if it was not 
for my choice to take the long route(s) and program what I could myself. 
Hehe, does that make sense? Lol.


Now-a-days (i.e. the starving freelance multimedia designer years), when 
I am pressed for time, I have no other choice than to bite the bullet 
and install something like (for example) Expression Engine.


Not sure where I am going with this. Lol, thanks for the response 
though, I really appreciate the motivation.


Cheers,
Micky

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



Re: [PHP] Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Micky Hulse

Dave Goodchild wrote:
www.abuddhistpodcast.com http://www.abuddhistpodcast.com and 
www.mediamasters.co.uk/dg/insp http://www.mediamasters.co.uk/dg/insp


Cool sites btw! Good work.  :)

Cheers,
M

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



Re: [PHP] paging results in large resultsets: mysql vs postgresql?

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 11:11 am, D. Dante Lorenso wrote:
 I just discovered this neat little gem in MySQL which makes it easy to
 page large result sets:

 * SELECT SQL_CALC_FOUND_ROWS *

 * SELECT FOUND_ROWS()


 I can't seem to find the equivalent of it in PostgreSQL!  The only
 options I see are:

2.

   Using PHP row seek and only selecting the number of rows I need.

3. use the built-in cursor of PostgreSQL which pre-dates MySQL
LIMIT and OFFSET clauses, which are non-standard hacks Rasmus
introduced back in the day.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] How to run one php app from another?

2006-06-15 Thread Richard Lynch


Just include 'a.php'; and it will get done.

On Thu, June 15, 2006 11:11 am, tedd wrote:
 Hi gang:

 This seems like so obvious a question, I am reluctant to ask.

 In any event, I simply want my php application to run another, like
 so:

 switch (option)
{
case a:
run a.php;
exit;
break;

case b:
run b.php;
exit;
break;

case c:
run c.php;
exit;
break;
   }

 I know that from within an application I can run another php
 application via a user click (.e., button), or from javascript event
 (onclick), or even from cron. But, what if you want to run another
 application from the results of a calculation inside your main
 application without a user trigger. How do you do that?

 I have tried header(Location: http://www.example.com/;); ob_start(),
 ob_flush() and such, but I can't get anything to work.

 Is there a way?

 Thanks.

 tedd
 --
 
 http://sperling.com  http://ancientstones.com  http://earthstones.com

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




-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Anthony Ettinger

echo $_GET['comment']  htdocs/comments.html


:)



On 6/15/06, Micky Hulse [EMAIL PROTECTED] wrote:

Dave Goodchild wrote:
 www.abuddhistpodcast.com http://www.abuddhistpodcast.com and
 www.mediamasters.co.uk/dg/insp http://www.mediamasters.co.uk/dg/insp

Cool sites btw! Good work.  :)

Cheers,
M

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





--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] basic php problem

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 8:11 am, Ross wrote:

 I want to set a page number of a page

 if(!isset($_REQUEST['page'])) {
 $page =$_REQUEST['page'] + 1;

These two together make no sense at all...

If the $_REQUEST['page'] is NOT set, then why use it?  It's NOT THERE.

 echo page is .$page; // this echos out page is 1
 }

Here is a more sensible approach:

//use page requested, or default to page 1:
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;

You can write that as a 6-line if statement if you like:

if (isset($_REQUEST['page']){
  $page = $_REQUEST['page'];
}
else{
  $page = 1;
}

 The problem is when I try and use $page further down in the body $page
 is 0

In that case, you are on ?page=2 in your script, and you didn't do
ANYTHING about $page in the original version.

 Question ?=$page; ? BR /
 ? echo page is.$page; ?
 ?=$question[($page-1)]; ?


 I also get an undefined index notice

 Notice: Undefined index: page in
 c:\Inetpub\wwwroot\lss\module_one\evaluation.php on line 8
 page is 1

 but I though if I do a if(!isset($_REQUEST['page'])) this is the way
 to set
 a previously undefined index?

No.

isset() CHECKS if a variable/index is set.  It does not alter anything
at all.  It just tests.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Using PHP/HTML effectivly

2006-06-15 Thread Jochem Maas
Robert Cummings wrote:
 On Thu, 2006-06-15 at 03:16, Larry Garfield wrote:
 Another recommendation: Do not, under any circumstances, try to write your 
 own 
 template engine.  All you'll be doing is writing a syntax parser in PHP for 
 another syntax that will give you fewer options, less flexibility, and worse 
 performance than well-used native PHP.

 There ARE good PHP based template engines out there (Smarty, Flexy, PHPTal, 
 etc.), written by people much smarter than you or I and field tested by 
 thousands of people on more sites than you've ever used.  If you want to use 
 a non-PHP-syntax for your template files, find one.  Don't write it.  You 
 will thank yourself later.
 
 While I understand where you're coming from with this, I think it
 depends on your goals. The smart or as I prefer experienced people
 out there that have written complex systems have done so by getting
 their feet wet and trying. If you have an idea, the inclination, and the
 time then I think it's a great idea to rebuild the wheel. How else would
 better wheels come about? :)

good question - my wheels always turn out lumpy ;-)

 
 Cheers,
 Rob.

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



Re: [PHP] generating/transforming HTML so that it 'works' in a flash file

2006-06-15 Thread Jochem Maas
Richard Lynch wrote:
 
 I suspect the first question would be if Flash people have bothered to
 document what HTML subset they support.

they do, to a point (although trying to figure out what is supported across
all version is painful) and reading what they do apparently support made me
cry.

 
 And second is, wouldn't you have a lot more luck in a Flash forum?...

probably, I was kind of hoping that someone had made written something in php
already - figured I possibly wasn't the first to swim these waters.

that said the 'solution' I'm toying with currently is a slightly extended 
version
of the following :-) ...

$flashHTML = strip_tags($myHTML);

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



Re: [PHP] A tricky little problem

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 4:30 am, Ross wrote:
 I have a multiple choice quiz where the questions  answers are
 extracted
 from an external file

 $q1 = what is the capital of Scotland ; $a1 = Edinburgh; $b1
 =Glasgow;
 $c1 =dundee; $d1 =Stirling; $q1_answer = $a1;
 $q2 = what is the capital of France; $a2 = Lyon; $b2 =Paris; $c2
 =Carcassonne; $d2 =Madrid; $q2_answer = $b1;

 ?

 These are fed into a page which displays the questions and displays a
 radio
 button to select the answer, the page is incremnted when a correct
 answer is
 given

 if  ($_POST['x']== $q1_answer) {
 $incrementedPage = $page + 1;
 header(Location: evaluation.php?page=$incrementedPage);
 }

 but how can I insert and compare the next question?

$q = ${'q'.$_GET['page']};
echo $q;

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] Re: Simple blog software... Simple but clean code... suggestions?

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 2:17 pm, Micky Hulse wrote:
 Barry wrote:
 Well if you have that often this case, i would prefer you code one
 for
 yourself.

 Oh, for sure. I completely agree... For the longest time (i.e. the
 college years) I was against using other peoples blog software or
 scripts... I would have never learned anything about PHP if it was not
 for my choice to take the long route(s) and program what I could
 myself.
 Hehe, does that make sense? Lol.

 Now-a-days (i.e. the starving freelance multimedia designer years),
 when
 I am pressed for time, I have no other choice than to bite the bullet
 and install something like (for example) Expression Engine.

 Not sure where I am going with this. Lol, thanks for the response
 though, I really appreciate the motivation.

Anybody who writes a decent blog system that everybody can use is then
flooded with a zillion Feature Requests and, ultimately, you end up
with Bloated Blog.

I do not forsee this problem going away.

Ditto for forums and shopping carts.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] serving video files with php

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 3:04 am, Andras Kende wrote:
 Is there any drawback servings video files through php downloader
 script on
 high load site?

 Or just straight link to the videos are more efficient?

TAANSTAAFL

There certainly IS some overhead using PHP downloader script, and a
straight link IS definitely more efficient.

The correct question is HOW MUCH more efficient

The correct answer is You'll only know after you test on YOUR machine

Note that the bandwidth is probably gonna kill you long before PHP
does, if you write a lean mean PHP application...

If your PHP download script has to include 4,000 class files before it
can do anything useful, well, no, it won't be fast.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] progress monitor in php

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 4:48 am, weetat wrote:
I was using PEAR:HTTP_Upload to upload file in php 4.3.2.
Is ok , however i need to display some sort of progress monitor to
 the user because some file is very large and took some times to
 upload.
 I need to inform the users to uploading is in progress.

 I have search google ,and found megaupload , however the problem of
 megaupload is the filename is rubbish, i need the filename of uploaded
 file because the file is xml , need to convert data from xml to
 database.

 Anybody have any ideas ? Or have any another php upload progress
 monitor ?

[soapbox]

Can I respectfully suggest you just take php *OUT* of the equation?

You're talking about something on the CLIENT that needs to indicate
number of bytes SENT by the client out of total number of bytes the
client needs to SEND.

All the information involved is client-side.

Trying to hook PHP, on the server, into this is just plain daft.

Go bug the FireFox guys to give you callback hooks into the upload
process, or submit a patch to them.

Getting PHP involved in this equation makes zero sense -- You'd only
be generating a TON of HTTP traffic for PHP to tell the browser what
the browser already KNOWS.

[/soapbox]

PS
Or you could just train your users to actually look at the progress
meter in those browsers that already have one... :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] paging results in large resultsets: mysql vs postgresql?

2006-06-15 Thread D. Dante Lorenso

Richard Lynch wrote:

3. use the built-in cursor of PostgreSQL which pre-dates MySQL
LIMIT and OFFSET clauses, which are non-standard hacks Rasmus
introduced back in the day.


Care to elaborate?  Cast into context of PDO if you can...?

Dante

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



[PHP] Re: Replacing text with criteria

2006-06-15 Thread Rafael

Try with
  preg_replace('/\d(?!(?\d*)\))/X', '*', $phone)
wich would be a bit more efficient than
  preg_replace('/\d(?!\d*\))/X', '*', $phone)

Jeff Lewis wrote:

I have been working on a script to parse a CSV file and in the process I
clean out a lot of the garbage not needed but I am a bit stumped on one
aspect of this file. It's a list of over 3000 contacts and I'm trying to
mask a lot of the information with *.
 
So as I loop through this list I am checking the array elements as if I find

a phone number (555) 555-1212 (I was searching for the (555)) I want to
convert it to (555) ***-
 
For fields not containing an area code, I wanted any text to be replaced by

an * except for the first and last letter in the element.
 
I'm stumped and was hoping that this may be something horribly simple I'm

overlooking that someone can point out for me.

--
Atentamente / Sincerely,
J. Rafael Salazar Magaña

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



Re: [PHP] Re: File Download Headers

2006-06-15 Thread Richard Lynch
On Thu, June 15, 2006 3:04 am, Barry wrote:
 Richard Lynch schrieb:
 and are all you can find from Google?
 O_o

 Anybody?
 What?!?


 I for myself use this:
 header(Content-Type: application/force-download);
 header(Content-Type: application/octet-stream);
 header(Content-Type: application/download);

 Never had any problems with any browser.

You might as well delete the first two lines.  They don't do anything.

The last line works in the sense that no browser currently has any
pre-defined idea of what to *DO* with an application/download
because that's not a known MIME-type.

So the browser punts and presents a download window, because it has
NO IDEA what else to do.

Some goofball MADE UP application/download and it worked

If, however, tomorrow, some MS weenie decides that the Right Thing to
do with application/download is to store it in My Documents because
that's where everybody wants all the downloads to go, right?, then it
WILL NOT WORK tomorrow.

It's that simple.  IE 8 could decide application/download means Put
it in My Documents and you no longer have a download popup.

There is NOTHING to stop the MS engineers from doing that to you.

Nada.

BUT:

application/octet-stream is DEFINED in the HTTP SPEC to ALWAYS WORK.
Any browser that ever makes it not work is BADLY BROKEN.
They cannot change this tomorrow, without being non-HTTP-compliant,
and breaking backwards compatibility with a zillion Documented
Features.

So, use some goofball header that you make up, like:
header(Content-type: asdfqwerowiru/werouitohvosdfho);
and it will work

Or, realy on a DOCUMENTED FEATURE and use:
header(Content-type: application/octet-stream);

Your choice, really, though obviously I have a strong opinion on which
one is the Right Way to do it.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



  1   2   >