php-general Digest 17 Jun 2004 08:23:46 -0000 Issue 2826

Topics (messages 188434 through 188461):

Re: Value in URL issue
        188434 by: Mike R
        188435 by: Mike R
        188438 by: Gabino Travassos
        188450 by: Curt Zirzow
        188451 by: Curt Zirzow

Re: Regarding variable reference
        188436 by: Justin Patrin
        188453 by: Curt Zirzow

Re: list methods of class COM ?
        188437 by: Marek Kilimajer

Re: Unit Testing
        188439 by: Red Wingate
        188440 by: Red Wingate

Re: Search Sanitization
        188441 by: Greg Donald

Re: Read Last Lines of a Text File
        188442 by: Ashwin Purohit
        188449 by: Curt Zirzow

Re: list methods of class COM ?]
        188443 by: Marek Kilimajer

Include Issues
        188444 by: Stephen Craton
        188446 by: Justin Patrin
        188448 by: Stephen Craton

Resolving a warning
        188445 by: Ryan Schefke
        188447 by: Justin Patrin
        188452 by: Curt Zirzow
        188454 by: Marek Kilimajer

imagecolortransparent & IE
        188455 by: Brian Krausz
        188456 by: Richard Harb

PDF Templates with PHP
        188457 by: Merlin
        188461 by: Torsten Roehr

session looses variable
        188458 by: Anthony Weston

Email with attachment function
        188459 by: Mark Cubitt
        188460 by: Merlin

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 ---
I only get 'NULL' when I do that.  Sort of interesting.....

-Mike



> -----Original Message-----
> From: Matt Grimm [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 16, 2004 4:10 PM
> To: Mike R
> Subject: Re: [PHP] Re: Value in URL issue
>
>
> Try this at the top of nav.php (before any other code):
>
> var_dump($_GET['page']);
>
> It can generally can give you more interesting information.
>
> --
>
> Matt Grimm
> Web Developer
> The Health TV Channel, Inc.
> (a non - profit organization)
> 3820 Lake Otis Parkway
> Anchorage, AK 99508
> 907.770.6200 ext. 686
> 907.336.6205 (fax)
> E-mail: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
> Web: www.healthtvchannel.org <http://www.healthtvchannel.org>
>
>
>
> Mike R wrote:
>
> >
> >
> >>-----Original Message-----
> >>From: chmok [mailto:[EMAIL PROTECTED]
> >>Sent: Wednesday, June 16, 2004 3:50 PM
> >>To: [EMAIL PROTECTED]
> >>Subject: [PHP] Re: Value in URL issue
> >>
> >>
> >>[EMAIL PROTECTED] (Mike R) wrote in
> >>news:[EMAIL PROTECTED]:
> >>
> >>
> >>
> >>>I have an issue where I have a value in a link like this:
> >>>
> >>>http://www.something.com/templates/nav.php?page=about
> >>>
> >>>But when the link is clicked on, the value of page is empty.  Is this a
> >>>globals issue of some sort?
> >>>
> >>>Thanks,
> >>>
> >>>-Mike
> >>>
> >>>
> >>How are you testing for the variable on nav.php? It will be in $_GET
> >>['page'] with more recent versions of PHP. If you want to use the
> >>variable
> >>directly, like $page, you need to extract it first - extract($_GET).
> >>
> >>
> >
> >I did print  $_GET['page'];
> >
> >:)
> >
> >-Mike
> >
> >
> >
> >
> >
> >
>
>

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

Nothing gets printed out with this.  :\

-Mike



> -----Original Message-----
> From: Gabino Travassos [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 16, 2004 4:04 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP] Value in URL issue
> 
> 
> $_SERVER['QUERY_STRING'] should get anything after the "?" in your url.
> 
> ----- Original Message ----- 
> From: "Mike R" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, June 16, 2004 1:45 PM
> Subject: [PHP] Value in URL issue
> 
> 
> > 
> > I have an issue where I have a value in a link like this:
> > 
> > http://www.something.com/templates/nav.php?page=about
> > 
> > But when the link is clicked on, the value of page is empty.  Is this a
> > globals issue of some sort?
> > 
> > Thanks,
> > 
> > -Mike
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Maybe you should post all the relevant code.

----- Original Message ----- 
From: "Mike R" <[EMAIL PROTECTED]>
To: "Gabino Travassos" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, June 16, 2004 2:36 PM
Subject: RE: [PHP] Value in URL issue


>
>
> Nothing gets printed out with this.  :\
>
> -Mike
>
>
>
> > -----Original Message-----
> > From: Gabino Travassos [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, June 16, 2004 4:04 PM
> > To: [EMAIL PROTECTED]
> > Subject: Re: [PHP] Value in URL issue
> >
> >
> > $_SERVER['QUERY_STRING'] should get anything after the "?" in your url.
> >
> > ----- Original Message ----- 
> > From: "Mike R" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 16, 2004 1:45 PM
> > Subject: [PHP] Value in URL issue
> >
> >
> > >
> > > I have an issue where I have a value in a link like this:
> > >
> > > http://www.something.com/templates/nav.php?page=about
> > >
> > > But when the link is clicked on, the value of page is empty.  Is this
a
> > > globals issue of some sort?
> > >
> > > Thanks,
> > >
> > > -Mike
> >
> > -- 
> > 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
>

--- End Message ---
--- Begin Message ---
hmm.. the third different topic in this thread..

* Thus wrote Mike R ([EMAIL PROTECTED]):
> 
> I have an issue where I have a value in a link like this:
> 
> http://www.something.com/templates/nav.php?page=about
> 
> But when the link is clicked on, the value of page is empty.  Is this a
> globals issue of some sort?

most likely yes. More information needs to be known about you're
system check the local values from the output of phpinfo()

  php version:
  register_globals:
  variables_order:
  error_reporing:
  display_errors:


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
* Thus wrote Gabino Travassos ([EMAIL PROTECTED]):
> Maybe you should post all the relevant code.

Please dont.

If a simple script like so:
  <?php vardump($_GET);

that is access via:
http://server/simplescript.php?avar=avalue

Is printing null, then something else is wrong.

Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
Ulrik S. Kofod wrote:

Justin Patrin sagde:

Ulrik S. Kofod wrote:

Why are you using eval? Eval is slow and is a hack... Just do:
$y = $$x;


       if(isset($y))
       {
               echo "<p>$x:$y</p>";
       }
}


True ! I just tested it with both eval and $$, and $$ seems to be about 3 to 4 times faster than eval BUT if you are processing less than 10000 variables then there is no noticeable difference.

Sorry I suggested eval!

but I think it is easier to read the program when using eval as it is more eye
catching than just an extra $ that is easily missed.

Well, eval can also easily be a security vulnerability... Using $$x means that you *will* be using $x as the var name. Consider this:


$x = 'varName; `rm -rf /`';
eval("\$y = \$$x;");

This will produce the PHP code:

$y = $varName; `rm -rf /`';

Which will be evaled and delete files from your system.

$y = $$x; will take the value of the variable with the name of what's in $x. You can even do:

$x = '"I am an invalid var name!"';
$$x = 'abc';
$y = $$x;

Even though what's in x isn't a valid normal variable name, this will work. Strange, huh?


AFAIK the eval code looks very similar to my code as it also has $$. IMHO, it's harder to read eval code.


--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
* Thus wrote Ulrik S. Kofod ([EMAIL PROTECTED]):
> but I think it is easier to read the program when using eval as it is more eye
> catching than just an extra $ that is easily missed.

<quote>
If eval() is the answer, you're almost certainly asking the
wrong question. -- Rasmus Lerdorf, BDFL of PHP
</quote>


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message --- Matthieu Loudes wrote --- napísal::
Hi,

    Where can i find the methods list of module COM ?

Ex :  $Odject = new COM("WinNT://domain");

Thanks !

Matt


http://msdn.microsoft.com/

--- End Message ---
--- Begin Message ---
Used all but 'Generic PHP Framework' and everything was quite fine and
worked out just as i expected. But i was still missing some features
which made me build my own small library to fit into my Framework.

 -- red

Rick Fletcher wrote:
Has anyone done any PHP unit testing? I've been looking around for a unit
testing library to try out. Below are the ones I've found so far:

SimpleTest: http://www.lastcraft.com/simple_test.php
PHPUnit (dead?): http://phpunit.sourceforge.net/
Pear PHPUnit: http://pear.php.net/package/PHPUnit
Generic PHP Framework (dead?): http://gpfr.sourceforge.net/

SimpleTest looks the most complete and the most active, so that's where I'm
leaning. Anyone have any experience with any of these libraries, or have any
comments on PHP Unit testing in general?

Thanks.

Rick

--- End Message ---
--- Begin Message ---
Allmost forgot about this one:

http://www.phppatterns.com/index.php/article/articleview/33/1/2/

very well written ( phpPatterns() ) covers some other nice topics
as well, allways worth a read.

 -- red

Red Wingate wrote:

Used all but 'Generic PHP Framework' and everything was quite fine and
worked out just as i expected. But i was still missing some features
which made me build my own small library to fit into my Framework.

 -- red

Rick Fletcher wrote:

Has anyone done any PHP unit testing? I've been looking around for a unit
testing library to try out. Below are the ones I've found so far:

SimpleTest: http://www.lastcraft.com/simple_test.php
PHPUnit (dead?): http://phpunit.sourceforge.net/
Pear PHPUnit: http://pear.php.net/package/PHPUnit
Generic PHP Framework (dead?): http://gpfr.sourceforge.net/

SimpleTest looks the most complete and the most active, so that's where I'm
leaning. Anyone have any experience with any of these libraries, or have any
comments on PHP Unit testing in general?


Thanks.

Rick

--- End Message ---
--- Begin Message ---
On Wed, 16 Jun 2004 16:10:10 -0400, Gabe <[EMAIL PROTECTED]> wrote:
> 
> Hi Greg, I was looking at your function and I was wondering if you could
>  explain how the slashes function works exactly.  It looks like it is
> recursive, but I don't understand why you would need to do that.

It handles regular form variables as well as arrays.

So if your form had an array of checkboxes coming in via $_POST for
example, it will handle it.

-- 
Greg Donald
http://destiney.com/

--- End Message ---
--- Begin Message ---
Or maybe execution time limit.

[snip]
I've created the code below, but since this file is so large
(currently 8 MB) it won't work.
[/snip]

I would guess you are running into your php memory_limit.

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


_________________________________________________________________
Is your PC infected? Get a FREE online computer virus scan from McAfee� Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963

--- End Message ---
--- Begin Message ---
* Thus wrote Scott Miller ([EMAIL PROTECTED]):
> I have a text file (log file) that I want to be able to read the last 30 or
> 40 lines of.  I've created the code below, but since this file is so large
> (currently 8 MB) it won't work.  The code works on smaller files, but not
> this one.  Can someone look at this below and tell me where I went wrong?
>
> ...
> 
> $fcontents = file($filename);

This will make your script consume lots of memory, and is very
inefficient.

You'd be better of using the unix tail command:

$fp = popen("/usr/bin/tail -$limit $file", 'r');
if (! $fp ) {
  echo 'unable to pipe command';
}
while (!feof($fp) ) {
  $line = fgets($fp);
  print $line;
}

Of course if you're simply going to output the results a simple:

  system("/usr/bin/tail -$limit $file");

Would do the job nicely.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message ---
Forwarded to the list...

----- P�vodn� spr�va -----
Predmet: RE: [PHP] list methods of class COM ?
D�tum: Wed, 16 Jun 2004 17:06:25 -0400
Od: Gryffyn, Trevor <[EMAIL PROTECTED]>
Pre: Marek Kilimajer <[EMAIL PROTECTED]>

I'm not familiar with using COM("WinNT://domain") but I've done quite a bit with COM objects involving Excel, MapPoint, Word and Access. If you're working with a specific application like this, search for "mappoint data model" or "mappoint object model".

Here's the one for MapPoint:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mappoint2004/BIZOMAboutOM.asp

You can probably find what you're looking for in that general area. Some object models are written better than others.

Good luck!

-TG

-----Original Message-----
From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 4:59 PM
To: Matthieu Loudes
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] list methods of class COM ?



Matthieu Loudes wrote --- nap�sal::
> Hi,
> > Where can i find the methods list of module COM ?
> > Ex : $Odject = new COM("WinNT://domain");
> > Thanks !
> > Matt
>


http://msdn.microsoft.com/

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

--- End Message ---
--- Begin Message ---
I have a script that calls a function called conbox. This function creates
the HTML to a content box and you also pass a file to be included into the
content area of the box.
 
The function echos out some of the HTML, then does a simple include(), and
then echos out the rest of the HTML.
 
I'm trying to do this with another file containing PHP code and HTML
together, it's a file that fetches and displays information from a database.
The file is fine by itself, but once I include it into the actual content
box, it does a die(). I have it set to do that if there's a MySQL error, but
it doesn't output any error at all, and the file works by itself. Here is
the code that fetches from the database:

<?php
mysql_select_db($database_default, $default);
$query_headlines = "SELECT id, headline, short, datetime FROM snews ORDER BY
datetime DESC";
$headlines = mysql_query($query_headlines, $default) or die(mysql_error());
$row_headlines = mysql_fetch_assoc($headlines);
$totalRows_headlines = mysql_num_rows($headlines);
?>

And here's where it displays:

<table width="98%"  border="0" cellspacing="0" cellpadding="2"
bordercolor="#616161" align="center" style="border-collapse:collapse">
  <tr bgcolor="#E0EBF1">
    <td align="left" style="padding:3px 3px 3px 3px;"><a
href="snews.php?id=<?php echo $row_headlines['id']; ?>"
class="headline"><?php echo $row_headlines['headline']; ?></a></td>
  </tr>
</table>

This is fine, completely fine, by itself (if I include the database
credentials of course, but if I leave that include in there, it still won't
work). I've already included that file into the file it's being included
into anyway so it should work, but it simply isn't. Here's the conbox
function with less of the echo:

function conbox($title, $contentfile, $content, $width, $height) {
        echo 'Stuff...';
        if($content == '') {
                if([EMAIL PROTECTED]($contentfile)) {
                        echo 'content unavailable';
                }
        }
        if($content != '') {
                echo '<p align="left">'.$content.'</p>';
        }
        echo    'stuff';
}

Like I said, all the database credentials and everything is included into
the final file, but it simply won't work. Any ideas here?

Thanks,
Stephen Craton
http://www.melchior.us <http://www.melchior.us/> 

--- End Message ---
--- Begin Message ---
Stephen Craton wrote:

I have a script that calls a function called conbox. This function creates
the HTML to a content box and you also pass a file to be included into the
content area of the box.
The function echos out some of the HTML, then does a simple include(), and
then echos out the rest of the HTML.
I'm trying to do this with another file containing PHP code and HTML
together, it's a file that fetches and displays information from a database.
The file is fine by itself, but once I include it into the actual content
box, it does a die(). I have it set to do that if there's a MySQL error, but
it doesn't output any error at all, and the file works by itself. Here is
the code that fetches from the database:


<?php
mysql_select_db($database_default, $default);
$query_headlines = "SELECT id, headline, short, datetime FROM snews ORDER BY
datetime DESC";
$headlines = mysql_query($query_headlines, $default) or die(mysql_error());
$row_headlines = mysql_fetch_assoc($headlines);
$totalRows_headlines = mysql_num_rows($headlines);
?>

And here's where it displays:

<table width="98%"  border="0" cellspacing="0" cellpadding="2"
bordercolor="#616161" align="center" style="border-collapse:collapse">
  <tr bgcolor="#E0EBF1">
    <td align="left" style="padding:3px 3px 3px 3px;"><a
href="snews.php?id=<?php echo $row_headlines['id']; ?>"
class="headline"><?php echo $row_headlines['headline']; ?></a></td>
  </tr>
</table>

This is fine, completely fine, by itself (if I include the database
credentials of course, but if I leave that include in there, it still won't
work). I've already included that file into the file it's being included
into anyway so it should work, but it simply isn't. Here's the conbox
function with less of the echo:

function conbox($title, $contentfile, $content, $width, $height) {
        echo 'Stuff...';
        if($content == '') {
                if([EMAIL PROTECTED]($contentfile)) {
                        echo 'content unavailable';
                }
        }
        if($content != '') {
                echo '<p align="left">'.$content.'</p>';
        }
        echo    'stuff';
}

Like I said, all the database credentials and everything is included into
the final file, but it simply won't work. Any ideas here?

Thanks,
Stephen Craton
http://www.melchior.us <http://www.melchior.us/>

You're probably running into a namespace issue here. The global variables that you're trying to use for mysql_select_db aren't in the namespace of the function that's including the file.


I would suggest using a better (OOP) system to get around this. Barring that, the best way IMHO is to use $GLOBALS['database_default'], etc. for the vars in the include that are created globally.

--
paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
Thank you for the suggestion, worked like a charm. I was using GLOBALS
earlier in the script because of the same issue, just wasn't thinking about
it for these variables. :-)
 
Thanks,
Stephen Craton
http://www.melchior.us

-----Original Message-----
From: Justin Patrin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 16, 2004 5:53 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Include Issues

Stephen Craton wrote:

> I have a script that calls a function called conbox. This function 
> creates the HTML to a content box and you also pass a file to be 
> included into the content area of the box.
>  
> The function echos out some of the HTML, then does a simple include(), 
> and then echos out the rest of the HTML.
>  
> I'm trying to do this with another file containing PHP code and HTML 
> together, it's a file that fetches and displays information from a
database.
> The file is fine by itself, but once I include it into the actual 
> content box, it does a die(). I have it set to do that if there's a 
> MySQL error, but it doesn't output any error at all, and the file 
> works by itself. Here is the code that fetches from the database:
> 
> <?php
> mysql_select_db($database_default, $default); $query_headlines = 
> "SELECT id, headline, short, datetime FROM snews ORDER BY datetime 
> DESC"; $headlines = mysql_query($query_headlines, $default) or 
> die(mysql_error()); $row_headlines = mysql_fetch_assoc($headlines); 
> $totalRows_headlines = mysql_num_rows($headlines); ?>
> 
> And here's where it displays:
> 
> <table width="98%"  border="0" cellspacing="0" cellpadding="2"
> bordercolor="#616161" align="center" style="border-collapse:collapse">
>   <tr bgcolor="#E0EBF1">
>     <td align="left" style="padding:3px 3px 3px 3px;"><a 
> href="snews.php?id=<?php echo $row_headlines['id']; ?>"
> class="headline"><?php echo $row_headlines['headline']; ?></a></td>
>   </tr>
> </table>
> 
> This is fine, completely fine, by itself (if I include the database 
> credentials of course, but if I leave that include in there, it still 
> won't work). I've already included that file into the file it's being 
> included into anyway so it should work, but it simply isn't. Here's 
> the conbox function with less of the echo:
> 
> function conbox($title, $contentfile, $content, $width, $height) {
>       echo 'Stuff...';
>       if($content == '') {
>               if([EMAIL PROTECTED]($contentfile)) {
>                       echo 'content unavailable';
>               }
>       }
>       if($content != '') {
>               echo '<p align="left">'.$content.'</p>';
>       }
>       echo    'stuff';
> }
> 
> Like I said, all the database credentials and everything is included 
> into the final file, but it simply won't work. Any ideas here?
> 
> Thanks,
> Stephen Craton
> http://www.melchior.us <http://www.melchior.us/>

You're probably running into a namespace issue here. The global variables
that you're trying to use for mysql_select_db aren't in the namespace of the
function that's including the file.

I would suggest using a better (OOP) system to get around this. Barring
that, the best way IMHO is to use $GLOBALS['database_default'], etc. for the
vars in the include that are created globally.

--
paperCrane <Justin Patrin>

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

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

 

I've built my own shopping cart and use a library supplied by USAePay.  The
library is accessed via an include statement in my code.  Because of theirs
a desire to keep this library outside of my public web file directory
USAePay recommended using:

 

include "/usr/local/lib/php/usaepay.php";

 

I put the file "usaepay.php" in that directory (using a dedicated linux box
with root access) and run my script with the above include.  I get the
following: 

 

Warning: main(): open_basedir restriction in effect.
File(/usr/local/lib/php/usaepay.php) is not within the allowed path(s):
(/home/httpd/vhosts/tgwedding.com/httpdocs:/tmp) in
/home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/payment7.php on line 11

 

How can I resolve this?

 

Thanks,

Ryan


--- End Message ---
--- Begin Message ---
Warning: main(): open_basedir restriction in effect.
File(/usr/local/lib/php/usaepay.php) is not within the allowed path(s):
(/home/httpd/vhosts/tgwedding.com/httpdocs:/tmp) in
/home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/payment7.php on line 11



How can I resolve this?


Search the PHP docs or google. You'll find something.


-- paperCrane <Justin Patrin>

--- End Message ---
--- Begin Message ---
* Thus wrote Ryan Schefke ([EMAIL PROTECTED]):
> 
> I've built my own shopping cart and use a library supplied by USAePay.  The
> library is accessed via an include statement in my code.  Because of theirs
> a desire to keep this library outside of my public web file directory
> USAePay recommended using:
> 
> include "/usr/local/lib/php/usaepay.php";

Actually you're better off not hard coding that path. A simple
  include "usaepay.php";

> 
> I put the file "usaepay.php" in that directory (using a dedicated linux box
> with root access) and run my script with the above include.  I get the
> following: 
> 
> Warning: main(): open_basedir restriction in effect.
> File(/usr/local/lib/php/usaepay.php) is not within the allowed path(s):
> (/home/httpd/vhosts/tgwedding.com/httpdocs:/tmp) in
> /home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/payment7.php on line 11

Two things:
1. which is probably already set, is to make sure your include_path 
   has /usr/local/lib/php  in listed in it as the first item.
2. add to open_basedir: /usr/local/lib/php

You'll be all set.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

--- End Message ---
--- Begin Message --- Ryan Schefke wrote --- nap�sal::
Hi All,



I've built my own shopping cart and use a library supplied by USAePay.  The
library is accessed via an include statement in my code.  Because of theirs
a desire to keep this library outside of my public web file directory
USAePay recommended using:



include "/usr/local/lib/php/usaepay.php";



I put the file "usaepay.php" in that directory (using a dedicated linux box
with root access) and run my script with the above include. I get the
following:




Warning: main(): open_basedir restriction in effect.
File(/usr/local/lib/php/usaepay.php) is not within the allowed path(s):
(/home/httpd/vhosts/tgwedding.com/httpdocs:/tmp) in
/home/httpd/vhosts/tgwedding.com/httpdocs/tgwedding/payment7.php on line 11



How can I resolve this?

The library must be either under /home/httpd/vhosts/tgwedding.com/httpdocs or /tmp. /tmp is out of question, so the only directory left is your docroot. But as you are saing you are root on the server, you can change open_basedir setting to /home/httpd/vhosts/tgwedding.com:/tmp and put the library to /home/httpd/vhosts/tgwedding.com/usepay/ directory.

--- End Message ---
--- Begin Message --- Hi, I have been working to create a program that takes a user-uploaded background image, a little alpha blending, some data, and a pinch of fairy dust, and outputs a nice image. I have had trouble with the image displaying properly in Internet Explorer. An example:

http://ffxi.nerdlife.net/ffxi.php?id=1

If you open it in any non-IE browser, it looks fine, but if you open it in IE, the gray background is not made transparent.

My question is, how can I fix this, and if I can't, is there any alternative for making a transparent background. Here's my code snipplet:

        $color = ImageColorAt($im, 1, 1);
        imagecolortransparent($im, $color);

Also, I output the file as a png file, but I don't care what it is output as (although my server for some reason doesn't recognize ImageGif...):

        header("Content-Type: image/png");
        Imagepng($im);

Any advice?

Thanks,
Brian

--- End Message ---
--- Begin Message ---
That's sort of a known issue with our oh so standards compliant
favourite browser...

Search google for
       ie png transparency

and though shall be enlighted.
Richard

-----Original Message-----
> Hi, I have been working to create a program that takes a user-uploaded
> background image, a little alpha blending, some data, and a pinch of
> fairy dust, and outputs a nice image.  I have had trouble with the image
> displaying properly in Internet Explorer.  An example:

> http://ffxi.nerdlife.net/ffxi.php?id=1

> If you open it in any non-IE browser, it looks fine, but if you open it
> in IE, the gray background is not made transparent.

> My question is, how can I fix this, and if I can't, is there any 
> alternative for making a transparent background.  Here's my code snipplet:

>               $color = ImageColorAt($im, 1, 1);
>       imagecolortransparent($im, $color);

> Also, I output the file as a png file, but I don't care what it is 
> output as (although my server for some reason doesn't recognize 
> ImageGif...):

>       header("Content-Type: image/png");
>       Imagepng($im);

> Any advice?

> Thanks,
> Brian

--- End Message ---
--- Begin Message ---
HI there,

I am wondering if it is possible to generate a pdf page with pdflib based on a existing pdf document. For example using an invoice template and filling in the values with php.

Thank you for any hint,

Merlin
--- End Message ---
--- Begin Message ---
"Merlin" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> HI there,
>
> I am wondering if it is possible to generate a pdf page with pdflib based
on a
> existing pdf document. For example using an invoice template and filling
in the
> values with php.

The last time I checked it (1 year ago) you needed the PDI library of PDFLib
to open an existing PDF file and do something with it. Go to the pdflib page
and check if this is still the case.

I simple workaround would be to place placeholders into your template
(e.g.[###filed1###] or something similar) then get the file contents with
get_file_contents() or fopen() and replace the placeholders with their
values with str_replace().

Hope it helps. Regards,
Torsten Roehr


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

This is what is probably a newbie session problem.

I've been having some trouble with sessions on php 4.0.6, I'm developing 
a website in which I don't have direct control over the server.  Due to 
some other problems I created a test counter script to try to narrow 
down where the problem resides but no I'm sort of stuck.

Here is the small counter script.

session_start();
print_r($HTTP_SESSION_VARS);
if (!session_is_registered('count2345')) {
    $GLOBALS['count2345'] = 0;
    echo "create count<br>";
    session_register('count2345');
} else {
    $count2345++;
}
echo "<br>";
echo session_id();
session_write_close();

When I refresh it will periodically loose the count2345 session variable 
and recreate the variable.  At times it will also jump in value.

Here are also the php configuration session settings.

session.auto_start      Off         Off
session.cache_expire 180         180
session.cache_limiter   nocache     nocache
session.cookie_domain   no value    no value
session.cookie_lifetime 0        0
session.cookie_path  /        /
session.cookie_secure   Off         Off
session.entropy_file    no value    no value
session.entropy_length  0        0
session.gc_maxlifetime  1440     1440
session.gc_probability  1        1
session.name         PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler files       files
session.save_path    /tmp        /tmp
session.serialize_handler php       php
session.use_cookies  On       On

Here is also the compile configuration which includes --enable-trans-sid
�'./configure' '--disable-pear' '--enable-ftp' 
'--with-sybase-ct=/usr/local/freetds' '--enable-trans-sid' 
'--enable-force-cgi-redirect'

Thank you

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

I'm trying to write a function that sends an email with an attachment using
sendmail,
But I can't seem to get it working, the code I currently have is below,
Any ideas would be much appreciated.

I'm probably doing something stupid as the output is what its meant to be
except it isn't divided up (i.e. attachment is text)

Regards

Mark Cubitt

<CODE>

function send_mail($to, $from, $subject, $body, $attachment = '',
$attachmentDir = '')
{

        $path_to_sendmail = "/usr/sbin/sendmail";
        $fp = popen("$path_to_sendmail -t", "w");

        if ($attachment != '')
        {

                $filename = $attachmentDir.$attachment;

                $filePointer = fopen($filename, "rb");

                $fileContent = fread($filePointer, filesize($filename));

                $fileContent = chunk_split(base64_encode($fileContent));

                fclose($filePointer);

                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

                $num = fputs($fp, "To: $to\n");
                $num += fputs($fp, "From: $from\n");
                $num += fputs($fp, "Subject: $subject\n");
                $num += fputs($fp, "MIME-Version: 1.0\n");
                $num += fputs($fp, "Content-type: multipart/mixed;\n");
                $num += fputs($fp, " boundry=\"{".$mime_boundary."}\"\n\n");
                $num += fputs($fp, 'This is a multi-part message in MIME
format'."\n");
                $num += fputs($fp, "\n");
                $num += fputs($fp, "--{".$mime_boundary."}\n");
                $num += fputs($fp, "Content-type: text/html;
charset=iso-8859-1\n");
//                $num += fputs($fp, "Content-Transfer-Encoding: 7bit\n");
                $num += fputs($fp, "\n");
//              $num += fputs($fp, "Subject: $subject\n");
                $num += fputs($fp, "$body");
                $num += fputs($fp, "--{".$mime_boundary."}\n");
                $num += fputs($fp, "--{".$mime_boundary."}\n");
                $num += fputs($fp, "Content-type: application/zip;\n");
                $num += fputs($fp, " name=\"{".$attachment."}\"\n");
                $num += fputs($fp, "Content-Transfer-Encoding: base64\n");
//                $num += fputs($fp, "Content-Disposition: attachment;\n");
//                $num += fputs($fp, " filename=\"{".$attachment."\"}\n");
                $num += fputs($fp, "\n");
                $num += fputs($fp, $fileContent);
                $num += fputs($fp, "\n");
                $num += fputs($fp, "--{".$mime_boundary."}--\n");


        }
        else
        {

                $num = fputs($fp, "To: $to\n");
                $num += fputs($fp, "From: $from\n");
                $num += fputs($fp, "MIME-Version: 1.0\n");
                $num += fputs($fp, "Content-type: text/html;
charset=iso-8859-1\n");
                $num += fputs($fp, "Subject: $subject\n\n");
                $num += fputs($fp, "$body");

        }

        pclose($fp); if ($num>0) { return 1; } else { return 0; }

} // end function send_mail()

</CODE>

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

don't try to invent the wheel twice. There are great functions for that already available. Try to search for phpmailer. Thats a great one.

Merlin

Mark Cubitt wrote:

Hello,

I'm trying to write a function that sends an email with an attachment using
sendmail,
But I can't seem to get it working, the code I currently have is below,
Any ideas would be much appreciated.

I'm probably doing something stupid as the output is what its meant to be
except it isn't divided up (i.e. attachment is text)

Regards

Mark Cubitt

<CODE>

function send_mail($to, $from, $subject, $body, $attachment = '',
$attachmentDir = '')
{

        $path_to_sendmail = "/usr/sbin/sendmail";
        $fp = popen("$path_to_sendmail -t", "w");

        if ($attachment != '')
        {

                $filename = $attachmentDir.$attachment;

                $filePointer = fopen($filename, "rb");

                $fileContent = fread($filePointer, filesize($filename));

                $fileContent = chunk_split(base64_encode($fileContent));

                fclose($filePointer);

                $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

                $num = fputs($fp, "To: $to\n");
                $num += fputs($fp, "From: $from\n");
                $num += fputs($fp, "Subject: $subject\n");
                $num += fputs($fp, "MIME-Version: 1.0\n");
                $num += fputs($fp, "Content-type: multipart/mixed;\n");
                $num += fputs($fp, " boundry=\"{".$mime_boundary."}\"\n\n");
                $num += fputs($fp, 'This is a multi-part message in MIME
format'."\n");
                $num += fputs($fp, "\n");
                $num += fputs($fp, "--{".$mime_boundary."}\n");
                $num += fputs($fp, "Content-type: text/html;
charset=iso-8859-1\n");
//                $num += fputs($fp, "Content-Transfer-Encoding: 7bit\n");
                $num += fputs($fp, "\n");
//              $num += fputs($fp, "Subject: $subject\n");
                $num += fputs($fp, "$body");
                $num += fputs($fp, "--{".$mime_boundary."}\n");
                $num += fputs($fp, "--{".$mime_boundary."}\n");
                $num += fputs($fp, "Content-type: application/zip;\n");
                $num += fputs($fp, " name=\"{".$attachment."}\"\n");
                $num += fputs($fp, "Content-Transfer-Encoding: base64\n");
//                $num += fputs($fp, "Content-Disposition: attachment;\n");
//                $num += fputs($fp, " filename=\"{".$attachment."\"}\n");
                $num += fputs($fp, "\n");
                $num += fputs($fp, $fileContent);
                $num += fputs($fp, "\n");
                $num += fputs($fp, "--{".$mime_boundary."}--\n");


} else {

                $num = fputs($fp, "To: $to\n");
                $num += fputs($fp, "From: $from\n");
                $num += fputs($fp, "MIME-Version: 1.0\n");
                $num += fputs($fp, "Content-type: text/html;
charset=iso-8859-1\n");
                $num += fputs($fp, "Subject: $subject\n\n");
                $num += fputs($fp, "$body");

        }

        pclose($fp); if ($num>0) { return 1; } else { return 0; }

} // end function send_mail()

</CODE>

--- End Message ---

Reply via email to