php-general Digest 5 Jan 2003 09:19:52 -0000 Issue 1804

Topics (messages 130242 through 130301):

No Global Code Fixing
        130242 by: Michael J. Pawlowsky
        130244 by: Rasmus Lerdorf
        130245 by: Michael J. Pawlowsky
        130248 by: Michael J. Pawlowsky
        130249 by: Tularis
        130250 by: Jason Sheets

Re: security in guest book and user forums
        130243 by: Seraphim
        130246 by: Tularis
        130254 by: Jason Wong
        130285 by: Justin French
        130286 by: Justin French

mssql functions
        130247 by: Duncan

Re: One more form question
        130251 by: Ford, Mike               [LSS]

Re: PHP and MySQL bug
        130252 by: Stefan Hinz, iConnect \(Berlin\)
        130253 by: Michael J. Pawlowsky

You gotta love it...
        130255 by: Michael J. Pawlowsky
        130256 by: Andy Turegano

Re: [PEAR-DEV] Announcing open CVS for phpDocumentor project
        130257 by: Greg Beaver

I can't code today to save my life! :(
        130258 by: Phil Powell
        130259 by: Chris Hayes
        130260 by: Michael J. Pawlowsky
        130261 by: Michael J. Pawlowsky

Re: upgrading WAMP environment
        130262 by: David T-G

counter problem
        130263 by: Anthony Ritter
        130265 by: Michael J. Pawlowsky
        130266 by: Michael J. Pawlowsky
        130270 by: Anthony Ritter
        130281 by: Michael J. Pawlowsky

Second (Bizarre) Question regarding PHP and ASP
        130264 by: Phil Powell
        130267 by: Michael J. Pawlowsky
        130268 by: Andrew Brampton
        130273 by: Gerald Timothy Quimpo
        130280 by: Phil Powell
        130284 by: Michael J. Pawlowsky

Perl > PHP
        130269 by: Sam
        130275 by: Leif K-Brooks

web visitor viewing a script?
        130271 by: Larry Brown
        130277 by: Timothy Hitchens \(HiTCHO\)
        130282 by: Michael J. Pawlowsky
        130294 by: Larry Brown

PHP and empty() if form value is 0
        130272 by: Phil Powell
        130278 by: Michael Sims
        130279 by: Phil Powell
        130300 by: Michael Sims

Re: exec() not exec-ing?
        130274 by: Brendon Gearin

Read-only gif support in 4.3.0
        130276 by: Adam Plocher
        130283 by: Michael J. Pawlowsky
        130287 by: Adam Plocher
        130288 by: Michael J. Pawlowsky
        130289 by: Adam Plocher
        130292 by: Rasmus Lerdorf
        130293 by: Michael J. Pawlowsky

Function to catch all mySQL errors?
        130290 by: Jeff Lewis
        130291 by: Adam Plocher
        130296 by: Michael J. Pawlowsky
        130298 by: Tom Rogers

pack, unpack and little endian double values
        130295 by: timmer

Re: Recommend payment processors?
        130297 by: Jonathan Rosenberg \(Tabby's Place\)
        130299 by: David McInnis

php4.3.0 & GD library
        130301 by: thkiat

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 ---
Well I've been fixing up all my code (and other peoples which is worst) getting ready 
to do an upgrade to 4.3. and turning off globals and warnings on.

I very often move parameters that were once POSTed as a GETs.
For instance... some one does a search but is not logged in, they can see the results 
but don's see the "Edit" results button.
So they log in, and I send them back to the search they just did.

The first search is done by a POST and when I redirect them after the login it's done 
by a GET.

So I use to simply not specify if it was a GET or POST and looked to see if the var 
existed or not to see how to load that page.

Now I've been adding alot of:


        if (isset($_POST['keyword'])){
            $keyword = $_POST['keyword'];
        }elseif (isset($_GET['keyword'])){
            $keyword = $_GET['keyword'];
        } else {
            unset($keyword);
        }


I suppose I could also do something like this (which is not much different)

     if(isset($_POST['keyword']) || isset($_GET['keyword'])){
        $keyword = isset($_POST['keyword'])?$_POST['keyword']:$_GET['keyword'];
     }else{
       unset($keyword);
     }

I guess I could get rid of the unset, but I like it there just in case something 
earlier filled that puppy.

So I end up with alot of these right now at the top of each page.
Especially if the URI is something like 
http:www.mysite.com/index.php?this=that&id=1&lang=en&so=on&so=on&so=on&so=on&so=on&so=on

Know what I mean?

So just wondering if anyine had something really elegant to replace it.


Cheers,
Mike

--- End Message ---
--- Begin Message ---
Why don't you just use $_REQUEST['keyword'] ?

On Sat, 4 Jan 2003, Michael J. Pawlowsky wrote:

> Well I've been fixing up all my code (and other peoples which is worst) getting 
>ready to do an upgrade to 4.3. and turning off globals and warnings on.
>
> I very often move parameters that were once POSTed as a GETs.
> For instance... some one does a search but is not logged in, they can see the 
>results but don's see the "Edit" results button.
> So they log in, and I send them back to the search they just did.
>
> The first search is done by a POST and when I redirect them after the login it's 
>done by a GET.
>
> So I use to simply not specify if it was a GET or POST and looked to see if the var 
>existed or not to see how to load that page.
>
> Now I've been adding alot of:
>
>
>         if (isset($_POST['keyword'])){
>             $keyword = $_POST['keyword'];
>         }elseif (isset($_GET['keyword'])){
>             $keyword = $_GET['keyword'];
>         } else {
>             unset($keyword);
>         }
>
>
> I suppose I could also do something like this (which is not much different)
>
>      if(isset($_POST['keyword']) || isset($_GET['keyword'])){
>         $keyword = isset($_POST['keyword'])?$_POST['keyword']:$_GET['keyword'];
>      }else{
>        unset($keyword);
>      }
>
> I guess I could get rid of the unset, but I like it there just in case something 
>earlier filled that puppy.
>
> So I end up with alot of these right now at the top of each page.
> Especially if the URI is something like 
>http:www.mysite.com/index.php?this=that&id=1&lang=en&so=on&so=on&so=on&so=on&so=on&so=on
>
> Know what I mean?
>
> So just wondering if anyine had something really elegant to replace it.
>
>
> Cheers,
> Mike
>
>
--- End Message ---
--- Begin Message ---
I just found a better answer, but still open to suggestions....

with the URI :  
http://rc.mikeathome.net/test/index.php?one=1&two[]=2&two[]=3&three=3&key=This%20is%20the%20key

I tried this:


<?php

        if (isset($_GET)){
                foreach($_GET as $key => $value){
                        ${$key}=$value;
                }
                echo $one;
                echo "<br>";
                print_r($two);
                echo "</br>";
                echo $three . "<br>\n";
                echo $key;
        }

?>

Result:
-------------------------------------------------
1
Array ( [0] => 2 [1] => 3 )
3
This is the key
------------------------------------------------


And that actually worked.......  I can live without the unset()'s.
Just need to add the same for POST and do an include with it.

Anyone have a better idea?



*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 1:22 PM Michael J. Pawlowsky wrote:

>
>So just wondering if anyone had something really elegant to replace it.
>
>
>Cheers,
>Mike




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

Hey that's great... I didn't know about $_REQUEST....
I suppose the order of overlapping is set in php.ini

I think I saw that somewhere.


Thanks

As for tunring it back on... in .htaccess
I like the idea of having cleaner code....




*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 11:37 AM Rasmus Lerdorf wrote:

>Why don't you just use $_REQUEST['keyword'] ?



--- End Message ---
--- Begin Message --- NOTE:
this basicly mimics the way register_globals works.

I use this code to fix register_globals aswell as the magic_quotes_gpc:

$global = @array($_SESSION, $_SERVER, $_COOKIE, $_POST, $_GET, $_FILES, $_ENV);
$global_old = @array($HTTP_SESSION_VARS, $HTTP_SERVER_VARS, $HTTP_COOKIE_VARS, $HTTP_POST_VARS, $HTTP_GET_VARS, $HTTP_FILES_VARS, $HTTP_ENV_VARS);

if(!$global[1]){
$global = $global_old;
}

if(!@ini_get('magic_quotes_gpc')){
foreach($global as $array){
if(is_array($array)){
foreach($array as $key=>$val){
$$key = addslashes($val);
}
}
}
}else{
foreach($global as $array){
if(is_array($array)){
foreach($array as $key=>$val){
$$key = $val;
}
}
}
}

--- End Message ---
--- Begin Message ---
If you do that you might as well just turn on register globals, you
should look at the $_REQUEST variable, it combines $_POST, $_GET and
$_COOKIE into one array so you can just reference $_REQUEST['variable']
for example $_REQUEST['one'].

Jason

On Sat, 2003-01-04 at 11:50, Michael J. Pawlowsky wrote:
> 
> I just found a better answer, but still open to suggestions....
> 
> with the URI :  
>http://rc.mikeathome.net/test/index.php?one=1&two[]=2&two[]=3&three=3&key=This%20is%20the%20key
> 
> I tried this:
> 
> 
> <?php
> 
>       if (isset($_GET)){
>               foreach($_GET as $key => $value){
>                       ${$key}=$value;
>               }
>               echo $one;
>               echo "<br>";
>               print_r($two);
>               echo "</br>";
>               echo $three . "<br>\n";
>               echo $key;
>       }
> 
> ?>
> 
> Result:
> -------------------------------------------------
> 1
> Array ( [0] => 2 [1] => 3 )
> 3
> This is the key
> ------------------------------------------------
> 
> 
> And that actually worked.......  I can live without the unset()'s.
> Just need to add the same for POST and do an include with it.
> 
> Anyone have a better idea?
> 
> 
> 
> *********** REPLY SEPARATOR  ***********
> 
> On 04/01/2003 at 1:22 PM Michael J. Pawlowsky wrote:
> 
> >
> >So just wondering if anyone had something really elegant to replace it.
> >
> >
> >Cheers,
> >Mike
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
Anders Thoresson wrote:
>   I've seen both guest books and user forums "hacked" by users who
> enter javascript or other code, and that way redirects vistors to
> other sites or do other unwelcome things. What expressions should I
> look for and not allow in my forms?

I use the htmlspecialchars() function to disable all html. This function
basically puts a '\' in front of eacht html character and thus disables all
html.
You may not want to do this if you want to allow, for example <b></b> or
other friendly html. If so you can use a regex to disable the <script> or
</table> tags.

Now that I think about it, it might be better to disable all html and later
enable <i>,<b> etc (or define your own, like a lot of forums seem to do).

-Peter


--- End Message ---
--- Begin Message ---
most forums do this
<?php
htmlentities($input);

--save input
-- get output
if($html == 'on'){
$output = hymlentities_decode($output);
}

print($output);
exit();
?>

Seraphim wrote:
Anders Thoresson wrote:

 I've seen both guest books and user forums "hacked" by users who
enter javascript or other code, and that way redirects vistors to
other sites or do other unwelcome things. What expressions should I
look for and not allow in my forms?

I use the htmlspecialchars() function to disable all html. This function
basically puts a '\' in front of eacht html character and thus disables all
html.
You may not want to do this if you want to allow, for example <b></b> or
other friendly html. If so you can use a regex to disable the <script> or
</table> tags.

Now that I think about it, it might be better to disable all html and later
enable <i>,<b> etc (or define your own, like a lot of forums seem to do).

-Peter



--- End Message ---
--- Begin Message ---
On Sunday 05 January 2003 01:16, Anders Thoresson wrote:
>   I've seen both guest books and user forums "hacked" by users who enter
> javascript or other code, and that way redirects vistors to other sites or
> do other unwelcome things. What expressions should I look for and not allow
> in my forms?

Disallow all HTML tags by using strip_tags().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"A dirty mind is a joy forever."
-- Randy Kunkee
*/

--- End Message ---
--- Begin Message ---
on 05/01/03 5:24 AM, Seraphim ([EMAIL PROTECTED]) wrote:

> I use the htmlspecialchars() function to disable all html. This function
> basically puts a '\' in front of eacht html character and thus disables all
> html.
> You may not want to do this if you want to allow, for example <b></b> or
> other friendly html. If so you can use a regex to disable the <script> or
> </table> tags.
> 
> Now that I think about it, it might be better to disable all html and later
> enable <i>,<b> etc (or define your own, like a lot of forums seem to do).

What about striptags()? Designed EXACTLY for disabling HTML tags, except for
a list you allow:

<?
$text = stiptags($text,'<b><i>'); // allows bold and italics
?>

Justin


--- End Message ---
--- Begin Message ---
on 05/01/03 4:16 AM, Anders Thoresson ([EMAIL PROTECTED]) wrote:

> I've seen both guest books and user forums "hacked" by users who enter
> javascript or other code, and that way redirects vistors to other sites or
> do other unwelcome things. What expressions should I look for and not allow
> in my forms?

Personally, I'd disallow ALL HTML tags.  Why?  Best two reasons I have are:

- someone might open a <b> tag, and never close it, making your whole page
bold, or a link, or whatever

- someone could do something evil with javascript or any other
onmouseover/click type event, like
<b onmouseover="javascript:window.close();"> (can't remember exact syntax)


Just use striptags() (or is it strip_tags()?) on the entire contents of all
your form's text elements, giving you clean text.


If you wanted to bring back simple formatting (say, B,I,BR), you could
implement 'BBtags', basically using [ and ] instead of < and >:

Hello, [b]this bit is in bold[/b][br][i]and this in italics on a new
line[/i].

Then you can specifically search and replace those tags using str_replace()
or eregi_replace() or preg_replace().


Personally, I believe they don't have the right to get such amazing access
to your site... everyone who you don't "know" shouldn't be trusted to
provide decent content, or write decent HTML.


Cheers,

Justin


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

i need the php mssql functions, but php is not configured --with-mssql on my server.
What options do i have to enable this?
I mean, if i need the mssql-functions, does the client (as stated in the php manual) have to be installed, or can i use s.th. dynamical and load it at runtime?
S.o. mentioned to use a mssql.so with the php dl command, but regarding the client isn't installed on the server, would it work then?
btw: with client i mean Sybase's OpenClient or FreeTDS.

Regards,
Duncan

--- End Message ---
--- Begin Message ---
-----Original Message-----
From: David Chamberlin
To: [EMAIL PROTECTED]

Is there an easy way to set something in a select list to be selected? 
Right now I'm doing a real brute-force method.  e.g.,

        echo "<td><select name=\"disp_address\">";
        $choices = array( 'pub' => 'On Public Page',
           'members' => 'Only on Members Page',
           'nodisp' => 'Do not Display' );
        foreach ( $choices as $key => $choice ) {
          $selected = '';
          if ( strcmp( $key, $member_info->display_address ) == 0 ) {
            $selected = 'selected';
          }
          echo "<option value=\"$key\" $selected>$choice";
        }
        echo '</select></td>';
--------------------------

Well, that's pretty much how to do it.  I'd really only query the expense of
a call to strcmp(), rather than just doing a straight comparison.  And I'd
tend to do the if in-line where required, rather than assigning to an
intermediate variable.  Which gives you this:

        foreach ( $choices as $key => $choice ) {
          echo "<option value=\"$key\""
          if ($key==$member_info->display_address) {
            echo 'selected';
          }
          echo ">$choice</option>";
        }

Actually, I often wrap the "selected" test into a ?: operator, so you get
something like this:

        foreach ( $choices as $key => $choice ) {
          echo "<option value=\"$key\"" .
             . ($key==$member_info->display_address?'selected':'')
             . ">$choice</option>";
        }

Also, the suggestion of turning this whole thing into a function is a good
one, if that works for you.

Cheers!

Mike Ford
--- End Message ---
--- Begin Message ---
Nuno,

> $r=MYSQL_QUERY("SELECT n,u,m,h FROM d WHERE id='$id'");
>
> /* Some code including "mysql_num_rows" and "mysql_fetch_array($r,
> MYSQL_NUM)"
> And the another query:
> */
>
> MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'");
>
> /* i don't know why but this doesn't work!*/

It doesn't work because of the /* Some code including ... */ part ;-)

First thing, I would check if $h and $id really are what you expect them
to be, like:

$sql = "UPDATE d SET h='$h' WHERE id='$id'";
echo $sql;
MYSQL_QUERY($sql);

If this part is okay, then the problem lies within this myterious /*
Some code */.

Regards,
--
  Stefan Hinz <[EMAIL PROTECTED]>
  Geschäftsführer / CEO iConnect GmbH <http://iConnect.de>
  Heesestr. 6, 12169 Berlin (Germany)
  Tel: +49 30 7970948-0  Fax: +49 30 7970948-3

----- Original Message -----
From: "Nuno Lopes" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, January 04, 2003 11:46 AM
Subject: PHP and MySQL bug


> Dear Sirs,
>
> I'm using PHP and MySQL to make my programs. But I think I discovered
a bug
> in PHP or in MySQL (I don't know!).
>
> In one of my files I have the following:
>
> MYSQL_CONNECT("localhost", "**user**", "**pass**");
> mysql_select_db("be");
> $r=MYSQL_QUERY("SELECT n,u,m,h FROM d WHERE id='$id'");
>
> /* Some code including "mysql_num_rows" and "mysql_fetch_array($r,
> MYSQL_NUM)"
> And the another query:
> */
>
> MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'");
>
> /* i don't know why but this doesn't work! But if I close the
connection and
> open another te query is done:*/
>
> MYSQL_CLOSE();
> MYSQL_CONNECT("localhost", "**user**", "**pass**");
> mysql_select_db("be");
> MYSQL_QUERY("UPDATE d SET h='$h' WHERE id='$id'");
>
> ---------------
> I don't know why is this? Because I'm used to do more than a query per
> connection and this never happened!
> I'm using Win 2k, Apache 2.0.43, MySQL 3.23.49-nt and PHP 4.3.
>
>
> I hope you solve this,
> Nuno Lopes
>
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>

--- End Message ---
--- Begin Message ---
Personally I think the problem lies somewhere between the chair and the keyboard....

(Sorry, couldn't resist)  :-)



*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 4:58 PM Stefan Hinz, iConnect (Berlin) wrote:

>It doesn't work because of the /* Some code including ... */ part ;-)
>



--- End Message ---
--- Begin Message ---
When doing a function seach at www.php.net I just got:

Parse error: parse error in /local/Web/sites/phpweb/search.php on line 233

Twice in a row...   Maybe they will be posting us a question soon!!  :-)





--- End Message ---
--- Begin Message ---
Well, we're all human.


On Sat, 4 Jan 2003, Michael J. Pawlowsky wrote:

> 
> When doing a function seach at www.php.net I just got:
> 
> Parse error: parse error in /local/Web/sites/phpweb/search.php on line 233
> 
> Twice in a row...   Maybe they will be posting us a question soon!!  :-)
> 
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
--- End Message ---
--- Begin Message ---
Hi all,

open cvs has been fixed.  Use at will

Take care,
Greg

"Jesus M. Castagnetto" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> It does not seem to be working at the moment.
>
> --- Greg Beaver <[EMAIL PROTECTED]> wrote:
> > Hello all,
> >
> > Josh Eichorn has just finished setting up an open cvs for the
phpDocumentor
> > project (http://www.phpdoc.org).  To get a current cvs build, use this
> > command:
> >
> > cvs -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot login
> >
> > don't enter a password, then
> >
> > cvs -z 3 -d :pserver:[EMAIL PROTECTED]:/opt/cvsroot co phpdoc
>
> I got:
>
> ...
> U phpdoc/Documentation/Release-old/Release-1.1.0rc1
> U phpdoc/Documentation/Release-old/Release-1.1.0rc2
> cvs server: Updating phpdoc/Documentation/old
> cvs server: failed to create lock directory for
> `/opt/cvsroot/phpdoc/Documentation/old'
> (/opt/cvsroot/phpdoc/Documentation/old/#cvs.lock): Permission denied
> cvs server: failed to obtain dir lock in repository
> `/opt/cvsroot/phpdoc/Documentation/old'
> cvs [server aborted]: read lock failed - giving up
> ...
>
> Seems like the repository is messed up.
>
>
> =====
> --- Jesus M. Castagnetto ([EMAIL PROTECTED])
>
> Research:
>  http://metallo.scripps.edu/
> Personal: http://www.castagnetto.org/
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com


--- End Message ---
--- Begin Message ---
I have $REQUEST_URI that will take two values:

"/event/login.php"

and

"/event/register.php"

What I need to do is so simple it's brainless!!! I need to look into $REQUEST_URI and 
find if it contains "register.php".  I tried this and it completely failed, the 
results were wrong every time:

if (strpos($REQUEST_URI, "register.php") !== 0) { // you're in login.php }

I don't know why I can't get this other than weekend stupidity, can someone help?

Thanx
Phil
--- End Message ---
--- Begin Message ---
At 22:21 4-1-2003, you wrote:
completely failed, the results were wrong every time:

if (strpos($REQUEST_URI, "register.php") !== 0) { // you're in login.php }
try

if (!strpos($REQUEST_URI, "register.php") === FALSE)

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

if(stristr($_SERVER['REREQUEST_URI'], "register.php"){
        echo "at register";
} else {
        echo "Not";
}

Not tested but should work.. also case insensitive now...



*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 4:21 PM Phil Powell wrote:

>I have $REQUEST_URI that will take two values:
>
>"/event/login.php"
>
>and
>
>"/event/register.php"
>
>What I need to do is so simple it's brainless!!! I need to look into
>$REQUEST_URI and find if it contains "register.php".  I tried this and it
>completely failed, the results were wrong every time:
>
>if (strpos($REQUEST_URI, "register.php") !== 0) { // you're in login.php }
>
>I don't know why I can't get this other than weekend stupidity, can
>someone help?
>
>Thanx
>Phil




--- End Message ---
--- Begin Message ---
I must be doibg drugs with all those typos...  

Typos removed:



<?php

if(stristr($_SERVER['REQUEST_URI'], "register.php")){
        echo "at register";
} else {
        echo "Not";
}


?>


*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 4:43 PM Michael J. Pawlowsky wrote:

>try
>
>if(stristr($_SERVER['REREQUEST_URI'], "register.php"){
>       echo "at register";
>} else {
>       echo "Not";
>}
>
>Not tested but should work.. also case insensitive now...
>
>


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

...and then Anders Thoresson said...
% 
%  I've been using Apache, MySQL and PHP under Win2k for a while to learn 
% PHP. At the moment, I'm running PHP 4.2.2, MySQL 3.23.39 and Apache 2.0.40.

Good for you!  All you have left to do is upgrade to Linux ;-)


% 
%  During the holidays, I've read about a security hole in MySQL and 

I haven't seen this one...  If the list isn't interested, could you at
least send me a pointer?


% therefore plans to upgrade to 3.23.54a. At the same time, I want to install 
% PHP 4.3.0 and Apache 2.0.43.

Sounds like fun.


% 
%  But when I started to look for upgrading instructions for each software 
% package, I find nothing.

Yeah.  Generally just think of it as a fresh install instead of an
upgrade.

If I were you, I would

  - shut down mysqld and httpd

  - make a backup, of course

  - save your configs for each (did you install the utils originally?)

  - remove all three

  - install apache

  - install mysql

  - install php

  - install perl ;-)

I say that because the web server is the base and mysql may tie into it;
then you load mysql so php can see both it and the web server; then you
drop in php (and the same for perl and mod_perl :-)

You should be fine with the installation instructions for each.  When in
doubt, you might try the mailing lists for each, but I know that they are
all supposed to go in together.


HTH & HAND

:-D
-- 
David T-G                      * There is too much animal courage in 
(play) [EMAIL PROTECTED] * society and not sufficient moral courage.
(work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/      Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

Attachment: msg91643/pgp00000.pgp
Description: PGP signature

--- End Message ---
--- Begin Message ---
The following script is found in Matt Zandstra's book on PHP (Sams) on page
160.

He's explaining forms with PHP and has hard coded a value - 42.

He also is explaining a hidden fleld where the user can submit the number
and each time the user hits submit in the formbox, the counter will register
the total number of guesses.

However, after running this script and submitting the number, I get:

Guess number:  0 \\\"\\

submit again and...

Guess number: 0 \\\\\\""\\\\, etc...

instead of:

Guess number: 1
Guess numver : 2
etc...

Thanking all in advance.
Tony Ritter
..........................................................


<?
$numtoguess=42;
$num_tries=(isset($num_tries)) ? $num_tries++ : 0;
$message="";
if(!isset($guess))
$message="Welcome to the guessing machine";
elseif ($guess<$numtoguess)
$message="Your guess was too low.";
elseif ($guess>$numtoguess)
$message="Your guess was too high.";
else
$message="That is the correct number.";
$guess=(int)$guess;
?>
<HTML>
<BODY>
<H1>
<? print $message ?>
</H1>
Guess number: <?print $num_tries?>
<FORM METHOD="post">
Type your guess here:<BR>
<INPUT TYPE ="text" NAME="guess" VALUE="<?print $guess?>">
<INPUT TYPE ="hidden" NAME="num_tries" VALUE=<? print $num_tries?>">
<INPUT TYPE="submit" VALUE="submit it!">
</FORM>
</BODY>
</HTML>




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

Use this... enjoy



<?php

$numtoguess=42;

if (isset($_POST['num_tries']))
        $num_tries = $_POST['num_tries'] + 1;
$message="";
if(!isset($_POST['guess']))
        $message="Welcome to the guessing machine";
elseif ($_POST['guess'] < $numtoguess)
        $message="Your guess was too low.";
elseif ($_POST['guess'] > $numtoguess)
        $message="Your guess was too high.";
else
        $message="That is the correct number.";

if(isset($_POST['guess']))
        $guess=(int)$_POST['guess'];
else 
        $guess=0;
        
        print_r($_POST);
        
?>


<HTML>
<BODY>
<H1>
<?php print $message ?>
</H1>
Guess number: <?php print $num_tries ?>
<FORM METHOD="post">
Type your guess here:<BR>
<INPUT TYPE ="text" NAME="guess" VALUE="<?php print $guess ?>">
<INPUT TYPE ="hidden" NAME="num_tries" VALUE="<?php print $num_tries ?>">
<INPUT TYPE="submit" VALUE="submit it!">
</FORM>
</BODY>
</HTML>










*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 6:40 PM Anthony Ritter wrote:

>The following script is found in Matt Zandstra's book on PHP (Sams) on
>page
>160.
>
>He's explaining forms with PHP and has hard coded a value - 42.
>
>He also is explaining a hidden fleld where the user can submit the number
>and each time the user hits submit in the formbox, the counter will
>register
>the total number of guesses.
>
>However, after running this script and submitting the number, I get:
>
>Guess number:  0 \\\"\\
>
>submit again and...
>
>Guess number: 0 \\\\\\""\\\\, etc...
>
>instead of:
>
>Guess number: 1
>Guess numver : 2
>etc...
>
>Thanking all in advance.
>Tony Ritter
>..........................................................
>
>
><?
>$numtoguess=42;
>$num_tries=(isset($num_tries)) ? $num_tries++ : 0;
>$message="";
>if(!isset($guess))
>$message="Welcome to the guessing machine";
>elseif ($guess<$numtoguess)
>$message="Your guess was too low.";
>elseif ($guess>$numtoguess)
>$message="Your guess was too high.";
>else
>$message="That is the correct number.";
>$guess=(int)$guess;
>?>
><HTML>
><BODY>
><H1>
><? print $message ?>
></H1>
>Guess number: <?print $num_tries?>
><FORM METHOD="post">
>Type your guess here:<BR>
><INPUT TYPE ="text" NAME="guess" VALUE="<?print $guess?>">
><INPUT TYPE ="hidden" NAME="num_tries" VALUE=<? print $num_tries?>">
><INPUT TYPE="submit" VALUE="submit it!">
></FORM>
></BODY>
></HTML>
>
>
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
This also works with the ternary operator... I don't think it likes the ++ because it 
doesn't know the type yet.


<?php

$numtoguess=42;

$num_tries = isset($_POST['num_tries'])?$_POST['num_tries']+1:0;
$message="";
if(!isset($_POST['guess']))
        $message="Welcome to the guessing machine";
elseif ($_POST['guess'] < $numtoguess)
        $message="Your guess was too low.";
elseif ($_POST['guess'] > $numtoguess)
        $message="Your guess was too high.";
else
        $message="That is the correct number.";

if(isset($_POST['guess']))
        $guess=(int)$_POST['guess'];
else
        $guess=0;

        print_r($_POST);

?>


<HTML>
<BODY>
<H1>
<?php print $message ?>
</H1>
Guess number: <?php print $num_tries ?>
<FORM METHOD="post">
Type your guess here:<BR>
<INPUT TYPE ="text" NAME="guess" VALUE="<?php print $guess ?>">
<INPUT TYPE ="hidden" NAME="num_tries" VALUE="<?php print $num_tries ?>">
<INPUT TYPE="submit" VALUE="submit it!">
</FORM>
</BODY>
</HTML>





*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 6:40 PM Anthony Ritter wrote:

>The following script is found in Matt Zandstra's book on PHP (Sams) on
>page
>160.
>
>He's explaining forms with PHP and has hard coded a value - 42.
>
>He also is explaining a hidden fleld where the user can submit the number
>and each time the user hits submit in the formbox, the counter will
>register
>the total number of guesses.
>
>However, after running this script and submitting the number, I get:
>
>Guess number:  0 \\\"\\
>
>submit again and...
>
>Guess number: 0 \\\\\\""\\\\, etc...
>
>instead of:
>
>Guess number: 1
>Guess numver : 2
>etc...
>
>Thanking all in advance.
>Tony Ritter
>..........................................................
>
>
><?
>$numtoguess=42;
>$num_tries=(isset($num_tries)) ? $num_tries++ : 0;
>$message="";
>if(!isset($guess))
>$message="Welcome to the guessing machine";
>elseif ($guess<$numtoguess)
>$message="Your guess was too low.";
>elseif ($guess>$numtoguess)
>$message="Your guess was too high.";
>else
>$message="That is the correct number.";
>$guess=(int)$guess;
>?>
><HTML>
><BODY>
><H1>
><? print $message ?>
></H1>
>Guess number: <?print $num_tries?>
><FORM METHOD="post">
>Type your guess here:<BR>
><INPUT TYPE ="text" NAME="guess" VALUE="<?print $guess?>">
><INPUT TYPE ="hidden" NAME="num_tries" VALUE=<? print $num_tries?>">
><INPUT TYPE="submit" VALUE="submit it!">
></FORM>
></BODY>
></HTML>
>
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
Michael J. Pawlowsky wrote in message:

> This also works with the ternary operator...
.........................................................

No dice Michael.

I treid both your scripts.

The formbox comes up.
I enter a number.
I hit submit.
The box clears out the entered number without any message whether the number
was too high or too low or correct.

Nothing with the counter as well...

Please advise.

TR



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

I won't keep it up long... but go here...  you will see it works...

http://rc.mikeathome.net:8080/test/index.php



*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 7:17 PM Anthony Ritter wrote:

>Michael J. Pawlowsky wrote in message:
>
>> This also works with the ternary operator...
>.........................................................
>
>No dice Michael.
>
>I treid both your scripts.
>
>The formbox comes up.
>I enter a number.
>I hit submit.
>The box clears out the entered number without any message whether the
>number
>was too high or too low or correct.
>
>Nothing with the counter as well...
>
>Please advise.
>
>TR
>
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
I don't know how to post this one so I'm sorry for such bizarre cross-posting, but 
honestly I don't know where to go for help on this one!

I have process.php that has to call a remote file called process.asp on another site.

Site 1 has the cookie domain I want (that's where process.php is housed)
Site 2 has the database I need (because I can't obtain a database for Site 1 - Site 2 
is where process.asp is housed)

process.php has to do an fopen to process.asp to process username and password 
material.  process.asp needs security, obviously, to ensure that the user is "coming" 
from process.asp (but he's not because he's doing an fopen).

in other words, process.php opens up process.asp and returns the evaluation of 
process.asp onto process.php

I tried using REQUEST_URI but I didn't get the results I wanted.  How will process.asp 
know that process.php called it in order to do what it should do?

Thanx
Phil
--- End Message ---
--- Begin Message ---
I'm not sure I totally understand...   But why not just call it like a web page using 
curl?




*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 6:43 PM Phil Powell wrote:

>I don't know how to post this one so I'm sorry for such bizarre
>cross-posting, but honestly I don't know where to go for help on this one!
>
>I have process.php that has to call a remote file called process.asp on
>another site.
>
>


--- End Message ---
--- Begin Message ---
It would look like any other user.
In ASP you will have to check the request's IP (if its static), or you can
use some kind of username/password combinition... Or if you are real lazy
use just a hidden url ie mysite.com/akjdhsanlfas/process.asp

There is no way to tell the page process.php is making the request.

Andrew
----- Original Message -----
From: "Phil Powell" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Saturday, January 04, 2003 11:43 PM
Subject: [PHP] Second (Bizarre) Question regarding PHP and ASP


I don't know how to post this one so I'm sorry for such bizarre
cross-posting, but honestly I don't know where to go for help on this one!

I have process.php that has to call a remote file called process.asp on
another site.

Site 1 has the cookie domain I want (that's where process.php is housed)
Site 2 has the database I need (because I can't obtain a database for Site
1 - Site 2 is where process.asp is housed)

process.php has to do an fopen to process.asp to process username and
password material.  process.asp needs security, obviously, to ensure that
the user is "coming" from process.asp (but he's not because he's doing an
fopen).

in other words, process.php opens up process.asp and returns the evaluation
of process.asp onto process.php

I tried using REQUEST_URI but I didn't get the results I wanted.  How will
process.asp know that process.php called it in order to do what it should
do?

Thanx
Phil

--- End Message ---
--- Begin Message ---
On Sunday 05 January 2003 07:43 am, Phil Powell wrote:
> I tried using REQUEST_URI but I didn't get the results I wanted.  How will
> process.asp know that process.php called it in order to do what it should
> do?

if you can get $_SERVER["REMOTE_ADDR"] or $HTTP_REMOTE_ADDR
and if you can trust it (not only that it's right, but also that there are no
man in the middle attacks or other scripts on the client that can pretend
to be your script) then you could just check that the request is coming
from the right IP.

alternatively, you could use hashes that change from one invocation
to the next (to avoid replay attacks).  the server and the client
should both have a secret passphrase (perhaps even a whole set
of them, one for each day, and generated every month or so).

on the client (process.php) randomly generate a string, e.g., $randstr.
create a hash based on the secret passphrase and the randstr, e.g,

$hash=makeMyHash($passphrase.$randstr); /* use whatever hash
   function you want: openssl, mhash, mcrypt or whatever you
   use */

send the randstr and the hash along with the rest of the data.  on the 
server side, process.asp takes the randstr, takes the hash as above,
and compares the hash generated with the hash passed in.
if they don't match, don't reply.  if they match, then the request comes
from process.php (unless you're really paranoid, in which case, add
some more hoops for process.php to jump through :).

tiger

-- 
Gerald Timothy Quimpo  tiger*quimpo*org gquimpo*sni-inc.com tiger*sni*ph
Public Key: "gpg --keyserver pgp.mit.edu --recv-keys 672F4C78"
                   Veritas liberabit vos.
                   Doveryai no proveryai.
--- End Message ---
--- Begin Message ---
CURL? I only understand CURL as a Vignette command, sorry, you lost me.

Phil

"Michael J. Pawlowsky" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> I'm not sure I totally understand...   But why not just call it like a web
page using curl?
>
>
>
>
> *********** REPLY SEPARATOR  ***********
>
> On 04/01/2003 at 6:43 PM Phil Powell wrote:
>
> >I don't know how to post this one so I'm sorry for such bizarre
> >cross-posting, but honestly I don't know where to go for help on this
one!
> >
> >I have process.php that has to call a remote file called process.asp on
> >another site.
> >
> >
>
>


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

http://www.php.net/manual/en/ref.curl.php

have the page send back whatever info you need.



*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 8:33 PM Phil Powell wrote:

>CURL? I only understand CURL as a Vignette command, sorry, you lost me.
>
>Phil
>
>"Michael J. Pawlowsky" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>>
>> I'm not sure I totally understand...   But why not just call it like a
>web
>page using curl?



--- End Message ---
--- Begin Message ---
I don't know what the heck this is but it works:

#!/usr/bin/perl

$ENV{LD_LIBRARY_PATH} .=":.:..:../lib";
$ENV{CLASSPATH} .= ":Verisign.jar:.";
print `javac PFProJava.java`;
print `java PFProJava test-payflow.verisignscks.com`;

How can it be done with PHP?

OR

run the perl script from a PHP script.

<? exec(perl.pl) ?>

didn't work.

Thanks,
Sam

--- End Message ---
--- Begin Message ---
Not good at perl, but you need to do:
<?php exec('perl.pl'); ?>

Sam wrote:

I don't know what the heck this is but it works:

#!/usr/bin/perl

$ENV{LD_LIBRARY_PATH} .=":.:..:../lib";
$ENV{CLASSPATH} .= ":Verisign.jar:.";
print `javac PFProJava.java`;
print `java PFProJava test-payflow.verisignscks.com`;

How can it be done with PHP?

OR

run the perl script from a PHP script.

<? exec(perl.pl) ?>

didn't work.

Thanks,
Sam



--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
This came up in another group and I just wanted to know from the experts
whether this is possible.  Being someone well versed in PHP can you visit a
web site, hit a script in PHP and be able to view the script on the page
rather than just the html it generates.  Is it true that the only way to
view the script itself is to have some problem with the web server or have a
local login for the server?

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388



--- End Message ---
--- Begin Message ---
Only if your webserver has a handler issue will this occur or if you
have a .htaccess to override the server from passing onto PHP.

This will happen with .php3 files if you don't have them set to be
processed by php or any other extension that is not included in your web
server configuration file / htaccess.

And you are correct unless you have FTP/File Sharing etc you can't view
the source of a handler/parsed file.


HiTCHO has Spoken! 
Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED] 

-----Original Message-----
From: Larry Brown [mailto:[EMAIL PROTECTED]] 
Sent: Sunday, 5 January 2003 10:18 AM
To: PHP List
Subject: [PHP] web visitor viewing a script?


This came up in another group and I just wanted to know from the experts
whether this is possible.  Being someone well versed in PHP can you
visit a web site, hit a script in PHP and be able to view the script on
the page rather than just the html it generates.  Is it true that the
only way to view the script itself is to have some problem with the web
server or have a local login for the server?

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388




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

--- End Message ---
--- Begin Message ---
or rename the file to .phps
for PHP source. Many servers recognize this mime type as source and send you the file.

But if you are thinking about security...  the script is compiled and executed on the 
server.
What you see are the results of the application.

Get it?

This is good and bad...  Because it means you can only run each application once and 
then you have to call it again.
Possibly with different parameters etc.

It's why I also use JavaScript. The application resides on the client. Meaning the 
client can interact with it,
So lets say you have 2 select boxes. You want to populate the second one with data 
depending on the selection of the first
with out reloading the page. This can be done in JavaScript. Not in PHP. When doing 
something like that I use PHP to populate
my javaScript arrays and JS handle the interaction with the client.


Mike




*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 7:17 PM Larry Brown wrote:

>This came up in another group and I just wanted to know from the experts
>whether this is possible.  Being someone well versed in PHP can you visit a
>web site, hit a script in PHP and be able to view the script on the page
>rather than just the html it generates.  Is it true that the only way to
>view the script itself is to have some problem with the web server or have
>a
>local login for the server?
>
>Larry S. Brown
>Dimension Networks, Inc.
>(727) 723-8388
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php




--- End Message ---
--- Begin Message ---
Thank you guys for the confirmation and ...yes I got it. :(

Larry S. Brown
Dimension Networks, Inc.
(727) 723-8388

-----Original Message-----
From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 04, 2003 8:52 PM
To: Larry Brown; [EMAIL PROTECTED]
Subject: Re: [PHP] web visitor viewing a script?

or rename the file to .phps
for PHP source. Many servers recognize this mime type as source and send you
the file.

But if you are thinking about security...  the script is compiled and
executed on the server.
What you see are the results of the application.

Get it?

This is good and bad...  Because it means you can only run each application
once and then you have to call it again.
Possibly with different parameters etc.

It's why I also use JavaScript. The application resides on the client.
Meaning the client can interact with it,
So lets say you have 2 select boxes. You want to populate the second one
with data depending on the selection of the first
with out reloading the page. This can be done in JavaScript. Not in PHP.
When doing something like that I use PHP to populate
my javaScript arrays and JS handle the interaction with the client.


Mike




*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 7:17 PM Larry Brown wrote:

>This came up in another group and I just wanted to know from the experts
>whether this is possible.  Being someone well versed in PHP can you visit a
>web site, hit a script in PHP and be able to view the script on the page
>rather than just the html it generates.  Is it true that the only way to
>view the script itself is to have some problem with the web server or have
>a
>local login for the server?
>
>Larry S. Brown
>Dimension Networks, Inc.
>(727) 723-8388
>
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php





--- End Message ---
--- Begin Message ---
foreach ($HTTP_GET_VARS as $key => $val) {
   if (!empty($HTTP_GET_VARS["$key"])) ${"$key"} = $HTTP_GET_VARS["$key"];
  }

  foreach ($HTTP_POST_VARS as $key => $val) {
   if (!empty($HTTP_POST_VARS["$key"])) ${"$key"} = $HTTP_POST_VARS["$key"];
  }

Whenever the form variable is equal to 0, the value is not passed into the 
corresponding variable.

For example, if isLogin = 1, then $isLogin = 1
But if isRegistered = 0 then $isRegistered = {null}

I do not understand why this happens, someone enlighten me!

Phil
--- End Message ---
--- Begin Message ---
On Sat, 4 Jan 2003 19:26:02 -0500, you wrote:

>Whenever the form variable is equal to 0, the value is not passed into the 
>corresponding variable.
>
>For example, if isLogin = 1, then $isLogin = 1
>But if isRegistered = 0 then $isRegistered = {null}
>
>I do not understand why this happens, someone enlighten me!

That's just the way empty() works.  Strings which evaluate to false
(either an empty string or the string '0') will cause empty() to
return true.  Therefore if you have a form where '0' is a valid value,
empty() is not appropriate.

Instead of:

if (!empty($var)) { ... }

use:

if (isset($var) && $var != '') { ... }
--- End Message ---
--- Begin Message ---
I couldn't think of isset, so I winged it:

if (strlen($var) > 0) {...}

Phil

"Michael Sims" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
On Sat, 4 Jan 2003 19:26:02 -0500, you wrote:

>Whenever the form variable is equal to 0, the value is not passed into the
corresponding variable.
>
>For example, if isLogin = 1, then $isLogin = 1
>But if isRegistered = 0 then $isRegistered = {null}
>
>I do not understand why this happens, someone enlighten me!

That's just the way empty() works.  Strings which evaluate to false
(either an empty string or the string '0') will cause empty() to
return true.  Therefore if you have a form where '0' is a valid value,
empty() is not appropriate.

Instead of:

if (!empty($var)) { ... }

use:

if (isset($var) && $var != '') { ... }


--- End Message ---
--- Begin Message ---
On Sat, 4 Jan 2003 20:33:14 -0500, you wrote:

>I couldn't think of isset, so I winged it:
>
>if (strlen($var) > 0) {...}

This should work most of the time, but be aware this will produce a
warning if $var isn't set (and you haven't set your error reporting
level to ignore warnings)...  If you're not sure that $var exists it's
better to check it with isset() before checking strlen()...
--- End Message ---
--- Begin Message ---
Could you just get the php script to send the commands to schedule it as a
task to run via cron etc  in say 1 minute into the future... that command
would be done quickly.. and the server could continue..

i did something similar when i used NT/ASP.

But i'm just a php newbie so i could be lost..

cheers

Brendon



-----Original Message-----
From: gilrain [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 04, 2003 8:04 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] exec() not exec-ing?


> I'm back to square one, if I can't run that
> script without the browser waiting on it to finish...

For instance, is there a way for my PHP script to log into my shell account
and *then* send the command? Since I can execute the script, but PHP can't,
this would solve the problem -- if it's possible.

gilrain



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

--- End Message ---
--- Begin Message ---
I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version of gdlib.  
I am using the windows version with apache and tried both php_gd.dll and php_gd2.dll 
and I could not access any GIF related image functions, however I could use JPG, PNG, 
etc.  Does anyone know if I need to do anything special to get those functions to 
work?  The function I am mainly needing to use is imagecreatefromgif().

 

Thanks

-Adam

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

I just installed 4.3 today...  configured as

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-zlib -
-with-gd --enable-exif --with-jpeg-dir=/usr/lib --with-png --with-ttf --with-fre
etype --enable-gd-native-ttf


I run this code:

<?php

 header("Content-type: image/jpeg");

 $img = imagecreatefromgif("../images/camera.gif");
 imagejpeg($img);
 imagedestroy($img);


?>

and it works fine....


Mike




*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 4:50 PM Adam Plocher wrote:

>This encoded message has been converted to an attachment.
>
>I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version
>of gdlib.  I am using the windows version with apache and tried both
>php_gd.dll and php_gd2.dll and I could not access any GIF related image
>functions, however I could use JPG, PNG, etc.  Does anyone know if I need
>to do anything special to get those functions to work?  The function I am
>mainly needing to use is imagecreatefromgif().
>
>
>
>Thanks
>
>-Adam




--- End Message ---
--- Begin Message ---
Michael, thanks for the response..
 
Only prob is I'm using the win32 precompiled version.. I got a couple linux boxes I 
could throw this on I suppose, but I was kind of hoping to use this machine as a dev 
box.
 
I ran the same code you posted and these were my results:

Fatal error: Call to undefined function: imagecreatefromgif() in 
c:\apache\htdocs\test.php on line 14
 
I don't get it - there are two gd dll's that come with it and I've tried both.  Any 
other advice would be appreciated. Thanks
 
-Adam

        -----Original Message----- 
        From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]] 
        Sent: Sat 1/4/2003 5:58 PM 
        To: Adam Plocher; [EMAIL PROTECTED] 
        Cc: 
        Subject: Re: [PHP] Read-only gif support in 4.3.0
        
        



        I just installed 4.3 today...  configured as
        
        ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-zlib 
-
        -with-gd --enable-exif --with-jpeg-dir=/usr/lib --with-png --with-ttf 
--with-fre
        etype --enable-gd-native-ttf
        
        
        I run this code:
        
        <?php
        
         header("Content-type: image/jpeg");
        
         $img = imagecreatefromgif("../images/camera.gif");
         imagejpeg($img);
         imagedestroy($img);
        
        
        ?>
        
        and it works fine....
        
        
        Mike
        
        
        
        
        *********** REPLY SEPARATOR  ***********
        
        On 04/01/2003 at 4:50 PM Adam Plocher wrote:
        
        >This encoded message has been converted to an attachment.
        >
        >I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version
        >of gdlib.  I am using the windows version with apache and tried both
        >php_gd.dll and php_gd2.dll and I could not access any GIF related image
        >functions, however I could use JPG, PNG, etc.  Does anyone know if I need
        >to do anything special to get those functions to work?  The function I am
        >mainly needing to use is imagecreatefromgif().
        >
        >
        >
        >Thanks
        >
        >-Adam
        
        
        
        
        
        --
        PHP General Mailing List (http://www.php.net/)
        To unsubscribe, visit: http://www.php.net/unsub.php
        
        

--- End Message ---
--- Begin Message ---
when you do a phpinfo() what are the compiled with options?




*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 6:24 PM Adam Plocher wrote:

>This encoded message has been converted to an attachment.
>
>Michael, thanks for the response..
> 
>Only prob is I'm using the win32 precompiled version.. I got a couple
>linux boxes I could throw this on I suppose, but I was kind of hoping to
>use this machine as a dev box.
> 
>I ran the same code you posted and these were my results:
>
>Fatal error: Call to undefined function: imagecreatefromgif() in
>c:\apache\htdocs\test.php on line 14
> 
>I don't get it - there are two gd dll's that come with it and I've tried
>both.  Any other advice would be appreciated. Thanks
> 



--- End Message ---
--- Begin Message ---
There aren't any, however there is a GD section which says:
 
GD Support      enabled         
GD Version      bundled (2.0 compatible)        
FreeType Support        enabled         
FreeType Linkage        with freetype   
JPG Support     enabled         
PNG Support     enabled         
WBMP Support    enabled         

Doesn't say anything about GIF =/.  I looked in the php.ini file and didn't see 
anything relating to gif support, and there aren't any gif extensions in the 
php\extensions directory.
 
Thx again.
-Adam

        -----Original Message----- 
        From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]] 
        Sent: Sat 1/4/2003 6:34 PM 
        To: Adam Plocher; [EMAIL PROTECTED] 
        Cc: 
        Subject: RE: [PHP] Read-only gif support in 4.3.0
        
        


        when you do a phpinfo() what are the compiled with options?
        
        
        
        
        *********** REPLY SEPARATOR  ***********
        
        On 04/01/2003 at 6:24 PM Adam Plocher wrote:
        
        >This encoded message has been converted to an attachment.
        >
        >Michael, thanks for the response..
        >
        >Only prob is I'm using the win32 precompiled version.. I got a couple
        >linux boxes I could throw this on I suppose, but I was kind of hoping to
        >use this machine as a dev box.
        >
        >I ran the same code you posted and these were my results:
        >
        >Fatal error: Call to undefined function: imagecreatefromgif() in
        >c:\apache\htdocs\test.php on line 14
        >
        >I don't get it - there are two gd dll's that come with it and I've tried
        >both.  Any other advice would be appreciated. Thanks
        >
        
        
        
        

--- End Message ---
--- Begin Message ---
Didn't I answer this already?  The Windows binary was built without the
right #define to enable the GIF support.  You will have to wait for the
next Windows build before this will work.

-Rasmus

On Sat, 4 Jan 2003, Adam Plocher wrote:

> Michael, thanks for the response..
>
> Only prob is I'm using the win32 precompiled version.. I got a couple linux boxes I 
>could throw this on I suppose, but I was kind of hoping to use this machine as a dev 
>box.
>
> I ran the same code you posted and these were my results:
>
> Fatal error: Call to undefined function: imagecreatefromgif() in 
>c:\apache\htdocs\test.php on line 14
>
> I don't get it - there are two gd dll's that come with it and I've tried both.  Any 
>other advice would be appreciated. Thanks
>
> -Adam
>
>       -----Original Message-----
>       From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]]
>       Sent: Sat 1/4/2003 5:58 PM
>       To: Adam Plocher; [EMAIL PROTECTED]
>       Cc:
>       Subject: Re: [PHP] Read-only gif support in 4.3.0
>
>
>
>
>
>       I just installed 4.3 today...  configured as
>
>       ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-zlib 
>-
>       -with-gd --enable-exif --with-jpeg-dir=/usr/lib --with-png --with-ttf 
>--with-fre
>       etype --enable-gd-native-ttf
>
>
>       I run this code:
>
>       <?php
>
>        header("Content-type: image/jpeg");
>
>        $img = imagecreatefromgif("../images/camera.gif");
>        imagejpeg($img);
>        imagedestroy($img);
>
>
>       ?>
>
>       and it works fine....
>
>
>       Mike
>
>
>
>
>       *********** REPLY SEPARATOR  ***********
>
>       On 04/01/2003 at 4:50 PM Adam Plocher wrote:
>
>       >This encoded message has been converted to an attachment.
>       >
>       >I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version
>       >of gdlib.  I am using the windows version with apache and tried both
>       >php_gd.dll and php_gd2.dll and I could not access any GIF related image
>       >functions, however I could use JPG, PNG, etc.  Does anyone know if I need
>       >to do anything special to get those functions to work?  The function I am
>       >mainly needing to use is imagecreatefromgif().
>       >
>       >
>       >
>       >Thanks
>       >
>       >-Adam
>
>
>
>
>
>       --
>       PHP General Mailing List (http://www.php.net/)
>       To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>
--- End Message ---
--- Begin Message ---

If I look at my phpinfo I get:


gd
GD Support  enabled  
GD Version  bundled (2.0 compatible)  
FreeType Support  enabled  
FreeType Linkage  with TTF library  
GIF Read Support  enabled  
JPG Support  enabled  
PNG Support  enabled  
WBMP Support  enabled  

Notice the GIF Read Support

Why dont you try and compile your own on Windoze....

Mike



*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 6:40 PM Adam Plocher wrote:

>This encoded message has been converted to an attachment.
>
>There aren't any, however there is a GD section which says:
> 
>GD Support     enabled         
>GD Version     bundled (2.0 compatible)        
>FreeType Support       enabled         
>FreeType Linkage       with freetype   
>JPG Support    enabled         
>PNG Support    enabled         
>WBMP Support   enabled         
>



--- End Message ---
--- Begin Message ---
I know that mySQL errors are caught in mysql_error() and I find that
function extremely useful (kudos!). However, I have several queries in a few
scripts of mine but am wondering if anyone has written a small function that
catches errors and outputs them. What I mean is lets say I have a block of
code like so:

$result = mysql_query("SELECT field1, field2 FROM users WHERE userLogin =
'$authusername' AND userPassword = '$authpassword'");

Instead of a small loop under my query that is like so:

if (mysql_error()) {
 echo "Error: ".mysql_error();
 exit;
}

I'd like to be able to call a function that does this instead of adding this
if statement after all my queries...so...anyone do something similar?

Jeff


--- End Message ---
--- Begin Message ---
How about something like this..
 
function runquery($query)
{
     $query = mysql_query($query);
     if (mysql_error())
     {
         echo "<div style=\"color:red\">MySQL Error: ". mysql_error() ."</div>\n";
         exit(1);
     }
     
    return $query;
}
     

        -----Original Message----- 
        From: Jeff Lewis [mailto:[EMAIL PROTECTED]] 
        Sent: Sat 1/4/2003 6:43 PM 
        To: [EMAIL PROTECTED] 
        Cc: 
        Subject: [PHP] Function to catch all mySQL errors?
        
        

        I know that mySQL errors are caught in mysql_error() and I find that
        function extremely useful (kudos!). However, I have several queries in a few
        scripts of mine but am wondering if anyone has written a small function that
        catches errors and outputs them. What I mean is lets say I have a block of
        code like so:
        
        $result = mysql_query("SELECT field1, field2 FROM users WHERE userLogin =
        '$authusername' AND userPassword = '$authpassword'");
        
        Instead of a small loop under my query that is like so:
        
        if (mysql_error()) {
         echo "Error: ".mysql_error();
         exit;
        }
        
        I'd like to be able to call a function that does this instead of adding this
        if statement after all my queries...so...anyone do something similar?
        
        Jeff
        
        
        
        --
        PHP General Mailing List (http://www.php.net/)
        To unsubscribe, visit: http://www.php.net/unsub.php
        
        

--- End Message ---
--- Begin Message ---
Also if you dont want ot to break you need to add the "@" operator in front


Mike


*********** REPLY SEPARATOR  ***********

On 04/01/2003 at 6:47 PM Adam Plocher wrote:

>This encoded message has been converted to an attachment.
>
>How about something like this..
> 
>function runquery($query)
>{
>     $query = mysql_query($query);
>     if (mysql_error())
>     {
>         echo "<div style=\"color:red\">MySQL Error: ". mysql_error()
>."</div>\n";
>         exit(1);
>     }
>     
>    return $query;
>}
>     


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

Sunday, January 5, 2003, 12:47:40 PM, you wrote:
AP> How about something like this..
 
AP> function runquery($query)
AP> {
AP>      $query = mysql_query($query);
AP>      if (mysql_error())
AP>      {
AP>          echo "<div style=\"color:red\">MySQL Error: ". mysql_error() ."</div>\n";
AP>          exit(1);
AP>      }
     
AP>     return $query;
AP> }
     

AP>         -----Original Message----- 
AP>         From: Jeff Lewis [mailto:[EMAIL PROTECTED]] 
AP>         Sent: Sat 1/4/2003 6:43 PM 
AP>         To: [EMAIL PROTECTED] 
AP>         Cc: 
AP>         Subject: [PHP] Function to catch all mySQL errors?
        
        

AP>         I know that mySQL errors are caught in mysql_error() and I find that
AP>         function extremely useful (kudos!). However, I have several queries in a 
few
AP>         scripts of mine but am wondering if anyone has written a small function 
that
AP>         catches errors and outputs them. What I mean is lets say I have a block of
AP>         code like so:
        
AP>         $result = mysql_query("SELECT field1, field2 FROM users WHERE userLogin =
AP>         '$authusername' AND userPassword = '$authpassword'");
        
AP>         Instead of a small loop under my query that is like so:
        
AP>         if (mysql_error()) {
AP>          echo "Error: ".mysql_error();
AP>          exit;
AP>         }
        
AP>         I'd like to be able to call a function that does this instead of adding 
this
AP>         if statement after all my queries...so...anyone do something similar?
        
AP>         Jeff
Here is a small class I use for mysql that will do what you want.

<?
class mysql_class{
        var $connection =
        
array('db'=>'database','host'=>':/tmp/mysql.sock','user'=>'username','password'=>'password');
        var $handles = array();
        var $con;
        function mysql_class($db='',$ini=''){
                global $class_ref;
                $class_ref["mysql_class"] =& $this;
                if($ini != '' && file_exists($ini)){
                        $this->connection = parse_ini_file($ini,TRUE);
                }
                if(!$this->con = @mysql_connect($this->connection['host'] , 
$this->connection['user'] , $this->connection['password'])):
                        echo "oops failed to connect <br>";
                else:
                        if($db != '')   mysql_select_db($db,$this->con);
                        else mysql_select_db($this->connection['db']);
                endif;
        }
        function get_handle($db=''){
                $r = 0;
                if(!empty($this->con)):
                        $r = count($this->handles) + 1;
                        if($db == '') $db = $this->connection['db'];
                        $this->handles[$r]['db'] = $db;
                endif;
                return $r;
        }
        function select_db($h){
                mysql_select_db($this->handles[$h]['db'],$this->con);
        }
        function sql_query($sql,$h,$line=''){
                $r = 0;
                if(!empty($line)){
                        $line = "on line $line ";
                }
                if($sql != ''):
                        $this->select_db($h);
                        if(!$r = mysql_query($sql,$this->con)):
                                echo 'Oops error '.$line.': 
'.mysql_error($this->con).'<br>';
                        endif;
                endif;
                return $r;
        }
        function num_rows($result){
                return mysql_num_rows($result);
        }
        function sql_insert($sql,$h,$line=''){
                $r = 0;
                if($sql != ''):
                        $this->select_db($h);
                        if(!$r = mysql_query($sql,$this->con)):
                                echo 'Oops error at '.$line.': 
'.mysql_error($this->con).'<br>';
                        else:
                                $r = mysql_insert_id($this->con);
                        endif;
                endif;
                return $r;
        }
        function fetch_array($res,&$row,$type=MYSQL_ASSOC){
                $r = 0;
                if($row = mysql_fetch_array($res,$type)) $r = 1;
                return $r;
        }
        function fetch_result($res,$field){
                return mysql_result($res,0,$field);
        }
}

//usage
        
 $mysql = new mysql_class();
 $con = $mysql->get_handle('test_database');
 $result = $mysql->sql_query("SELECT * FROM test_table",$con,__LINE__)):
 .
 .
 .
 $insert_id = $mysql->insert("INSERT INTO test_table (id,name) VALUES 
($id,'$name')",$con,__LINE__);
 .
 .


 If it errors it will print an error and give the line number of the call.
 It can handle multiple databases in the same class just get another handle.
 Hope this helps
 Tom
 

 



-- 
regards,
Tom

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

I am trying to parse ESRI shape files, which have double values stored in
little endian format.  when i read these values using something like this:

  $RawFileHeader = fread($ShapeFile, 100);
  $FileHeader =
unpack("NFileCode/N5Unused/NFileLength/VVersion/VShapeType/d8Box",
$RawFileHeader);

the double values seem garbled.  Is there any way to force unpack() to read
the doubles as little endians and convert the value accordingly?

Thanks.

Tim


--- End Message ---
--- Begin Message ---
I've been using Authorize.Net for about 6 months now & am happy with them.  I
use their AIM interface, which allows ,e complete control over the look & feel
of the payment process.  There is no problem doing everything in PHP, as long as
you have the CURL extensions & they are built with SSL support.

--
JR

> -----Original Message-----
> From: Chad Day [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 03, 2003 11:15 AM
> To: php general
> Subject: [PHP] Recommend payment processors?
>
>
> Just wondering what people are using/recommend out there.. I'm going to be
> getting a merchant account and let people purchase services through my
> website on a secure server, all in PHP.  What concerns me is this archived
> post I came across:
>
> http://marc.theaimsgroup.com/?l=php-general&m=102165623600464&w=2
>
> Reading that, it sounds like it's not possible to use Payment Pro, or
> possibly other systems, with PHP .. is this correct?  Some of the other
> posts in the archive sounded like people were using it, so I'm not really
> sure what is possible at this point.
>
> Thanks,
> Chad
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--- End Message ---
--- Begin Message ---
I use authorize.net with curl as well.  It works great.  There are tutorials
on http://www.phpbuilder.net on how to set this up.

David

----- Original Message -----
From: "Jonathan Rosenberg (Tabby's Place)" <[EMAIL PROTECTED]>
To: "Chad Day" <[EMAIL PROTECTED]>; "php general" <[EMAIL PROTECTED]>
Sent: Saturday, January 04, 2003 7:16 PM
Subject: RE: [PHP] Recommend payment processors?


> I've been using Authorize.Net for about 6 months now & am happy with them.
I
> use their AIM interface, which allows ,e complete control over the look &
feel
> of the payment process.  There is no problem doing everything in PHP, as
long as
> you have the CURL extensions & they are built with SSL support.
>
> --
> JR
>
> > -----Original Message-----
> > From: Chad Day [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, January 03, 2003 11:15 AM
> > To: php general
> > Subject: [PHP] Recommend payment processors?
> >
> >
> > Just wondering what people are using/recommend out there.. I'm going to
be
> > getting a merchant account and let people purchase services through my
> > website on a secure server, all in PHP.  What concerns me is this
archived
> > post I came across:
> >
> > http://marc.theaimsgroup.com/?l=php-general&m=102165623600464&w=2
> >
> > Reading that, it sounds like it's not possible to use Payment Pro, or
> > possibly other systems, with PHP .. is this correct?  Some of the other
> > posts in the archive sounded like people were using it, so I'm not
really
> > sure what is possible at this point.
> >
> > Thanks,
> > Chad
> >
> >
> > --
> > 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 ---
Do you kow how can I upgrade the PHP 4.1.1 in PHPTriad to PHP 4.3.0?
I need PHP 4.3.0. as it includes a version of gd (GD Library) as "standard
equipment."

TQ!


--- End Message ---

Reply via email to