php-general Digest 29 Apr 2004 20:35:55 -0000 Issue 2734

Topics (messages 184930 through 184970):

Re: global vars inside includes inside functions?
        184930 by: De Greef Sébastien
        184953 by: Red Wingate
        184962 by: Tom Rogers
        184963 by: Red Wingate

web page existance check
        184931 by: Decapode Azur
        184932 by: Vinod Panicker

creating a mailing list
        184933 by: chris o'shea
        184935 by: Vinod Panicker
        184936 by: Chris Hayes
        184959 by: Chris W. Parker

Re: Problem with a class... any help will be appreciated.
        184934 by: Marius Dascalu

Single quotes inside double quoted string (Was: Re: [PHP] Re: Problem with a class... 
any help will be appreciated.)
        184937 by: John W. Holmes
        184942 by: Elliot J. Balanza
        184969 by: Torsten Roehr

Changing passwords
        184938 by: Jason Barnett
        184948 by: Jason Sheets

$_SERVER['SERVER_NAME'] in read-only.
        184939 by: Vincent M.
        184940 by: Jay Blanchard
        184941 by: Jason Barnett
        184960 by: Red Wingate
        184966 by: John W. Holmes

Re: Nonsense mail
        184943 by: Elliot J. Balanza
        184952 by: trlists.clayst.com

__toString or not __toString
        184944 by: Thomas Björk
        184945 by: Thomas Björk
        184946 by: Thomas Björk

Re: GD support
        184947 by: Marek Kilimajer
        184950 by: Anton Krall

Re: php code in a .js file?
        184949 by: Craig Donnelly

Re: Fetching XML for parsing
        184951 by: Pablo

variable-length arguments passed by reference... how?
        184954 by: Aric Caley
        184955 by: Aric Caley
        184956 by: Marek Kilimajer
        184957 by: Jay Blanchard
        184958 by: Marek Kilimajer
        184961 by: Aric Caley
        184965 by: Tom Rogers
        184968 by: Jason Barnett

Re: Using HTTP_REFERRER to ensure forms posted from server
        184964 by: Chris Shiflett

Re: Listing all id's in array
        184967 by: Torsten Roehr

how to verify PHP has been installed with ldap?
        184970 by: Bing Du

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
normally you just put
global $something;
at the begining of your function..
Like this
function safeInclude($file) {
global $something;
 if(file_exists($file)) { include($file);
 } else {
 debug("file $file not found");
 }
 }


"Justin French" <[EMAIL PROTECTED]> a écrit dans le message news:
[EMAIL PROTECTED]
> Can someone see a way to achieve what I want?
>
> I have the following function:
>
> <?
> function safeInclude($file) {
> if(file_exists($file)) {
> include($file);
> } else {
> debug("file $file not found");
> }
> }
> ?>
>
> When used in this context...
>
> <?
> $something = 'foo';
> safeInclude('somethingElse.inc');
> ?>
>
> ... somethingElse.inc cannot see the global variable $something.
>
>
> So, if an include is wrapped in a function, it would appear that the
> global variables no longer apply to the namespace of the included file.
>
> Is there anyway I can get around this?
>
> My only guess is I could add the line "global $GLOBALS;" to
> safeInclude(), but I have no idea how this affects memory usage or
> anything else.
>
>
>
> ---
> Justin French
> http://indent.com.au

--- End Message ---
--- Begin Message --- [...]
<?
function safeInclude($file) {
[...]

    foreach ( $GLOBALS AS $k => $v ) {
        $$k = $v ;
    }

[...]
    if(file_exists($file))     {
        include($file);
    } else {
        debug("file $file not found");
    }
}
?>
[...]

(better, as no eval-syntax is required)

-- red
--- End Message ---
--- Begin Message ---
Hi,

Friday, April 30, 2004, 1:29:12 AM, you wrote:
RW> [...]
>> <?
>> function safeInclude($file) {
RW> [...]

RW>      foreach ( $GLOBALS AS $k => $v ) {
RW>          $$k = $v ;
RW>      }

RW> [...]
>>     if(file_exists($file))     {
>>         include($file);
>>     } else {
>>         debug("file $file not found");
>>     }
>> }
>> ?>
RW> [...]

RW> (better, as no eval-syntax is required)

RW>    -- red
That makes local copies only, still no access to the global variable

The other thing to consider is that everything dies at the conclusion of
the function. It may be better to do this via a class construct

-- 
regards,
Tom

--- End Message ---
--- Begin Message --- Again ain't no problem anyway

foreach ( $GLOBALS AS $k => $v ) {
    $$k =& $GLOBALS[$k] ;
}

zap you are done ... again when using a function to include
a file with relying on depts within the file you would most
probably use a registry-pattern or similar to access the required
variables.

-- red

That makes local copies only, still no access to the global variable

The other thing to consider is that everything dies at the conclusion of
the function. It may be better to do this via a class construct

--- End Message ---
--- Begin Message ---
Hello,

What is the best way to check if a web page is still there or not?
(For exemple to check the links of a bookmarck database,
to remove old links.)

Cheers

--- End Message ---
--- Begin Message ---
How big is the bookmark database?  The approach would ideally change
based on that...

A standard mechanism would be to connect to the web server hosting the
page and issuing a HEAD request for the necessary web page.  Parse the
response and ensure that the webserver doesnt issue a 404.  Timeouts
ofcourse have to be handled as well.

Regards,
Vinod.

On Thu, 29 Apr 2004 11:18:23 +0200, Decapode Azur
<[EMAIL PROTECTED]> wrote:
> 
> Hello,
> 
> What is the best way to check if a web page is still there or not?
> (For exemple to check the links of a bookmarck database,
> to remove old links.)
> 
> Cheers
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
Hi

I have a list of email addresses in mySQL from people who have signed up on
my site and I want to use PHP to email out to the list.

My initial thought was to go through the loop, sending an email to each
person, but then I saw this somewhere:

"It is worth noting that the mail() function is not suitable for larger
volumes of email in a loop.

This function opens and closes an SMTP socket for each email... not very
efficient."

Does anybody know the best way of doing a mass mail through php?

Also, do you know how php mail() handles bounced emails? Ideally I'd like to
either receive them or use a script to record then.

Many thanks
Chris

--- End Message ---
--- Begin Message ---
Chris,
Mass mailing is ideally done using mailing lists - in this case i
assume that you would want to frequently send updates to the ppl who
have signed up.

majordomo/listserv etc can be used to implement mailing lists...

as you rightly said, using the mail() function would be pretty inefficient.

php mail() doesnt know about bounced emails simply because it doesnt
reach it.  there's no callback that allows you to register for bounced
emails.  the email is received by your smtp server and is redirected
to the appropriate account (depending on the configuration)

Regards,
Vinod.

On Thu, 29 Apr 2004 10:44:23 +0100, chris o'shea <[EMAIL PROTECTED]> wrote:
> 
> Hi
> 
> I have a list of email addresses in mySQL from people who have signed up on
> my site and I want to use PHP to email out to the list.
> 
> My initial thought was to go through the loop, sending an email to each
> person, but then I saw this somewhere:
> 
> "It is worth noting that the mail() function is not suitable for larger
> volumes of email in a loop.
> 
> This function opens and closes an SMTP socket for each email... not very
> efficient."
> 
> Does anybody know the best way of doing a mass mail through php?
> 
> Also, do you know how php mail() handles bounced emails? Ideally I'd like to
> either receive them or use a script to record then.
> 
> Many thanks
> Chris
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
php mail() doesnt know about bounced emails simply because it doesnt
reach it.  there's no callback that allows you to register for bounced
emails.  the email is received by your smtp server and is redirected
to the appropriate account (depending on the configuration)

you can get bounces and replies by adding some headers:
$mail_header .= "Return-Receipt-To: \"[EMAIL PROTECTED]" \n";
$mail_header .= "Return-Path: \"[EMAIL PROTECTED]" \n";
and then off course read out these addresses!

--- End Message ---
--- Begin Message ---
chris o'shea <mailto:[EMAIL PROTECTED]>
    on Thursday, April 29, 2004 2:44 AM said:

> Does anybody know the best way of doing a mass mail through php?

i recall a solution being to write a properly formatted email and dump
it into server's outgoing queue allowing the MTA (sendmail, exim,
postfix*) to distribute the emails as it sees fit.


hth,
chris.

* i think these are all MTA's.

--- End Message ---
--- Begin Message ---
Hi,

You wrote:
------
I have a class

class security {

  function blank($user,$pass) {
   if((empty($user)) || (empty($pass)))
            return 1;
   else
      $this -> revisa();
   }

  function revisa () {
      $this -> login();
   }

  function login() {
      $_SESSION['User']=$user;
   $_SESSION['Nivel']=$nivel;
   $this -> registra_entrada();
   }

  function registra_entrada() {
   header("location:../includes/login.php");
   }
}
?>

and it works great ... but this wont work at all, all
it wont go from one
part tot he other, any ideas what am I doing wrong?

class security {

  function blank($user,$pass) {
   if((empty($user)) || (empty($pass)))
            return 1;
   else
      $this -> revisa();
   }

  function revisa () {
      $query_revisa = $this->dbQuery("SELECT User,
Password, Nivel FROM
Admon WHERE User = '$user'");
      $row_revisa =
$this->dbFetchArray($query_revisa);
   if(md5($pass)==$row_revisa['Password']) {
      $this -> login();
   }    else {
      return 1;
   }

  function login() {
   $_SESSION['User']=$user;
   $_SESSION['Nivel']=$nivel;
   $this -> registra_entrada();
   }

  function registra_entrada() {
   $query_registra=$this->dbQuery("INSERT INTO
admon_log (User) VALUES
('$user')");
   header("location:../includes/login.php");
   }
}
?>
-----

I think the error is in line:

$query_revisa = $this->dbQuery("SELECT User, Password,
Nivel FROM Admon WHERE User = '$user'");

PHP doesn't expand variables in single quoted
expressions. Try this line instead:

$query_revisa = $this->dbQuery("SELECT User, Password,
Nivel FROM Admon WHERE User = $user");

Regards,

Marius


        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

--- End Message ---
--- Begin Message ---
From: "Marius Dascalu" <[EMAIL PROTECTED]>

> I think the error is in line:
>
> $query_revisa = $this->dbQuery("SELECT User, Password,
> Nivel FROM Admon WHERE User = '$user'");
>
> PHP doesn't expand variables in single quoted
> expressions. Try this line instead:
>
> $query_revisa = $this->dbQuery("SELECT User, Password,
> Nivel FROM Admon WHERE User = $user");

Take a look at that first line again. The string is delimited by DOUBLE
QUOTES. The single quotes are inside of the string. PHP will resolve the
variable because the string has double quotes, so this isn't the problem.
Sorry I can't help the OP as to what the actual problem is, but I wanted to
point out this misconception.

---John Holmes...

--- End Message ---
--- Begin Message ---
Actually you are right the problem is not in the proccess of writing to the
database, the problem is that after writing to the database it wont "jump"
to the next function it wont go to login() or any other function for this
matter.

vamp

"John W. Holmes" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> From: "Marius Dascalu" <[EMAIL PROTECTED]>
>
> > I think the error is in line:
> >
> > $query_revisa = $this->dbQuery("SELECT User, Password,
> > Nivel FROM Admon WHERE User = '$user'");
> >
> > PHP doesn't expand variables in single quoted
> > expressions. Try this line instead:
> >
> > $query_revisa = $this->dbQuery("SELECT User, Password,
> > Nivel FROM Admon WHERE User = $user");
>
> Take a look at that first line again. The string is delimited by DOUBLE
> QUOTES. The single quotes are inside of the string. PHP will resolve the
> variable because the string has double quotes, so this isn't the problem.
> Sorry I can't help the OP as to what the actual problem is, but I wanted
to
> point out this misconception.
>
> ---John Holmes...

--- End Message ---
--- Begin Message ---
"Elliot J. Balanza" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Actually you are right the problem is not in the proccess of writing to
the
> database, the problem is that after writing to the database it wont "jump"
> to the next function it wont go to login() or any other function for this
> matter.

If $this->login() is not called then this line does not evaluate to true:

if(md5($pass)==$row_revisa['Password']) {

Have you printed out both values to see if they are equal?

Regards, Torsten

--- End Message ---
--- Begin Message --- I know that you should change your passwords often, but I'm curious: how often do you all actually change your passwords? Any rules of thumb for this?
--- End Message ---
--- Begin Message ---
I change my password about every three months, 

I use 10 character randomly generated passwords containing numbers, letters
of both cases and symbols.  

There are several good password generators out there, my favorite is pwgen.
pwgen can generate normal passwords that are pronouncible or secure
passwords like I mentioned.

Example:

> pwgen -s 10 1
bs[=l>#/-,

I also have several passwords I use at one time, one for NT account, one for
banking and other information, one for general account use, one for Unix
account and one for the root password.

As I generate new random passwords I retire my old "secure" passwords into a
general purpose password since I already have it memorized.

How often you change your password depends on how secure you want/need to
be, you should change it a couple times per year at least and don't use
words in the dictionary or your name or anything common.

Pwgen is great because the passwords generated are not significant to you,
making them much harder to guess than say your last name, your daughter's
birth year, wife's middle name.

I've been known to generate 10 million secure passwords using pwgen and then
gzip the file and bring it with me so I can pick one in situations where
pwgen is not available to me as well.

There are some really good resources on how and when to change your password
that you can reach by googling for password security guidelines
(http://www.psynch.com/docs/strength.html for example).

Jason
 
-----Original Message-----
From: Jason Barnett [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 29, 2004 5:43 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Changing passwords

I know that you should change your passwords often, but I'm curious: how
often do you all actually change your passwords?  Any rules of thumb for
this?

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

--- End Message ---
--- Begin Message --- Hello,

I am using the variable $_SERVER['SERVER_NAME'] inside a function, for example:

function check_servname() {
  global $server ;
  if($_SERVER['SERVER_NAME'] != $server) {
     echo "NOT OK, NOT GOOD SERVER NAME" ;
     exit ;
   }
}

But we can modify the value of $_SERVER['SERVER_NAME'] before calling the function check_servname(). And I am looking for a the right server name not for a server name which may have been changed before calling check_servername:
$_SERVER['SERVER_NAME'] = "www.google.com" ; //before calling check_servname and $_SERVER['SERVER_NAME'] will be "www.google.com" inside the function even the server name is not "www.google.com".


Is there any way to get the server name with a variable which would be read-only ?

Thanks,
Vincent.

--- End Message ---
--- Begin Message ---
[snip]
Is there any way to get the server name with a variable which would be 
read-only ?
[/snip]

Constants? http://us4.php.net/manual/en/language.constants.php

--- End Message ---
--- Begin Message --- Vincent M. wrote:

Hello,

I am using the variable $_SERVER['SERVER_NAME'] inside a function, for example:

function check_servname() {
  global $server ;
  if($_SERVER['SERVER_NAME'] != $server) {
     echo "NOT OK, NOT GOOD SERVER NAME" ;
     exit ;
   }
}

But we can modify the value of $_SERVER['SERVER_NAME'] before calling the function check_servname(). And I am looking for a the right server name not for a server name which may have been changed before calling check_servername:
$_SERVER['SERVER_NAME'] = "www.google.com" ; //before calling check_servname and $_SERVER['SERVER_NAME'] will be "www.google.com" inside the function even the server name is not "www.google.com".


Is there any way to get the server name with a variable which would be read-only ?

Thanks,
Vincent.

Agreed - constants are the way to do this. I wanted to mention that the $_SERVER variables are meant to hold values generated by your server. Of course if you really ARE google then I'm going to feel stupid for even mentioning this :)


http://www.php.net/reserved.variables

Jason
--- End Message ---
--- Begin Message ---
AFAIK the content of the superglobal variables cannot be changed ( even
though i haven't found this in the docs i can remeber got beaten by PHP
for doing so :-) )

Back to the problem ( if existent ):

If you don't do stuff like '$_SERVER['SERVER_NAME'] = xxxx;' inside your
script you won't run into trouble - I know some ppl like to use such
strange work-arounds ;-)

Otherwise using
define ( 'SERVER_NAME' , $_SERVER['SERVER_NAME'] );
right at startup will usually solve your problem ( as workarounds will
most likely kill other scripts if the SERVER_NAME is diffrent :-))

-- red

[...]
Hello,

I am using the variable $_SERVER['SERVER_NAME'] inside a function, for example:

function check_servname() {
  global $server ;
  if($_SERVER['SERVER_NAME'] != $server) {
     echo "NOT OK, NOT GOOD SERVER NAME" ;
     exit ;
   }
}

But we can modify the value of $_SERVER['SERVER_NAME'] before calling the function check_servname(). And I am looking for a the right server name not for a server name which may have been changed before calling check_servername:
$_SERVER['SERVER_NAME'] = "www.google.com" ; //before calling check_servname and $_SERVER['SERVER_NAME'] will be "www.google.com" inside the function even the server name is not "www.google.com".


Is there any way to get the server name with a variable which would be read-only ?

Thanks,
Vincent.


Agreed - constants are the way to do this. I wanted to mention that the $_SERVER variables are meant to hold values generated by your server. Of course if you really ARE google then I'm going to feel stupid for even mentioning this :)

http://www.php.net/reserved.variables
[...]
--- End Message ---
--- Begin Message ---
From: "Red Wingate" <[EMAIL PROTECTED]>

> AFAIK the content of the superglobal variables cannot be changed ( even
> though i haven't found this in the docs i can remeber got beaten by PHP
> for doing so :-) )

They can be changed and you can even add to them.

$_SERVER['foo'] = 'bar';

is valid and now it's a superglobal, too. I wouldn't recommend relying on
this, though.

If you talking about the users changing the values of of superglobals then
that's different. Users can't directly set $_SERVER values, for example, but
they can pass values that may influence them. $_SERVER['HTTP_REFERRER']
comes from what the user supplies, for instance, so they are able to
manipulate it. A user would not be able to set $_SERVER['SERVER_NAME'] or
$_SERVER['PHP_SELF'], though. Which ones are safe or not just takes some
research or asking. :)

---John Holmes...

--- End Message ---
--- Begin Message ---
I'm getting it also
"Brent Clark" <[EMAIL PROTECTED]> escribió en el mensaje
news:[EMAIL PROTECTED]
> Hi
>
> Could someone please tell me why I keep getting this mail, when I send
> something to the list
> Brent
>
> ----- Original Message ----- 
> From: <[EMAIL PROTECTED]>
> To: "Brent Clark" <[EMAIL PROTECTED]>
> Sent: Thursday, April 29, 2004 9:20 AM
> Subject: NDN: Re: [PHP] Progress Bar
>
>
> > Sorry. Your message could not be delivered to:
> >
> > PHP Net List [Conference] (Mailbox or Conference is full.)
> >
> >

--- End Message ---
--- Begin Message ---
On 29 Apr 2004 Brent Clark wrote:

> Could someone please tell me why I keep getting this mail, when I send
> something to the list

It's an autoresponder on an email address that is subscribed to the 
list.  I get three autoresponder messages for every list message I 
send.

As far as I can tell there is nothing you can do about this or other 
list problems because there is no list owner to write to.  If you send 
email to the usual owner address you get an automated response, but 
that's all.

--
Tom

--- End Message ---
--- Begin Message --- Hi everyone

I'm struggling with a minor problem that probably has a solution that I've already encountered.

The problem is the magic function __toString in PHP5 that is giving me a hard time.

class nisse {
  function __toString() {
    return "Junk";
  }
}

$n = new nisse();
echo $n;

This returns "Junk" as expected but I'd like to do more.

If this code is used instead:
$s = "Result: ".$n;
echo $s;

The result is "Result: Object id #1" which might be what I expected.

If "typecasting" is used the same result appears:
$s = "Result: ".(string)$n;
echo $s;

And this isn't quite what I expected.

I guess that the __toString function is only called from functions like echo and print and not when typecasting is performed which would be nice.


Regards Thomas Björk

--
=====================================
Thomas Björk
CTO
UNINET

--- End Message ---
--- Begin Message --- Hi everyone

I'm struggling with a minor problem that probably has a solution that I've already encountered.

The problem is the magic function __toString in PHP5 that is giving me a hard time.

class nisse {
  function __toString() {
    return "Junk";
  }
}

$n = new nisse();
echo $n;

This returns "Junk" as expected but I'd like to do more.

If this code is used instead:
$s = "Result: ".$n;
echo $s;

The result is "Result: Object id #1" which might be what I expected.

If "typecasting" is used the same result appears:
$s = "Result: ".(string)$n;
echo $s;

And this isn't quite what I expected.

I guess that the __toString function is only called from functions like echo and print and not when typecasting is performed which would be nice.


Regards Thomas Björk

--
=====================================
Thomas Björk
CTO
UNINET

--- End Message ---
--- Begin Message --- Hi everyone

I'm struggling with a minor problem that probably has a solution that I've already encountered.

The problem is the magic function __toString in PHP5 that is giving me a hard time.

class nisse {
  function __toString() {
    return "Junk";
  }
}

$n = new nisse();
echo $n;

This returns "Junk" as expected but I'd like to do more.

If this code is used instead:
$s = "Result: ".$n;
echo $s;

The result is "Result: Object id #1" which might be what I expected.

If "typecasting" is used the same result appears:
$s = "Result: ".(string)$n;
echo $s;

And this isn't quite what I expected.

I guess that the __toString function is only called from functions like echo and print and not when typecasting is performed which would be nice.


Regards Thomas Björk

--
=====================================
Thomas Björk
CTO
UNINET

--- End Message ---
--- Begin Message --- Anton Krall wrote:

Guys.
I noticed that Im having problem with some apps that use graphics line
netoffice and phpnuke. Seems I dont have gd compiled into php so I went to
php.net and followed the instructions that say I should compile the bundled
gd using:
configure --prefix=/usr/local/php --with-gd (no dir needs to be specified
according to the docs)
but after a while I get this error on configure:
checking for GD support... yes
checking for the location of libjpeg... no
checking for the location of libpng... no
checking for the location of libXpm... no
checking for FreeType 1.x support... no
checking for FreeType 2... no
checking for T1lib support... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.
What else do I need to do here?

you need devel packages of libjpeg, libpng and libXpm(part of XFree-devel I think)

--- End Message ---
--- Begin Message ---
Thx Marek!

------------------------------------
Intruder Consulting
Anton Krall
Director General
[EMAIL PROTECTED]
tel: 5233-9281
mobile: 044-55-1320-8717
IM: [EMAIL PROTECTED]
www.intruder.com.mx
------------------------------------
 

%-----Original Message-----
%From: Marek Kilimajer [mailto:[EMAIL PROTECTED] 
%Sent: Jueves, 29 de Abril de 2004 08:19 a.m.
%To: Anton Krall
%Cc: [EMAIL PROTECTED]
%Subject: Re: [PHP] GD support
%
%Anton Krall wrote:
%
%> Guys.
%>  
%> I noticed that Im having problem with some apps that use 
%graphics line 
%> netoffice and phpnuke. Seems I dont have gd compiled into php so I 
%> went to php.net and followed the instructions that say I should 
%> compile the bundled gd using:
%>  
%> configure --prefix=/usr/local/php --with-gd (no dir needs to be 
%> specified according to the docs)
%>  
%> but after a while I get this error on configure:
%>  
%> checking for GD support... yes
%> checking for the location of libjpeg... no checking for the location 
%> of libpng... no checking for the location of libXpm... no 
%checking for 
%> FreeType 1.x support... no checking for FreeType 2... no 
%checking for 
%> T1lib support... no checking whether to enable truetype string 
%> function in GD... no checking whether to enable JIS-mapped Japanese 
%> font support in GD... no checking for fabsf... yes checking for 
%> floorf... yes If configure fails try --with-jpeg-dir=<DIR>
%> configure: error: libpng.(a|so) not found.
%>  
%> What else do I need to do here?
%
%you need devel packages of libjpeg, libpng and libXpm(part of 
%XFree-devel I think)
%
%--
%PHP General Mailing List (http://www.php.net/) To unsubscribe, 
%visit: http://www.php.net/unsub.php
%
%

--- End Message ---
--- Begin Message ---
Why not just use a .php instead of a .js?

<script language="Javascript" src="jsscript.php"></script>

Regards,

Craig


"Marek Kilimajer" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Aaron Wolski wrote:
> > Hey all,
> >
> > I'm writing in the process of writing a content management system for a
> > client.. it's in the logic stag right now but once piece of logic I am
> > having trouble with is the Javascript files that have code that
> > reference pages.
> >
> > I want to use absolute URLS by having PHP set the domain and script path
> > but HOW do I get PHP parsed in a .js file?
> >
>
> Make a php file that will output the javascript code with correct
> Content-Type header

--- End Message ---
--- Begin Message ---
On 04/27/2004 2:53 PM, Patagonia Hosting Development Group
<[EMAIL PROTECTED]> wrote:

> Does anybody has something on this? :)
> 
> Thanks.
> 
> "Patagonia Hosting Development Group" <[EMAIL PROTECTED]>
> escribió en el mensaje news:[EMAIL PROTECTED]
>> That may be the exact problem. I was not figuring that one out. Thi is my
>> fopen and XML parser code:
>> 
>> $xml_parser = xml_parser_create();
>> xml_set_element_handler($xml_parser, "startElement", "endElement");
>> xml_set_character_data_handler($xml_parser, "characterData");
>> if (!($fp = fopen($uFile,"rb"))) {
>> die ("could not open RSS for input");
>> }
>> while ($data = fread($fp, 4096)) {
>> if (!xml_parse($xml_parser, $data, feof($fp))) {
>> die(sprintf("XML error: %s at line %d",
>> xml_error_string(xml_get_error_code($xml_parser)),
>> xml_get_current_line_number($xml_parser)));
>> }
>> }
>> 
>> xml_parser_free($xml_parser);
>> 
>> How can I make PHP to first open the dynamically built page and THEN read
>> it's content?

Do you have allow_url_fopen=On in php.ini? Given that your code works with a
local copy of the .xml file but not the 'live' version, this could be an
explanation.

Pablo

--- End Message ---
--- Begin Message --- I want to create a function similar to the MySqli extensions' mysqli_stmt_bind_param() function. I assume that this function takes its arguments passed by reference. Now, I know how to do variable length argument lists in a function with func_get_arg(s) but how do I tell it that they are to be passed by reference?
--- End Message ---
--- Begin Message --- I want to create a function similar to the MySqli extensions' mysqli_stmt_bind_param() function. I assume that this function takes its arguments passed by reference. Now, I know how to do variable length argument lists in a function with func_get_arg(s) but how do I tell it that they are to be passed by reference?

I'm using PHP5 and I want to stick by the latest recomendations..
--- End Message ---
--- Begin Message --- Not possible :(

Aric Caley wrote:

I want to create a function similar to the MySqli extensions' mysqli_stmt_bind_param() function. I assume that this function takes its arguments passed by reference. Now, I know how to do variable length argument lists in a function with func_get_arg(s) but how do I tell it that they are to be passed by reference?

I'm using PHP5 and I want to stick by the latest recomendations..


--- End Message ---
--- Begin Message ---
[snip]
Now, I know how to do variable length argument lists in a function with
func_get_arg(s) but how do I 
tell it that they are to be passed by reference?
[/snip]

Have you RTFM? http://us3.php.net/manual/en/function.func-get-args.php

[quote]
...a couple of different methods to pass by reference....
[/quote]

--- End Message ---
--- Begin Message --- But workaround would be to call your function with array():

function f($a) {
   foreach($a as $k => $v) $a[$k] = $v+1;
}

$a = 1;
$b = 2;

f(array(&$a, &$b));

echo "$a $b";

Aric Caley wrote:

I want to create a function similar to the MySqli extensions' mysqli_stmt_bind_param() function. I assume that this function takes its arguments passed by reference. Now, I know how to do variable length argument lists in a function with func_get_arg(s) but how do I tell it that they are to be passed by reference?

I'm using PHP5 and I want to stick by the latest recomendations..


--- End Message ---
--- Begin Message --- Marek Kilimajer wrote:

But workaround would be to call your function with array():


Thanks, I was afraid that might be the only way. I guess its possible if you write an extension (like mysqli) in C?

--- End Message ---
--- Begin Message ---
Hi,

Friday, April 30, 2004, 1:40:26 AM, you wrote:
AC> I want to create a function similar to the MySqli extensions' 
AC> mysqli_stmt_bind_param() function.  I assume that this function takes
AC> its arguments passed by reference.  Now, I know how to do variable
AC> length argument lists in a function with func_get_arg(s) but how do I
AC> tell it that they are to be passed by reference?

Just make them all references, if it was expecting a copy it will just
get a reference to a copy, if it was expecting a reference it will get
one. I do a similar trick in a class loader I use that copes with
variable length argument lists and passing by reference.

A bit like this

$num_args = func_num_args();
$arg_list = func_get_args();
$vars = 'function_to_call(';
for ($i = 0; $i < $num_args; $i++) {
  $vars .= ($i > 0)? ',':'';
  $varname = 'variable'.$i;
  $$varname =& $arg_list[$i];
  $vars .= "\$$varname";
}
$vars .= ');';

//that leaves you with a string you can use eval on
eval($vars);


-- 
regards,
Tom

--- End Message ---
--- Begin Message ---

A bit like this


$num_args = func_num_args();
$arg_list = func_get_args();
$vars = 'function_to_call(';
for ($i = 0; $i < $num_args; $i++) {
  $vars .= ($i > 0)? ',':'';
  $varname = 'variable'.$i;
  $$varname =& $arg_list[$i];
  $vars .= "\$$varname";
}
$vars .= ');';

//that leaves you with a string you can use eval on
eval($vars);



I know I'm probably paranoid, but eval() always bugs me. I think for what you want to do you can use call_user_func_array()


$args = func_get_args();
call_user_func_array('function_to_call', $args);

http://www.php.net/manual/en/function.call-user-func-array.php
--- End Message ---
--- Begin Message ---
--- Terence <[EMAIL PROTECTED]> wrote:
> To avoid malicious users creating their own forms and posting to my
> site, is it advisable to use the $_SERVER['HTTP_REFERRER'] to ensure
> that posted forms only come from the intended source? Anyone out there
> using this?

Hopefully not. :-)

Referer is just as easy to spoof as the form data you're expecting.

What you're wanting to do is prevent spoofed form submissions, and New
York PHP has a nice resource that I encourage you to read:

http://phundamentals.nyphp.org/PH_spoofed_submission.php

Hope that helps.

Chris

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

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

--- End Message ---
--- Begin Message ---
"Alex Hogan" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have asked a lot of questions in the last few weeks, but I do try to
> preface those questions by checking out the php.net online manual first.
>
> Anyway, here is one way to do it.  There are probably more elegant
> solutions, but I don't know off hand what they are.
>
> $model  = array();
>
> $query  = "SELECT product_id
>     FROM products";
> $result = mysql_query($query) or die("error in query);
> $i      = 0;
> while($row = mysql_fetch_array($result)){
> $model[$i] = $row['product_id'];
> $i++;
> }

I think $i is not needed here. If you add it to the array with $model[] =
... PHP will automatically use and increment an integer for the key.

Regards, Torsten

>
> print_r($model);
>
>
>
>
> alex hogan
>
>
> > -----Original Message-----
> > From: Phpu [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, April 28, 2004 3:01 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Listing all id's in array
> >
> > I want to list all the product id's af the database in an array, but i
do
> > not how.
> >
> > I have this script but it is not working:
> >
> > $model = array();
> >
> > $query = "SELECT product_id FROM products";
> > $result = mysql_query($query) or die("error in query - $query -
> > ".mysql_error());
> > while (list($product_id) = mysql_fetch_array($result)) {
> > $model = "$product_id";
> > }
> >
> > echo "$model";
> >
> >
> > Plese someone tell me how to do it...
> >
> > Thanks
>
>
>
> ******************************************************************
> The contents of this e-mail and any files transmitted with it are
> confidential and intended solely for the use of the individual or
> entity to whom it is addressed.  The views stated herein do not
> necessarily represent the view of the company.  If you are not the
> intended recipient of this e-mail you may not copy, forward,
> disclose, or otherwise use it or any part of it in any form
> whatsoever.  If you have received this e-mail in error please
> e-mail the sender.
> ******************************************************************
>
>
>

--- End Message ---
--- Begin Message ---
Greetings,

I've installed PHP with ldap.  But I got this error "Fatal error: Call to
undefined function: ldap_connect() in /home/me/public_html/test1.php on
line 5".  Why ldap_connect() is undefined?

This is what I did:

==========
# ./configure --with-apxs=/usr/local/apache/bin/apxs
--with-config-file-path=/usr/local/apache/php.ini --with-mysql --with-zlib
--with-ldap
# make
# make install
==========

It went through without obvious errors.

And this is the PHP script test1.php that generates the above error:

====
<?php
$dn="cn=john smith, ou=Users, ou=eng,dc=iastate, dc=edu";
$password = "ok4now";

if (!($ldap = ldap_connect("w2kdc1.eng.some.edu", 389))) {
die ("Could not connect to LDAP server");
}
if (!($res = @ldap_bind($ldap, $dn, $password))) {
die ("Could not bind to $dn");
}
echo "bind fine!";
?>
====

So my question is how to verify PHP has been installed with ldap support?

Thanks in advance for any help,

Bing

--- End Message ---

Reply via email to