RE: [PHP] How to access any function of a any class?

2005-03-17 Thread Kim Madsen

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 16, 2005 2:27 PM
To: php-general@lists.php.net
Subject: [PHP] How to access any function of a any class?

Hello.
Please consider this:

class A {
[snip]

class B {
[snip]

class Container{
  function Container(){
[snip]

$MyOBJ=new Container();


> The problem is that "sometimes" member functions and variables can be
> reached this way, but sometimes not (mainly variables or file pointers)
> depending WHEN you create the object and when (for example) you create a
> file pointer inside some class.

> What I want to do is to be able to use any function of any class from any
> function of any class.

That´s not possible if You wanna do _entirely_ OOPD programming. You can let B 
inherits from A and let Container inherits from B then an instance of Container 
will contain all functions, but a instance from A cannot call the function 
Container. Read more here: http://dk2.php.net/manual/en/keyword.extends.php

You could just drop the idea of several classes or the OOP programming (I 
removed the D on purpose due to the bad design ;-)

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper
Naverland 31

DK-2600 Glostrup
www.comx.dk
Telefon: +45 70 25 74 74
Telefax: +45 70 25 73 74
E-mail: [EMAIL PROTECTED]

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



[PHP] VERY basic function question

2005-03-17 Thread William Stokes
I'm trying to learn functions (just started). I can't see why this fails:


I probably just didn't understand my manual. Any ideas?

Thanks
-Will 

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



[PHP] SimpleXML and xpath woes

2005-03-17 Thread Simon Turvey
Hi all,
(Apologies for the larger than normal wrapping - there are some long lines)
I'm playing with SimpleXML for reading REST responses from Amazon Web Services.
Having successfuly read the response to my request I'd like to perform an xpath 
query
on the result.  I've pared down the original response to a static XML file for 
testing
purposes containing the following:
http://webservices.amazon.com/AWSECommerceService/2005-02-23";>




0MTRFP41HYDBPAEM41Q5






0.0166029930114746



True

0201788977



0201788977 

Hesham Soliman
Book
Mobile IPv6 : Mobility in a Wireless 
Internet




The code looks like this:
$xml = simplexml_load_file('test.xml');
$result = $xml->xpath($query);
var_dump($result);
When:
$query = '//*';
Everything is fine and an enormous array of matching elements is returned. 
However, when:
$query = '//ItemLookupResponse';
var_dump returns:
array(0) {
}
Either a) I'm doing something terribly wrong (and I thought that I was 
attempting a pretty
simple xpath query) or b) SimpleXML's broken.
I'd prefer a) - it's easier to fix :)
Thanks a bunch,
Simon Turvey
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] VERY basic function question

2005-03-17 Thread YaronKh
Hi

Don’t call you function count

-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 17, 2005 10:25 AM
To: php-general@lists.php.net
Subject: [PHP] VERY basic function question

I'm trying to learn functions (just started). I can't see why this fails:


I probably just didn't understand my manual. Any ideas?

Thanks
-Will 

-- 
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] VERY basic function question

2005-03-17 Thread Chris Ramsay
On Thu, 17 Mar 2005 10:24:31 +0200, William Stokes <[EMAIL PROTECTED]> wrote:
> I'm trying to learn functions (just started). I can't see why this fails:
>  function count($var)

You cannot use count as a function name - count() actually does
something - see the php manual

> {
> if ($var == 10){
> $result = $var + 10;
> return $result;
> }
> else {
> $result = $var + 20;
> return $result;
> }
> }
> $setvar = 10;
> count($setvar);
> echo "$result";
> ?>

This is what you may want:




> 
> I probably just didn't understand my manual. Any ideas?
> 
> Thanks
> -Will
> 
> --
> 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] VERY basic function question

2005-03-17 Thread YaronKh
And another thing
Let say you called you function count1

Change :
count1($setvar);
to :
$result = count1($setvar);
echo "$result";


-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 17, 2005 10:25 AM
To: php-general@lists.php.net
Subject: [PHP] VERY basic function question

I'm trying to learn functions (just started). I can't see why this fails:


I probably just didn't understand my manual. Any ideas?

Thanks
-Will 

-- 
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] How to access any function of a any class?

2005-03-17 Thread pf
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, March 16, 2005 2:27 PM
> To: php-general@lists.php.net
> Subject: [PHP] How to access any function of a any class?
>
> Hello.
> Please consider this:
>
> class A {
> [snip]
>
> class B {
> [snip]
>
> class Container{
>   function Container(){
> [snip]
>
> $MyOBJ=new Container();
>
>
>> The problem is that "sometimes" member functions and variables can be
>> reached this way, but sometimes not (mainly variables or file pointers)
>> depending WHEN you create the object and when (for example) you create a
>> file pointer inside some class.
>
>> What I want to do is to be able to use any function of any class from
>> any
>> function of any class.
>
> That´s not possible if You wanna do _entirely_ OOPD programming. You can
> let B inherits from A and let Container inherits from B then an instance
> of Container will contain all functions, but a instance from A cannot call
> the function Container. Read more here:
> http://dk2.php.net/manual/en/keyword.extends.php

I'm sorry Kim, but it is possible, I've made a web hosting control panel
using entirely this approach and it is working very well for months now. A
demo: http://cpdemo.sistemasdinamicos.com.ar/

Just a snip of the class that creates a domain (any other class uses
exactle the same constructor):

class CDominio
{

function CDominio(&$cont)
{
$this->ct= &$cont;
$this->classname=get_class($this);
}
#
#
function CreateDomain($d,$SecLevel="1",$UserType="1") /*UserType 1)
reseller 2) user*/
{
$d=trim($d);
$new_user_id=$this->ct->syf->user_uniqid(2);
if(!$this->ct->db->query("insert into dominios (dominio, 
user_id) values
('$d', '$new_user_id')")) {
die(gettext("Unable to insert new domain"));
}
//Si el usuario que crea es un reseller, tomamos la info de su 
PC
if($this->ct->cr->sess->user['perms'] == "reseller") {


Look how I can access any member using the container class (which has a
reference to every class used in the script)

For ex: $this->ct->db->query...
The db class contained by ct (the container)
or
$this->ct->cr->sess
the cr object (another container [contained in the ct] that contains all
the core classes=session, authentication, security)

But, this approach works ok statically or in single scripts, but I have
problems, for example with this:

class A, B and the Container the same as before

and thne you add (for example) a socket pointer to the Container (from the
main script or from B), then you if  you do
is_resource($this->Container->SocketPointer) from A the poiter is not
there.
It seems that "sometimes" it works as expected and sometimes not.
It do work when you add the class to the container after you add the
pointer to it (I've found this today)

Googling I also found that I should first create tmp copies of the objects
before adding them to the container class (I was trying to find the link
to post it here, but forgot the query I've made).

Perhaps I should try php5, I was told it has MUCH BETTER objects.

Thanks for your answer.

>
> You could just drop the idea of several classes or the OOP programming (I
> removed the D on purpose due to the bad design ;-)
>
> --
> Med venlig hilsen / best regards
> ComX Networks A/S
> Kim Madsen
> Systemudvikler/Systemdeveloper
> Naverland 31
>
> DK-2600 Glostrup
> www.comx.dk
> Telefon: +45 70 25 74 74
> Telefax: +45 70 25 73 74
> E-mail: [EMAIL PROTECTED]
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Hernán Marino

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



Re: [PHP] php 4 & php 5

2005-03-17 Thread Bostjan Skufca @ domenca.com
Abandon all your hopes, this will not work (unless you do some heavy 
programming/patching) because modules interfere with each other. I've been 
trying this for a week without success.

Still the best/easiest approach is to set up ordinary apache/PHP4 server 
combination with proxy support compiled in, then configure it to forward 
all .php5 requests to another apache/PHP5 server (listening i.e. internally 
on 127.0.0.1:81)

PHP3/PHP4 was a diffferent situation, do not compare it to this one.


Bostjan




On Wednesday 16 March 2005 13:45, Kim Madsen wrote:
> -Original Message-
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, March 15, 2005 4:05 AM
>
> > > That's why I'd like to stick with apache2 + php5 default and
> > > apache2+php4 just for a single site hosted (the one that uses imp).
> >
> > See my previous message describing the ProxyPass approach.  It is by far
> > the easiest way to solve this cleanly.
>
> I´ve only been on the list for a couple of weeks, so sorry if it´s already
> been answered but couldn´t one use 2 AddTypes?
>
> LoadModule php4_module libexec/libphp4.so
> AddType application/x-httpd-php .php4
>
> LoadModule php5_module libexec/libphp5.so
> AddType application/x-httpd-php5 .php .php5
>
> AddModule mod_php4.c
> AddModule mod_php5.c
>
> I believe that´s how we did it while testing 3 vs 4 at one of my previous
> jobs (the ISP World Online/Tiscali), worked for hosted customers aswell.
>
> --
> Med venlig hilsen / best regards
> ComX Networks A/S
> Kim Madsen
> Systemudvikler
> Naverland 31
>
> DK-2600 Glostrup
> www.comx.dk
> Telefon: +45 70 25 74 74
> Telefax: +45 70 25 73 74
> E-mail: [EMAIL PROTECTED]

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



Re: [PHP] php 4 & php 5

2005-03-17 Thread Bostjan Skufca @ domenca.com
Versioned libraries do not work either.

Bostjan


On Wednesday 16 March 2005 23:11, Rasmus Lerdorf wrote:
> Kim Madsen wrote:
> > -Original Message-
> > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, March 15, 2005 4:05 AM
> >
> >>>That's why I'd like to stick with apache2 + php5 default and
> >>>apache2+php4 just for a single site hosted (the one that uses imp).
> >>
> >>See my previous message describing the ProxyPass approach.  It is by far
> >>the easiest way to solve this cleanly.
> >
> > I´ve only been on the list for a couple of weeks, so sorry if it´s
> > already been answered but couldn´t one use 2 AddTypes?
> >
> > LoadModule php4_module libexec/libphp4.so
> > AddType application/x-httpd-php .php4
> >
> > LoadModule php5_module libexec/libphp5.so
> > AddType application/x-httpd-php5 .php .php5
> >
> > AddModule mod_php4.c
> > AddModule mod_php5.c
> >
> > I believe that´s how we did it while testing 3 vs 4 at one of my previous
> > jobs (the ISP World Online/Tiscali), worked for hosted customers aswell.
>
> Nope, this won't work.  libphp4.so and libphp5.so will have a lot of
> symbol clashes.  You could attempt compiling versioned libraries here,
> but we really haven't tested that.
>
> -Rasmus

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



Re: [PHP] Re: Strange PHP5 message

2005-03-17 Thread aka MacGuru
Hi, Jason,
Thanks a lot for suggestion. Does it mean that I have tried to  
serialize some object (like adodb db object)? How I can eliminate this?  
I really cannot find where this object or whatever else is going to be  
serailized. The problematic line of code just serialized an array.

On Mar 16, 2005, at 18:30, Jason Barnett wrote:
Andrei Verovski wrote:
...
Notice: serialize() [function.serialize]: __sleep should return an  
array
only containing the names of instance-variables to serialize. in
ANVphpApp.php on line 840

Anyone knows what is the problem?
Exactly what the notice says ;) basically __sleep is used so that you
can prevent certain properties (file pointers, db connections, objects,
etc.) from being serialized.

session_start();
error_reporting(E_ALL);
class Dummy {
  public$s1  = 'I am a test string';
  protected $s2  = 'I am the protected string';
  private   $_s3 = 'I am the private string';
  var   $a1  = array('testing', 1, 2, 3);
  static$i1  = 0;
  function __sleep() {
$i = self::$i1++;
echo "Oops, I forgot everything!  $i\n";
return array();
  }
}
class hasMemory extends Dummy {
  private $_fp = NULL;
  function __construct() {
$this->_fp = fopen('/path/to/some/file', 'r');
  }
  function __sleep() {
$props_to_save = array('s1', 's2', 'a1');
echo "I know about the following properties:\n";
print_r($props_to_save);
return $props_to_save;
  }
}
$_SESSION['obj1']= new Dummy();
$_SESSION['obj2']= new hasMemory();
$_SESSION['string']  = '123abcdefg!';
$_SESSION['integer'] = 1;
$_SESSION['float']   = .1234;
$_SESSION['double']  = .1234567890123456;
$_SESSION['bool']= TRUE;
foreach ($_SESSION as $key => $value) {
  echo "$key: ";
  var_dump(serialize($value));
}
?>
--
Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html? 
name=PHP&submitform=Find+search+plugins

*
*   Best Regards   ---   Andrei Verovski
*
*   Personal Home Page
*   http://snow.prohosting.com/guru4mac/
*   Mac, Linux, DTP, Development, IT WEB Site
*


RE: [PHP] How to access any function of a any class?

2005-03-17 Thread pf
> Hi
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Thursday, March 17, 2005 10:04 AM
>
>> I'm sorry Kim, but it is possible, I've made a web hosting control panel
>> using entirely this approach and it is working very well for months now.
>> A
>> demo: http://cpdemo.sistemasdinamicos.com.ar/
>
> As I understood You wanted to create an instance of class a and directly
> access class B´s functions with $A->function_from_b();
>
> THAT is only solved if Your class A inherits from B
>
> ###
>
> class CDominio
> {
>
>   function CDominio(&$cont)
>   {
>   $this->ct= &$cont;
>   $this->classname=get_class($this);
>   }
>   #
>   function CreateDomain($d,$SecLevel="1",$UserType="1") /*UserType 1)
> reseller 2) user*/
>   {
>   $d=trim($d);
>   $new_user_id=$this->ct->syf->user_uniqid(2);
>   if(!$this->ct->db->query("insert into dominios (dominio, 
> user_id) values
> ('$d', '$new_user_id')")) {
>   die(gettext("Unable to insert new domain"));
>   }
>
>
> 
>
>> Look how I can access any member using the container class (which has a
>> reference to every class used in the script)
>
>> For ex: $this->ct->db->query...
>> The db class contained by ct (the container)
>> or $this->ct->cr->sess
>> the cr object (another container [contained in the ct] that contains all
>> the core classes=session, authentication, security)
>
> But is it true to OOPD? No :-) Workarounds can always be made, but then
> You miss the whole concept of OOPD and all the advantages. This is not
> easy read code, right?
>
>> Perhaps I should try php5, I was told it has MUCH BETTER objects.
>
> I think You WILL run into problems with the current code in PHP5, since it
> introduces private and
> public functions.

I dont think so, because nothing is declared private in the present code.

But OOPD is not the point, nor it benefits (I found that trying to to be
complaint with EVERY specification and rule is a whole job on itself).
The point of my post was to know if somebody knows a way to use this
approach consistently, without the oddities I've found while programming.

Anyway thanks A LOT for your answers (and your time), I'll try php5 and
see what happens.

>
> But if it works for You then that´s cool ;-)
>
> Sincerely
> Kim Madsen
>
>

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



Re: [PHP] opt-in mail list best practice

2005-03-17 Thread Scott Haneda
on 3/16/05 12:46 PM, Todd Trent at [EMAIL PROTECTED] wrote:

> - This could be hosted on shared hosting server.
> - Opt-in list could be less than 100 or in the 1000¹s.
> - May need a way to track sending success.

Check this out:


I use it to create HTML emails, send them to 1000's of people.  I think I
did a test to 30K or so, it handled it fine using mail locally.

As for tracking, what we do is embed a image bug in the html and track when
that loads, it is getting less reliable in todays anti spam world, but in my
case these are paying subscribers so they generally want to get these
emails.

To track your users, at least the bounces we set the bounce address
(return-path) to [EMAIL PROTECTED] and POP check domain.com every few
seconds.  We then scan for the bounce address and mark that user as bouncing
x times, if they go over y we cancel the account.

Many will want you to use mailman and such, a mailing list manager, but if
you want to do custom mailings to each person, to integrate all this is just
not gonna be easy.
-- 
-
Scott HanedaTel: 415.898.2602
 Novato, CA U.S.A.

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



[PHP] Re: Session time out

2005-03-17 Thread Jacques
Is session time measured in seconds or minutes?

Regards

Jacques


"Jacques" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> What is the life time of a PHP session object (variable)?  Which 
> conditional test can I perform to check if the session object has timed 
> out?
>
> Jacques 

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



[PHP] something stupid... split().

2005-03-17 Thread Chris Knipe
Lo all,
echo ConvertTime($AcctSessionTime/90); # Returns: 03:17:46.77
I am trying to drop the .whatever..  Thus,
list($Duration, $none) = split('.', ConvertTime($AcctSessionTime/90), 2);
However, $Duration is empty, and $none has the whole string from 
ConvertTime  As I said, something silly ;)

Thanks for the help.
--
Chris. 

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


[PHP] Re: [PEAR] Re: HTTP_Download to track amount of bytes downloaded help

2005-03-17 Thread Ken
On Thu, 17 Mar 2005 12:19:38 +0100, Ken <[EMAIL PROTECTED]> wrote:
> Header for download script
> 
> http://localhost/download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers
> 
> GET /download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers
> HTTP/1.1
> Host: localhost
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)
> Gecko/20050225 Firefox/1.0.1
> Accept: 
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://localhost/?item=repository&cat=2
> Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin;
> GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c;
> wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670;
> comment_author_86a9106ae65537651a8e456835b316ab=Administrator;
> comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com;
> visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e;
> userdetails[username]=strikers; userdetails[loggedin]=y;
> phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D;
> PHPSESSID=bb9309b20034a71e4c59382028afd1c3;
> phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716;
> phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D
> 
> HTTP/1.x 200 OK
> Date: Thu, 17 Mar 2005 11:10:04 GMT
> Server: Apache/2.0.49 (Win32) PHP/4.3.10
> X-Powered-By: PHP/4.3.10
> Pragma: cache
> Cache-Control: public, must-revalidate, max-age=0
> Accept-Ranges: bytes
> x-sent-by: PEAR::HTTP::Download
> content-disposition: attachment; filename="KPM1.avi"
> Etag: "2063849717d32dd19e534b77cabac517--856247520"
> Content-Length: 0
> Keep-Alive: timeout=15, max=84
> Connection: Keep-Alive
> Content-Type: application/x-octetstream
> *** END 
> 
> And after I refresh the page:
> ***
> http://localhost/?item=repository&cat=2
> 
> GET /?item=repository&cat=2 HTTP/1.1
> Host: localhost
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)
> Gecko/20050225 Firefox/1.0.1
> Accept: 
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip,deflate
> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 300
> Connection: keep-alive
> Referer: http://localhost/?item=repository&cat=1
> Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin;
> GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c;
> wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670;
> comment_author_86a9106ae65537651a8e456835b316ab=Administrator;
> comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com;
> visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e;
> userdetails[username]=strikers; userdetails[loggedin]=y;
> phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D;
> PHPSESSID=bb9309b20034a71e4c59382028afd1c3;
> phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716;
> phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D
> Cache-Control: max-age=0
> 
> HTTP/1.x 200 OK
> Date: Thu, 17 Mar 2005 11:10:10 GMT
> Server: Apache/2.0.49 (Win32) PHP/4.3.10
> X-Powered-By: PHP/4.3.10
> Cache-Control: no-store, no-cache, must-revalidate, max-age=0
> Pragma: no-cache
> Expires: Sat, 01 Jan 2000 00:00:00 GMT
> Set-Cookie: visited=y; expires=Fri, 18-Mar-2005 11:10:10 GMT
> Keep-Alive: timeout=15, max=80
> Connection: Keep-Alive
> Transfer-Encoding: chunked
> Content-Type: text/html; charset=ISO-8859-1
> END*
> 
> I strongly believe that this is a ffox problem. It does not happen at
> all with IE...
> 
> Ken
> 
> On Thu, 17 Mar 2005 11:43:27 +0100, Michael Wallner <[EMAIL PROTECTED]> wrote:
> > Hi Ken, you wrote:
> >
> > > Thanks for the reply
> > > Second thing:
> > > I am getting errors from refreshing the page after I cancel the download:
> > >
> > > Warning: fseek(): supplied argument is not a valid stream resource in
> > > C:\php\pear\HTTP\download.php on line 849
> > >
> > > Warning: fread(): supplied argument is not a valid stream resource in
> > > C:\php\pear\HTTP\download.php on line 855
> > >
> > > I am using firefox 1.01... i don't know if its firefox or not (since
> > > ie doesn't seem to have the error).
> > >
> > > I fixed it by adding @ in front of fseek and fread... would this have
> > > an effect on the performance?
> >
> > Yes a tiny bit, which should be neglible for downloads...
> >
> > However, the HTTP headers you receive when this happens may help a
> > lot (which shouldn't be too hard to discover with livehttpheaders).
> >
> > Does the same

[PHP] Re: [PEAR] Re: HTTP_Download to track amount of bytes downloaded help

2005-03-17 Thread Ken
i forgot to add: pressing go has the same effect as refresh.


On Thu, 17 Mar 2005 12:20:12 +0100, Ken <[EMAIL PROTECTED]> wrote:
> On Thu, 17 Mar 2005 12:19:38 +0100, Ken <[EMAIL PROTECTED]> wrote:
> > Header for download script
> > 
> > http://localhost/download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers
> >
> > GET /download.php?fid=1&SID=bb9309b20034a71e4c59382028afd1c3&user=strikers
> > HTTP/1.1
> > Host: localhost
> > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)
> > Gecko/20050225 Firefox/1.0.1
> > Accept: 
> > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> > Accept-Language: en-us,en;q=0.5
> > Accept-Encoding: gzip,deflate
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive: 300
> > Connection: keep-alive
> > Referer: http://localhost/?item=repository&cat=2
> > Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin;
> > GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c;
> > wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670;
> > comment_author_86a9106ae65537651a8e456835b316ab=Administrator;
> > comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com;
> > visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e;
> > userdetails[username]=strikers; userdetails[loggedin]=y;
> > phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D;
> > PHPSESSID=bb9309b20034a71e4c59382028afd1c3;
> > phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716;
> > phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D
> >
> > HTTP/1.x 200 OK
> > Date: Thu, 17 Mar 2005 11:10:04 GMT
> > Server: Apache/2.0.49 (Win32) PHP/4.3.10
> > X-Powered-By: PHP/4.3.10
> > Pragma: cache
> > Cache-Control: public, must-revalidate, max-age=0
> > Accept-Ranges: bytes
> > x-sent-by: PEAR::HTTP::Download
> > content-disposition: attachment; filename="KPM1.avi"
> > Etag: "2063849717d32dd19e534b77cabac517--856247520"
> > Content-Length: 0
> > Keep-Alive: timeout=15, max=84
> > Connection: Keep-Alive
> > Content-Type: application/x-octetstream
> > *** END 
> >
> > And after I refresh the page:
> > ***
> > http://localhost/?item=repository&cat=2
> >
> > GET /?item=repository&cat=2 HTTP/1.1
> > Host: localhost
> > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.6)
> > Gecko/20050225 Firefox/1.0.1
> > Accept: 
> > text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> > Accept-Language: en-us,en;q=0.5
> > Accept-Encoding: gzip,deflate
> > Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
> > Keep-Alive: 300
> > Connection: keep-alive
> > Referer: http://localhost/?item=repository&cat=1
> > Cookie: wordpressuser_86a9106ae65537651a8e456835b316ab=admin;
> > GALLERYSID=c8dd063a064de9c093628f3e5ebc9f1c;
> > wordpresspass_86a9106ae65537651a8e456835b316ab=0f2f790150e18652ee1c7ff3deb39670;
> > comment_author_86a9106ae65537651a8e456835b316ab=Administrator;
> > comment_author_email_86a9106ae65537651a8e456835b316ab=kenkam%40gmail.com;
> > visited=y; userdetails[unique]=2ab983fb60321d8de1045100c656cf5e;
> > userdetails[username]=strikers; userdetails[loggedin]=y;
> > phpbb2mysql_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A32%3A%221a1dc91c907325c69271ddf0c944bc72%22%3Bs%3A6%3A%22userid%22%3Bi%3A2%3B%7D;
> > PHPSESSID=bb9309b20034a71e4c59382028afd1c3;
> > phpbb2mysql_sid=5e345aa85f774eeece28ecae74742716;
> > phpbb2mysql_t=a%3A1%3A%7Bi%3A12%3Bi%3A057793%3B%7D
> > Cache-Control: max-age=0
> >
> > HTTP/1.x 200 OK
> > Date: Thu, 17 Mar 2005 11:10:10 GMT
> > Server: Apache/2.0.49 (Win32) PHP/4.3.10
> > X-Powered-By: PHP/4.3.10
> > Cache-Control: no-store, no-cache, must-revalidate, max-age=0
> > Pragma: no-cache
> > Expires: Sat, 01 Jan 2000 00:00:00 GMT
> > Set-Cookie: visited=y; expires=Fri, 18-Mar-2005 11:10:10 GMT
> > Keep-Alive: timeout=15, max=80
> > Connection: Keep-Alive
> > Transfer-Encoding: chunked
> > Content-Type: text/html; charset=ISO-8859-1
> > END*
> >
> > I strongly believe that this is a ffox problem. It does not happen at
> > all with IE...
> >
> > Ken
> >
> > On Thu, 17 Mar 2005 11:43:27 +0100, Michael Wallner <[EMAIL PROTECTED]> 
> > wrote:
> > > Hi Ken, you wrote:
> > >
> > > > Thanks for the reply
> > > > Second thing:
> > > > I am getting errors from refreshing the page after I cancel the 
> > > > download:
> > > >
> > > > Warning: fseek(): supplied argument is not a valid stream resource in
> > > > C:\php\pear\HTTP\download.php on line 849
> > > >
> > > > Warning: fread(): supplied argument is not a valid stream resource in
> > > > C:\php\pear\HTTP\download.php on line 855
> > > >
> > > > I am using firefox 1.01... i don't know if its firefox or not (since
> > > > ie doesn't seem to have the error)

[PHP] db to xml using php

2005-03-17 Thread K Karthik
sir,

i downloaded the zip from
http://php.chregu.tv/sql2xml/. and then i couldnt know what i am suppose
to do..
when i tried running the file am getting error
Fatal error: main() [function.require]: Failed opening required
'XML/sql2xml.php' (include_path='.:/usr/local/lib/php') in
/home/kkarthik/web/XML_sql2xml-0.3.2/sql2xml_ext.php on line 20
what shd i do..
thanks,
karthik
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] something stupid... split().

2005-03-17 Thread Chris Knipe
[] was the answer... Something stupid sorted :)
--
Chris
- Original Message - 
From: "Chris Knipe" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, March 17, 2005 1:16 PM
Subject: [PHP] something stupid... split().


Lo all,
echo ConvertTime($AcctSessionTime/90); # Returns: 03:17:46.77
I am trying to drop the .whatever..  Thus,
list($Duration, $none) = split('.', ConvertTime($AcctSessionTime/90), 2);
However, $Duration is empty, and $none has the whole string from 
ConvertTime  As I said, something silly ;)

Thanks for the help.
--
Chris. 

--
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] something stupid... split().

2005-03-17 Thread Kim Madsen
-Original Message-
From: Chris Knipe [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 17, 2005 12:16 PM
To: php-general@lists.php.net
Subject: [PHP] something stupid... split().

> echo ConvertTime($AcctSessionTime/90); # Returns: 03:17:46.77

> I am trying to drop the .whatever..  Thus,

> list($Duration, $none) = split('.', ConvertTime($AcctSessionTime/90),
2);


> However, $Duration is empty, and $none has the whole string from 
> ConvertTime  As I said, something silly ;)

"." means any char in regular expressions.

list($Duration, $none) = split('\.', ConvertTime($AcctSessionTime/90),
2);

will do the trick for ya.

--
Med venlig hilsen / best regards
ComX Networks A/S
Kim Madsen
Systemudvikler/Systemdeveloper
Naverland 31

DK-2600 Glostrup
www.comx.dk
Telefon: +45 70 25 74 74
Telefax: +45 70 25 73 74
E-mail: [EMAIL PROTECTED]

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



RE: [PHP] How to access any function of a any class?

2005-03-17 Thread pf
>> I dont think so, because nothing is declared private in the present
>> code.
>
> But they _might_ be as default in PHP5 ;-) That´s the really annoying
> difference between JAVA and C++, one is public by default, the other is
> private by default. I don´t know which approach they´ve chosen in PHP5, I
> would be surprised if they chose to do it different than C++, since these
> languages are very similar, syntax-wise, IE it´s public
>
>> The point of my post was to know if somebody knows a way to use this
>> approach consistently, without the oddities I've found while
>> programming.
>
> Inherit is the way to do it, the whole idea of OOPD is to give access to
> only the stuff the user needs:
>
> Class User {
>   Function list_users(){}
> }
> Class Supervisor extends User {
>   Function edit_users(){}
> }
> Class Admin extends Supervisor {
>   Function delete_users(){}
> }
> Class Ceo extends Supervisor {
>   Function sack_employee(){}
> }
>

Nice clear example, it very clearly shows the OOP design concept.
But (and there's always a but ;) real life problems are not so easy to
abstract all the time, and inevitable you always end "fixing something in
a rush" just to make it work (you know what I mean ;)
This doesn't mean you care little of the quality or security or speed of
your code, but as Lee Iacocca (GM's former ceo) used to say "don`t matter
how much information you collect before, to hit the duck you will almost
always end moving the rifle" (not exactly quote, but that's the idea).
So unless you go trough a strict programming cycle, defining precisely
prerequisites, use cases, identifying objects, etc, etc all things you
would expect more in a "serious" (read big) company, you (read I) just
write down the main objects I can think off, then write a couple of ideas
of what the client wants (read what I would want if I was him) and then
start writing some code.
In this my "OOPD killing" design approach :), 100% of the time is more
usefull to keep things all accesible so you can use them the second you
need them and rely in other means for access restriction (permissions,
etc).

Anyway, the way you mention is THE way to go, definitly, but you have that
little overhead of pre design tasks, that are not always worth, except in
big collaborative envs, etc.


> This way an instance of supervisor can list and edit users, but NOT delete
> them
> Admin can also delete them, but not fire any
> The CEO can fire a person, but not delete a user (for a number of reasons)
>
> YOU wanna give the user access to all, not good ;-)
>
>> Anyway thanks A LOT for your answers (and your time), I'll try php5 and
>> see what happens.
>
> No problem :-)
>
> /Kim
>
>
>

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



[PHP] multiple OR's

2005-03-17 Thread AndreaD
Looking for the most code efficient way to do multiple boolean OR's on one 
line

if ($name==andrea) OR ($name==john)

Ta

AD 

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



[PHP] multiple OR's

2005-03-17 Thread AndreaD
Looking for the most code efficient way to do multiple boolean OR's on one 
line

if ($name==andrea) OR ($name==john)

Ta

AD 

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



[PHP] multiple OR's

2005-03-17 Thread AndreaD
Looking for the most code efficient way to do multiple boolean OR's on one
line

if ($name==andrea) OR ($name==john)

Ta

AD

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



Re: [PHP] multiple OR's

2005-03-17 Thread eoghan
can do:
if ($name==andrea || $name==john)
On 17 Mar 2005, at 11:59, AndreaD wrote:
if ($name==andrea) OR ($name==john)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Data and time problem

2005-03-17 Thread virtualsoftware
Hi,
I have a mysql database where i store a user name and date when he registered. 
The date format is like this 2005-03-17 02:41:51.

How can i found out how many minutes passed from the date he registered till 
now.

Thanks in advance for your help !

[PHP] Re: SimpleXML and xpath woes

2005-03-17 Thread Simon Turvey
Rob Richards kindly sent me the following response via email - posting it here 
as he's not subscribed.
You need to register a namespace for XPath since there's a default 
namesapce.

$xml = simplexml_load_file('test.xml');
/* Register arbitrary namesapce prefix for xpath*/
$xml->registerXPathNamespace('p', 
'http://webservices.amazon.com/AWSECommerceService/2005-02-23');
$query = '//p:ItemLookupResponse';
$result = $xml->xpath($query);
var_dump($result);
Just to add to this: the registerXPathNamespace method is only present in 
CVS/snapshot builds and is
scheduled for the 5.1 release.
Cheers,
Simon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] can I do a for each here??

2005-03-17 Thread AndreaD
I have about 10 text boxes each taking in value (ages) , The code I have 
checks for a value and if it is set it then sets the cookie to that value. 
The else just clears the value. On the next page I use a foreach to get the 
values but I think there must be a quicker way to collect the data appart 
from 10 if-else staements.

if (isset($andrea){

setcookie("cookie[andrea]", "$andrea");
}

else {setcookie("cookie[$andrea]", "");

}


if (isset($james){

setcookie("cookie[james]", "$james");
}

else {setcookie("cookie[$james]", "");

}


AD 

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



[PHP] Re: multiple OR's

2005-03-17 Thread AndreaD
This works...

if ($name == jim || andrea || tommy)

I must have had an extra ( somewhere.

AD

"AndreaD" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Looking for the most code efficient way to do multiple boolean OR's on one 
> line
>
> if ($name==andrea) OR ($name==john)
>
> Ta
>
> AD 

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



Re: [PHP] can I do a for each here??

2005-03-17 Thread Chris Ramsay
Difficult to be definitive without seeing your code, but I would be
tempted by the use of arrays...

cheers

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



Re: [PHP] multiple OR's

2005-03-17 Thread anirudh dutt
and if u've got several checks for just $name, u could use in_array
(http://php.net/in_array).

if (in_array($name, array('andrea', 'john', 'jane')))

it's case sensitive so if the array has all lower-case letters, u
might wanna use strtolower (http://php.net/strtolower) on $name.

for general cases of OR...
On Thu, 17 Mar 2005 12:32:20 +, eoghan <[EMAIL PROTECTED]> wrote:
> can do:
> if ($name==andrea || $name==john)
> 
> On 17 Mar 2005, at 11:59, AndreaD wrote:
> > if ($name==andrea) OR ($name==john)

-- 
]#
Anirudh Dutt


...pilot of the storm who leaves no trace
like thoughts inside a dream

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



Re: [PHP] Data and time problem

2005-03-17 Thread kalinga
store the date as a 'unix timestamp', so you can easily compare
the stored timestamp with the current timestamp, by doing a 
simple calculation you can get the duration in minutes without
a headache.

http://www.php.net/time

vk.


On Thu, 17 Mar 2005 14:32:48 +0200, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> Hi,
> I have a mysql database where i store a user name and date when he 
> registered. The date format is like this 2005-03-17 02:41:51.
> 
> How can i found out how many minutes passed from the date he registered till 
> now.
> 
> Thanks in advance for your help !
> 


-- 
vk.

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



RE: [PHP] showing the decimal places

2005-03-17 Thread Jay Blanchard
[snip]
when I define a number as

$number = 2.00

then echo it the number shows as 2. How can I get the two zeros to show?

This is not in any of my books but a fairly easy solution I'll bet!
[/snip]

http://www.php.net/number_format

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



Re: [PHP] can I do a for each here??

2005-03-17 Thread Marek Kilimajer
AndreaD wrote:
I have about 10 text boxes each taking in value (ages) , The code I have 
checks for a value and if it is set it then sets the cookie to that value. 
The else just clears the value. On the next page I use a foreach to get the 
values but I think there must be a quicker way to collect the data appart 
from 10 if-else staements.

if (isset($andrea){
setcookie("cookie[andrea]", "$andrea");
}
else {setcookie("cookie[$andrea]", "");
}
if (isset($james){
setcookie("cookie[james]", "$james");
}
else {setcookie("cookie[$james]", "");
}
$names = array('andrea', 'james', ...);
foreach($names as $name) {
  if (isset($_POST[$name]){
setcookie("cookie[$name]", $_POST[$name]);
  } else {
setcookie("cookie[$name]", "");
  }
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] can I do a for each here??

2005-03-17 Thread AndreaD
Think what I want to do then is create two arrays, one for the values of the 
age and one for the correponding name e.g.

$age  = array() // this is the inputed textbox values
$name= array('john', 'bob', 'tim')

Then I need to assign the the ages to cookie of the persons name by using a 
for or do-while loop.

loop{
if (isset($age[x])){setcookie("cookie[ $name[x] ]", "$age[x]");}
else {
setcookie("cookie[ name[x] ]", "");}

}end loop

Any suggestion how I would execute this would be fantactic. Not to worry I 
can just have 10 lines if need be.

AD


"Chris Ramsay" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Difficult to be definitive without seeing your code, but I would be
> tempted by the use of arrays...
>
> cheers 

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



[PHP] function troubles...

2005-03-17 Thread William Stokes
I don't know whats wrong with this. Can someone help please.



This will print: "shaisse" but nothing else. I need to know why the other 
variables won't print. The sql query worksand echoes work if not used in 
function. I tested it in an other file and it worked but when I put it in a 
function it doesn't work.

Help Appreciated!
Thanks
-Will 

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



Re: [PHP] Re: multiple OR's

2005-03-17 Thread Jeff Schmidt

AndreaD wrote:
This works...
But not the way you think it does.
if ($name == jim || andrea || tommy)
This if statement will first check to see if $name == "jim" (oh yeah, 
you are missing quotes around jim, andrea, and tommy, by the way). Then, 
it does *NOT* check to see if $name == andrea. Instead, what it does, is 
it treats "andrea" as a seperate test condition. A simple value by 
itself, with no logical operator, gets automatically cast to a boolean 
value. Because the string "Andrea" is not empty ("") or "0", PHP casts 
it as TRUE. (See 
http://www.php.net/manual/en/language.types.boolean.php#language.types.boolean.casting 
for more details).

So, this conditional is always true (assuming andrea and tommy are 
wrapped in string delimters so that they are strings; it could be 
possible that you have defined constants called jim, andrea, and tommy, 
in which case you don't need the quotes - in any case, the same basic 
principle applies - the == operator only applies to jim). Even if $name 
= 'Bob', your conditional will evaluate to TRUE, and your code block 
will execute. I suspect this is not the behavior you want.

As an earlier poster suggested, the best way to do this would be to use 
the in_array construct, which tests to see if the first value is in the 
array specified as the second value.

if (in_array($name, array("jim", "andrea", "bob")))
{
//code here
}
Jeff Schmidt
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Ensure only one instance of a script is running

2005-03-17 Thread Jeremiah Fisher
Test for a lock file when the script starts, and remove it when the 
script ends. This isn't 100% reliable, but it's the typical solution to 
this problem. If the script fails, the lock file may not be removed 
(ever have a Mozilla browser crash and tell you the default profile is 
locked?), so be careful with your error handling!


// test for lock file
if ( !$f = fopen( 'lock', 'r')) {
// touch the lock file
$f = fopen( 'lock', 'w');
fwrite( $f, 'lock');
fclose( $f);
} else {
// lock file exists; another instance must be running (we hope)
echo 'Error: An instance of this script is already running!';
exit( 1);
}
/* script stuff */
// remove the lock file for the next instance
unlink( 'lock');
?>
Shaun wrote:
Hi,
I have a script that inserts data from files uploaded to our server. I need 
to make sure that only one instance of this script runs at anyone time, can 
anyone tell me how I can do this?

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


Re: [PHP] function troubles...

2005-03-17 Thread Chris Ramsay
Will

Whatever you are making available in the required file sql.php, it is
not accessible by the function shit_func. Define the connection string
or whatever as a global inside function shit_func and it should work,
else make the connection within the function - not such a good idea...

chris

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



[PHP] Re: db to xml using php

2005-03-17 Thread Jason Barnett
K Karthik wrote:
...
> i downloaded the zip from
> http://php.chregu.tv/sql2xml/. and then i couldnt know what i am suppose
> to do..
> when i tried running the file am getting error
>
> Fatal error: main() [function.require]: Failed opening required
> 'XML/sql2xml.php' (include_path='.:/usr/local/lib/php') in
> /home/kkarthik/web/XML_sql2xml-0.3.2/sql2xml_ext.php on line 20

Apparently PHP looked for XML/sql2xml.php in the folder . and the folder
/usr/local/lib/php.  However, it wasn't in either of those places.  So
either change your include_path or move the include to a directory in
your include_path.


--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] Re: Strange PHP5 message

2005-03-17 Thread Jason Barnett
Andrei Verovski wrote:
> Hi, Jason,
>
> Thanks a lot for suggestion. Does it mean that I have tried to
> serialize some object (like adodb db object)? How I can eliminate this?
> I really cannot find where this object or whatever else is going to be
> serailized. The problematic line of code just serialized an array.
>
...

Yes, you tried to serialize some object.  But rather than *not*
serializing the object, what you really want to do is to fix your
__sleep function.  Serializing objects is "A Good Thing." (tm)

I don't know what your class is, but you need __sleep to return an array
of class properties.  Certainly you can look at the last code example
that I provided and figure out how to do that.  Or at least I hope that
you can ;)

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] can I do a for each here??

2005-03-17 Thread Jeff Schmidt
I would be tempted to do the following.
First, I would setup the html form so that the text boxes are named 
something like 'age[Andrea]', 'age[Bob]', etc. When the form submitted, 
this will give you an array, accessible as $_POST['age'] (or 
$_GET['age'] depending on whether you used POST or GET form submission 
method).

This array would look like ("Andrea" => "25", "Bob" => "13", etc).
Then, I would use the following:
foreach($_POST['age'] as $name => $age)
{
  setcookie("cookie[$name]", $age);
}
Although, unfortunately, this approach you take of using seperate 
cookies for all your different stored value is what I call cookie bloat. 
I would suggest you look at PHP's built-in session handling facilities.

http://www.php.net/manual/en/ref.session.php
 The way the session handling works is, in a nutshell, at the start of 
each of your scripts, you call session_start(). Then, you can access 
session variables as $_SESSION['name']. You can use the isset() operator 
to test to see if you already set a session variable, and you can use 
any of the normal access methods to manipulating the variable. You 
assign to it with $_SESSION['name'] = "value", you can get the value 
just by using $_SESSION['name'] anywhere you would otherwise use a 
variable or constant (e.g. if($_SESSION['ages']['Andrea'] > 18) {echo 
"You have been selected for Jury duty.";}.

(All this assumes your hosting provider has setup PHP for you, and 
configured the session handler. If that is not the case, then cookies 
might be an easier way to go. Depending on how ambitious you feel, and 
how much control you have of your site, you might also setup session 
handling yourself - it's not incredibly difficult, just read the 
documentation).

With that in mind, I would alter my above code to be the following:
foreach($_POST['age'] as $name => $age)
{
  $_SESSION['age'][$name] = $age;
}
AndreaD wrote:
Think what I want to do then is create two arrays, one for the values of the 
age and one for the correponding name e.g.

$age  = array() // this is the inputed textbox values
$name= array('john', 'bob', 'tim')
Then I need to assign the the ages to cookie of the persons name by using a 
for or do-while loop.

loop{
if (isset($age[x])){setcookie("cookie[ $name[x] ]", "$age[x]");}
else {
setcookie("cookie[ name[x] ]", "");}
}end loop
Any suggestion how I would execute this would be fantactic. Not to worry I 
can just have 10 lines if need be.

AD
"Chris Ramsay" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

Difficult to be definitive without seeing your code, but I would be
tempted by the use of arrays...
cheers 

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


Re: [PHP] opt-in mail list best practice

2005-03-17 Thread Jason Barnett
Scott Haneda wrote:
...
> I use it to create HTML emails, send them to 1000's of people.  I think I
> did a test to 30K or so, it handled it fine using mail locally.

HTML emails [shudder]

> As for tracking, what we do is embed a image bug in the html and track when
> that loads, it is getting less reliable in todays anti spam world, but in my
> case these are paying subscribers so they generally want to get these
> emails.

[shudder]
The above paragraph is why I abhor HTML emails, and why I am glad that
Mozilla lets me block all remote images (and click to view if I *really*
want to see them).

>
> To track your users, at least the bounces we set the bounce address
> (return-path) to [EMAIL PROTECTED] and POP check domain.com every few
> seconds.  We then scan for the bounce address and mark that user as bouncing
> x times, if they go over y we cancel the account.

Now this is interesting... so you're telling me that all I have to do to
get you to stop emailing me, is to bounce back all of your messages?
Sure I'll have to forge a few headers to make it look like the mail
server daemon didn't recognize my address... but THAT sounds like time
well spent!!!

OK, OK, I'm being a little harsh here.  Because after all you're sending
emails to customers that have at least opted-in (or so I hope).  But
there are so many shady ways of getting someone to opt-in, or making it
hard to opt-out, or just plain harvesting emails and ignoring the wishes
of the users.

So yeah, sometimes when I hear about these things it just rubs me the
wrong way.  To anyone reading this: please use these techniques
judiciously if you use them at all.

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


[PHP] Re: Session time out

2005-03-17 Thread Jason Barnett
Jacques wrote:
> Is session time measured in seconds or minutes?
>

seconds

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] can I do a for each here??

2005-03-17 Thread Jeff Schmidt
Yeah, after hitting the send button, I looked again at what I sent and 
realized something else. Having already caused PHP to put the stuff into 
an array, by the way I suggested constructing the form, you can 
eliminate the foreach loop, and just use the assignment operator to get 
PHP to copy the array from $_POST to $_SESSION (although, you might want 
to do some validation code, in which case you probably do want to use 
the foreach block, so that you have a chance to validate each of the 
submitted values, and the keys [sometimes it's usefull to validate the 
keys, to check to see if someone has forged a form submission with 
values other than what they are supposed to be using]).

But, assuming you aren't worried about validating, you could do like this:
$_SESSION['age'] = $_POST['age'];
But, honestly, I would still use the foreach loop, check the values of 
$name and $age to make sure they are legal, and in the correct format, 
and then assign them individually, as before.

Jeff
Jeff Schmidt wrote:
I would be tempted to do the following.
First, I would setup the html form so that the text boxes are named 
something like 'age[Andrea]', 'age[Bob]', etc. When the form submitted, 
this will give you an array, accessible as $_POST['age'] (or 
$_GET['age'] depending on whether you used POST or GET form submission 
method).

This array would look like ("Andrea" => "25", "Bob" => "13", etc).
Then, I would use the following:
foreach($_POST['age'] as $name => $age)
{
  setcookie("cookie[$name]", $age);
}

[snip]
With that in mind, I would alter my above code to be the following:
foreach($_POST['age'] as $name => $age)
{
  $_SESSION['age'][$name] = $age;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Session in URL [RESOLVED}

2005-03-17 Thread Mignon Hunter

I had my admin change the 
session.use_trans_sid = 1
to =0
no more sess ID in the URL - woo hoo

I guess this has to be 0 or in later versions 4.3.0
session.use_only_cookies = 1


*
Hello

I have tested this app on my machine but it doesnt do this - but when testing 
on development server, my script is displaying the session in the url.  I was 
reading in man about session.use_only_cookies can keep this from happening but 
the dev server has php 4.1.2

Is there another way to stop this?

My script is such:

 while($row = mysql_fetch_row($res))
{
echo "$row[1]";
}

where $row[0] is a filename like filename.pdf 

But when sess_download_p2.php loads in browser the URL has ...&PHPSESSID=(rand 
number)

Thanks for any help

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



[PHP] Re: can I do a for each here??

2005-03-17 Thread AndreaD
Thanks for all your replies.

I liked Jeffs approach as it was more straightforward and  using 
age[Andrea] for the texboxes creates les confusion when doing the foreach 
statement.

I didn't quite get the cookie vs session bit. Are you saying they [cookies] 
use greater resources?

AD

"AndreaD" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>I have about 10 text boxes each taking in value (ages) , The code I have 
>checks for a value and if it is set it then sets the cookie to that value. 
>The else just clears the value. On the next page I use a foreach to get the 
>values but I think there must be a quicker way to collect the data appart 
>from 10 if-else staements.
>
> if (isset($andrea){
>
> setcookie("cookie[andrea]", "$andrea");
> }
>
> else {setcookie("cookie[$andrea]", "");
>
> }
>
>
> if (isset($james){
>
> setcookie("cookie[james]", "$james");
> }
>
> else {setcookie("cookie[$james]", "");
>
> }
>
>
> AD 

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



RE: [PHP] Encrypted 2.5+M files do upload, but don't create a record when stored as LongBlobs (PHP/Apache/MySQL)

2005-03-17 Thread Steven Altsman
This may be a stupid question. If it is, could somebody do a one line reply
of "it is." That way I will know to turn my attention elsewhere.

I've gone through about 45 pages of archives trying to glean anything useful
out of it, and either it's the same answer or the version is about 4 years
out of date.

-Original Message-
From: Steven Altsman [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 16, 2005 12:15 PM
To: php-general@lists.php.net; users@httpd.apache.org
Subject: [PHP] Encrypted 2.5+M files do upload, but don't create a record
when stored as LongBlobs (PHP/Apache/MySQL)

Files under 2.5 megs will go into the database just fine, any thing over
that will return the page without errors, but will not be injected into the
database.  Not even a record is created.

Edited PHP.INI to allow up to 40M of data to be uploaded.  Set the script
timeout to be 9000 seconds.  Set the script operational memory to 80M.  I
did a print_r of $_FILES and the results show that there is a file in the
tmp directory, but I'm not sure after that if there is a problem with mcrypt
or MySQL.  I did read something about a limitation of MySQL and max packet
size between server and client, but only 4.1 or less is mentioned with that.
I also switched from the fopen/fread combo and did file_get_contents
instead, as it was recommended to be more efficient.

http://us4.php.net/fopen
http://us4.php.net/fread
http://us4.php.net/file_get_contents
http://us3.php.net/mcrypt
http://us3.php.net/features.file-upload
http://us3.php.net/print_r

http://www.ispirer.com/doc/sqlways38/Output/SQLWays-1-195.html
http://www.totalchoicehosting.com/forums/lofiversion/index.php/t10276.html
http://www.chipmunk-scripts.com/board/index.php?forumID=27&ID=1674
http://scripts.franciscocharrua.com/database-file-upload-download.php
http://www.hotscripts.com/Detailed/33694.html

http://www.google.com

If there is any other links to M's that I haven't R'ed, please let me know.
Otherwise I'm clueless.  Google gives me a metric tonne of information, but
it is mostly people asking the same question I am with recommendations on
editing the PHP.INI.  Obviously this is a useful script that many people
have written in their own way for their own needs, and I'm sure they've run
into the same problem I'm encountering now.

Using MySQL 5.0.2, PHP 5, newest mcrypt, mhash, Apache 2, FC 3, it is on
port 443 with a valid SSL cert, and if you need to know any other version or
variable info I will gladly provide it.


-=-=-=-=-=-=- /docs/phpinfo.php -=-=-=-=-=-

allow_call_time_pass_reference On On 
allow_url_fopen On On 
always_populate_raw_post_data Off Off 


8< -- Snip Snip --- 8< 

version_comment Official MySQL RPM 
version_compile_machine i686 
version_compile_os pc-linux 
wait_timeout 28800

-- 
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] Different approach?

2005-03-17 Thread John Taylor-Johnston
Hi,

I've read:

> http://dev.mysql.com/doc/mysql/en/create-table.html

Would anyone code/approach this differently?

#
$server = "localhost";
$user = "myname";
$pass = "mypass";
$db = "mydb";
$table = "demo_assignment1";

#
$myconnection = mysql_connect($server,$user,$pass);

#
$sql = "CREATE TABLE IF NOT EXISTS `demo_assignment1` (
`StudentNumber` varchar(8) NOT NULL default '',
`Exercise1` varchar(100) NOT NULL default '',
`Exercise2` varchar(100) NOT NULL default '',
`TimeStamp` timestamp(14) NOT NULL,
PRIMARY KEY  (`TimeStamp`)
) TYPE=MyISAM COMMENT='place something here';";

mysql_select_db($db,$myconnection);
mysql_query($sql) or die(print mysql_error());


#
$sql = "INSERT INTO $table
(StudentNumber,Exercise1,Exercise2) values
('$StudentNumber','$Exercise1','$Exercise2')";

mysql_select_db($db,$myconnection);
mysql_query($sql) or die(print mysql_error());

mysql_close($myconnection);

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



Re: [PHP] showing the decimal places

2005-03-17 Thread Jochem Maas
[EMAIL PROTECTED] wrote:
when I define a number as
$number = 2.00
then echo it the number shows as 2. How can I get the two zeros to show?
This is not in any of my books but a fairly easy solution I'll bet!
please consider php.net as your book too ;-)
have fun with the following:

$newLine = ($viaWeb = isset($_SERVER["HTTP_HOST"]))
 ? ""
 : "\n";
$number = 2.00;
echo $number;   echo $newLine;
var_dump( $number );if ($viaWeb) { echo $newLine; }
printf("%0.2f", $number); echo $newLine;
echo number_format( $number, 2 );   echo $newLine;
echo sprintf("%01.2f", $number);  echo $newLine;
echo number_format(123456789, 2, ",", " "); echo $newLine;
R. 

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


Re: [PHP] Encrypted 2.5+M files do upload, but don't create a record when stored as LongBlobs (PHP/Apache/MySQL)

2005-03-17 Thread Jason Barnett
Steven Altsman wrote:
> This may be a stupid question. If it is, could somebody do a one line reply
> of "it is." That way I will know to turn my attention elsewhere.
>
...

It's not a stupid question, it's just that the people that have read it
so far (including me) don't really know the answer.  I seem to recall
that Raditha Dissanayake had an upload script that let you do larger
uploads... just look in the archives for his messages and look for the
link in his signature.

HTH

--
Teach a man to fish...

NEW? | http://www.catb.org/~esr/faqs/smart-questions.html
STFA | http://marc.theaimsgroup.com/?l=php-general&w=2
STFM | http://php.net/manual/en/index.php
STFW | http://www.google.com/search?q=php
LAZY |
http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins


signature.asc
Description: OpenPGP digital signature


Re: [PHP] PHP source code formatter for OS X

2005-03-17 Thread Jochem Maas
DuSTiN KRySaK wrote:
Does anyone know of a PHP source code formatter to clean up sloppy code 
that runs on OS X?
maybe the php tidy extension works?
http://php.net/tidy
d
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] getting text with strange encodng

2005-03-17 Thread Diana Castillo
Does anyone know what kind of string encoding this is :
®®
mA®
and how can I decode this?

-- 
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039 Ext 216
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
  http://www.destinia.com

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



Re: [PHP] migrating to PHP 5 + Apache 2 from PHP 4.3.8 + Apache 1.3.33.

2005-03-17 Thread Rasmus Lerdorf
symbulos partners wrote:
Dear friends,
we would like to migrate a server where we host several websites (in virtual
hosting) to PHP 5 with Apache 2.
Technical support at the hosting provider told us there are still problems
about safety of threads on php 5 + Apache 2 (management of memory). They
would propose to migrate Apache to the pre-fork version in order to avoid
these problems (but we would be unable to use all the features of Apache
2). 

Is that right?
Yes, if you are going to use Apache2, use the prefork MPM.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] file/array manipulation

2005-03-17 Thread Jochem Maas
Mignon Hunter wrote:
Ok I got this to work but I'm not sure how -- and am having trouble 
re-producing the data:
My script I have so far is:
$lines = file('test2.csv');
foreach ($lines as $line) {
	$line_split = explode(",", $line);
	if(!(empty($line_split[0]) ) ){
		//echo "I'm not empty";
		$new_array = array(
			$line_split[0] => $line_split[1]
			);	   
		}		
		print("");
		print_r($new_array);
		print("");		
		//echo "" . $new_array[0] . "" . $new_array[1] . "";// this doesnt work			
}

Here's what the printed format spits out (abbreviated):
Array
(
[R] => "ABC company
)
Array
(
[R] => "ABC company
)
Array
(
[R] => "ABC company
)
Array
(
[R] => "ABC company
)
Array
(
[O] => XYZ company
)
Array
(
[O] => XYZ company
)
Array
(
[O] => XYZ company
)
Array
(
[O] => XYZ company
)
So - I'm getting the write letters assigned to write companys which is great. 
But my echo line:
echo "" . $new_array[0] . "" . $new_array[1] . "";// this doesnt work	
given the array you printed above:

foreach ($new_array as $k => $v) {
echo "{$k}{$v}";
}
Do I have several arrays or a multidim array?
you create a single array for each line of the csv file. each array
contains one item. what you have done is assign the first field's value as the 
key of the
array item, and the second field's value as the array items value.
$t = array( "R" => "ABC company"); // array with 1 item, using associative key
var_dump($t[ "R" ],$t[ 0 ]);
$t = array( "R" , "ABC company");  // array with 2 items, using implicit 
numeric keys
var_dump($t[ "R" ],$t[ 0 ]);
Thanks for any guidance

"Richard Lynch" <[EMAIL PROTECTED]> 03/15/05 10:39AM >>>

Hello
I'm trying to manipulate a text(.csv) file using php. I've read the file
and can print each line,
but I need to write where column A is missing
ColumnAColumnB
RABC company
 ABC company
 ABC company
 ABC company
OXYZ company
  XYZ company
  XYZ company
  XYZ company
What I need to do is write a while loop (I think) to interate through the
lines and populate ColumnA
while ColumnB equals $var (ABC company, XYZ company), so that I end up
with:
ColumnAColumnB
RABC company
RABC company
RABC company
RABC company
OXYZ company
OXYZ company
OXYZ company
OXYZ company
Is this possible. What I've got so far to print out the file:
$lines = file('test2.csv');

$category = '';

// Loop through our array, and show line and numbers too.
foreach ($lines as $line_num => $line) {
 echo "Line #{$line_num} : " . $line . "\n";

//Assuming it's the FIRST character of each line that has space or category:
//Check first character:
if ($line[0] != ' ' && $line[0] != "\t"){
  $category = $line[0];
}
echo "$category\t", trim(substr($line, 1)), "\n";

}
Thanks in advance
--
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] multiple OR's

2005-03-17 Thread Chris Shiflett
AndreaD wrote:
Looking for the most code efficient way to do multiple boolean OR's on one 
line

if ($name==andrea) OR ($name==john)
If you put an opening brace after that, you'll get a parse error. You're 
also treating andrea and john as constants, which I'm guessing isn't 
what you mean. I think you were wanting:

if ($name == 'andrea' || $name == 'john')
If you have a bunch of these conditions, a switch might be convenient:
switch ($name)
{
case 'andrea':
case 'john':
case 'chris':
case 'rasmus':
case 'andi':
case 'zeev':
echo 'The name was one of those';
break;
default:
echo 'The name wasn't one of those';
}
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] getting text with strange encodng

2005-03-17 Thread Chris Shiflett
Diana Castillo wrote:
Does anyone know what kind of string encoding this is :
®®
mA®
and how can I decode this?
That looks almost like an HTML entity:
®
Assuming that's what it is, and you just left off the semicolon, you can 
decode it with this:

html_entity_decode()
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] can I do a for each here??

2005-03-17 Thread Chris Shiflett
AndreaD wrote:
I have about 10 text boxes each taking in value (ages), The code I have
checks for a value and if it is set it then sets the cookie to that value.
The else just clears the value. On the next page I use a foreach to get the
values but I think there must be a quicker way to collect the data appart
from 10 if-else staements.
if (isset($andrea){
setcookie("cookie[andrea]", "$andrea");
}
else {setcookie("cookie[$andrea]", "");
}
Let's look at your two setcookie() calls:
setcookie("cookie[andrea]", "$andrea")
setcookie("cookie[$andrea]", "")
Just for debugging purposes, assume $andrea is initialized prior to this 
as follows:

$andrea = 29;
So, your code says that you want a cookie with the following name and 
value (available on the next request):

$_COOKIE['cookie[andrea]'] = 29;
Is that really what you want?
Of course, it's very odd that if $andrea is not set, you want a cookie 
like this:

$_COOKIE['cookie[]'] = '';
In addition, you will be generating a notice, because you're using 
$andrea in the name of the cookie, although you're first making certain 
that $andrea isn't set.

I'm also a bit concerned about where $andrea originates. Is this coming 
from the user, and you're trusting it? That's a very dangerous practice.

If you explain your problem, we might be able to offer some help.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] Files upload - Encrypt into a variable - Do not inject into db (PHP/Apache/MySQL)

2005-03-17 Thread Steven Altsman
Yes, the link is http://www.radinks.com/upload/config.php

file_uploads = On
upload_max_filesize = 40M
max_input_time = 9000 (seconds)
memory_limit (not limited, per handload config, from source)
max_execution_time = 9000 (seconds)
post_max_size = 40M

also, hidden INPUT tag MAX_FILE_SIZE with value="4", which I'm guessing
needs it in kilobytes.

Radditha has a pretty sweet upload script going on there.. however, not sure
if it contains the same security requirements I've got.

Per GLBA requirements, my data has to be stored no more than 48 hours and
must be encrypted with 128-bit or higher algorithms.  I'm starting to
suspect that I have more lists I've got to sign up with, as it may be MCRYPT
or MySQL that is barfing because of it.

If that is all I can tweak in PHP, then I'm definitely hitting a dead-end on
this list.

Thank you for your time.

-Original Message-
From: Jason Barnett [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 17, 2005 10:35 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Encrypted 2.5+M files do upload, but don't create a
recordwhen stored as LongBlobs (PHP/Apache/MySQL)

Steven Altsman wrote:
> This may be a stupid question. If it is, could somebody do a one line
reply
> of "it is." That way I will know to turn my attention elsewhere.
>
...

It's not a stupid question, it's just that the people that have read it
so far (including me) don't really know the answer.  I seem to recall
that Raditha Dissanayake had an upload script that let you do larger
uploads... just look in the archives for his messages and look for the
link in his signature.

HTH

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



Re: [PHP] Help with dates

2005-03-17 Thread Jochem Maas
Kevin wrote:
Dear mr. Maas,
no need for 'mr' :-)
First of all my appologies for taking so long to respond. I had a family
death to attend to.
my condolences.
there is no need to apologise in any case.
...
why is OBC relevant, I read later on that you take the start of egyptian
civilization as zero. is that not much earlier.

Well it's relevant to make a baseline so that I can calculate the difference
from then until now. That's the only reason thusfar.

whats the structure of the egyptian|rpg calendar?

A year consists of 769 days, 13 months of 63 days a month, except for month
13 which has 14 days. Every month has 7 weeks of 9 days, of course month 13
is the exception. A day is 24 hours.
a few thoughts:
1. you have a date in both calendars which represent the same day?
and/or rather what is day zero in the egyptian calendar in the gregorian
calendar?
2. maybe you should store the date internally as number of days since zero,
where zero is the first day on the egyptian calendar ..
er, checking this thread again, Richard Lynch puts it better than I can so
I'll just let you read his answer (again?) and hope it helps!
oh one last thing: I notice that in the function you posted you did this:
# Calculating the year in Egypt.
$yr_Egypt  = floor($EgyptianDays / 769);
# Calculating the Month in Egypt.
$mnt_Egypt  = round( ($EgyptianDays-($yr_Egypt*769)) / 63 );
# Calculating the Day in Egypt.
$dy_Egypt  = round( $EgyptianDays - (($yr_Egypt * 769) + ($mnt_Egypt * 63)) 
);
# Filling the date array variable with the day, month and year of the
Egyptian calendar.
$ec_date["Day"]  = $dy_Egypt;
$ec_date["Month"] = $mnt_Egypt;
$ec_date["Year"] = $yr_Egypt;
# Returning the Calculated date.
return $ec_date;
which could be written more succinctly as:
/* Calculating the year,month,day in Egypt and returning. */
return array (
"Year"  => ($y = floor(  $EgyptianDays / 769 )),
   
"Month" => ($m = round( ($EgyptianDays -  ($y * 769)) / 63 )),  
   
"Day"   => round(  $EgyptianDays - (($y * 769) + ($m * 63)) ),
);
that might inspire you to use less variables in your code, which is a good 
thing - but in this
case completely beside the point. whats less beside the point is that you use 
floor() for the year
and round() for the day and month, I wonder if it helps if you use floor() for 
all 3?
beware of floating point rounding errors, compare:

$EgyptianDays = 10345;
var_dump(
array(
"Year"  => ($y = floor(  $EgyptianDays / 769 )),
"Month" => ($m = floor( ($EgyptianDays -  ($y * 769)) / 63 )),
"Day"   => floor(  $EgyptianDays - (($y * 769) + ($m * 63)) ),
),
array(
"Year"  => ($y = floor(  $EgyptianDays / 769 )),
"Month" => ($m = round( ($EgyptianDays -  ($y * 769)) / 63 )),
"Day"   => round(  $EgyptianDays - (($y * 769) + ($m * 63)) ),
)
);
?>
kind regards,
Jochem
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] FreeBSD php upgrade oddity - can't load dynamic librari es [RESOLVED]

2005-03-17 Thread Al Arzaga
For the sake of someone who may benefit from this info:

I resolved this by removing the file
/usr/local/etc/php/extensions.ini
and then reinstalling the php5 base
and then reinstalling php5-extensions



-Original Message-
From: Al Arzaga 
Sent: Wednesday, March 16, 2005 10:34 PM
To: php-general@lists.php.net
Subject: [PHP] FreeBSD php upgrade oddity - can't load dynamic libraries


I'm running FreeBSD 5.2.1, and last night I cvsupped to the latest
ports.

This afternoon, I proceeded to upgrade PHP from 5.0.1 to 5.0.3.
But I kept getting these errors when restarting apache that it could not
find various shared libraries in /usr/local/lib/php/20041030

I see that I'm supposed to have such a directory, but what I do have is
a /usr/local/lib/php/20040412 instead.  (Pointing to that directory in
php.ini clearly is not the answer.)

Similar errors appear when running from the command line:

[kungpao:~]$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/ctype.so' - Cannot open 
"/usr/local/lib/php/20041030/ctype.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/simplexml.so' - Cannot open 
"/usr/local/lib/php/20041030/simplexml.so" in Unknown on line 
0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/dom.so' - Cannot open 
"/usr/local/lib/php/20041030/dom.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/gd.so' - Cannot open 
"/usr/local/lib/php/20041030/gd.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/iconv.so' - Cannot open 
"/usr/local/lib/php/20041030/iconv.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/ldap.so' - Cannot open 
"/usr/local/lib/php/20041030/ldap.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/mysql.so' - Cannot open 
"/usr/local/lib/php/20041030/mysql.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/odbc.so' - Cannot open 
"/usr/local/lib/php/20041030/odbc.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/oracle.so' - Cannot open 
"/usr/local/lib/php/20041030/oracle.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/pcre.so' - Cannot open 
"/usr/local/lib/php/20041030/pcre.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/pdf.so' - Cannot open 
"/usr/local/lib/php/20041030/pdf.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/posix.so' - Cannot open 
"/usr/local/lib/php/20041030/posix.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/session.so' - Cannot open 
"/usr/local/lib/php/20041030/session.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/sqlite.so' - Cannot open 
"/usr/local/lib/php/20041030/sqlite.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/tokenizer.so' - Cannot open 
"/usr/local/lib/php/20041030/tokenizer.so" in Unknown on line 
0
PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/local/lib/php/20041030/xml.so' - Cannot open 
"/usr/local/lib/php/20041030/xml.so" in Unknown on line 0
PHP 5.0.3 (cli) (built: Mar 16 2005 20:27:24)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
[kungpao:~]$


I've tried re-installing just the base install without any php 
configurations but to no avail.

Can anyone provide some insight on how I may solve this?


-Al

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



[PHP] Setting cookies for other domains

2005-03-17 Thread Brian Dunning
I've always known that you can specify a domain when you set a cookie, 
and for kicks I experimented with a test page setting a cookie for the 
yahoo.com. Seems to me that browsers wouldn't allow this as it could 
create any number of security problems. I tried the following code, and 
the yahoo cookie did not get set, as I expected, and the 
briandunning.com cookie did (that's my site). I made sure that my 
browser's settings were set to allow all cookies, including those from 
other sites.


setcookie('test', 'anything', time()+31536000, '/', '.yahoo.com');
setcookie('test', 'anything', time()+31536000, '/', 
'.briandunning.com');
?>

Question: why didn't this work, is it supposed to work the way I was 
trying, and if not, then what is that domain variable there for???

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


[PHP] download files with header

2005-03-17 Thread helene malamoud
I tryed the function that aarondunlap.com sent the 28 dec 2004.
The browser open the window for download, I get the file on the client , same 
size as the original but 
when I want to open the file , it's corrupted.
It's like if the script file is mixed with the file I sent
(I tryed with IE and FIREFOX, and different extension)
""
"404 File not found!"); }

   //Gather relevent info about file
   $len = filesize($file);
   $filename = basename($file);
   $file_extension = strtolower(substr(strrchr($filename,"."),1));

   //This will set the Content-Type to the appropriate setting for the file
   switch( $file_extension ) {
 case "pdf": $ctype="application/pdf"; break;
 case "exe": $ctype="application/octet-stream"; break;
 case "zip": $ctype="application/zip"; break;
 case "doc": $ctype="application/msword"; break;
 case "xls": $ctype="application/vnd.ms-excel"; break;
 case "ppt": $ctype="application/vnd.ms-powerpoint"; break;
 case "gif": $ctype="image/gif"; break;
 case "png": $ctype="image/png"; break;
 case "jpeg":
 case "jpg": $ctype="image/jpg"; break;
 case "mp3": $ctype="audio/mpeg"; break;
 case "wav": $ctype="audio/x-wav"; break;
 case "mpeg":
 case "mpg":
 case "mpe": $ctype="video/mpeg"; break;
 case "mov": $ctype="video/quicktime"; break;
 case "avi": $ctype="video/x-msvideo"; break;

 //The following are for extensions that shouldn't be downloaded (sensitive 
stuff, like php files)
 case "php":
 case "htm":
 case "html":
 case "txt": die("Cannot be used for ". $file_extension ." files!"); 
break;

 default: $ctype="application/force-download";
   }

   //Begin writing headers
   header("Pragma: public");
   header("Expires: 0");
   header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
   header("Cache-Control: public"); 
   header("Content-Description: File Transfer");
   
   //Use the switch-generated Content-Type
   header("Content-Type: $ctype");

   //Force the download
   $header="Content-Disposition: attachment; filename=".$filename.";";
   header($header );
   header("Content-Transfer-Encoding: binary");
   header("Content-Length: ".$len);
   @readfile($file);
   exit;
}

?>"





RE: [PHP] Setting cookies for other domains

2005-03-17 Thread Chris W. Parker
Brian Dunning 
on Thursday, March 17, 2005 4:45 PM said:

> Question: why didn't this work, is it supposed to work the way I was
> trying, and if not, then what is that domain variable there for???

Answer:
> Seems to me that browsers wouldn't allow this as it could
> create any number of security problems.


Nonetheless, I've never really used the domain option but I suspect it's
for sub-domains of sites you administer and not completely different
domains altogether.

Read here: http://wp.netscape.com/newsref/std/cookie_spec.html


HTH,
Chris.

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



Re: [PHP] Setting cookies for other domains

2005-03-17 Thread Chris Shiflett
Brian Dunning wrote:
I've always known that you can specify a domain when you set a cookie,
and for kicks I experimented with a test page setting a cookie for the
yahoo.com. Seems to me that browsers wouldn't allow this as it could
create any number of security problems.
This is why the specification mentions, "Only hosts within the specified 
domain can set a cookie for a domain."

Question: why didn't this work, is it supposed to work the way I was
trying, and if not, then what is that domain variable there for?
It allows you to specify the domain for which the cookie is valid. When 
a browser makes a request, it checks for cookies to be included in the 
Cookie header. Only those that meet the requirements (domain, path, 
expiry, etc.) are included.

Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: getting text with strange encodng

2005-03-17 Thread Jim Plush
Where did the string come from?

Jim
PHP WebBlog =
http://www.litfuel.net/plush/
Diana Castillo wrote:
Does anyone know what kind of string encoding this is :
®®
mA®
and how can I decode this?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Fwd: can you help me ??

2005-03-17 Thread Wahyu SP


  --- the forwarded message follows ---

Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826)
 
--- Begin Message ---
hello ..
dear webmaster i would like to ask few questions :
1. can php determine the mime type of file without 
uploading a file ??
2. if it can how is it ??

thanks very much
best regard's
wahyu sp
malang
indonesia

Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN (467826)
 

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

Re: [PHP] Setting cookies for other domains

2005-03-17 Thread Brian Dunning
I suspect it's
for sub-domains of sites you administer and not completely different
domains altogether.
If this is true, and it's not possible for a site to set a cookie for a 
completely different domain, then why do browsers have security options 
to allow or prevent this specific action? I'm thinking it must be 
possible, and that there's a reason for the domain option in 
setcookie() other than subdomains. Would just love to know how to make 
it work...

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


[PHP] New Website for PHP Coders.. www,lifenit.com

2005-03-17 Thread freshersworld .com
Hi All,

 This is a very interesting website.

Visit www.lifenit.com

Also I can refer one more sebsite for you..

www.merchantii.com

Hope these were Useful.

Rgds,
 Freshersworld

First Job. Dream Job...  Freshersworld.com

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

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



[PHP] Visit www.Merchantii.com

2005-03-17 Thread freshersworld .com



Visit www.Merchantii.com




--- Ahmed Abdel-Aliem <[EMAIL PROTECTED]> wrote:
> hi
> i use this code to send email from mysite
> but when it sends to some accounts it repeats the
> body part twice in
> the same email while to other accounts it sends the
> body one time only
> can anyone help in that plz ?
> 
> 
>   if ($email_to != "") {
>   $to = array();
>   $to = explode (",", $email_to);
>   $to_mum = count($email_to);
>   for ($i=0; $i<$to_mum ; $i++){
>   $to_email = $to[$i];
>   $subject = $email_subject;
>   $body .= $HTTP_POST_VARS['message'];
>   $body .= "\n---\n";
>   $body .= "Article Name :";
>   $body .= "\n---\n";
>   $body .= $Article_Name;
>   $body .= "\n---\n\n";   
>   $body .= "\nStory :\n\n";
>   $body .= $TheStory; 
>   $body .= "\n\n\n---\n";
>   $body .= "Sent By: " .
> $HTTP_POST_VARS['email_address'] . "\n";
>   $header = "From: " .
> $HTTP_POST_VARS['email_address'] . " <" .
> $HTTP_POST_VARS['email_address'] . ">\n";
>   $header .= "Reply-To: " .
> $HTTP_POST_VARS['email_address'] . " <" .
> $HTTP_POST_VARS['email_address'] . ">\n";
>   $header .= "X-Mailer: PHP/" . phpversion() .
> "\n";
>   $header .= "X-Priority: 1";
>   mail($to_email, $subject, $body, $header);
> 
> -- 
> Ahmed Abdel-Aliem
> Web Developer
> www.ApexScript.com
> 0101108551
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

First Job. Dream Job...  Freshersworld.com



__ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

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



Re: [PHP] New Website for PHP Coders.. www,lifenit.com

2005-03-17 Thread Stephen Johnson
What is with all the crap india programming sites spamming this list?
I for one, am not interested in web sites that are competing to take my 
clients.  If I have to explain one more time why it is NOT better to 
pay less to deal with a company across the a few oceans versus' paying 
more for local services, I think I might scream.

Can't they just move to the US and take our jobs the old fashioned way. 
J/K

Stephen
On Mar 17, 2005, at 8:22 PM, freshersworld .com wrote:
Hi All,
 This is a very interesting website.
Visit www.lifenit.com
Also I can refer one more sebsite for you..
www.merchantii.com
Hope these were Useful.
Rgds,
 Freshersworld
First Job. Dream Job...  Freshersworld.com
__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

*
Stephen Johnson
[EMAIL PROTECTED]
http://www.thelonecoder.com
--continuing the struggle against bad code--
*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Fwd: can you help me ??

2005-03-17 Thread M. Sokolewicz
Wahyu SP wrote:


  --- the forwarded message follows ---
 

Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk 
wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN 
(467826)
 


Subject:
can you help me ??
From:
"Wahyu SP" <[EMAIL PROTECTED]>
Date:
Wed, 16 Mar 2005 16:57:07 +0700
To:
[EMAIL PROTECTED]
To:
[EMAIL PROTECTED]
hello ..
dear webmaster i would like to ask few questions :
1. can php determine the mime type of file without uploading a file ??
of course not
2. if it can how is it ??
thanks very much
best regard's
wahyu sp
malang
indonesia
 

Akses Internet TELKOMNet-Instan beri Diskon s.d. 50 % khusus untuk 
wilayah Jawa Timur.
Informasi selengkapnya di www.telkomnetinstan.com atau hub 0800-1-INSTAN 
(467826)
 

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


[PHP] passing return value from fucntion

2005-03-17 Thread William Stokes
Hello,
Just simple question (I think?)

How to pass return value from function to the main program?

Here's example:
do some code in funtion to set the $res value:

} elseif ($rightsid == $oik6) {
   $res = ok;
   return $res;
} elseif ($rightsid == $oik7) {
   $res = notok;
   return $res;
}

How can I get to use the  $res in the main program. The return $res; doesn't 
pass the variable to the main program right?

Thanks
-Will

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