php-general Digest 8 Apr 2002 09:42:24 -0000 Issue 1274

Topics (messages 91954 through 92015):

Re: Test for one bit set?
        91954 by: bvr
        91955 by: Lars Torben Wilson
        91956 by: Charlie Killian

Disabling bars on Browser
        91957 by: David Johansen
        91958 by: phplists.woodenpickle.com
        91960 by: David Johansen
        91962 by: phplists.woodenpickle.com
        91973 by: Justin French
        91976 by: Leif K-Brooks
        91980 by: phplists.woodenpickle.com
        91983 by: Justin French
        91984 by: Justin French
        91988 by: Jason Wong

Re: how to sort by value in associative array
        91959 by: Chris Adams

Test for whole number.
        91961 by: Charlie Killian
        91963 by: Charlie Killian
        91970 by: Tom Rogers
        91971 by: Miguel Cruz

Function that escapes special caracters from regular expressions
        91964 by: Leif K-Brooks
        91965 by: Charlie Killian
        91966 by: Matt Friedman
        91968 by: CC Zona

Emulating a browser, parse cookies with PHP
        91967 by: DRaGoNLz
        92012 by: heinisch.creaction.de

Re: - REPOST - Flock manual clarification please  ;-)
        91969 by: Matt Friedman
        91972 by: Jim Winstead
        91982 by: Matt Friedman

xml-rpc for windows?
        91974 by: dietrich
        91977 by: Tyler Longren
        91981 by: dietrich

Workaround for no cron?
        91975 by: Leif K-Brooks
        91986 by: Steve Werby
        92014 by: gaouzief

asking about .exe file
        91978 by: wong
        91979 by: Martin Towell

Re: Phone number validation
        91985 by: Timothy J. Luoma

Re: PHP from HTML
        91987 by: Matjaž Prtenjak
        91989 by: Chris Adams
        92002 by: Matjaž Prtenjak

mod_php4
        91990 by: javier

asking about exe file
        91991 by: wong

Newbie Question
        91992 by: Hubert DAUL
        91993 by: Miguel Cruz
        92015 by: Michael Virnstein

Copying Directory
        91994 by: Hiroshi Ayukawa
        91999 by: Michael Virnstein
        92000 by: Michael Virnstein
        92009 by: Hiroshi Ayukawa
        92011 by: Jason Wong
        92013 by: Hiroshi Ayukawa

Adding "a" in "try.jpg"!
        91995 by: Thomas Edison Jr.
        91996 by: Miguel Cruz
        91997 by: Billy S Halsey
        91998 by: Jason Wong

Re: Adding "a" in "try.jpg"! Problems!
        92001 by: Thomas Edison Jr.
        92003 by: Miguel Cruz
        92004 by: Richard Baskett

Re: Adding "a" in "try.jpg"! SOLVED!!
        92005 by: Thomas Edison Jr.

difficulty in solving the unknown warning
        92006 by: erich

Sendmail 8.10.2 headers
        92007 by: Anthony Rodriguez
        92010 by: Jason Wong

sessions and passing variables
        92008 by: rarmin

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

This shows all integers from 1 to 10 that have the 2 least significant 
bits set:

<?php

   for ($i = 1; $i <= 10; $i++) 
   {
      if ($i & 3)
      {
         echo($i . "\n");
      }
   }
?>

bvr.

Charlie Killian wrote:

>How can I test if a number only has on bit set?
>
>So testing different numbers will return TRUE or FALSE:
>
>testing 00010000 would return TRUE.
>testing 00000011 would return FALSE.
>
>TIA
>
>Charlie
>
>
>
>
>


--- End Message ---
--- Begin Message ---
On Sun, 2002-04-07 at 13:38, Charlie Killian wrote:
> How can I test if a number only has on bit set?
> 
> So testing different numbers will return TRUE or FALSE:
> 
> testing 00010000 would return TRUE.
> testing 00000011 would return FALSE.
> 
> TIA
> 
> Charlie

AND them bitwise:

<?php
error_reporting(E_ALL);

$bit = 16;

$foo = bindec('00010000');
$bar = bindec('00000011');

echo "$foo; $bar\n";

if ($foo & $bit)
{
    echo "Bit 5 is set.\n";
}
else 
{
    echo "Bit 5 is not set.\n";
}

if ($bar & $bit)
{
    echo "Bit 5 is set.\n";
}
else 
{
    echo "Bit 5 is not set.\n";
}

?>


Torben

-- 
 Torben Wilson <[EMAIL PROTECTED]>
 http://www.thebuttlesschaps.com
 http://www.hybrid17.com
 http://www.inflatableeye.com
 +1.604.709.0506

--- End Message ---
--- Begin Message ---
Thanks to all those that replied. Especially Torben. (What have you been up
to?)

Miguel's solution works great.

Check out the example below:

<?php
function isOneBitSet($n)
{
    $x = log($n)/log(2);
    return ($x == intval($x));
}

for ($i = 0; $i < 32769; ++$i) {
      if(isOneBitSet($i)) {
          print("$i, ");
      }
}

?>

Prints out:
1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768,

Just what I wanted.

Thanks again,

Charlie


> > How can I test if a number only has on bit set?
> >
> > So testing different numbers will return TRUE or FALSE:
> >
> > testing 00010000 would return TRUE.
> > testing 00000011 would return FALSE.
>
> Think back to math class when you were 14!
>
>   function isOneBitSet($n)
>   {
>     $x = log($n)/log(2);
>     return ($x == intval($x));
>   }
>
> Cheesy alternative:
>
>   function isOneBitSet($n)
>   {
>     return (1 == substr_count(base_convert($n, 10, 2), '1'));
>   }
>
> miguel
>


--- End Message ---
--- Begin Message ---
I was just wondering if there was any way to turn off the bars at the top of
the browser window with PHP. If not does anyone know a way that I could make
it so that I could pass information from a form to window that I pop open
with javascript. I would either need some way to make the window look just
like a window that was popped up with this:

<SCRIPT LANGUAGE=javascript>
      window.open('https://secure.authorize.net/gateway/transact.dll',
'joe', config='toolbar=0,menubar=0,directories=0,location=0')
      </SCRIPT>

or some way I could pass the info from a form to that opened page.
Thanks,
Dave


--- End Message ---
--- Begin Message ---
Do you have something against using a class for interaction with the
Authorize.net URL you are trying to open? It is possible to pass vars to the
page I'm sure but a class would work better in most cases and automate the
process for the customer.

Later,

Bob
"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I was just wondering if there was any way to turn off the bars at the top
of
> the browser window with PHP. If not does anyone know a way that I could
make
> it so that I could pass information from a form to window that I pop open
> with javascript. I would either need some way to make the window look just
> like a window that was popped up with this:
>
> <SCRIPT LANGUAGE=javascript>
>       window.open('https://secure.authorize.net/gateway/transact.dll',
> 'joe', config='toolbar=0,menubar=0,directories=0,location=0')
>       </SCRIPT>
>
> or some way I could pass the info from a form to that opened page.
> Thanks,
> Dave
>
>


--- End Message ---
--- Begin Message ---
I would love to use a class. Where can I find one? I've posted on here
several times asking for examples or base code that work with Authorize.net
but no one ever responds. If you could point me to some that'd be great.
Thanks,
Dave

<[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Do you have something against using a class for interaction with the
> Authorize.net URL you are trying to open? It is possible to pass vars to
the
> page I'm sure but a class would work better in most cases and automate the
> process for the customer.
>
> Later,
>
> Bob
> "David Johansen" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > I was just wondering if there was any way to turn off the bars at the
top
> of
> > the browser window with PHP. If not does anyone know a way that I could
> make
> > it so that I could pass information from a form to window that I pop
open
> > with javascript. I would either need some way to make the window look
just
> > like a window that was popped up with this:
> >
> > <SCRIPT LANGUAGE=javascript>
> >       window.open('https://secure.authorize.net/gateway/transact.dll',
> > 'joe', config='toolbar=0,menubar=0,directories=0,location=0')
> >       </SCRIPT>
> >
> > or some way I could pass the info from a form to that opened page.
> > Thanks,
> > Dave
> >
> >
>
>


--- End Message ---
--- Begin Message ---
There are actually a couple at least listed here.. I don't know which are
best but the one that my shopping cart uses is one of these one.. I believe
it's this one:  http://zend.com/codex.php?id=619&single=1

Yeah, after I looked at it, it is that one.. Adam Olsen is my programmer..
Duh.. I forgot he posted the class file he did on Zend.com.. Anyway, hope
you can find something to work..

Later,

Bob Weaver

"David Johansen" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I would love to use a class. Where can I find one? I've posted on here
> several times asking for examples or base code that work with
Authorize.net
> but no one ever responds. If you could point me to some that'd be great.
> Thanks,
> Dave
>
> <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Do you have something against using a class for interaction with the
> > Authorize.net URL you are trying to open? It is possible to pass vars to
> the
> > page I'm sure but a class would work better in most cases and automate
the
> > process for the customer.
> >
> > Later,
> >
> > Bob
> > "David Johansen" <[EMAIL PROTECTED]> wrote in message
> > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > > I was just wondering if there was any way to turn off the bars at the
> top
> > of
> > > the browser window with PHP. If not does anyone know a way that I
could
> > make
> > > it so that I could pass information from a form to window that I pop
> open
> > > with javascript. I would either need some way to make the window look
> just
> > > like a window that was popped up with this:
> > >
> > > <SCRIPT LANGUAGE=javascript>
> > >       window.open('https://secure.authorize.net/gateway/transact.dll',
> > > 'joe', config='toolbar=0,menubar=0,directories=0,location=0')
> > >       </SCRIPT>
> > >
> > > or some way I could pass the info from a form to that opened page.
> > > Thanks,
> > > Dave
> > >
> > >
> >
> >
>
>


--- End Message ---
--- Begin Message ---
This is the wrong group/list for this post.

The disabling of bars, or any sort of browser feature/appearance is NOT PHP.

PHP is a server side langauge.  Commonly, you would use JavaScript for such
stuff, so I recommend you check out the millions of JavaScript sites and
newsgroups on the web.


on 08/04/02 8:29 AM, David Johansen ([EMAIL PROTECTED]) wrote:

> I was just wondering if there was any way to turn off the bars at the top of
> the browser window with PHP. If not does anyone know a way that I could make
> it so that I could pass information from a form to window that I pop open
> with javascript. I would either need some way to make the window look just
> like a window that was popped up with this:
> 
> <SCRIPT LANGUAGE=javascript>
> window.open('https://secure.authorize.net/gateway/transact.dll',
> 'joe', config='toolbar=0,menubar=0,directories=0,location=0')
> </SCRIPT>
> 
> or some way I could pass the info from a form to that opened page.
> Thanks,
> Dave
> 
> 

--- End Message ---
--- Begin Message ---
on 4/7/02 9:31 PM, Justin French at [EMAIL PROTECTED] wrote:

This is the wrong group/list for this post.

The disabling of bars, or any sort of browser feature/appearance is NOT PHP.

PHP is a server side langauge.  Commonly, you would use JavaScript for such
stuff, so I recommend you check out the millions of JavaScript sites and
newsgroups on the web.
It looks like you didn't even read the message.  He knew how to do it with
javascript, but he needed to pass information to it, and he wanted to know
that!  And, even if he was wrong, you don't need to be so harsh!  We aren't
born knowing binary!

--- End Message ---
--- Begin Message ---
Wow, you really feel like your better than everyone here don't you.. You
rarely even give an answer that isn't blatent criticism of what someone
posted or their ability to find information. You really need to stop.

Bob

"Justin French" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> This is the wrong group/list for this post.
>
> The disabling of bars, or any sort of browser feature/appearance is NOT
PHP.
>
> PHP is a server side langauge.  Commonly, you would use JavaScript for
such
> stuff, so I recommend you check out the millions of JavaScript sites and
> newsgroups on the web.
>
>
> on 08/04/02 8:29 AM, David Johansen ([EMAIL PROTECTED]) wrote:
>
> > I was just wondering if there was any way to turn off the bars at the
top of
> > the browser window with PHP. If not does anyone know a way that I could
make
> > it so that I could pass information from a form to window that I pop
open
> > with javascript. I would either need some way to make the window look
just
> > like a window that was popped up with this:
> >
> > <SCRIPT LANGUAGE=javascript>
> > window.open('https://secure.authorize.net/gateway/transact.dll',
> > 'joe', config='toolbar=0,menubar=0,directories=0,location=0')
> > </SCRIPT>
> >
> > or some way I could pass the info from a form to that opened page.
> > Thanks,
> > Dave
> >
> >
>


--- End Message ---
--- Begin Message ---
Bob,

I don't think I'm better than anyone on this list at all.  We all here to
learn, and help when we can.

In fact, I also made the mistake of asking the wrong questions in here when
I first joined.  It was pointed out to me that I was off topic, and I learnt
from my "mistakes".

I don't know if you're a member of any other lists, but most lists do not
tolerate any off topic posts, and they usually respond with a flame -- the
Perl groups being an excellent example.

The reason why?  High volume lists like this need to be kept on topic, in
order to remain a valued resource, and to keep the valued contributors on
the list.  If the list becomes cluttered, or if the experts have to wade
through too much bullshit, they become frustrated and leave.


The fact is that this list has been highly tolerant of off topic posts, but
the traffic in the group is becoming a lot higher, and MANY contributors
have welcomed the concept of guidelines and trimming the list down to
on-topic posts, wherever possible.


I'm sorry if you don't feel the same way.  I don't believe I was rude, and I
did advise them what topics it did relate to.

Perhaps the problem is that I didn't use enough ":)"'s or list thousands of
links to JavaScript newsgroups??  Gee, sorry.


As far as this goes:

> You
> rarely even give an answer that isn't blatent criticism of what someone
> posted or their ability to find information.

a) I've only ever made THREE posts about OT posts, compared to the 100's of
(hopefully) helpful on-topic posts, some of which took quite a lot of time
to prepare.

b) I was recently congratulated in public and private by many users for
finally speaking up a little.


I've only received one complaint so far, and that would be you.


Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------


on 08/04/02 12:09 PM, [EMAIL PROTECTED] ([EMAIL PROTECTED])
wrote:

> Wow, you really feel like your better than everyone here don't you.. You
> rarely even give an answer that isn't blatent criticism of what someone
> posted or their ability to find information. You really need to stop.
> 
> Bob

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

Yeah, it looks like I appeared a little harsher than I intended, and I'll
try not to do that again, but the subject line, and the message reek of
JavaScript:

> I was just wondering if there was any way to turn off the bars at the top of
> the browser window with PHP. If not does anyone know a way that I could make
> it so that I could pass information from a form to window that I pop open
> with javascript.

I didn't read the whole thread, and it looks like it went off in a tangent
from there.

It was not my intention to flame this guy, just point him in the right
direction.

Luckily, he's found what he's after, and all is well.


Justin French


on 08/04/02 11:40 AM, Leif K-Brooks ([EMAIL PROTECTED]) wrote:

> It looks like you didn't even read the message.  He knew how to do it with
> javascript, but he needed to pass information to it, and he wanted to know
> that!  And, even if he was wrong, you don't need to be so harsh!  We aren't
> born knowing binary!


--- End Message ---
--- Begin Message ---
On Monday 08 April 2002 07:00, David Johansen wrote:
> I would love to use a class. Where can I find one? I've posted on here
> several times asking for examples or base code that work with Authorize.net
> but no one ever responds. If you could point me to some that'd be great.

1) Ever tried google? I just did, searched for "php class authorize.net" and 
it came up with more than one promising result. Rather than posting and 
waiting for someone to do your homework you could have done it yourself.

2) "...but no one ever responds", aside from the fact that it is untrue 
(there were responses to your posts, don't know whether they were useful to 
you), people usually respond when they have something positive to contribute. 
You ask a question "Does anyone know where I can get a class to work with 
Authorize.net?", you don't want all list members replying "No I don't".


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

/*
Tallulah Bankhead barged down the Nile last night as Cleopatra and sank.
                -- John Mason Brown, drama critic
*/
--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002 18:21:10 -0600, Peter J. Schoenster
<[EMAIL PROTECTED]> wrote:
> I tried the above.
> 
> uksort ($ArrayOfNewsLinks, "SortByValue");
> 
> function SortByValue ($a, $b) {
>     if ($a["language"] == $b["language"]) return 0;
>     return ($a["language"] > $b["language"]) ? 1 : -1; 
> }
> 
> 
> or this
> 
> function SortByValue ($a, $b) {
>   return strcmp ( $a["language"], $b["language"]);
> }
> 
> Doesn't work.

I should have caught this earlier. Try uasort() - uksort() sorts on the
array *key*, not the value.


<?
        $ArrayOfNewsLinks = array(
                "http://dailynews.yahoo.com/fc/World/Brazil/"; => array(
                        'title'                 => 'Yahoo Brazil News',
                        'category'  => 'news',
                        'language'      => 'English',
                ),

                "http://news.bbc.co.uk/hi/english/world/americas/default.stm"; => array(
                        'title'                 => 'BBC News',
                        'category'  => 'news',
                        'language'      => 'English',
                ),

                "http://news.yahoo.com/"; => array(
                        'title'                 => 'Yahoo News',
                        'category'  => 'news',
                        'language'      => 'English',
                ),

                "http://chinese.news.yahoo.com/"; => array(
                        'title'                 => 'Yahoo News',
                        'category'  => 'news',
                        'language'      => 'Chinese',
                )

        );

        function news_sort($a, $b) {
                        // Two key sort: first by language, then by title
                        $i = strcmp($a['language'], $b['language']);
                        if ($i != 0) {
                                return $i;
                        } else {
                                return strcmp($a['title'], $b['title']);
                        }
        }

        header("Content-Type: text/plain");

        print_r($ArrayOfNewsLinks);
        uasort($ArrayOfNewsLinks, "news_sort");
        print_r($ArrayOfNewsLinks);
?>
--- End Message ---
--- Begin Message ---
Is there a one line test for whole numbers?

I want to condense this function down to one line:

function isOneBitSet($n)
{
    $x = log($n)/log(2);
    return ($x == intval($x));
}

TIA,

Charlie


--- End Message ---
--- Begin Message ---
That post was incomprehensible. Here it is revised:

I'd like to condense the function below into one line.

function isOneBitSet($n)
{
  $x = log($n)/log(2);
  return ($x == intval($x));
}

AND I don't want to do this:
return (log($n)/log(2) == intval(log($n)/log(2)));

So, is there a way to check if a number is whole only using the number once?
Something like is_whole_number(log($n)/log(2));

Charlie


> Is there a one line test for whole numbers?
>
> I want to condense this function down to one line:
>
> function isOneBitSet($n)
> {
>     $x = log($n)/log(2);
>     return ($x == intval($x));
> }
>
> TIA,
>
> Charlie
>
>


--- End Message ---
--- Begin Message ---
Hi
Not sure if this is the best way to do it:
function isOneBitSet($n)
{
         return !ereg("\.",strval(log($n)/log(2)));
}


Tom

At 09:16 AM 8/04/2002, Charlie Killian wrote:
>That post was incomprehensible. Here it is revised:
>
>I'd like to condense the function below into one line.
>
>function isOneBitSet($n)
>{
>   $x = log($n)/log(2);
>   return ($x == intval($x));
>}
>
>AND I don't want to do this:
>return (log($n)/log(2) == intval(log($n)/log(2)));
>
>So, is there a way to check if a number is whole only using the number once?
>Something like is_whole_number(log($n)/log(2));
>
>Charlie
>
>
> > Is there a one line test for whole numbers?
> >
> > I want to condense this function down to one line:
> >
> > function isOneBitSet($n)
> > {
> >     $x = log($n)/log(2);
> >     return ($x == intval($x));
> > }
> >
> > TIA,
> >
> > Charlie
> >
> >
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Mon, 8 Apr 2002, Tom Rogers wrote:
> At 09:16 AM 8/04/2002, Charlie Killian wrote:
>> I'd like to condense the function below into one line.
>>
>> function isOneBitSet($n)
>> {
>>    $x = log($n)/log(2);
>>    return ($x == intval($x));
>> }
>>
>> AND I don't want to do this:
>> return (log($n)/log(2) == intval(log($n)/log(2)));
>
> Not sure if this is the best way to do it:
> function isOneBitSet($n)
> {
>          return !ereg("\.",strval(log($n)/log(2)));
> }

Beware; using a regular expression for this is slower than creating an
intermediate variable.

miguel

--- End Message ---
--- Begin Message ---
Is there one?

--- End Message ---
--- Begin Message ---
I don't now of one.

Charlie

> Is there one?
>


--- End Message ---
--- Begin Message ---
http://www.php.net/manual/en/function.preg-quote.php

Found this in the manual in about 3 secs.

Try to check the manual first before posting. ;-)

Matt Friedman
Web Applications Developer
www.SpryNewMedia.com
 

-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED]] 
Sent: Sunday April 7, 2002 7:16 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Function that escapes special caracters from regular
expressions

Is there one?


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


--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Charlie Killian) wrote:

> > Is there one?

> I don't now of one.

That's because PHP doesn't have "one", it has two: 
<http://php.net/preg-quote> and <http://php.net/quotemeta>.  (Read the docs 
carefully; these functions escape slightly different character sets...)

-- 
CC
--- End Message ---
--- Begin Message ---
Hi, I'm trying to make a PHP script that would go in a website and log in. The website 
uses cookie to authenticate with its services. I made HTTP GET requests using 
fsockopen and parsed the results back into a variable. However I cannot find the 
cookie info(Set-cookie) in the returned content. Is there special commands I have to 
send with the GET request in order for the server to send back cookies? Or am I just 
doing this all wrong?

Any help will be appreciated!

thanks!!

-David Zhao

--- End Message ---
--- Begin Message ---
At 07.04.2002  16:22, you wrote:
>
>Hi, I'm trying to make a PHP script that would go in a website and log in. 
>The website uses cookie to authenticate with its services. I made HTTP GET 
>requests using fsockopen and parsed the results back into a variable. 
>However I cannot find the cookie info(Set-cookie) in the returned content. 
>Is there special commands I have to send with the GET request in order for 
>the server to send back cookies? Or am I just doing this all wrong?
>
>Any help will be appreciated!
Lokk at sourceforge.net, look for 'snoopy', that´s what makes everything 
you need
Oliver

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

>From the manual:

<snip>
Note: Because flock() requires a file pointer, you may have to use a
special lock file to protect access to a file that you intend to
truncate by opening it in write mode (with a "w" or "w+" argument to
fopen()).
</snip>

The manual indicates that you "may" need to use "a special lock file" if
you intend to open a file with "w" or "w+". I wrote some code to examine
this. (2 files) Each file locks a file after opening using "w" to do so.
Then, the file is locked using LOCK_EX. Subsequently executed, each file
appears to respect the lock applied by the other file. (Each file waits
for the lock to be released by the other) - So, I don't see this manual
entry applying in this case.

In regards to the <snip> above, under what circumstances might you have
to create a separate lock file? Is this an OS issue? Is it an issue when
concurrency is high? The manual says "you may have to"; I am looking for
some clarification as to when exactly you "may have to" follow the
<snip> advice.

Thanks as always,

Matt Friedman
Web Applications Developer
www.SpryNewMedia.com




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


--- End Message ---
--- Begin Message ---
Matt Friedman <[EMAIL PROTECTED]> wrote:
> In regards to the <snip> above, under what circumstances might you have
> to create a separate lock file? Is this an OS issue? Is it an issue when
> concurrency is high? The manual says "you may have to"; I am looking for
> some clarification as to when exactly you "may have to" follow the
> <snip> advice.

when you do an fopen("file","w"), it truncates the file -- before you
can call flock(). so if one process locks the file, and starts writing
data, a second one could just come along and blow away all or part of
the data even though the first still has it locked. by the time the
second process calls flock() and notices that the first has it locked,
it has already truncated the file.

jim
--- End Message ---
--- Begin Message ---
Ok, that makes sense to me now. I see how you could lose some data.

Do you have any opinions on what a good algorithm might be for getting
locks without the potential for overwriting data? I suppose I could
create a second "lock file" which I would open using "r" - then, wait
for a lock on the lock file and then go on with any processing on the
actual data file. After the processing is done release the lock on the
lock file. Perhaps there are better ways to do this.

What do you think?

Matt Friedman
Web Applications Developer
www.SpryNewMedia.com
 

-----Original Message-----
From: Jim Winstead [mailto:[EMAIL PROTECTED]] 
Sent: Sunday April 7, 2002 8:27 PM
To: [EMAIL PROTECTED]
Subject: Re: FW: [PHP] - REPOST - Flock manual clarification please ;-)

Matt Friedman <[EMAIL PROTECTED]> wrote:
> In regards to the <snip> above, under what circumstances might you
have
> to create a separate lock file? Is this an OS issue? Is it an issue
when
> concurrency is high? The manual says "you may have to"; I am looking
for
> some clarification as to when exactly you "may have to" follow the
> <snip> advice.

when you do an fopen("file","w"), it truncates the file -- before you
can call flock(). so if one process locks the file, and starts writing
data, a second one could just come along and blow away all or part of
the data even though the first still has it locked. by the time the
second process calls flock() and notices that the first has it locked,
it has already truncated the file.

jim

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


--- End Message ---
--- Begin Message ---
does anyone know where i could find an XML-RPC-EPI dll?

thx,

dietrich


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

I think the file you're looking for is located somewhere in the zip file for
Windows.  At least I've heard it was in php 4.1.0.

Good luck,
Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

----- Original Message -----
From: "dietrich" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, April 07, 2002 11:29 PM
Subject: [PHP] xml-rpc for windows?


> does anyone know where i could find an XML-RPC-EPI dll?
>
> thx,
>
> dietrich
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
nope. that was the first place i looked. thanks though!

"Tyler Longren" <[EMAIL PROTECTED]> wrote in message
002601c1dea0$c403edd0$0101a8c0@nightengale">news:002601c1dea0$c403edd0$0101a8c0@nightengale...
> Hi,
>
> I think the file you're looking for is located somewhere in the zip file
for
> Windows.  At least I've heard it was in php 4.1.0.
>
> Good luck,
> Tyler Longren
> Captain Jack Communications
> [EMAIL PROTECTED]
> www.captainjack.com
>
> ----- Original Message -----
> From: "dietrich" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, April 07, 2002 11:29 PM
> Subject: [PHP] xml-rpc for windows?
>
>
> > does anyone know where i could find an XML-RPC-EPI dll?
> >
> > thx,
> >
> > dietrich
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>


--- End Message ---
--- Begin Message ---
I have to wait for my host to compile php as binary for cron to work with
php, and a lot of things on my site depend on cron.  Does anyone have some
sort of code that I could put at the top of all my pages so when they get
visited, it checks to see if a script has been executed yet this time
petiod, and if not yet, it does?  Or any type of workaround for not having
cron?  Thanks! 
--- End Message ---
--- Begin Message ---
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote:
> I have to wait for my host to compile php as binary for cron to work with
> php, and a lot of things on my site depend on cron.

It's not my favorite solution from a security standpoint, but you could call
the PHP scripts from cron using wget or lynx.  wget even supports HTTP
authentication and I *think* lynx does as well so you can password protect
the scripts using .htaccess.  And I'm assuming you have cron access since if
you don't, having your host install PHP as a CGI won't cure that.  <g>

> Does anyone have some
> sort of code that I could put at the top of all my pages so when they get
> visited, it checks to see if a script has been executed yet this time
> petiod, and if not yet, it does?

Better to teach a man to fish...?  Either create a db entry or text file
entry with the timestamp of the last run of the scheduled script and have
your calling scripts check the timestamp to see if it's time to run.

> Or any type of workaround for not having
> cron?  Thanks!

You just need access to a machine (can even be a Windows desktop) which can
launch a URL at a specified time or you just need someone who can do the
same via a cron job on one of their boxes.  Hope that helps.

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


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

hi

you should try this free service http://www.webcron.org it is really great (supports 
authentication, stores resulting file...) and free, 
the site is in french though !


Regards
_________________________________
Hassan El Forkani
http://WarmAfrica.com EveryOne's Africa
_________________________________


08/04/2002 04:15:01, "Steve Werby" <[EMAIL PROTECTED]> a écrit:

>"Leif K-Brooks" <[EMAIL PROTECTED]> wrote:
>> I have to wait for my host to compile php as binary for cron to work with
>> php, and a lot of things on my site depend on cron.
>
>It's not my favorite solution from a security standpoint, but you could call
>the PHP scripts from cron using wget or lynx.  wget even supports HTTP
>authentication and I *think* lynx does as well so you can password protect
>the scripts using .htaccess.  And I'm assuming you have cron access since if
>you don't, having your host install PHP as a CGI won't cure that.  <g>
>
>> Does anyone have some
>> sort of code that I could put at the top of all my pages so when they get
>> visited, it checks to see if a script has been executed yet this time
>> petiod, and if not yet, it does?
>
>Better to teach a man to fish...?  Either create a db entry or text file
>entry with the timestamp of the last run of the scheduled script and have
>your calling scripts check the timestamp to see if it's time to run.
>
>> Or any type of workaround for not having
>> cron?  Thanks!
>
>You just need access to a machine (can even be a Windows desktop) which can
>launch a URL at a specified time or you just need someone who can do the
>same via a cron job on one of their boxes.  Hope that helps.
>
>--
>Steve Werby
>President, Befriend Internet Services LLC
>http://www.befriend.com/
>
>
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>



--- End Message ---
--- Begin Message ---
Can php execute .exe file under dos and view result on the browser ?

Rizal

--- End Message ---
--- Begin Message ---
yes - look at system(), exec() and "backtick" in the manual (the last one
goes under a different name, I believe)

-----Original Message-----
From: wong [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 08, 2002 11:58 AM
To: [EMAIL PROTECTED]
Subject: [PHP] asking about .exe file


Can php execute .exe file under dos and view result on the browser ?

Rizal


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

> I'd just add that validating international numbers against any sort of
> list is bound 
to lead to extreme annoyance. Even telephone companies
> have trouble keeping track of 
changes.

Not to mention people who will just put in valid-format-but-false numbers when 
they are "required"

No stranger on the Internet is trustworthy enough to give my real 
phone number.

TjL


--- End Message ---
--- Begin Message ---
HI!

> Your problem is just the same as the case with counters, banners and so

Exatctly! I need this, but with counters and banners I can return GIF file
so form HTML I can say <IMG SRC="server1...">, but I need to send (get) som
text not picture.

> 1. Instead of ????? you could use server side includes (this would work on
SERVER2 side)
I can't use include statement because server 2 dos not have PHP!

> 2. Some Javascript file, which could be downloaded from SERVER1, like
<SCRIPT SRC="...SERVER1...">
I have tried that but it dosn't work??? Any ideas??

> 3. Use <IFRAME>
This is something new! I will tired it with this. It seems like frames
(frames arnt my prifered choise; hm).

Thanks!
MATJAZ




--- End Message ---
--- Begin Message ---
On Sun, 7 Apr 2002 20:03:42 +0200, Matjaž Prtenjak <[EMAIL PROTECTED]> wrote:
> SERVER1 with PHP.... some file with name xTest.php
> xTest.php:
><? echo("Hi from SERVER1"); ?>
> 
> SERVER2 without PHP.... some file with name file1.html
> file1.html:
><html>
>  <body>
> Server1 is saying : ?????
>  </body>
></html>
> 
> How can I make HTML file (on SERVER2) say 'Server1 is saying : Hi from
> SERVER1'?

One possibility is an IFRAME. Unfortunately, IFRAME may not be
compatible with all of the browsers you need to support and may cause
undesirable scrolling effects, so I'd test carefully.

One more compatible workaround would be to have your PHP return
JavaScript:

<script lang="javascript1.1">
                document.write("Hello from Server1");
</script>

In the HTML page on server2:

<script src="http://server1/xTest.php";></script>

Chris
--- End Message ---
--- Begin Message ---
THANKS!!!!!

That works!!

Except on PHP side I have to produce javascript code without <script> tag,
like

xTest.php - SERVER1 with PHP
document.write(<?php echo("\"This WORKS!!!\""); ?>);

on server 2 I just have to write this inside <script> tag, like

HTML file on SERVER2 WITHOUT PHP
<html>
<body>
<script src="...server1.../test.php"></script>
</body>
</html>

Thanks again!
Have a nice day
Matjaz Prtenjak

> One more compatible workaround would be to have your PHP return
> JavaScript:
>
> <script lang="javascript1.1">
> document.write("Hello from Server1");
> </script>
>
> In the HTML page on server2:
>
> <script src="http://server1/xTest.php";></script>
>
> Chris


--- End Message ---
--- Begin Message ---
Will be any changes to mod_php4 since the release of apache 2.0.35?
I wanted to compile it (freebsd ports) with a apache 2.0.33 and I
had problems while compiling.

--- End Message ---
--- Begin Message ---
Can php execute .exe file ( compile from BorlandC) and view result on the
browser ? PLease Help Me

Rizal

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

Hi ,

Here's my problem :

I read a data file (no sql file) which contains 8 lines, and in each line, 8
datas

(ex: name1;picture1;title1;anything1;everything1;nothing1)

and when i run it I see only one picture(the second data) and not all of
them

If someone could help me

TYA

Here the code :

<html>
<head>
<title>Solid</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="384" border="1">

<?php
 $row = 1;
 $fp = fopen ("album.dat","r");
  while ($data = fgetcsv ($fp, 1000, ";"))
  {
    $num = count ($data);

    $row++;

    if (isset($vignette))
        {
        print("<tr>");
        print("<td>$vignette</td>");
       // I think it's wrong here but I dont know why
==>       print("<td><img src=\"images/$photo\"><a href =
\"prod.php?file=lecteur.dat\"></a></td>");
        print("<td>$marque</td>");
        print("<td>$nom</td>");
        print("<td>$pdfproduit</td>");
        print("<td>$commprod</td>");
        print("</tr>");
        }


    for ($c=0; $c<$num; $c++)
    switch ($c)          {
            case 0 :
                    {
                    $vignette = $data[$c];
                    break;
                    }

            case 1 :
                    {
                    $photo= $data[$c];
                    break;
                    }

            case 2 :
                    {
                    $marque= $data[$c];
                    break;
                    }

            case 3 :
                    {
                    $nom = $data[$c];
                    break;
                    }

            case 4 :
                    {
                    $pdfproduit= $data[$c];
                    break;
                    }

            case 5 :
                    {
                    $commprod = $data[$c];
                    break;
                    }
    }
 }
?>
</table>
</body>
</html>





--- End Message ---
--- Begin Message ---
$fp = fopen($filename, 'r');
while ($l = fgets($fp, 1000))
{
  list ($parts, $vignette, $marque, $nom, $pdfproduit, $commprod) = 
    explode (';', $l);
  // now use the data
  print "<p>$parts</p>"; // or whatever
}
fclose ($fp);

On Mon, 8 Apr 2002, Hubert DAUL wrote:

> 
> Hi ,
> 
> Here's my problem :
> 
> I read a data file (no sql file) which contains 8 lines, and in each line, 8
> datas
> 
> (ex: name1;picture1;title1;anything1;everything1;nothing1)
> 
> and when i run it I see only one picture(the second data) and not all of
> them
> 
> If someone could help me
> 
> TYA
> 
> Here the code :
> 
> <html>
> <head>
> <title>Solid</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
> 
> <body bgcolor="#FFFFFF" text="#000000">
> <table width="384" border="1">
> 
> <?php
>  $row = 1;
>  $fp = fopen ("album.dat","r");
>   while ($data = fgetcsv ($fp, 1000, ";"))
>   {
>     $num = count ($data);
> 
>     $row++;
> 
>     if (isset($vignette))
>         {
>         print("<tr>");
>         print("<td>$vignette</td>");
>        // I think it's wrong here but I dont know why
> ==>       print("<td><img src=\"images/$photo\"><a href =
> \"prod.php?file=lecteur.dat\"></a></td>");
>         print("<td>$marque</td>");
>         print("<td>$nom</td>");
>         print("<td>$pdfproduit</td>");
>         print("<td>$commprod</td>");
>         print("</tr>");
>         }
> 
> 
>     for ($c=0; $c<$num; $c++)
>     switch ($c)          {
>             case 0 :
>                     {
>                     $vignette = $data[$c];
>                     break;
>                     }
> 
>             case 1 :
>                     {
>                     $photo= $data[$c];
>                     break;
>                     }
> 
>             case 2 :
>                     {
>                     $marque= $data[$c];
>                     break;
>                     }
> 
>             case 3 :
>                     {
>                     $nom = $data[$c];
>                     break;
>                     }
> 
>             case 4 :
>                     {
>                     $pdfproduit= $data[$c];
>                     break;
>                     }
> 
>             case 5 :
>                     {
>                     $commprod = $data[$c];
>                     break;
>                     }
>     }
>  }
> ?>
> </table>
> </body>
> </html>
> 
> 
> 
> 
> 
> 
> 

--- End Message ---
--- Begin Message ---
try this:

<html>
<head>
<title>Solid</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<table width="384" border="1">

<?php
 $fp = fopen ("album.dat","r");
 while ($data = fgetcsv ($fp, 1000, ";"))
 {
    if (isset($data[0]))
        {
        print("<tr>");
        print("<td>".$data[0]."</td>");
        print("<td><img src=\"images/".$data[1]."\"><a href
=\"prod.php?file=lecteur.dat\"></a></td>");
        print("<td>."$data[2]."</td>");
        print("<td>".$data[3]."</td>");
        print("<td>".$data[4]."</td>");
        print("<td>".$data[5]."</td>");
        print("</tr>");
        }
 }
?>
</table>
</body>
</html>


"Hubert Daul" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

>
> Hi ,
>
> Here's my problem :
>
> I read a data file (no sql file) which contains 8 lines, and in each line,
8
> datas
>
> (ex: name1;picture1;title1;anything1;everything1;nothing1)
>
> and when i run it I see only one picture(the second data) and not all of
> them
>
> If someone could help me
>
> TYA
>
> Here the code :
>
> <html>
> <head>
> <title>Solid</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
>
> <body bgcolor="#FFFFFF" text="#000000">
> <table width="384" border="1">
>
> <?php
>  $row = 1;
>  $fp = fopen ("album.dat","r");
>   while ($data = fgetcsv ($fp, 1000, ";"))
>   {
>     $num = count ($data);
>
>     $row++;
>
>     if (isset($vignette))
>         {
>         print("<tr>");
>         print("<td>$vignette</td>");
>        // I think it's wrong here but I dont know why
> ==>       print("<td><img src=\"images/$photo\"><a href =
> \"prod.php?file=lecteur.dat\"></a></td>");
>         print("<td>$marque</td>");
>         print("<td>$nom</td>");
>         print("<td>$pdfproduit</td>");
>         print("<td>$commprod</td>");
>         print("</tr>");
>         }
>
>
>     for ($c=0; $c<$num; $c++)
>     switch ($c)          {
>             case 0 :
>                     {
>                     $vignette = $data[$c];
>                     break;
>                     }
>
>             case 1 :
>                     {
>                     $photo= $data[$c];
>                     break;
>                     }
>
>             case 2 :
>                     {
>                     $marque= $data[$c];
>                     break;
>                     }
>
>             case 3 :
>                     {
>                     $nom = $data[$c];
>                     break;
>                     }
>
>             case 4 :
>                     {
>                     $pdfproduit= $data[$c];
>                     break;
>                     }
>
>             case 5 :
>                     {
>                     $commprod = $data[$c];
>                     break;
>                     }
>     }
>  }
> ?>
> </table>
> </body>
> </html>
>
>
>
>
>


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

I guess anyone have made the function to coppy directories, not files.
I'd like to copy directory including sub directories to other place.
Doesn't anyone has mades that kind of function?And please telll me.

  Thamks in advance.
  HiroshiAyukawa
  http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top

--- End Message ---
--- Begin Message ---
#########################################################
#
# boolean copy_dirs ( string src_dir, string target_dir )
#
#########################################################
#  copy  shopdirectories into a new shop
#########################################################
# Function Parameters:
#       string src_dir: source directory
#       string target_dir: target directory
#########################################################
# Return Values:
#       0 - error while copying
#       1 - files copied successfully
#########################################################
function copy_dirs ( $src_dir, $target_dir ) {

    $src_dir = ereg_replace ( "/$", "", $src_dir );
    $target_dir = ereg_replace ( "/$", "", $target_dir );

    if ( filetype ( $src_dir ) != "dir" ):
        return (0);
    endif;

    if ( !file_exists ( $target_dir ) ):
        mkdir ( $target_dir, 0777 );
    endif;

    $hdl = opendir ( $src_dir );

    while ( ( $file = readdir ( $hdl ) ) !== false ):

        if ( $file != "." && $file != ".." && $file != "" ):

            if ( filetype ( $src_dir."/".$file) == "dir" ):
            if ( filetype ( $src_dir."/".$file) == "dir" ):

                if ( !copy_dirs ( $src_dir."/".$file,
$target_dir."/".$file ) ):
                    return (0);
                endif;
            else:

                if ( !copy ( $src_dir."/".$file, $target_dir."/".$file ) ):
                    return (0);
                endif;
        endif;

    endwhile;

    return (1);

}
"Hiroshi Ayukawa" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hello,
>
> I guess anyone have made the function to coppy directories, not files.
> I'd like to copy directory including sub directories to other place.
> Doesn't anyone has mades that kind of function?And please telll me.
>
>   Thamks in advance.
>   HiroshiAyukawa
>   http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top
>


--- End Message ---
--- Begin Message ---
there was a typo...this one should work

#########################################################
#
# boolean copy_dirs ( string src_dir, string target_dir )
#
#########################################################
#  copy  a directory with subdirectories to a target directory
#########################################################
# Function Parameters:
#       string src_dir: source directory
#       string target_dir: target directory
#########################################################
# Return Values:
#       0 - error while copying
#       1 - files copied successfully
#########################################################
function copy_dirs ( $src_dir, $target_dir ) {

    $src_dir = ereg_replace ( "/$", "", $src_dir );
    $target_dir = ereg_replace ( "/$", "", $target_dir );

    if ( filetype ( $src_dir ) != "dir" ):
        return (0);
    endif;

    if ( !file_exists ( $target_dir ) ):
        mkdir ( $target_dir, 0777 );
    endif;

    $hdl = opendir ( $src_dir );

    while ( ( $file = readdir ( $hdl ) ) !== false ):

        if ( $file != "." && $file != ".." && $file != "" ):

            if ( filetype ( $src_dir."/".$file) == "dir" ):

                if ( !copy_dirs ( $src_dir."/".$file,
$target_dir."/".$file ) ):
                    return (0);
                endif;
            else:

                if ( !copy ( $src_dir."/".$file, $target_dir."/".$file ) ):
                    return (0);
                endif;
        endif;

    endwhile;

    return (1);

}
> "Hiroshi Ayukawa" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hello,
> >
> > I guess anyone have made the function to coppy directories, not files.
> > I'd like to copy directory including sub directories to other place.
> > Doesn't anyone has mades that kind of function?And please telll me.
> >
> >   Thamks in advance.
> >   HiroshiAyukawa
> >   http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top
> >
>
>


--- End Message ---
--- Begin Message ---
Sorry,
It didn't work.Mine too.
ALL of the files inside the deeoer directory come to top of the 
directory.
I'll go on trying .
Thanks.

By the way , your script looks like Python script , dont'you?

Hiroshi AYukawa
http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top
--- End Message ---
--- Begin Message ---
On Monday 08 April 2002 17:04, Hiroshi Ayukawa wrote:
> Sorry,
> It didn't work.Mine too.
> ALL of the files inside the deeoer directory come to top of the
> directory.
> I'll go on trying .
> Thanks.
>
> By the way , your script looks like Python script , dont'you?

Probably the easiest way is to some system functions. If you're on some *nix 
system use cp, if on windows use xcopy.


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

/*
Think sideways!
                -- Ed De Bono
*/
--- End Message ---
--- Begin Message ---
Thanks,
 But I can  try it ,cause I like PHP and I want to write a code tahat 
runs anyware.
 Actually, we use both *nix & windows.
 
I will announce if I could madde it.

Regards,
Hiroshi
http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top
--- End Message ---
--- Begin Message ---
I have a new very intriguing problem at hand. 

I have the name of my Images stored in my mySQL
database in one column. Now when i pick the images,
they are displayed as it as. However, they are the big
images, and the thumbnails of those images are stored
with an "a" at the end of thier names. 
That is, 
If the image is "try.jpg" , the thumbnail of the image
is "trya.jpg" !!
Now i want to display the thumbnail and not the large
image. And unfortunately, my whole database contains
the name of Large images and NOt the Thumbnails.

How can i :
1. Insert "a" at the end of the name of the image,
before the ".extension" through PHP. 
The problems are that the names are stored in the
database WITH the extesion. And the extensions also
vary, some are JPG and some are GIF. So in my datase i
have images as "try.jpg" or "something.gif"! How can i
insert an "a" at the end of the name before the "." ?

2. OR.. can i insert the "a" before the "." in the
image name in my mySQL database itself. 

Either of the two solutions can work for me. 

Thanks,
T. Edison Jr.

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
--- End Message ---
--- Begin Message ---
(untested)

  $newname = eregi_replace('\.jpg$', 'a.jpg', $oldname);

No point messing up your database; just use something like the above when 
you're outputting the image tags for the thumbnails.

miguel

On Mon, 8 Apr 2002, Thomas Edison Jr. wrote:

> I have a new very intriguing problem at hand. 
> 
> I have the name of my Images stored in my mySQL
> database in one column. Now when i pick the images,
> they are displayed as it as. However, they are the big
> images, and the thumbnails of those images are stored
> with an "a" at the end of thier names. 
> That is, 
> If the image is "try.jpg" , the thumbnail of the image
> is "trya.jpg" !!
> Now i want to display the thumbnail and not the large
> image. And unfortunately, my whole database contains
> the name of Large images and NOt the Thumbnails.
> 
> How can i :
> 1. Insert "a" at the end of the name of the image,
> before the ".extension" through PHP. 
> The problems are that the names are stored in the
> database WITH the extesion. And the extensions also
> vary, some are JPG and some are GIF. So in my datase i
> have images as "try.jpg" or "something.gif"! How can i
> insert an "a" at the end of the name before the "." ?
> 
> 2. OR.. can i insert the "a" before the "." in the
> image name in my mySQL database itself. 
> 
> Either of the two solutions can work for me. 
> 
> Thanks,
> T. Edison Jr.
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
> 
> 

--- End Message ---
--- Begin Message ---
$parts = preg_split('/\./', $filename);
$new_filename = $parts[0] . "a.jpg";

(Not tested, but _should_ work.)

/bsh/

Thomas Edison Jr. wrote:
> I have a new very intriguing problem at hand. 
> 
> I have the name of my Images stored in my mySQL
> database in one column. Now when i pick the images,
> they are displayed as it as. However, they are the big
> images, and the thumbnails of those images are stored
> with an "a" at the end of thier names. 
> That is, 
> If the image is "try.jpg" , the thumbnail of the image
> is "trya.jpg" !!
> Now i want to display the thumbnail and not the large
> image. And unfortunately, my whole database contains
> the name of Large images and NOt the Thumbnails.
> 
> How can i :
> 1. Insert "a" at the end of the name of the image,
> before the ".extension" through PHP. 
> The problems are that the names are stored in the
> database WITH the extesion. And the extensions also
> vary, some are JPG and some are GIF. So in my datase i
> have images as "try.jpg" or "something.gif"! How can i
> insert an "a" at the end of the name before the "." ?
> 
> 2. OR.. can i insert the "a" before the "." in the
> image name in my mySQL database itself. 
> 
> Either of the two solutions can work for me. 
> 
> Thanks,
> T. Edison Jr.
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
> 


-- 


/---------------------------------------------=[ BILLY S HALSEY ]=--\
| Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW  |
| "All opinions and technical advice offered in this message are my |
| own and not necessarily endorsed by my employer."                 |
\--=[ [EMAIL PROTECTED] ]=--------------------------------------------/

--- End Message ---
--- Begin Message ---
On Monday 08 April 2002 15:41, Thomas Edison Jr. wrote:

> How can i :
> 1. Insert "a" at the end of the name of the image,
> before the ".extension" through PHP.
> The problems are that the names are stored in the
> database WITH the extesion. And the extensions also
> vary, some are JPG and some are GIF. So in my datase i
> have images as "try.jpg" or "something.gif"! How can i
> insert an "a" at the end of the name before the "." ?
>
> 2. OR.. can i insert the "a" before the "." in the
> image name in my mySQL database itself.

Loads of ways to do it. Here's one:

explode() the file name on "." then concatenate an "a" onto the second from 
last element, then implode().


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

/*
Don't worry.  Life's too long.
                -- Vincent Sardi, Jr.
*/
--- End Message ---
--- Begin Message ---
Hi,

Thanks for your relies. There are a couple of
problems. Firstly, i'm picking the filename from the
database, so my code is something like this :

if ($myrow = mysql_fetch_array($result)) {
  do {
  echo("
<img src=\"images\\$myrow[ilmage]\"
       ");
  } while ($myrow = mysql_fetch_array($result));
} 


Now the filename is actually stored in $myrow[ilmage]
How do i perform the spliting & adding functions on
$myrow[ilmage] ??
Secondly, all images are not ".JPG", some are jpg &
others are gif !!!

Thank you.. 
T. Edison Jr.  
--- Miguel Cruz <[EMAIL PROTECTED]> wrote:
> (untested)
> 
>   $newname = eregi_replace('\.jpg$', 'a.jpg',
> $oldname);
> 
> No point messing up your database; just use
> something like the above when 
> you're outputting the image tags for the thumbnails.
> 
> miguel
> 
> On Mon, 8 Apr 2002, Thomas Edison Jr. wrote:
> 
> > I have a new very intriguing problem at hand. 
> > 
> > I have the name of my Images stored in my mySQL
> > database in one column. Now when i pick the
> images,
> > they are displayed as it as. However, they are the
> big
> > images, and the thumbnails of those images are
> stored
> > with an "a" at the end of thier names. 
> > That is, 
> > If the image is "try.jpg" , the thumbnail of the
> image
> > is "trya.jpg" !!
> > Now i want to display the thumbnail and not the
> large
> > image. And unfortunately, my whole database
> contains
> > the name of Large images and NOt the Thumbnails.
> > 
> > How can i :
> > 1. Insert "a" at the end of the name of the image,
> > before the ".extension" through PHP. 
> > The problems are that the names are stored in the
> > database WITH the extesion. And the extensions
> also
> > vary, some are JPG and some are GIF. So in my
> datase i
> > have images as "try.jpg" or "something.gif"! How
> can i
> > insert an "a" at the end of the name before the
> "." ?
> > 
> > 2. OR.. can i insert the "a" before the "." in the
> > image name in my mySQL database itself. 
> > 
> > Either of the two solutions can work for me. 
> > 
> > Thanks,
> > T. Edison Jr.
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://taxes.yahoo.com/
> > 
> > 
> 


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
--- End Message ---
--- Begin Message ---
$thumbnail = eregi_replace('\.jpg$', 'a.jpg', $myrow['ilmage']);
$thumbnail = eregi_replace('\.gif$', 'a.gif', $thumbnail);

It's no problem to do it twice in a row; it'll pick up one or the other.

miguel



On Mon, 8 Apr 2002, Thomas Edison Jr. wrote:

> Hi,
> 
> Thanks for your relies. There are a couple of
> problems. Firstly, i'm picking the filename from the
> database, so my code is something like this :
> 
> if ($myrow = mysql_fetch_array($result)) {
>   do {
>   echo("
> <img src=\"images\\$myrow[ilmage]\"
>        ");
>   } while ($myrow = mysql_fetch_array($result));
> } 
> 
> 
> Now the filename is actually stored in $myrow[ilmage]
> How do i perform the spliting & adding functions on
> $myrow[ilmage] ??
> Secondly, all images are not ".JPG", some are jpg &
> others are gif !!!
> 
> Thank you.. 
> T. Edison Jr.  
> --- Miguel Cruz <[EMAIL PROTECTED]> wrote:
> > (untested)
> > 
> >   $newname = eregi_replace('\.jpg$', 'a.jpg',
> > $oldname);
> > 
> > No point messing up your database; just use
> > something like the above when 
> > you're outputting the image tags for the thumbnails.
> > 
> > miguel
> > 
> > On Mon, 8 Apr 2002, Thomas Edison Jr. wrote:
> > 
> > > I have a new very intriguing problem at hand. 
> > > 
> > > I have the name of my Images stored in my mySQL
> > > database in one column. Now when i pick the
> > images,
> > > they are displayed as it as. However, they are the
> > big
> > > images, and the thumbnails of those images are
> > stored
> > > with an "a" at the end of thier names. 
> > > That is, 
> > > If the image is "try.jpg" , the thumbnail of the
> > image
> > > is "trya.jpg" !!
> > > Now i want to display the thumbnail and not the
> > large
> > > image. And unfortunately, my whole database
> > contains
> > > the name of Large images and NOt the Thumbnails.
> > > 
> > > How can i :
> > > 1. Insert "a" at the end of the name of the image,
> > > before the ".extension" through PHP. 
> > > The problems are that the names are stored in the
> > > database WITH the extesion. And the extensions
> > also
> > > vary, some are JPG and some are GIF. So in my
> > datase i
> > > have images as "try.jpg" or "something.gif"! How
> > can i
> > > insert an "a" at the end of the name before the
> > "." ?
> > > 
> > > 2. OR.. can i insert the "a" before the "." in the
> > > image name in my mySQL database itself. 
> > > 
> > > Either of the two solutions can work for me. 
> > > 
> > > Thanks,
> > > T. Edison Jr.
> > > 
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Yahoo! Tax Center - online filing with TurboTax
> > > http://taxes.yahoo.com/
> > > 
> > > 
> > 
> 
> 
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> *******************************************
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
> 
> 

--- End Message ---
--- Begin Message ---
Do the explode and implodes like that one fellow mentioned.

So basically:

while ($myrow = mysql_fetch_array($result)) {
  $img = explode('.',$myrow[ilmage]);
  echo "<img src=\"images/{$img[0]}a$img[1]\"><br />"
}

What this will do is take your image split the image at the '.' then echo it
with the 'a'.. Hope it helps!

Rick

Be kind. Everyone you meet is fighting a hard battle - John Watson

> From: "Thomas Edison Jr." <[EMAIL PROTECTED]>
> Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT)
> To: Miguel Cruz <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Adding "a" in "try.jpg"! Problems!
> 
> Hi,
> 
> Thanks for your relies. There are a couple of
> problems. Firstly, i'm picking the filename from the
> database, so my code is something like this :
> 
> if ($myrow = mysql_fetch_array($result)) {
> do {
> echo("
> <img src=\"images\\$myrow[ilmage]\"
>      ");
> } while ($myrow = mysql_fetch_array($result));
> } 
> 
> 
> Now the filename is actually stored in $myrow[ilmage]
> How do i perform the spliting & adding functions on
> $myrow[ilmage] ??
> Secondly, all images are not ".JPG", some are jpg &
> others are gif !!!
> 
> Thank you.. 
> T. Edison Jr.  
> --- Miguel Cruz <[EMAIL PROTECTED]> wrote:
>> (untested)
>> 
>>   $newname = eregi_replace('\.jpg$', 'a.jpg',
>> $oldname);
>> 
>> No point messing up your database; just use
>> something like the above when
>> you're outputting the image tags for the thumbnails.
>> 
>> miguel
>> 
>> On Mon, 8 Apr 2002, Thomas Edison Jr. wrote:
>> 
>>> I have a new very intriguing problem at hand.
>>> 
>>> I have the name of my Images stored in my mySQL
>>> database in one column. Now when i pick the
>> images,
>>> they are displayed as it as. However, they are the
>> big
>>> images, and the thumbnails of those images are
>> stored
>>> with an "a" at the end of thier names.
>>> That is, 
>>> If the image is "try.jpg" , the thumbnail of the
>> image
>>> is "trya.jpg" !!
>>> Now i want to display the thumbnail and not the
>> large
>>> image. And unfortunately, my whole database
>> contains
>>> the name of Large images and NOt the Thumbnails.
>>> 
>>> How can i :
>>> 1. Insert "a" at the end of the name of the image,
>>> before the ".extension" through PHP.
>>> The problems are that the names are stored in the
>>> database WITH the extesion. And the extensions
>> also
>>> vary, some are JPG and some are GIF. So in my
>> datase i
>>> have images as "try.jpg" or "something.gif"! How
>> can i
>>> insert an "a" at the end of the name before the
>> "." ?
>>> 
>>> 2. OR.. can i insert the "a" before the "." in the
>>> image name in my mySQL database itself.
>>> 
>>> Either of the two solutions can work for me.
>>> 
>>> Thanks,
>>> T. Edison Jr.
>>> 
>>> __________________________________________________
>>> Do You Yahoo!?
>>> Yahoo! Tax Center - online filing with TurboTax
>>> http://taxes.yahoo.com/
>>> 
>>> 
>> 
> 
> 
> =====
> Rahul S. Johari (Director)
> ******************************************
> Abraxas Technologies Inc.
> Homepage : http://www.abraxastech.com
> Email : [EMAIL PROTECTED]
> Tel : 91-4546512/4522124
> *******************************************
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Tax Center - online filing with TurboTax
> http://taxes.yahoo.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

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

Thanks.. actually that problem is solved, this is what
i used :

$myrow[ilmage] = eregi_replace('\.jpg$', 'a.jpg',
$myrow[ilmage]);
  $myrow[ilmage] = eregi_replace('\.gif$', 'a.gif',
$myrow[ilmage]);

and it's now showing the small images with the "a"!! 

Thanks AGAIN!
T. Edison Jr.



--- Miguel Cruz <[EMAIL PROTECTED]> wrote:
> (untested)
> 
>   $newname = eregi_replace('\.jpg$', 'a.jpg',
> $oldname);
> 
> No point messing up your database; just use
> something like the above when 
> you're outputting the image tags for the thumbnails.
> 
> miguel
> 
> On Mon, 8 Apr 2002, Thomas Edison Jr. wrote:
> 
> > I have a new very intriguing problem at hand. 
> > 
> > I have the name of my Images stored in my mySQL
> > database in one column. Now when i pick the
> images,
> > they are displayed as it as. However, they are the
> big
> > images, and the thumbnails of those images are
> stored
> > with an "a" at the end of thier names. 
> > That is, 
> > If the image is "try.jpg" , the thumbnail of the
> image
> > is "trya.jpg" !!
> > Now i want to display the thumbnail and not the
> large
> > image. And unfortunately, my whole database
> contains
> > the name of Large images and NOt the Thumbnails.
> > 
> > How can i :
> > 1. Insert "a" at the end of the name of the image,
> > before the ".extension" through PHP. 
> > The problems are that the names are stored in the
> > database WITH the extesion. And the extensions
> also
> > vary, some are JPG and some are GIF. So in my
> datase i
> > have images as "try.jpg" or "something.gif"! How
> can i
> > insert an "a" at the end of the name before the
> "." ?
> > 
> > 2. OR.. can i insert the "a" before the "." in the
> > image name in my mySQL database itself. 
> > 
> > Either of the two solutions can work for me. 
> > 
> > Thanks,
> > T. Edison Jr.
> > 
> > __________________________________________________
> > Do You Yahoo!?
> > Yahoo! Tax Center - online filing with TurboTax
> > http://taxes.yahoo.com/
> > 
> > 
> 


=====
Rahul S. Johari (Director)
******************************************
Abraxas Technologies Inc.
Homepage : http://www.abraxastech.com
Email : [EMAIL PROTECTED]
Tel : 91-4546512/4522124
*******************************************

__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
--- End Message ---
--- Begin Message ---
 i am a php programmer whose learning expr. is about 2 months. whatever
> running script of php that written by other php programmer or me, i
> always see the warning below shown, why this occurs? how to avoid?
>
> Warning: Undefined variable: HTTP_VIA in
> g:\wwwroot\phpformmail\formmail.php on line 111



--- End Message ---
--- Begin Message ---
As you may know, headers included in the 4th argument of PHP's mail() are 
sent to the outgoing mail server.

What header(s) can I send to sendmail 8.10.2 (running under Linux Redhat 
6.2) in order for invalid e-mails be returned to my e-mail address rather 
than my hosting provider's default address?

Thank you!

Tony Rodriguez
([EMAIL PROTECTED])


--- End Message ---
--- Begin Message ---
On Monday 08 April 2002 15:44, Anthony Rodriguez wrote:
> As you may know, headers included in the 4th argument of PHP's mail() are
> sent to the outgoing mail server.
>
> What header(s) can I send to sendmail 8.10.2 (running under Linux Redhat
> 6.2) in order for invalid e-mails be returned to my e-mail address rather
> than my hosting provider's default address?

"Return-Path: <[EMAIL PROTECTED]>\r\n";


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

/*
Pound for pound, the amoeba is the most vicious animal on earth.
*/
--- End Message ---
--- Begin Message ---
Is there a way to pass variables (objects) across the different 
sessions. I thought of sharing one object for all users that access my 
web site (it's an object that does some operations with files common to 
all users, like reading and writing). Any ideas?

Tnx in advance.
Armin

--- End Message ---

Reply via email to