[PHP] Problem with PHP5, CGI and Session

2004-12-14 Thread Markus Fischer
Hi,
I'm expiriencing a problem when I use my application with PHP5 as a CGI module 
(this is due to my provider). I've developed and tested the application on two 
servers, both using PHP5 as module, without problems.
It seems that the session gets malformed somehow during the first reuqest.
1) On the first request, the session itself is empty:
array(0) { }
2) On the second request, using session cookies, I see the initialized session 
array:
array(1) { ["fru"]=>  &array(1) { ["cache"]=>  array(0) { } } }
But only as long as I'm in my applications constructor.
But as soon as my class' constructor returns, the session suddenly contains 
another value:
object(Application)#1 (4) {
 ["db:protected"]=>
 object(TsMySQLConnection)#2 (4) {
   ["conRes:private"]=>
[..]
The simplified code-flow is:
session.php
class MySession {
function __construct() {
session_start();
$_SESSION['app']['cache'] = array();
}
}
application.php
class Application {
protected $session;
function __construct() {
$this->session = new MySession();
}
}
index.php
require_once 'application.php';
$app = new Application;
# here, var_dump($_SESSION['fru']) outputs suddenly the 
Application-class, instead of the empty array
$app->main();
I'm unable to find out the problem. It seems that after return from the 
constructor the _SESSION is messed up and contains the object which I just 
created newly.
Anyone expiriencing similiar problems?
regards,
- Markus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] register_user_func and register_shutdown_func

2004-12-14 Thread Bostjan Skufca @ domenca.com
Hi all,

is there any internal difference between following calls (they occur inside 
some class)?

#1 register_shutdown_function(array($this, 'myfunc'));
#2 register_shutdown_function(array(&$this, 'myfunc'));
(note the reference operator in #2)

Or is parameter "$this" in example #1 forced to be taken as reference 
internally, which makes both calls basically identical?


Thank you for your kind response.


Best regards,
Bostjan Skufca

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


Re: [PHP] getting name of class from a parent

2004-12-14 Thread Chris
I'm not sure I'm quite clear on what you want, ...

class base_class{
  static function get_instance(){
   static $oUtility = new utility_class();
   return $oUtility;
   }
}
class utility_class {
}
$instance = utility_class::get_instance()
?>
That should create an instance of utility_class the first time 
::get_instance() is called, and just return it afterwards. I'm not 
positive it will work, the relationship between the two objects, with 
the parent instantiating it's own child, is quite complex.

Hope this was of some help.
Chris
Rory Browne wrote:
Hi
I need a way to create an instance of a class, from a parent of that class.
Lets say I have the following code:

class base_class{
  static function get_instance(){
   // code I need goes here
   }
}
class utility_class {
}
$instance = utility_class::get_instance()
?>
You may be wondering why I don't just " $instance = new utility_class 
" - the reason is that I want to only create one of these instances. I
don't want any more than one instance of utility_class at any one
time.

I can't use get_class($this) either, because, there is no $this when
I'm accessing the method staticly.
Any suggestions?
 

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


[PHP] Output buffering - saving + echoing

2004-12-14 Thread Lorderon
Hi,

When using ob_start(), the output is buffered and not sent till
ob_end_flush() is called or got to end of the script. Also before flushing
you can get the buffer contents by ob_get_contents().



What I want to do is "catch" the output buffer, but do not delay the buffer
to be sent. How is it done?


thanks in advance,
Lorderon.

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



Re: [PHP] getting a date 25 years back

2004-12-14 Thread Mailit, LLC
You should do date arithmetic using the Unix date format (number of 
seconds since 1970).
I think these string format dates are not appropriate.
Mario

Merlin wrote:
Hi there,
I am trying to create a date which is 25 years back from today. The 
purpose of this is to be able to query a mysql database "date" field 
for columns smaller than this date.

I tried this:
$years = 25;
$start_from = date("Y-m-d",strtotime("- ".$years." year"));
Somehow it always ads the years instead of subtracting.
Has anybody an idea on how to do that?
Thank you in advance for any help,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] "Byte Array"

2004-12-14 Thread Marek Kilimajer
Ian Firla wrote:
You're right. I think it will. Thanks.
I've got another issue now though which may indeed be a show-stopper.
It seems that while socket_recvfrom is binary safe, there's no way to
send data in any way other than a string... Is that right? Can I not
send data of other types?
no problem, strings in php are binary safe
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Google search indexing

2004-12-14 Thread Jason FB
Follow up question:
At 4:39 PM + 12/14/04, Richard Davey wrote:
sp> does anybody know how does google (and other search engines) 
index websites
sp> implemented in PHP + MySQL? For instance, sites which use PHP based CMS
sp> (Content Management Systems)?

It doesn't. It indexes the HTML that they output. As far as Google is
concerned you could have a thousand trained monkies typing like mad
for your CMS, it still only cares about the output - the HTML.
sp> Someone told us google spiders do call for the pages so they only see the
sp> resulting HTML code. Is that right?
See, you knew this anyway ;)
sp> Do other search engine use different methodologies?
Thankfully not - if they could it would mean they could see into our
PHP code and MySQL databases.
This is really two questions about Google indexing
Let's say I have a site in PHP & MySQL.
Let's say that I have some links on my site that use GET variables to 
call other PHP pages and pass them a GET variable, like

http://www.somesite.com/somedir/somepage.php?flag=15
The "flag" variable is passed to somepage.php and read by the script 
using $_GET['flag'] etc, etc. When you look at the page with flag=15, 
you get one page, when you look at it with flag=14 you see a similar 
page with completely different content (record #14 instead of #15 
obviously)

Will Google see both pages if I have both linked with  
tags? Or will it stop at the question mark, only loading the page 
somepage.php and ignore the ?flag=14 and ?flag=15 or whatever? Will 
it index ?flag=14 and ?flag=15 as two separate pages (which is really 
what I want, since they produce different content), or will it treat 
both as the same page?

SECOND QUESTION, RELATED:
Same scenario, but with a POSTed form. I have several hidden FORM 
fields, an a drop-down, and depending on how you submit the form you 
get different content on the resulting page.

Will Google submit the form, perhaps a couple of different ways and 
treat each resulting page differently, or will it just bypass the 
form altogether?

THIRD QUESTION:
If the answers to the questions above are Yes and No, then I could 
use a dynamically generated list of links with ?flag= to make Google 
crawl through the part of the MySQL content (as displayed through the 
scripts in HTML) that I want it to, using links and GET variables, 
right?

If the answers to the questions above are No and No, do I have to set 
up a static .php page for EVERY record in my MySQL database to make 
it see that content I want it to see? Does anyone use the error.php 
page to catch for a 404 Not Found error, see if it can match the 
"ghost" name to a record in the DB, and display a page anyway (even 
though technically there is no somepage.php page, the error.php page 
knows to go look in the databsae for "somepage" and displays its 
content)?  I wonder if this would be a good optimization strategy.

(Of course, some of my MySQL dbs I want it to see and others I dont)
Thanks in advance.
--
Jason Fleetwood-Boldt
http://www.dataworksconsulting.net/
San Francisco, CA
 email [EMAIL PROTECTED]
 phone 866-407-3282
 fax 415-552-5912
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: scripting with php

2004-12-14 Thread Matthew Weier O'Phinney
* Bruno Santos <[EMAIL PROTECTED]>:
> since my first page, ive used php as a server side language, embebed in 
> html pages. now, i need to develop a small script to run as stand alone. 
> how can i do it ?
>
> just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not 
> working ...

Did you make the script executable...? Is the path to PHP correct? Did
you enclose all PHP commands within  directives?

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

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


[PHP] File locking & file_[get|put]_contents

2004-12-14 Thread Gerard Samuel
I was wondering.
Does file_get_contents() or file_put_contents() utilise
any kind of file locking?
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Getting mail() to return false/0

2004-12-14 Thread Manuel Lemos
Hello,
Paul Reinheimer said the following on 12/14/2004 11:49 PM:
I read that as, mail() will return true if PHP is able to connect to
the MTA, pass the message, and the MTA responds that the message was
accepted.
My understanding (or assumption) of how the MTA operates is that it
would not accept a message it did not know how to deliver, ie one with
an invalid destination address.
That being said, there is an article on builder.com with regards to
mail and PHP which states:
The mail() function will return true as long as it connects to the
specified SMTP server. This does not mean that the mail successfully
reached its intended recipient. The mail() function does not wait for
or report success/error codes from the SMTP server
This is not true under Unix/Linux as PHP does not establish an SMTP 
connection. It only pipes the message to the sendmail program (or an 
emulation). Sendmail may even try to deliver the message immediately but 
if it fails it may retry later or the message bounces to the return 
address, but the mail() function still returns true.

The mail function only returns false under Windows when the SMTP server 
does not accept the message for relay for a variety of possible reasons. 
Once the message is accepted for relay, even if the recipient address is 
invalid, the message may end up bouncing later, but the mail function 
still returns true.

--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: php mysql codes insertion error.

2004-12-14 Thread Jonathan
Found the problem.

I set  ( default_charset = "iso-8859-1" ) in php.ini and it solve the
problem.

Just in case anyone want to know.



"Jonathan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi,
>
> I have encounter something rather weird. In my development server,
>
> when I insert a string contain  '&*%$, I got this in my mysql server '&*%$
> (i.e. the same)
>
> but in my application server, I got this â?T&*%$ in my mysql server (i.e.
'
> ==> â?T)
>
> anyone know how to resolve this? When I use the string to send out the
> email, I got the funny characters instead.
>
> Version Running
>
> development server
> mysql-server-3.23.58-9
> php-4.3.4
>
> application server:
> mysql-server-3.23.58-9
> php-4.3.8-2.1

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



Re: [PHP] curl libraries on Debian Woody with apache 1.3.29.0.2-6 and php 4.3.4-4

2004-12-14 Thread symbulos partners
Christophe Chisogne wrote:

> hem, this is a PHP list. Perhaps you're talking about curl PHP extension?
> 


Sorry Cristophe, should have been more precise :-).

We meant the related PHP libraries. 

Thanks for your help!

-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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


Re: [PHP] Getting mail() to return false/0

2004-12-14 Thread Paul Reinheimer
'dude' is in fact not a user on my box, I was in fact something I
choose trying to use as an example of something that was not valid.
Running it again against "asdadasdsadasdadsad" returns the same
result.

When I do send mail that matters I include a From header, I was just
trying to stick with as simple an example of what I expected not to
work as possible.

Ramil: I am surprised to hear that, as it directly contridicts what is
in the builder.com article, but supports my reading of the manual.
Hmm.



paul




On Tue, 14 Dec 2004 20:53:37 -0600, Travis Conway
<[EMAIL PROTECTED]> wrote:
> 
> - Original Message -
> From: "Paul Reinheimer" <[EMAIL PROTECTED]>
> 
> > Hi,
> >
> > I was working with the mail function today to experiment with sending
> > a few messages, and threw in the apropriate checks so when mail()
> > can't send the message the apropriate errors were raised, however, I
> > discovered I couldn't actually get mail() to return 0. Take the
> > following call:
> > mail("dude", "Daily Feed Update", "body");
> 
> I assume "dude" is a local user you are mailing to?  Make sure you also give
> a FROM address.  Try this:
> 
> mail("[EMAIL PROTECTED]", "Daily Feed Update", "body", "From:
> [EMAIL PROTECTED]")
> 
> -Trav
> 
> >
> > When I run that exact call (well, I prepend echo, but you get the
> > idea) it returns 1. I can't for the life of me understand why my MTA
> > would accept an email with a destination of 'dude'.
> >
> > Any thoughts?
> >
> >
> >
> > paul
> > --
> > Paul Reinheimer
> 
> 


-- 
Paul Reinheimer
Zend Certified Engineer

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


[PHP] Re: Loops (Thank you very much!)

2004-12-14 Thread Steve Marquez
This is the code I went with and it works like a charm! Thank you very much
M. Sokolewicz!

echo "{$row['name']}{$row['description']}";
would work, just like all of the following would also:
echo "$row[name]$row[description]";
echo $row['name']."".$row['description'];

and a couple of others

--
Steve Marquez

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



[PHP] Re: Getting mail() to return false/0

2004-12-14 Thread Paul Reinheimer
In the continuing trend of responding to my own messages Perhapps
the issue is with how I am interpreting the docs, which state:
mail() returns TRUE if the mail was successfully accepted for
delivery, FALSE otherwise.

I read that as, mail() will return true if PHP is able to connect to
the MTA, pass the message, and the MTA responds that the message was
accepted.

My understanding (or assumption) of how the MTA operates is that it
would not accept a message it did not know how to deliver, ie one with
an invalid destination address.

That being said, there is an article on builder.com with regards to
mail and PHP which states:

The mail() function will return true as long as it connects to the
specified SMTP server. This does not mean that the mail successfully
reached its intended recipient. The mail() function does not wait for
or report success/error codes from the SMTP server

Which contridicts my understanding of what the docs state, but
explains my predicament.



paul



On Tue, 14 Dec 2004 20:05:41 -0500, Paul Reinheimer
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I was working with the mail function today to experiment with sending
> a few messages, and threw in the apropriate checks so when mail()
> can't send the message the apropriate errors were raised, however, I
> discovered I couldn't actually get mail() to return 0. Take the
> following call:
> mail("dude", "Daily Feed Update", "body");
> 
> When I run that exact call (well, I prepend echo, but you get the
> idea) it returns 1. I can't for the life of me understand why my MTA
> would accept an email with a destination of 'dude'.
> 
> Any thoughts?
> 
> paul
> --
> Paul Reinheimer
> 


-- 
Paul Reinheimer
Zend Certified Engineer

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



Re: [PHP] Getting mail() to return false/0

2004-12-14 Thread Travis Conway
- Original Message - 
From: "Paul Reinheimer" <[EMAIL PROTECTED]>

Hi,
I was working with the mail function today to experiment with sending
a few messages, and threw in the apropriate checks so when mail()
can't send the message the apropriate errors were raised, however, I
discovered I couldn't actually get mail() to return 0. Take the
following call:
mail("dude", "Daily Feed Update", "body");
I assume "dude" is a local user you are mailing to?  Make sure you also give 
a FROM address.  Try this:

mail("[EMAIL PROTECTED]", "Daily Feed Update", "body", "From: 
[EMAIL PROTECTED]")

-Trav
When I run that exact call (well, I prepend echo, but you get the
idea) it returns 1. I can't for the life of me understand why my MTA
would accept an email with a destination of 'dude'.
Any thoughts?

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


Re: [PHP] "Byte Array"

2004-12-14 Thread Richard Lynch
Ian Firla wrote:
> I thought of that too and have since expanded my debugging. The types
> are correct when passed to fwrite. They come out the other end as
> strings:
>
> 16:39:54 SENT 'K' of type string
> 16:39:54 SENT '0' of type integer
> 16:39:54 SENT '0' of type integer
> 16:39:54 SENT '65' of type integer
> 16:39:54 SENT '31' of type integer
>
> 15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |
>
>  : 4b   K
>
>
> 15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |
>
>
>  : 30   0
>
>
> 15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |
>
>  : 30   0
>
>
> 15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |
>
>  : 3635 65
>
>
> 15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |
>
>  : 3331   31
>
> As you can see, the last two elements "65" and "31" have arrived as
> strings of two bytes rather than integers of one.

Damn.

Okay, maybe maybe maybe try putting your binary data into a temp file, and
then sending that file out.

It won't be fast, but it might suffice for what you need.

That's assuming fwrite() to a file will output binary data...

Another option would be to convert to the string that would match the
binary data you want...

if (is_int($msg_to_send)){
  fwrite($fp, chr($msg_to_send));
}
else{
  fwrite($fp, $msg_to_send);
}

This would be faster, and probably cleaner than the temp file, actually.

NOTE: is_int is faster than gettype() == 'integer' and the manual states
that they don't guarantee that 'integer' won't change some day.  Use
is_int.

-- 
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] getting a date 25 years back

2004-12-14 Thread John Holmes
Merlin wrote:
Hi there,
I am trying to create a date which is 25 years back from today. The 
purpose of this is to be able to query a mysql database "date" field for 
columns smaller than this date.

I tried this:
$years = 25;
$start_from = date("Y-m-d",strtotime("- ".$years." year"));
Somehow it always ads the years instead of subtracting.
Has anybody an idea on how to do that?
You can use mktime() and subtract 25 from the year argument.
Or just do it in your query...
SELECT * FROM yourtable WHERE your_date_column < NOW() - INTERVAL 25 YEAR;
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] getting a date 25 years back

2004-12-14 Thread Jason Wong
On Wednesday 15 December 2004 03:21, Merlin wrote:
> I am trying to create a date which is 25 years back from today. The purpose
> of this is to be able to query a mysql database "date" field for columns
> smaller than this date.
>
> I tried this:
> $years = 25;
> $start_from = date("Y-m-d",strtotime("- ".$years." year"));
>
> Somehow it always ads the years instead of subtracting.

Try:

  strtotime("$years years ago");

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
printk ("%s: This looks like a LART board to me.
",module_name);
linux-2.6.6/drivers/mtd/devices/lart.c
*/

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



Re: [PHP] Loops

2004-12-14 Thread Richard Lynch
>> //Untested code.
>> $connection = @mysql_connect('localhost', 'USERNAME', 'PASSWORD') or
>> trigger_error(@mysql_error() . " connecting to mysql", E_USER_ERROR);
> mysql_error() *never* returns warnings... so why are you prepending an @ ?

If $connection is an invalid link, it most certainly does print an error
message.

I apologize for leaving out the $connection argument, however.

The correct code is:

$connection = @mysql_connect('localhost', 'USERNAME', 'PASSWORD') or 
trigger_error(@mysql_error($connection) . " connecting to mysql",
E_USER_ERROR);

It's Bad Programming to rely on the default argument.  I spent a *WEEK*
tracking down a case where the "Programmer" was connection to a different
database (he thought) and closing it, only he was closing his main
connection.  But only sometimes, because he only called the sub-routine
sometimes.  Aggh.

[NOTE]
In very old versions of PHP, mysql_error() would not have the error
message in the event of a failed connection -- You'd have to check PHP's
internal error message variables/functions if you run this on really old
PHP versions.
[/NOTE]

>> @mysql_select_db('DATABASENAME', $connection) or
>> trigger_error(@mysql_error($connection) . " selecting database",
>> E_USER_ERROR);

> neither does mysql_select_db()

Once again, if $connection is an invalid resource, it will.

So if you manage to get a good connection in the mysql_connect() line
above, and MySQL *dies* on your server before you get to this line of
code, then you have a potential error condition that will trigger this.

That may not happen very often -- In fact, odds are it will happen very
RARELY.  But it *can* happen, and not coding for it is Bad Programming.

I can guarantee this can happen, because it *has* happened to me.  Once.

>> $query = "select name, description from whatever order by name";
>> $people = @mysql_query($query, $connection) or
> nor does mysql_query()

Repeat comments from above.

>> trigger_error(@mysql_error($connection) . " $query", E_USER_ERROR);
>> while (list($name, $description) = @mysql_fetch_row($people)){
> nor does mysql_fetch_row, unless $people is not a mysql-resource, (thus
> being false,) which you already checked for.

I guess you've never had your database connection die on you in the middle
of processing, eh?

Well, it *does* happen, occasionally.

Program for it.

Also, I come from a PostgreSQL background, where PHP generates a message
on the attempt to read past the last row (which ends the loop) so I'm in
the habit of using @ there anyway.

[NOTE]
It may be that case that PostgreSQL/PHP only generates a NOTICE level
message which you only see if you have error_reporting() cranked up to
E_ALL level.  If you don't see the notice message, don't tell me I'm
wrong. Re-set your http://php.net/error_reporting and test again.
[/NOTE]

Even if I were solely a MySQL user, the database *CAN* go down in mid-loop.

>>   echo "$name\n$description\n";
>> }
>>
>
> Not to be rude, but adding so many @s is usually considered bad
> practice, and makes debugging scripts a hell of a lot harder.

Read more carefully :-)

See all the http://php.net/trigger_error calls?

I'm actually setting the Reader up to have *BETTER* error handling than
the ubiquitous (and horrible) "or die()" construct.

Using trigger_error consistently allows one to use:
http://php.net/set_error_handler
some day, and do something useful, maybe even intelligent, with the error
handling.

Meanwhile, the @ suppresses the default PHP error message, but
trigger_error spews out a more complete error message, resulting in about
the same quality of debugging as "or die()"

It just gives one flexibility for tomorrow to do something smart when one
realizes how bad "or die()" is. :-)

I don't know how many million scripters are using "or die()" because they
think it's the Right Thing because it's in every example in the on-line
manual, and every post, and every on-line tutorial, except for the
occasional good tutorial about error-handling itself.

It's no tougher to use trigger_error() without an error handler than
die(), and at least maybe someday they'll be able to convert their scripts
to use a real error-handler.

So, bottom line:  If you want to write sloppy code and not check for
possible error conditions, go right ahead. :-)

But don't be chastising me for writing GOOD code! :-) :-) :-)

-- 
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] getting a date 25 years back

2004-12-14 Thread John Nichel
Merlin wrote:
Hi there,
I am trying to create a date which is 25 years back from today. The 
purpose of this is to be able to query a mysql database "date" field for 
columns smaller than this date.

I tried this:
$years = 25;
$start_from = date("Y-m-d",strtotime("- ".$years." year"));
Somehow it always ads the years instead of subtracting.
Has anybody an idea on how to do that?
Thank you in advance for any help,
Merlin
http://us4.php.net/mktime
mktime ( date ( "G" ), date ( "i" ), date ( "s" ), date( "n" ), date ( 
"j" ), date ( "Y" ) - 25 );

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Google search indexing

2004-12-14 Thread Richard Lynch
> This is really two questions about Google indexing
> Let's say I have a site in PHP & MySQL.
> Let's say that I have some links on my site that use GET variables to
> call other PHP pages and pass them a GET variable, like
>
> http://www.somesite.com/somedir/somepage.php?flag=15
>
> The "flag" variable is passed to somepage.php and read by the script
> using $_GET['flag'] etc, etc. When you look at the page with flag=15,
> you get one page, when you look at it with flag=14 you see a similar
> page with completely different content (record #14 instead of #15
> obviously)
>
> Will Google see both pages if I have both linked with 
> tags? Or will it stop at the question mark, only loading the page
> somepage.php and ignore the ?flag=14 and ?flag=15 or whatever? Will
> it index ?flag=14 and ?flag=15 as two separate pages (which is really
> what I want, since they produce different content), or will it treat
> both as the same page?

If Google (et al) see the pages AT ALL, they will see them as separate
pages.  They have different URLs <==> they are different pages

Some search engines skip all URLs with ? in them.

Others selectively use the URLs with ? in them.

It's possible (but unlikely) that some search engines use *all* the URLs
with ? in them.

I don't know what Google, specifically, will do under what circumstances,
much less what they might decide to do tomorrow or next year.

> SECOND QUESTION, RELATED:
>
> Same scenario, but with a POSTed form. I have several hidden FORM
> fields, an a drop-down, and depending on how you submit the form you
> get different content on the resulting page.
>
> Will Google submit the form, perhaps a couple of different ways and
> treat each resulting page differently, or will it just bypass the
> form altogether?

I don't know of *ANY* search engine that will POST data to get to content.

I sincerely doubt they would want to do that, really.

> THIRD QUESTION:
>
> If the answers to the questions above are Yes and No, then I could
> use a dynamically generated list of links with ?flag= to make Google
> crawl through the part of the MySQL content (as displayed through the
> scripts in HTML) that I want it to, using links and GET variables,
> right?

Maybe.

Google might do it, while others won't and vice versa.

> If the answers to the questions above are No and No, do I have to set
> up a static .php page for EVERY record in my MySQL database to make
> it see that content I want it to see? Does anyone use the error.php
> page to catch for a 404 Not Found error, see if it can match the
> "ghost" name to a record in the DB, and display a page anyway (even
> though technically there is no somepage.php page, the error.php page
> knows to go look in the databsae for "somepage" and displays its
> content)?  I wonder if this would be a good optimization strategy.

There are several other possible solutions:
1. Use your robots.txt file to send the search engines to a "secret" page
that links to all your content, asking the engine to index that page.

2. Use Apache's mod_rewrite module to change URLs like:
http://example.com/page.php?flag=14
to URLs like:
http://example.com/page.php/flag/14
or
http://example.com/page.php/flag=14
or
http://exmaple.com/page/flag=14/page.htm

3. Use PHP and $_SERVER['PATH_INFO'] to do all the same things as in #2.
There are many examples/articles "out there" how to do this.
Google for "PHP $_SERVER PATH_INFO" and you should find some.

Also be sure to Google for "robots.txt search engines" to find out more
about the robots.txt file -- While I don't use it much myself, others find
it useful.

Finally, a note of caution.  At some point, if you have *enough* records,
you don't want to make the URLs look static.  If you do, and force Google
(et al) to index, say, a MILLION relatively un-interesting pages...

Put yourself in Google's shoes:  "Hey, here's this goofball that made us
index 1,000,000 pages of uninteresting content.  Let's just put him on the
blacklist and not index his site at all."

Use some common sense here, or suffer the consequences.

Let me give you an example:

Suppose you were responsible for maintaining a list of, oh, I don't know,
registered Republicans/Democrats.  Further suppose, for some reason, that
making this list public on the web was legal (I dunno) and you wanted to,
or, more likely, your boss wanted you to do that.

You *could* have a site where every registered voter was on their own page
with an elephant or donkey, and you *could* make static-looking URLs to
force them to get Googled...

Or you could have static-looking *pages* so every page has a couple
hundred, or even a thousand peope, to get Googled, with a nice common
masthead with the elephant or donkey.

If you force the search engines to index those zillion pages, one for each
person, you're going to make somebody cranky.  Somebody you *want* to be
friends with.

OTOH, if you arrange it so they aren't indexing *too* many pages, and the
content is useful to pot

Re: [PHP] getting a date 25 years back

2004-12-14 Thread John Nichel
Merlin wrote:
Hi there,
I am trying to create a date which is 25 years back from today. The 
purpose of this is to be able to query a mysql database "date" field for 
columns smaller than this date.

I tried this:
$years = 25;
$start_from = date("Y-m-d",strtotime("- ".$years." year"));
Somehow it always ads the years instead of subtracting.
Has anybody an idea on how to do that?
Thank you in advance for any help,
Merlin
http://us4.php.net/mktime
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP Question

2004-12-14 Thread CFDelBene
I am new to this languaue and need some info. I am not a programmer but I need 
some info for a project I am working on. I have data in MS Access and I want to 
create graphs and charts using this data to display on a website. I read on 
your website PHP is able to do this.
> What do I need to know about setting this up?
> Do you reccommed MS Access or SQL for the database?
> Are there any special hardware I need?
> Once the program is written in PHP, How do I get this on the website?
>
> Thanks
>
> Chris

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



[PHP] Conflicts between c-client and MySQL

2004-12-14 Thread Rodolfo Gonzalez Gonzalez
Hello,

I'm trying to compile with: UW-IMAP's c-client 2004, MySQL 4.1.7,
php-5.0.3RC2 and php-5.0.2, configure  --with-imap
--with-mysqli, and I get this:

/usr/lib/libc-client.a(misc.o)(.text+0x8a4): In function `hash_reset':
/home/rodolfo/software/imap-2004a/c-client/misc.c:278: multiple definition
of `hash_reset'
/usr/lib/mysql/libmysqlclient.a(hash.o)(.text+0x130): first defined here
/usr/bin/ld: Warning: size of symbol `hash_reset' changed from 94 to 89 in
/usr/lib/libc-client.a(misc.o)
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

Any help is appreciated,
Rodolfo.

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



Re: [PHP] Google search indexing

2004-12-14 Thread Merlin
You could also use a file called for example "pictures"
parse this file with php (use an apache directive for that)
and add the filename. Then you can get the filename from the url and interprete 
it inside the php file "pictures".

Its funny what you can do with php, and nobody will notice, not even the 
spiders.
Merlin
Octavian Rasnita wrote:
Yes Google index the entire url including the HTTP_QUERY_STRING (the part
after the question mark).
You will see many warnings in old tutorials telling that the search enginnes
don't index the entire url, but I don't think it is the case anymore.
However, if you want to avoid this, or to just create URLS more simple to
remember, use the Apache module mod_rewrite.
This way, you can let the server automaticly trranslate an url like
http://www.site.com/program/var1/var2/var3 in a URl like
http://www.site.com/program?v1=var1&v2=var2&v3=var3 ...or any other
translations.
The first link will be easier to remember and the search engines will see it
as a static web page.
The search engines won't submit any form, so they are not parsed at all. Use
common links if you want them to be indexed.
Teddy
- Original Message - 
From: "Jason FB" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 14, 2004 8:04 PM
Subject: [PHP] Google search indexing

Follow up question:
At 4:39 PM + 12/14/04, Richard Davey wrote:
sp> does anybody know how does google (and other search engines)
index websites
sp> implemented in PHP + MySQL? For instance, sites which use PHP based CMS
sp> (Content Management Systems)?
It doesn't. It indexes the HTML that they output. As far as Google is
concerned you could have a thousand trained monkies typing like mad
for your CMS, it still only cares about the output - the HTML.
sp> Someone told us google spiders do call for the pages so they only see
the
sp> resulting HTML code. Is that right?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] finding out the age from a birthdate

2004-12-14 Thread Merlin
Hi there,
i am somehow strugling to find out how to get the age of a person from its 
birthdate. If I divide the date from today, there still is a year instead of the 
age. And deviding the years does not work since we should be accurat about the day.

I tried:
$age[] = date("Y",(time()-$birthday));
(where birthday is a unix timestamp)
Has anybody an idea how to do that?
Thanx,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fopen/fpassthur

2004-12-14 Thread Matt M.
> Hi all,
> I have created a download manger to handle files, when a user clicks a link
> the file is sent though fopen() and fpassthru()

you could try http://us3.php.net/readfile

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


[PHP] Re: Good and free encoder for PHP5

2004-12-14 Thread Jon Drukman
Octavian Rasnita wrote:
Does anyone around here knows a *good* and *free* encoder for PHP5 ?
I used to run Turck, but it seems that somehow it has been discontinued.
(At least, the last release occured about a year ago).
Did it stop working? My Turck copy still works. ;-)
turck never worked for me.  in our very high traffic web environment 
(hundreds of requests per second) turck would leak memory like crazy 
until it eventually killed all the servers.  i gave up on it.  would 
love to find a reliable replacement that can handle millions of requests 
per day.

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


Re: [PHP] scripting with php

2004-12-14 Thread Marek Kilimajer
Bruno Santos wrote:
Hello all.
i'm working with php for about 3 years and i must say: i cant get tired 
of it !! :-)

since my first page, ive used php as a server side language, embebed in 
html pages. now, i need to develop a small script to run as stand alone. 
how can i do it ?

just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not 
working ...

can someone tell me how to i use php stand alone ?
chears !!!
It must work. What error do you get? Remember php code must be enclosed 
in 

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


Re: [PHP] PHP cross platform IDE

2004-12-14 Thread Daniel Schierbeck
Craig Slusher wrote:
... Another alternative is to use
Eclipse IDE with the PHPEclipse.de plugin. I've messed around with it
a little bit and it's not too bad.
Yeah, I'd go with Eclipse. It also integrates with CVS & WebDAV (and 
FTP!), and have some cool features. I've tried off Zend Studio, but I 
thought it was slow and had a messy and ugly user interface.

And hey, Eclipse is free!
--
Daniel Schierbeck
Help spread Firefox (www.getfirefox.com): 
http://www.spreadfirefox.com/?q=user/register&r=6584

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


RE: [PHP] Unreliable mail delivery through PHP

2004-12-14 Thread Chris W. Parker
Jason Wong 
on Monday, December 13, 2004 10:52 PM said:

> On Tuesday 14 December 2004 07:43, Chris W. Parker wrote:
> 
>> $headers = "From: $from\n"
>>   ."Reply-To: $from\n"
>>   ."X-Mailer: PHP/".phpversion();
> 
> Headers should be separated by "\r\n". Not sure why you're
> duplicating the From:.

Didn't know about the \r\n and I also didn't realize I was repeating the
>From value! :)

>> Assuming all the email addresses are correct, is there anything about
>> the above two functions that is incorrect or might be causing the
>> unreliable'ness'? Or maybe someone has some tips for debugging this
>> kind of thing?
> 
> Does your mailserver logs have anything to say?
> 
> Is the send_email() function being called at all? I would use
> trigger_error() or similar to write a message in the (php) log after
> mail() so that I would know for sure mail() was executed.

Good ideas. I will look into them.


Thanks,
Chris.

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



Re: [PHP] scripting with php

2004-12-14 Thread Christopher Fulton
one more note...you may look at the manual under

http://us3.php.net/features.commandline

-Chris


On Tue, 14 Dec 2004 16:04:15 -0800, Christopher Fulton
<[EMAIL PROTECTED]> wrote:
> Not sure if this is what you want, but i know that you can call php
> from a command line by using.
> 
> php code_name.php
> 
> that will print out the http headers, so to supress the headers you can do
> 
> php -q code_name.php
> 
> Hope this helps,
> Chris
> 
> 
> On Tue, 14 Dec 2004 21:38:18 +, Bruno Santos <[EMAIL PROTECTED]> wrote:
> > Hello all.
> >
> > i'm working with php for about 3 years and i must say: i cant get tired
> > of it !! :-)
> >
> > since my first page, ive used php as a server side language, embebed in
> > html pages. now, i need to develop a small script to run as stand alone.
> > how can i do it ?
> >
> > just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not
> > working ...
> >
> > can someone tell me how to i use php stand alone ?
> > chears !!!
> >
> > Bruno Santos
> >
> > --
> > 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] Loops

2004-12-14 Thread M. Sokolewicz
Richard Davey wrote:
Hello Steve,
Tuesday, December 14, 2004, 3:52:26 PM, you wrote:
SM> I would like to loop the multiple variables rather than put all the
SM> variables into a single variable with an array. I can not figure out how to
SM> do this.
I assume you have placed the MySQL query and checked the number of
rows it has returned? You could just do:
while ($row == mysql_fetch_assoc($result))
{
  $name = $row['name'];
  $desc = $row['description'];
  echo "$name ";
  echo "desc ";
}
and you're not just doing
echo $row['name'].'';
by itself because...? It makes your code longer without any real reason :S
yes it works, but is it useful?
This is just one of many ways of performing the same task. You could
use a for() loop based on mysql_num_rows, you could use fetch_array
instead of assoc. If you are only extracting a couple of details then
you could even use mysql_result($result, $record, 'name'). I would
suggest you take a look in the PHP manual, there are many examples of
this.
Best regards,
Richard Davey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] CGI vs Apache module

2004-12-14 Thread Sandy Keathley
We have a Redhat server, which only allows PHP 4.3.2 to be 
installed by RPM.  I manually compiled and installed 4.3.9 using 
the configure params as the RPM install.  It compiled the CGI 
version, which seems to run, but Apache (2.0) doesn't recognize it.
phpinfo() still reports 4.3.2.

Any ideas accepted on making 4.3.9 the default version!

Thanks,

Sandy Keathley

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



Re: [PHP] Google search indexing

2004-12-14 Thread Jason Wong
On Wednesday 15 December 2004 02:04, Jason FB wrote:

> Will Google see both pages if I have both linked with 
> tags? Or will it stop at the question mark, only loading the page
> somepage.php and ignore the ?flag=14 and ?flag=15 or whatever? Will
> it index ?flag=14 and ?flag=15 as two separate pages (which is really
> what I want, since they produce different content), or will it treat
> both as the same page?

A quick google would have answered your question! Just have a look at some 
typical search results and you'll see that Google will index those dynamic 
pages.http://www.metasystema.org/essays/reply-to-useful.mhtml

> Will Google submit the form, perhaps a couple of different ways and
> treat each resulting page differently, or will it just bypass the
> form altogether?

AFAIK search engines don't submit forms. It would be extremely impolite to do 
so. Imagine a form for comments and Google "enters" some rubbish and submits 
it.

> If the answers to the questions above are Yes and No, then I could
> use a dynamically generated list of links with ?flag= to make Google
> crawl through the part of the MySQL content (as displayed through the
> scripts in HTML) that I want it to, using links and GET variables,
> right?

Yes, that usually works.

> it see that content I want it to see? Does anyone use the error.php
> page to catch for a 404 Not Found error, see if it can match the
> "ghost" name to a record in the DB, and display a page anyway (even
> though technically there is no somepage.php page, the error.php page
> knows to go look in the databsae for "somepage" and displays its
> content)?  I wonder if this would be a good optimization strategy.

Are we still talking about search engines? Strictly speaking no search engine 
(crawler to be precise) should ever try to access a non-existent page. If you 
have moved pages around and want a search engine to still be able to access 
the now non-existent page then you should issue the correct HTTP header code 
for "resource moved permanently" (or whatever) and redirect to the new page.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Facts are stubborn, but statistics are more pliable.
*/

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



Re: [PHP] PHP &Apache Upload file Permission denied

2004-12-14 Thread Michael Leung
Yes, I have restarted my Apache.

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



Re: [PHP] scripting with php

2004-12-14 Thread Christopher Fulton
Not sure if this is what you want, but i know that you can call php
from a command line by using.

php code_name.php

that will print out the http headers, so to supress the headers you can do

php -q code_name.php

Hope this helps,
Chris


On Tue, 14 Dec 2004 21:38:18 +, Bruno Santos <[EMAIL PROTECTED]> wrote:
> Hello all.
> 
> i'm working with php for about 3 years and i must say: i cant get tired
> of it !! :-)
> 
> since my first page, ive used php as a server side language, embebed in
> html pages. now, i need to develop a small script to run as stand alone.
> how can i do it ?
> 
> just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not
> working ...
> 
> can someone tell me how to i use php stand alone ?
> chears !!!
> 
> Bruno Santos
> 
> --
> 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] Google search indexing

2004-12-14 Thread Octavian Rasnita
Yes Google index the entire url including the HTTP_QUERY_STRING (the part
after the question mark).
You will see many warnings in old tutorials telling that the search enginnes
don't index the entire url, but I don't think it is the case anymore.

However, if you want to avoid this, or to just create URLS more simple to
remember, use the Apache module mod_rewrite.

This way, you can let the server automaticly trranslate an url like
http://www.site.com/program/var1/var2/var3 in a URl like
http://www.site.com/program?v1=var1&v2=var2&v3=var3 ...or any other
translations.

The first link will be easier to remember and the search engines will see it
as a static web page.

The search engines won't submit any form, so they are not parsed at all. Use
common links if you want them to be indexed.

Teddy

- Original Message - 
From: "Jason FB" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 14, 2004 8:04 PM
Subject: [PHP] Google search indexing


Follow up question:

At 4:39 PM + 12/14/04, Richard Davey wrote:
>sp> does anybody know how does google (and other search engines)
>index websites
>sp> implemented in PHP + MySQL? For instance, sites which use PHP based CMS
>sp> (Content Management Systems)?
>
>It doesn't. It indexes the HTML that they output. As far as Google is
>concerned you could have a thousand trained monkies typing like mad
>for your CMS, it still only cares about the output - the HTML.
>
>sp> Someone told us google spiders do call for the pages so they only see
the
>sp> resulting HTML code. Is that right?
>

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


Re: [PHP] fopen/fpassthur

2004-12-14 Thread Sebastian
Q> I hope you have some good data validation going on too :)

I am not too sure about how secure it is. basically, the files are called by
an ID
eg, download?type=file&id=3

so i query the db to get check if its a valid id and get the filename from
the db as well.
if its not found it errors out.. i was under the impression that is more
secure to get files by an id from db than doing something like
download?file=filename.zip

i am worried about security as i am not even sure if this method would allow
people to download any file from the server.
maybe if you have time you can look at the script for me and find any flaws
;)

thanks.

- Original Message - 
From: "Richard Davey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 14, 2004 12:27 PM
Subject: Re: [PHP] fopen/fpassthur


> Hello Sebastian,
>
> Tuesday, December 14, 2004, 4:19:31 PM, you wrote:
>
> S> header("Content-type: application/octet-stream");
> S> header("Content-disposition: attachment; filename=" .
$file['filename']);
> S> header("Content-transfer-encoding: binary");
> S> header("Content-length: " . filesize($file['path'] .
$file['filename']));
>
> I use something almost identical, except I upper-case the second words
> (Content-Type, Content-Disposition, etc). Not that I've found a
> browser in active use yet that cares less, but there we go.
>
> I'd fclose() when done, and no need to exit() - it's the last line of
> your script anyway.
>
> I hope you have some good data validation going on too :)
>
> S> is this the most practical way of doing it? i don't want to display
> S> file location.. the script seems to be working okay, but i was just
>
> It is the way to do it, yes. You may get some varying suggestions re:
> the correct headers to use though. But what you have will actually
> work just fine (as you've found).
>
> S> also, is it possible to insert a txt file on the fly if the file
> S> they're downloading is a ZIP file? if so, any ideas how?
>
> No, you cannot interrupt the stream. Or do anything after it for that
> matter - you are "simulating" an HTTP request for a file, that is what
> you're sending back. There is no way to inject something else into
> this single transmission. Think of another way around it.
>
> Best regards,
>
> Richard Davey
> -- 
>  http://www.launchcode.co.uk - PHP Development Services
>  "I am not young enough to know everything." - Oscar Wilde
>
> -- 
> 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] getting name of class from a parent

2004-12-14 Thread Rory Browne
Hi

I need a way to create an instance of a class, from a parent of that class.

Lets say I have the following code:



You may be wondering why I don't just " $instance = new utility_class 
" - the reason is that I want to only create one of these instances. I
don't want any more than one instance of utility_class at any one
time.

I can't use get_class($this) either, because, there is no $this when
I'm accessing the method staticly.

Any suggestions?

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



Re: [PHP] PHP cross platform IDE

2004-12-14 Thread Rory Browne
I use kdevelop. I'm not sure how cross-platform it is, since I've
never tried to get it working on a non-linux machine, but it should
run anywhere KDE will run. I'm not sure what you'd need to do to get
it running on Windows.

Vim is a text editor, albeit a very good one, but Not an IDE, even
though it has many IDE features.

I haven't used the Eclipse plugin yet. What's it like?


On Tue, 14 Dec 2004 16:51:06 -0600, Greg Donald <[EMAIL PROTECTED]> wrote:
> On Tue, 14 Dec 2004 22:17:57 +0100, Daniel Schierbeck <[EMAIL PROTECTED]> 
> wrote:
> > And hey, Eclipse is free!
> 
> So is vim.
> 
> PHP explodes right on the screen for me, an IDE is so not required.
> 
> --
> Greg Donald
> Zend Certified Engineer
> http://gdconsultants.com/
> http://destiney.com/
> 
> --
> 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] Getting mail() to return false/0

2004-12-14 Thread Paul Reinheimer
Hi,

I was working with the mail function today to experiment with sending
a few messages, and threw in the apropriate checks so when mail()
can't send the message the apropriate errors were raised, however, I
discovered I couldn't actually get mail() to return 0. Take the
following call:
mail("dude", "Daily Feed Update", "body");

When I run that exact call (well, I prepend echo, but you get the
idea) it returns 1. I can't for the life of me understand why my MTA
would accept an email with a destination of 'dude'.

Any thoughts?



paul
-- 
Paul Reinheimer

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



Re: [PHP] Re: Good and free encoder for PHP5

2004-12-14 Thread Octavian Rasnita
Oh yeah but probably the problem is that it wasn't updated in order to work
with PHP 5.
Or does it does?

Teddy

- Original Message - 
From: "Manuel Lemos" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, December 15, 2004 1:16 AM
Subject: [PHP] Re: Good and free encoder for PHP5


Hello,

Mário gamito said the following on 12/14/2004 08:51 AM:
> Does anyone around here knows a *good* and *free* encoder for PHP5 ?
> I used to run Turck, but it seems that somehow it has been discontinued.
> (At least, the last release occured about a year ago).

Did it stop working? My Turck copy still works. ;-)

-- 

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



[PHP] MMS?

2004-12-14 Thread Robert Sossomon
Anyone know of some scripts to email ringtones/graphics to your cell phone?
Thanks,
Robert
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Turn off "out of offfice" messages for the list, please

2004-12-14 Thread John Holmes
List,
I'm sure many of us will be taking some time off for the holidays (if 
you aren't already). Just a friendly reminder to either 1) unsubscribe 
while you're gone (you won't miss much, trust me) or 2) set your notice 
to not reply to postings to the list. These get quite annoying after a 
while, if you can imagine. Yes, I know how to filter them to my Junk 
folder, but let's try to stop it at the source instead, eh? ;)

Happy Holidays,
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] scripting with php

2004-12-14 Thread Bruno Santos
Hello all.
i'm working with php for about 3 years and i must say: i cant get tired 
of it !! :-)

since my first page, ive used php as a server side language, embebed in 
html pages. now, i need to develop a small script to run as stand alone. 
how can i do it ?

just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not 
working ...

can someone tell me how to i use php stand alone ?
chears !!!
Bruno Santos
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] scripting with php

2004-12-14 Thread Robert Cummings
On Tue, 2004-12-14 at 16:38, Bruno Santos wrote:
> Hello all.
> 
> i'm working with php for about 3 years and i must say: i cant get tired 
> of it !! :-)
> 
> since my first page, ive used php as a server side language, embebed in 
> html pages. now, i need to develop a small script to run as stand alone. 
> how can i do it ?
> 
> just like bourn shell, ive used #!/usr/bin/php -q, but it apears is not 
> working ...
> 
> can someone tell me how to i use php stand alone ?
> chears !!!

Use:

#!/usr/bin/php -qC

The C flag makes it the working directory for the script the same one as
your are in when you invoke it. Also ensure that your PHP binary exists
at the specified path. Last but not least you still need the opening PHP
tag:

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] Re: MMS?

2004-12-14 Thread Manuel Lemos
Hello,
Robert Sossomon said the following on 12/14/2004 05:18 PM:
Anyone know of some scripts to email ringtones/graphics to your cell phone?
That is a bit vague, but you find something in these classes for 
Wireless and Mobile devices. If you do not find, you may want to post a 
a message in the forums of the classes that seem more likely that could 
do what you want.

http://www.phpclasses.org/browse/class/16.html
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] "Byte Array"

2004-12-14 Thread Ford, Mike
To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm



> -Original Message-
> From: Ian Firla
> Sent: 14/12/04 17:52
> 
> On Tue, 2004-12-14 at 08:40 -0800, Richard Lynch wrote:
> > Ian Firla wrote:
> > >
> > > Just a follow-up to myself... I decided to try packet sniffing to
see
> > > what was going on and ettercap confirms that I'm sending out strings
> > > rather than data of the type stored in my array:
> > >
> > > 16:12:26  192.168.0.101:32779 --> 192.168.0.88:32896 | UDP |
> > >
> > >  : 3331 31
> > >
> > > That "31" should be an integer of only one byte, not two.
> > 
> > I suspect that PHP is converting your integers into strings at some
> point,
> > as you build the array...
> > 
> > *WHERE* it is doing that is difficult to say, without seeing more
code.

It's not at all difficult.  The definition of fwrite is:

  int fwrite (resource handle, string string [, int length])

So the second parameter is converted to a string as it passes in to fwrite.
This is not at all unexpected -- it's kind of the file(/stream/whatever)
analogue of echo or print.

To get what you really want -- i.e. a 1-byte binary representation of your
value -- you'll have to encode it as the appropriate character and then send
that.  Two possible ways to do that are with pack() and chr().

Cheers!

Mike

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



[PHP] Re: email processing

2004-12-14 Thread Manuel Lemos
Hello,
Adwin Wijaya said the following on 12/14/2004 12:06 AM:
I want to create a system to process the email that coming. For example, 
I send a confirmation email to our client and they just simply reply the 
email that we send to them to verify. The problem I got, I dont know how 
to process the email that coming to our mailbox and process the message 
inside with PHP.

can someone recommend me a PHP class that has been created for handling 
this task ?
If you can access that mailbox via POP3, you can try using this POP3 
client PHP class to access it. I use it for the same purpose as yours:

http://www.phpclasses.org/pop3class
If you want to process messages to generate automatic responses, there 
is also this class that is more specific for that purpose:

http://www.phpclasses.org/autoresponse
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Good and free encoder for PHP5

2004-12-14 Thread Manuel Lemos
Hello,
Mário gamito said the following on 12/14/2004 08:51 AM:
Does anyone around here knows a *good* and *free* encoder for PHP5 ?
I used to run Turck, but it seems that somehow it has been discontinued.
(At least, the last release occured about a year ago).
Did it stop working? My Turck copy still works. ;-)
--
Regards,
Manuel Lemos
PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/
PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/
Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] CGI vs Apache module

2004-12-14 Thread Richard Lynch
Sandy Keathley wrote:
> We have a Redhat server, which only allows PHP 4.3.2 to be
> installed by RPM.  I manually compiled and installed 4.3.9 using
> the configure params as the RPM install.  It compiled the CGI
> version, which seems to run, but Apache (2.0) doesn't recognize it.
> phpinfo() still reports 4.3.2.
>
> Any ideas accepted on making 4.3.9 the default version!

Unless you actually *WANT* PHP as CGI, go back and re-compile as Module.

Right before you do "make install" you'll need to RPM un-install PHP, so
you don't confuse things.

You'll need to re-start Apache for sure, and if that doesn't work, you may
need to change the httpd.conf settings by hand.

I don't know where RPM-makers hide your httpd.conf file, but you should be
able to find it and edit it to find the PHP parts and fix them up.

-- 
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] Google search indexing

2004-12-14 Thread Richard Lynch
> I've heard different claims about how google handles GET queries and am
> pretty sure it doesn't submit POSTed forms.

I can guarantee that at least one time one search engine indexed a URL
with GET data in it.

Shocked the [bleep] out of me to find one of my dynamic pages in a search
results page. :-)  "Hey!  They don't index those dynamix pages?!  Hmmm. 
Guess they do now.  Sometimes."

I don't know what sort of algorithm the search engines use to decide
which, if any, URLs with ? in them are worth indexing or not.

Since Google won't publish their inner workings, one can only hypothesize
and theorize about what they do.

But once I found that one URL, I decided to re-think a lot of my sites and
now I make the decision on a page by page basis if I want a static-looking
URL or a dynamic-looking one.

I'd much rather do that than try to beat my head against the "How does
Google work" wall, or wade through a zillion "search engine optimization"
experts' postings (much of which is bunk or out-dated or sheer
guess-work).

Maybe someday search engines will make an informed decision that even a
static-looking URL is really dynamic, and classify it in the "don't index"
bucket, and vice versa.

For the forseeable future, though, I think it's safe to say that rewriting
your URLs will help search engines find you.

Worked for me.  A musical artist I know (and you almost-for-sure don't
know of him) checks his own name Google et al routinely every few weeks or
so.  He's quite disconcerted when one of my pages "bumps" his own site
down to #2 occasionally.  Fortunately, he usually pops back up to #1 next
time he tests.

Thank goodness we're friends and he controls the content on his profile on
my site, so it's always up to him what people see when they go there
anyway.

In terms of bang for the buck in search engine optimization, making your
URLs search-engine friendly has to be just about as good as it gets.

-- 
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] Infinity and nested categories

2004-12-14 Thread Bruno B B Magalhães
Thanks Richard!
Helped a lot!
Regards,
Bruno B B Magalhaes
On Dec 13, 2004, at 4:16 PM, Richard Lynch wrote:
Bruno B B Magalhães wrote:
Hi again everybody,
well, I've asked it before, but I couldn't work on this at all.
As some knows I have a system witch has a category system. The generic
part of the site is handled by a generic module called contents...
generic like products, services, company, etc. Where the content 
layout
and structure is quite the same.

Well suppose that I have this:
http://www.the_company.com/site/products/product_one/requirements/
requirements.html
Where:
site/   < the controller
products/  <- alias module for content module
product_one/   <- top category
requirements/<- nested category
 <-- as many nested categories as needed
requirements.html <- article is called searching using it without
the .html, witch is used to know that it is an article and not a
category. ('WHERE article_path='requirements' AND category_id='022')
My problem is that how can I handle those categories! and
build a three of it.
Is it a true hierarchy, or is it a heterarchy?
In other words, can "sub_category_57" appear in *TWO* different 
branches
in the tree?

If *NOT*, then you really don't need all the nested categories in your
URL:  As soon as you have the "bottom" category, you've already got all
the others in your database.
Of course, you could simply walk through $_SERVER['PATH_INFO'] and 
build
your category list:


--
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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] getting a date 25 years back

2004-12-14 Thread Merlin
Richard Lynch wrote:
Merlin wrote:
I am trying to create a date which is 25 years back from today. The
purpose of
this is to be able to query a mysql database "date" field for columns
smaller
than this date.
I tried this:
$years = 25;
//> $start_from = date("Y-m-d",strtotime("- ".$years." year"));
Somehow it always ads the years instead of subtracting.
Has anybody an idea on how to do that?

You can do this in all MySQL:
select ... where date_field <= sub_date(now(), interval 25 years)
Or you could try:
$back_then = mktime(0, 0, 0, date('m'), date('d'), date('Y') - 25);
$start_from = date("Y-m-d", $back_then);
thank you everybody for your help.
I used this which works excellent:
$back_then = mktime(0, 0, 0, date('m'), date('d'), date('Y') - 25);
Thanx, Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fopen/fpassthur

2004-12-14 Thread Richard Lynch
Sebastian wrote:
> Q> I hope you have some good data validation going on too :)
>
> I am not too sure about how secure it is. basically, the files are called
> by
> an ID
> eg, download?type=file&id=3
>
> so i query the db to get check if its a valid id and get the filename from
> the db as well.
> if its not found it errors out.. i was under the impression that is more
> secure to get files by an id from db than doing something like
> download?file=filename.zip
>
> i am worried about security as i am not even sure if this method would
> allow
> people to download any file from the server.
> maybe if you have time you can look at the script for me and find any
> flaws
> ;)

If you mean any of the potential downloads, you've got big problems. :-)

What's to stop somebody from trying &id=4 and &id=5 and so on and getting
*ALL* the files?

If you mean they could download *any* file, even the ones you're not
trying to let somebody download, it would be more efficient to see the
script itself to point out flaws, rather than just surfing to the site and
trying to break it.  Though that can be instructive too, especially if you
have acquired the same sort of tools your average script kiddie uses to
try to break in and steal stuff.

-- 
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] PHP cross platform IDE

2004-12-14 Thread Greg Donald
On Tue, 14 Dec 2004 22:17:57 +0100, Daniel Schierbeck <[EMAIL PROTECTED]> wrote:
> And hey, Eclipse is free!

So is vim.

PHP explodes right on the screen for me, an IDE is so not required.


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



Re: [PHP] Slow Zend Optimizer

2004-12-14 Thread Richard Lynch
Bruno B B Magalhães wrote:
> I've installed the zend Optimizer with my Mac OS X, Apache 1.2, PHP5.
> And guess what, it became about 40% slower!!!
>
> My framework was running for example in the modules administration
> (admin area) at 0.104ms, and now the average is 0.2ms - 0.24ms
>
> Does anybody have any idea of what hell is this optimizer optimizing?!?1

On a very gross simplified level, the Zend optimizer works like this:

When the user requests "*.php" URL:
1  Check if the page is in the cache.
2  Load the PHP script from the disk.
3  Compile the PHP script to byte-code.
4  Check for ~20 specific optimizations to alter the compilation
5  Store the byte-code in a list matching URL <-> byte-code.
6  Execute the byte-code script.

The next time that URL is requested, steps 2, 3, 4, and 5 are *skipped*

It simply finds the byte-code in RAM and starts executing it.  Pretty much
like a big fat "GOTO" to skip all those slow steps :-)

Step 2 is the BIG win, actually.  Hard drive slow.  RAM fast.

Step 3, compiling PHP to byte-code saves a bit of time to skip, but not a
whole whole lot usually.

Step 4 you have control over which Optimizations it does or skips.  The
default settings, which is probably not even to have all 20 Optimizations
"on" usually works best for the "average" user, whatever that means.

If the Zend Optimizer actually made your site slower, then...

Perhaps you tried to set the memory size for the Optimizer really high,
and you are page-faulting the cache back onto the disk.  Don't do that.
:-)  Set your Zend memory size to something that will actually fit in RAM.
 More RAM + the Zend Optimizer can also make a *huge* difference if you
were bordering on RAM full before.

It's also possible that your scripts are triggering some particular
condition among the ~20 optimizations.  You can try turning them on/off
one by one or in a binary search to see if it's a particular optimization.
 You do this in the Zend config file.  It will take some time and effort
to tweak and test, but it may turn out that the default settings suck for
you for some odd reason, even though they're great for 99% of the users. 
That's why they let you change them :-)

Actually, maybe start by turning off *all* Optimizations and re-testing. 
Right there you can determine if it's an Optimization or a RAM issue.

The Zend Optimizer also comes with (or used to anyway) a feature to track
the performance/pages that came out of the cache and generated some simple
statistics from that to give you some idea what it was doing.

Disclosure/Disclaimer:  I used to work for Zend as "Vice President of
Customer Support" answering questions like this.  In no way, shape, or
form, does that make this answer official, correct, or authoritative. :-)
YMMV. NAIAA. IANAL.

PS  The Zend Optimizer is actually way way way more complicated than this
brief description, but that's the way life goes, ya know?

-- 
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] CGI vs Apache module

2004-12-14 Thread Greg Donald
On Tue, 14 Dec 2004 15:09:21 -0600, Sandy Keathley
<[EMAIL PROTECTED]> wrote:
> We have a Redhat server, which only allows PHP 4.3.2 to be
> installed by RPM.  I manually compiled and installed 4.3.9 using
> the configure params as the RPM install.

Did you remove the PHP rpm(s) first?

> It compiled the CGI
> version, which seems to run, but Apache (2.0) doesn't recognize it.
> phpinfo() still reports 4.3.2.

Did you restart Apache?

> Any ideas accepted on making 4.3.9 the default version!

What was your ./configure command?


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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



[PHP] getting a date 25 years back

2004-12-14 Thread Merlin
Hi there,
I am trying to create a date which is 25 years back from today. The purpose of 
this is to be able to query a mysql database "date" field for columns smaller 
than this date.

I tried this:
$years = 25;
$start_from = date("Y-m-d",strtotime("- ".$years." year"));
Somehow it always ads the years instead of subtracting.
Has anybody an idea on how to do that?
Thank you in advance for any help,
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] fopen/fpassthur

2004-12-14 Thread John Holmes
Sebastian wrote:
Q> I hope you have some good data validation going on too :)
I am not too sure about how secure it is. basically, the files are called by
an ID
eg, download?type=file&id=3
so i query the db to get check if its a valid id and get the filename from
the db as well.
if its not found it errors out.. i was under the impression that is more
secure to get files by an id from db than doing something like
download?file=filename.zip
i am worried about security as i am not even sure if this method would allow
people to download any file from the server.
maybe if you have time you can look at the script for me and find any flaws
While this method may not present a clear security danger, how does the 
data get into the database? If I can feed a "filename" of anything on 
your system that you blindly put in the database, then I can call it 
with an appropriate URL.

So... you can trust data coming from your database only if it was 
trusted/validated/sanitized going in. :)

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] getting a date 25 years back

2004-12-14 Thread Richard Lynch
Merlin wrote:
> I am trying to create a date which is 25 years back from today. The
> purpose of
> this is to be able to query a mysql database "date" field for columns
> smaller
> than this date.
>
> I tried this:
> $years = 25;
//> $start_from = date("Y-m-d",strtotime("- ".$years." year"));
>
> Somehow it always ads the years instead of subtracting.
>
> Has anybody an idea on how to do that?

You can do this in all MySQL:
select ... where date_field <= sub_date(now(), interval 25 years)

Or you could try:
$back_then = mktime(0, 0, 0, date('m'), date('d'), date('Y') - 25);
$start_from = date("Y-m-d", $back_then);

-- 
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] fopen/fpassthur

2004-12-14 Thread Richard Lynch
Richard Davey wrote:
> no need to exit() - it's the last line of
> your script anyway.

There was a bug in PHP for a very brief period of time where scripts were
not ending under some conditions after all the content was delivered.

If one is running that version of PHP, exit; at the end of a script is a
Good Thing.

-- 
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] bargraph gd not working

2004-12-14 Thread Richard Lynch
jm wrote:
> Hi guys:
> I'm using php5 on winxp with IIS. I'm trying to run a simple bar graph
> demo
> found it on phpbuilder site. When I run it I get nothing but an x in the
> top
> left corner of my web page(no errors nothing).
> GD is uncommented in my php.ini, ext dir set and I have verified that GD
> is
> installed through php -m,phpinfo() , and gd_info(). Can anyone offer me
> some
> advice on how to troubleshoot this problem.
> I searched google, and did see other posts like mine but no solutions. Any
> thoughts or suggestions would be appreciated

Comment out the header("Content-type: ...") line in your script.

Then surf directly to the image:
http://example.com/bargraph.php

You should then be able to read the error messages PHP is probably
printing instead of an image.

The browser isn't smart enough to tell that that PHP error message isn't
supposed to be an image at all, and tries to interpret it as an image. 
Oddly enough, it never quite works, eh? :-)

-- 
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] PHP &Apache Upload file Permission denied

2004-12-14 Thread Richard Lynch
Michael Leung wrote:
>Yes, apache can do read/write in /tmp.  I can't su to apache.
> But I created  another account in apache group(userid test1). I have
> such tests by using that account. I can do mv , cp , create new file.
> After those successful test, I have  modified httpd.conf to make
> apache web server run as test1. But they are still working like the
> same error.

You re-started Apache, right?...

Just to be sure, does  show 'test1' as the user?

If so, check http://bugs.php.net for your OS/PHP version and bugs related
to file upload:  If the user running PHP can do all that stuff, PHP should
be able to do it with no problem.

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

2004-12-14 Thread Steve Marquez
Greetings. I am trying to display looped information from a MySQL database
in a PHP file. 

Loop

$name (witht a br />) then
$description

End of loop

I would like to loop the multiple variables rather than put all the
variables into a single variable with an array. I can not figure out how to
do this.

I have very little knowledge of PHP but am learning. Let me know if more
information is needed.

Thank you for any help.

--
Steve Marquez
[EMAIL PROTECTED]

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



Re: [PHP] Google search indexing

2004-12-14 Thread James Stewart
On Dec 14, 2004, at 1:04 PM, Jason FB wrote:
If the answers to the questions above are Yes and No, then I could use 
a dynamically generated list of links with ?flag= to make Google crawl 
through the part of the MySQL content (as displayed through the 
scripts in HTML) that I want it to, using links and GET variables, 
right?

If the answers to the questions above are No and No, do I have to set 
up a static .php page for EVERY record in my MySQL database to make it 
see that content I want it to see? Does anyone use the error.php page 
to catch for a 404 Not Found error, see if it can match the "ghost" 
name to a record in the DB, and display a page anyway (even though 
technically there is no somepage.php page, the error.php page knows to 
go look in the databsae for "somepage" and displays its content)?  I 
wonder if this would be a good optimization strategy.
I've heard different claims about how google handles GET queries and am 
pretty sure it doesn't submit POSTed forms.

There are, however, other options than simply setting up static pages 
or using error pages. If you're using apache, you might want to look 
into use of mod_rewrite (make sure you have a thorough understanding of 
it before use) or producing URLs like 
http://your.host/file.php/first/second/third using server variables and 
explode()

James.
--
James Stewart : Freelance Web Developer
Work : http://jystewart.net
Play : http://james.anthropiccollective.org
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] max_input_time

2004-12-14 Thread Richard Lynch
Rick Lim wrote:
> Hi there,
>
> I am trying to run a command line windows php script where I wait for
> characters from the serial port i.e. $sTemp = fgets($Serialfp);
>
> After about 60 seconds the script times out and quits, I have tried to
> change max_input_time in php.ini but it still times out in 60 secs.
>
> I have set_time_limit(0); in the program and safe_mode = Off in php.ini
> which will allow the program to run endlessly but waiting for characters
> from the serial port just quits after 60 seconds no matter what value
> max_input_time is set to.
>
> The impression I get is that in windows max_input_time is ignored.
>
> Anyone have any info on this?

It seems more likely to me that fgets() is timing out.

You may need to resort to lower-level function calls to keep the stream open.

Check for PHP functions that change the time-out limit of streams and
sockets here:
http://php.net/fgets

-- 
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] Slow Zend Optimizer

2004-12-14 Thread Bruno B B Magalhães
Hi guys,
I've installed the zend Optimizer with my Mac OS X, Apache 1.2, PHP5. 
And guess what, it became about 40% slower!!!

My framework was running for example in the modules administration 
(admin area) at 0.104ms, and now the average is 0.2ms - 0.24ms

Does anybody have any idea of what hell is this optimizer optimizing?!?1
Regards,
Bruno
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] "Byte Array"

2004-12-14 Thread Ian Firla
On Tue, 2004-12-14 at 08:40 -0800, Richard Lynch wrote:
> Ian Firla wrote:
> >
> > Just a follow-up to myself... I decided to try packet sniffing to see
> > what was going on and ettercap confirms that I'm sending out strings
> > rather than data of the type stored in my array:
> >
> > 16:12:26  192.168.0.101:32779 --> 192.168.0.88:32896 | UDP |
> >
> >  : 3331 31
> >
> > That "31" should be an integer of only one byte, not two.
> 
> I suspect that PHP is converting your integers into strings at some point,
> as you build the array...
> 
> *WHERE* it is doing that is difficult to say, without seeing more code.
> 
> > The function that's doing the sending looks like this:
> >
> > function send_back($sock, $msg, $ip, $port) {
> > $fp = fsockopen("udp://$ip", $port, $errno, $errstr);
> > foreach ($msg as $msg_to_send) {
> 
> //To confirm my suspicion that you have a string here:
> error_log("The type of $msg_to_send is " . gettype($msg_to_send));
> //Now go check your PHP error log (default: Apache error_log)

Thanks Richard.

I thought of that too and have since expanded my debugging. The types
are correct when passed to fwrite. They come out the other end as
strings:

16:39:54 SENT 'K' of type string
16:39:54 SENT '0' of type integer
16:39:54 SENT '0' of type integer
16:39:54 SENT '65' of type integer
16:39:54 SENT '31' of type integer

15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |

 : 4b   K


15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |


 : 30   0


15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |

 : 30   0


15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |

 : 3635 65


15:46:10  192.168.0.101:32778 --> 192.168.0.84:32896 | UDP |

 : 3331 31

As you can see, the last two elements "65" and "31" have arrived as
strings of two bytes rather than integers of one.

Ian


> > fwrite($fp, $msg_to_send);
> > echo date("H:i:s")." SENT '$msg_to_send'\n"; //seen server 
> > side
> > }
> > fclose($fp);
> > }
> >
> > Can anyone see where I might be going wrong? Why am I not sending the
> > integers as integers and the binary bits as binary bits?
> 
> -- 
> 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] bargraph gd not working

2004-12-14 Thread M. Sokolewicz
Richard Lynch wrote:
Oooop!
Hit Send too soon.
After you put the header BACK IN, the image should work, except some
versions of IE are so badly-broken that they've cached the fact that that
URL is text, not an image, and will refuse to display it as an image, and
will dump out the image contents to the browser.
Quit IE completely (all windows) and re-start IE to fix that. 
pressing CTRL-F5 works aswell. Basically tells the browser to recache it.
 Or just use
Netscape/Firefox/Mozilla/whatever to fix it once and for all. :-)
jm wrote:
Hi guys:
I'm using php5 on winxp with IIS. I'm trying to run a simple bar graph
demo
found it on phpbuilder site. When I run it I get nothing but an x in the
top
left corner of my web page(no errors nothing).
GD is uncommented in my php.ini, ext dir set and I have verified that GD
is
installed through php -m,phpinfo() , and gd_info(). Can anyone offer me
some
advice on how to troubleshoot this problem.
I searched google, and did see other posts like mine but no solutions. Any
thoughts or suggestions would be appreciated

Comment out the header("Content-type: ...") line in your script.
Then surf directly to the image:
http://example.com/bargraph.php
You should then be able to read the error messages PHP is probably
printing instead of an image.
The browser isn't smart enough to tell that that PHP error message isn't
supposed to be an image at all, and tries to interpret it as an image. 
Oddly enough, it never quite works, eh? :-)

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


[PHP] Free Auction Scripts

2004-12-14 Thread Robert Sossomon
Anyone have some good free auction scripts?  I can write what I want it to do, 
but why re-invent the wheel if I can find one at a great price (FREE)?

Thanks,
Robert
--
Robert Sossomon, Business and Technology Application Technician
4-H Youth Development Department
200 Ricks Hall, Campus Box 7606
N.C. State University
Raleigh NC 27695-7606
Phone: 919/515-8474
Fax:   919/515-7812
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Loops

2004-12-14 Thread M. Sokolewicz
Richard Lynch wrote:
Steve Marquez wrote:
Greetings. I am trying to display looped information from a MySQL database
in a PHP file.
Loop
$name (witht a br />) then
$description
End of loop
I would like to loop the multiple variables rather than put all the
variables into a single variable with an array. I can not figure out how
to
do this.
I have very little knowledge of PHP but am learning. Let me know if more
information is needed.

//Untested code.
$connection = @mysql_connect('localhost', 'USERNAME', 'PASSWORD') or
trigger_error(@mysql_error() . " connecting to mysql", E_USER_ERROR);
mysql_error() *never* returns warnings... so why are you prepending an @ ?
@mysql_select_db('DATABASENAME', $connection) or
neither does mysql_select_db()
trigger_error(@mysql_error($connection) . " selecting database",
E_USER_ERROR);
$query = "select name, description from whatever order by name";
$people = @mysql_query($query, $connection) or
nor does mysql_query()
trigger_error(@mysql_error($connection) . " $query", E_USER_ERROR);
while (list($name, $description) = @mysql_fetch_row($people)){
nor does mysql_fetch_row, unless $people is not a mysql-resource, (thus 
being false,) which you already checked for.
  echo "$name\n$description\n";
}
Not to be rude, but adding so many @s is usually considered bad 
practice, and makes debugging scripts a hell of a lot harder.

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


Re: [PHP] fopen/fpassthur

2004-12-14 Thread Richard Davey
Hello Sebastian,

Tuesday, December 14, 2004, 4:19:31 PM, you wrote:

S> header("Content-type: application/octet-stream");
S> header("Content-disposition: attachment; filename=" . $file['filename']);
S> header("Content-transfer-encoding: binary");
S> header("Content-length: " . filesize($file['path'] . $file['filename']));

I use something almost identical, except I upper-case the second words
(Content-Type, Content-Disposition, etc). Not that I've found a
browser in active use yet that cares less, but there we go.

I'd fclose() when done, and no need to exit() - it's the last line of
your script anyway.

I hope you have some good data validation going on too :)

S> is this the most practical way of doing it? i don't want to display
S> file location.. the script seems to be working okay, but i was just

It is the way to do it, yes. You may get some varying suggestions re:
the correct headers to use though. But what you have will actually
work just fine (as you've found).

S> also, is it possible to insert a txt file on the fly if the file
S> they're downloading is a ZIP file? if so, any ideas how?

No, you cannot interrupt the stream. Or do anything after it for that
matter - you are "simulating" an HTTP request for a file, that is what
you're sending back. There is no way to inject something else into
this single transmission. Think of another way around it.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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


Re: [PHP] fopen/fpassthur

2004-12-14 Thread Richard Lynch




Sebastian wrote:
> Hi all,
> I have created a download manger to handle files, when a user clicks a
> link
> the file is sent though fopen() and fpassthru()
> like this:

fopen() + fpassthru() == http://php.net/readfile

> is this the most practical way of doing it? i don't want to display file
> location.. the script seems to be working okay, but i was just looking for
> opinions on the method. also, is it possible to insert a txt file on the
> fly
> if the file they're downloading is a ZIP file? if so, any ideas how?

Probably.

http://php.net/zlib should give you some ideas in that direction.

It would maybe be easier to start with all unzipped files, and zip them
with your text file when you send them out...

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

2004-12-14 Thread Richard Davey
Hello Steve,

Tuesday, December 14, 2004, 3:52:26 PM, you wrote:

SM> I would like to loop the multiple variables rather than put all the
SM> variables into a single variable with an array. I can not figure out how to
SM> do this.

I assume you have placed the MySQL query and checked the number of
rows it has returned? You could just do:

while ($row == mysql_fetch_assoc($result))
{
  $name = $row['name'];
  $desc = $row['description'];

  echo "$name ";
  echo "desc ";
}

This is just one of many ways of performing the same task. You could
use a for() loop based on mysql_num_rows, you could use fetch_array
instead of assoc. If you are only extracting a couple of details then
you could even use mysql_result($result, $record, 'name'). I would
suggest you take a look in the PHP manual, there are many examples of
this.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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


Re: [PHP] Loops

2004-12-14 Thread M. Sokolewicz
Gareth Williams wrote:
$result = mysql_query("SELECT name, description FROM table");
while ($row = mysql_fetch_assoc($result))
{
echo "{$row['name']}$row['description']";
that will throw errors.
echo "{$row['name']}{$row['description']}";
would work, just like all of the following would also:
echo "$row[name]$row[description]";
echo $row['name']."".$row['description'];
and a couple of others

}
On 14 Dec 2004, at 16:52, Steve Marquez wrote:
Greetings. I am trying to display looped information from a MySQL 
database
in a PHP file.

Loop
$name (witht a br />) then
$description
End of loop
I would like to loop the multiple variables rather than put all the
variables into a single variable with an array. I can not figure out 
how to
do this.

I have very little knowledge of PHP but am learning. Let me know if more
information is needed.
Thank you for any help.
--
Steve Marquez
[EMAIL PROTECTED]
--
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] bargraph gd not working

2004-12-14 Thread Richard Lynch
Oooop!

Hit Send too soon.

After you put the header BACK IN, the image should work, except some
versions of IE are so badly-broken that they've cached the fact that that
URL is text, not an image, and will refuse to display it as an image, and
will dump out the image contents to the browser.

Quit IE completely (all windows) and re-start IE to fix that.  Or just use
Netscape/Firefox/Mozilla/whatever to fix it once and for all. :-)

jm wrote:
> Hi guys:
> I'm using php5 on winxp with IIS. I'm trying to run a simple bar graph
> demo
> found it on phpbuilder site. When I run it I get nothing but an x in the
> top
> left corner of my web page(no errors nothing).
> GD is uncommented in my php.ini, ext dir set and I have verified that GD
> is
> installed through php -m,phpinfo() , and gd_info(). Can anyone offer me
> some
> advice on how to troubleshoot this problem.
> I searched google, and did see other posts like mine but no solutions. Any
> thoughts or suggestions would be appreciated

Comment out the header("Content-type: ...") line in your script.

Then surf directly to the image:
http://example.com/bargraph.php

You should then be able to read the error messages PHP is probably
printing instead of an image.

The browser isn't smart enough to tell that that PHP error message isn't
supposed to be an image at all, and tries to interpret it as an image. 
Oddly enough, it never quite works, eh? :-)

-- 
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] email processing

2004-12-14 Thread Richard Lynch
adwin wijaya wrote:
> I want to create a system to process the email that coming. For example,
> I send a confirmation email to our client and they just simply reply the
> email that we send to them to verify. The problem I got, I dont know how
> to process the email that coming to our mailbox and process the message
> inside with PHP.
>
> can someone recommend me a PHP class that has been created for handling
> this task ?

http://phpclasses.org might have one.

You'll want to look into 'smrsh' and some sendmail documentation for how
to get the email to the PHP script in the first place, if you want this to
happen the instant the email comes in.

If you can wait a minute or two longer per email, you can use
http://php.net/imap to open up and read email and then process them as you
see fit.

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

2004-12-14 Thread Richard Lynch
Daniel Lahey wrote:
> Can anyone point me to a good source of information for how to use SSL
> with PHP?  I know it's not quite on-topic, but perhaps someone could
> point me at a good source of info?  TIA

Not sure what you mean by using SSL with PHP...

There's really not a whole lot to it.

You put SSL on your server, and PHP on your server, and, like, they both
work. :-)

When switching from your non-SSL pages to SSL pages and back, you have to
transfer any "context" (session, GET/POST variables, etc) back and forth.

Just general advice:  Keep your SSL pages in a well-defined and clear-cut
place in your application, as much as possible, if you mix non-SSL and SSL
pages.

If you want to use PHP to read from SSL sites, go here: http://php.net/curl

-- 
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] divide the text

2004-12-14 Thread Richard Lynch
Ahmed Abdel-Aliem wrote:
> hi,
> i have a page that views details of games from a database
> i get the text and screen shots from the database,
> i want to view 3 pictures among the text when i view it
> how i can view the 1st picture after 1/3 of the text and the next one
> after 2/3 of the text without affecting the text itself

There might be some fancy CSS way to do this...

But a crude way to do it, which should work with just about every browser,
would be:



  
  
  


-- 
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] "Byte Array"

2004-12-14 Thread Richard Lynch
Ian Firla wrote:
>
> Just a follow-up to myself... I decided to try packet sniffing to see
> what was going on and ettercap confirms that I'm sending out strings
> rather than data of the type stored in my array:
>
> 16:12:26  192.168.0.101:32779 --> 192.168.0.88:32896 | UDP |
>
>  : 3331 31
>
> That "31" should be an integer of only one byte, not two.

I suspect that PHP is converting your integers into strings at some point,
as you build the array...

*WHERE* it is doing that is difficult to say, without seeing more code.

> The function that's doing the sending looks like this:
>
> function send_back($sock, $msg, $ip, $port) {
>   $fp = fsockopen("udp://$ip", $port, $errno, $errstr);
>   foreach ($msg as $msg_to_send) {

//To confirm my suspicion that you have a string here:
error_log("The type of $msg_to_send is " . gettype($msg_to_send));
//Now go check your PHP error log (default: Apache error_log)

>   fwrite($fp, $msg_to_send);
>   echo date("H:i:s")." SENT '$msg_to_send'\n"; //seen server 
> side
>   }
>   fclose($fp);
> }
>
> Can anyone see where I might be going wrong? Why am I not sending the
> integers as integers and the binary bits as binary bits?

-- 
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 does google index PHP + MySQL (PostgreesSQL) websites?

2004-12-14 Thread Richard Davey
Hello symbulos,

Tuesday, December 14, 2004, 4:12:20 PM, you wrote:

sp> does anybody know how does google (and other search engines) index websites
sp> implemented in PHP + MySQL? For instance, sites which use PHP based CMS
sp> (Content Management Systems)?

It doesn't. It indexes the HTML that they output. As far as Google is
concerned you could have a thousand trained monkies typing like mad
for your CMS, it still only cares about the output - the HTML.

sp> Someone told us google spiders do call for the pages so they only see the
sp> resulting HTML code. Is that right?

See, you knew this anyway ;)

sp> Do other search engine use different methodologies?

Thankfully not - if they could it would mean they could see into our
PHP code and MySQL databases.

Think about that for a second.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

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


[PHP] How does google index PHP + MySQL (PostgreesSQL) websites?

2004-12-14 Thread symbulos partners
Dear friends,

does anybody know how does google (and other search engines) index websites
implemented in PHP + MySQL? For instance, sites which use PHP based CMS
(Content Management Systems)?

Someone told us google spiders do call for the pages so they only see the
resulting HTML code. Is that right?

Do other search engine use different methodologies?

-- 
symbulos partners
-.-
symbulos - ethical services for your organisation
http://www.symbulos.com

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


Re: [PHP] PHP cross platform IDE

2004-12-14 Thread Richard Lynch
Bryan Dina wrote:
> A bit off topic, what are people out there using for PHP IDE's?

vi

:-)

Zend Studio and Komodo have been recommended to me in the past by people I
trust.

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

2004-12-14 Thread Richard Lynch




Steve Marquez wrote:
> Greetings. I am trying to display looped information from a MySQL database
> in a PHP file.
>
> Loop
>
> $name (witht a br />) then
> $description
>
> End of loop
>
> I would like to loop the multiple variables rather than put all the
> variables into a single variable with an array. I can not figure out how
> to
> do this.
>
> I have very little knowledge of PHP but am learning. Let me know if more
> information is needed.

//Untested code.
$connection = @mysql_connect('localhost', 'USERNAME', 'PASSWORD') or
trigger_error(@mysql_error() . " connecting to mysql", E_USER_ERROR);
@mysql_select_db('DATABASENAME', $connection) or
trigger_error(@mysql_error($connection) . " selecting database",
E_USER_ERROR);
$query = "select name, description from whatever order by name";
$people = @mysql_query($query, $connection) or
trigger_error(@mysql_error($connection) . " $query", E_USER_ERROR);
while (list($name, $description) = @mysql_fetch_row($people)){
  echo "$name\n$description\n";
}

-- 
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] fopen/fpassthur

2004-12-14 Thread Sebastian
Hi all,
I have created a download manger to handle files, when a user clicks a link
the file is sent though fopen() and fpassthru()
like this:

header("Content-type: application/octet-stream");
header("Content-disposition: attachment; filename=" . $file['filename']);
header("Content-transfer-encoding: binary");
header("Content-length: " . filesize($file['path'] . $file['filename']));

// get file contents
$file = @fopen($file['path'] . $file['filename'], 'r');

// output
fpassthru($file);
exit;

is this the most practical way of doing it? i don't want to display file
location.. the script seems to be working okay, but i was just looking for
opinions on the method. also, is it possible to insert a txt file on the fly
if the file they're downloading is a ZIP file? if so, any ideas how?

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


Re: [PHP] Loops

2004-12-14 Thread Gareth Williams
$result = mysql_query("SELECT name, description FROM table");
while ($row = mysql_fetch_assoc($result))
{
echo "{$row['name']}$row['description']";
}
On 14 Dec 2004, at 16:52, Steve Marquez wrote:
Greetings. I am trying to display looped information from a MySQL 
database
in a PHP file.

Loop
$name (witht a br />) then
$description
End of loop
I would like to loop the multiple variables rather than put all the
variables into a single variable with an array. I can not figure out 
how to
do this.

I have very little knowledge of PHP but am learning. Let me know if 
more
information is needed.

Thank you for any help.
--
Steve Marquez
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] PHP cross platform IDE

2004-12-14 Thread Bryan Dina
I have done a little checking and I think I already know the answer, but
I wanted to toss this one out there anyway.

Are there any cross platform IDE's available for PHP v.5 development,
specifically I am looking for Linux/Mac.

A bit off topic, what are people out there using for PHP IDE's?

thanks!
--Bryan

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


Re: [PHP] PHP cross platform IDE

2004-12-14 Thread Chris Boget
> A bit off topic, what are people out there using for PHP IDE's?

Thought not specifically a PHP IDE, I use Visual Slick Edit (which
is cross platform).  It's probably the best IDE I've come across to
date.

thnx,
Chris

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


[PHP] php mysql codes insertion error.

2004-12-14 Thread Jonathan
Hi,

I have encounter something rather weird. In my development server,

when I insert a string contain  '&*%$, I got this in my mysql server '&*%$
(i.e. the same)

but in my application server, I got this â?T&*%$ in my mysql server (i.e. '
==> â?T)

anyone know how to resolve this? When I use the string to send out the
email, I got the funny characters instead.

Version Running

development server
mysql-server-3.23.58-9
php-4.3.4

application server:
mysql-server-3.23.58-9
php-4.3.8-2.1

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


[PHP] Good and free encoder for PHP5

2004-12-14 Thread Mário Gamito
Hi,
Does anyone around here knows a *good* and *free* encoder for PHP5 ?
I used to run Turck, but it seems that somehow it has been discontinued.
(At least, the last release occured about a year ago).
Any help would be apreciated.
Warm Regards.
--
Mário Gamito
Administração de sistemas e desenvolvimento
Netual - Multimédia e Telecomunicações, Lda.
Rua João Afonso, Nº1
3800-198 Aveiro - Portugal
Tel. +351 234 371 431 / Fax. +351 234 371 438
E-mail: [EMAIL PROTECTED]
www.netual.pt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] divide the text

2004-12-14 Thread Ahmed Abdel-Aliem
hi, 
i have a page that views details of games from a database
i get the text and screen shots from the database, 
i want to view 3 pictures among the text when i view it
how i can view the 1st picture after 1/3 of the text and the next one
after 2/3 of the text without affecting the text itself

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


Re: [PHP] Automaticly Play Sound when MySql Reach some Number

2004-12-14 Thread Nigel Jones
That would be javascript alert() feature. (Documented so much on sites
which can be found on google I won't even bother explain)


On Mon, 13 Dec 2004 18:23:35 -0800 (PST), Sejati Opreker
<[EMAIL PROTECTED]> wrote:
> I planning to make an inventory php-mysql based
> program, that need to warn my user when the stock
> reach at specific mount, yeah that true playing sound
> might annoyed some people around, is it posible to use
> the same way if sound replace by a dialog box ?
> 
> 
> --- Richard Lynch <[EMAIL PROTECTED]> wrote:
> 
> > Sejati Opreker wrote:
> > > How do I make automaticly PHP playing a sound
> > (Ogg, or
> > > MP3 format file) when MySql (in Table, or Coulom)
> > > reach a number (for example 5)
> >
> > Er.
> >
> > You'd have to write a query in MySQL/PHP such as:
> > $query = "select whatever = 5 from something";
> >
> > Or, perhaps:
> > $query = "select count(*) from something where
> > whatever";
> >
> > Or maybe something entirely different.  You've been
> > so vague about the
> > specification that we can't really say.
> >
> > Then, you need to use OBJECT and EMBED tags in your
> > HTML printed out by
> > PHP to make the sound play.  You can count on a
> > *LOT* of annoyed users
> > when you automatically play an audio file, by the
> > way.
> >
> > The exact format of the OBJECT and EMBED tags
> > depends on what format you
> > want, Ogg or MP3.
> >
> > Pretty much, there wasn't really any PHP in your
> > question, when you get
> > right down to 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
> >
> >
> 
> 
> __
> Do you Yahoo!?
> Yahoo! Mail - 250MB free storage. Do more. Manage less.
> http://info.mail.yahoo.com/mail_250
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
N Jones
#newzealand @ irc.freenode.net
The future of IRC is coming,

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