php-general Digest 20 Jun 2005 11:42:07 -0000 Issue 3522

Topics (messages 217200 through 217214):

Re: comparing two texts
        217200 by: jenny mathew
        217203 by: Jochem Maas
        217207 by: JamesBenson

Returned mail: see transcript for details
        217201 by: MAILER-DAEMON

Re: Fshockopen error while opening a https stream urgent help needed
        217202 by: choksi

SIMPLExml problem....
        217204 by: Cruonit
        217205 by: Cruonit
        217206 by: Cruonit
        217208 by: Paul Waring
        217214 by: Jochem Maas

Allowed memory size of
        217209 by: david forums

Re: rename
        217210 by: JamesBenson

Re: possible jscript/php/frames question!!
        217211 by: JamesBenson

file upload
        217212 by: Han

Re: Permission argh!
        217213 by: Jochem Maas

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:
        php-general@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
so,what what should i conclude .it is not possible to compare two texts and 
hight the difference at this moment.
thanks.
Yours ,
Jenny

 On 6/19/05, Robert Cummings <[EMAIL PROTECTED]> wrote: 
> 
> On Sun, 2005-06-19 at 12:33, M. Sokolewicz wrote:
> > Robert Cummings wrote:
> > > On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote:
> > >
> > >>jenny mathew wrote:
> > >>
> > >>>>Untested, very crude:
> > >>>>
> > >>>><?php
> > >>>>$maxlen = max(strlen($text1), strlen($text2));
> > >>>>for ($i = 0; $i < $maxlen; $i++){
> > >>>>if (@$text1[$i] == @$text2[$i]) echo @$text1[$i];
> > >>>>else @echo "<font color=red>$text1[$i]|$text2[$i]</font>";
> > >>>>}
> > >>>>?>
> > >>>
> > >>> donot you think you program will just bring the server to its foot 
> ,if the
> > >>>text message encountered is very large of order of 40 KB or
> > >>>larger.is <http://larger.is><http://larger.is>there any other 
> efficient method.
> > >>>
> > >>
> > >>40KB isn't large... now, when you're talking about hundreds of MBs of
> > >>text, then it gets large :) 40KB, with that method, is nothing...
> > >
> > >
> > > It's a bit of a dirty hack though. If I compare a 2 character text
> > > against a 40k text, the error handler will be invoked (39998 * 3) 
> times
> > > if $text1 is the 2 byte string. That's extremely inefficient. I don't
> > > think I've ever seen error suppression abused so badly to prevent
> > > writing an extra line or 2 using isset().
> > >
> > > Cheers,
> > > Rob.
> > I agree with what you said fully; however, even though that's the case,
> > and it indeed could be written a lot faster and cleaner, it would not
> > pose a problem on most systems. That was the point I tried to make ;)
> 
> Oh absolutely, 40k is tiny :) Just never seen error suppression used for
> such mundane processing. Now if we up it to 2 chars and 5 megs :) With a
> custom user space error handler in the background... ugh.
> 
> Cheers,
> Rob.
> --
> .------------------------------------------------------------.
> | InterJinn Application Framework - http://www.interjinn.com |
> :------------------------------------------------------------:
> | An application and templating framework for PHP. Boasting |
> | a powerful, scalable system for accessing system services |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for |
> | creating re-usable components quickly and easily. |
> `------------------------------------------------------------'
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--- End Message ---
--- Begin Message ---
jenny mathew wrote:
so,what what should i conclude .it is not possible to compare two texts and hight the difference at this moment.

1. conclude whatever the **** you like
2. 'hight' is not an english word (I guess you mean highlight)
3. actually it is possible but you have to write some code
4. nobody will be writing a

compare_these_two_strings_and_show_the_differences_in_a_complete_webpage_styled_the_way_I_like_it()

function for php anytime soon.
5. go read about 'DIFF' like I said the first time.

thanks.
Yours ,

<humour class="monday, crass, dark, sexist">
with regard to the concept of 'objectification of women' you might
consider another sign off than 'Yours' - or maybe you want to be 0wn3d?
</humour>

Jenny

On 6/19/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
On Sun, 2005-06-19 at 12:33, M. Sokolewicz wrote:

Robert Cummings wrote:

On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote:


jenny mathew wrote:


Untested, very crude:

<?php
$maxlen = max(strlen($text1), strlen($text2));
for ($i = 0; $i < $maxlen; $i++){
if (@$text1[$i] == @$text2[$i]) echo @$text1[$i];
else @echo "<font color=red>$text1[$i]|$text2[$i]</font>";
}
?>

donot you think you program will just bring the server to its foot

,if the

text message encountered is very large of order of 40 KB or
larger.is <http://larger.is><http://larger.is>there any other

efficient method.

40KB isn't large... now, when you're talking about hundreds of MBs of
text, then it gets large :) 40KB, with that method, is nothing...


It's a bit of a dirty hack though. If I compare a 2 character text
against a 40k text, the error handler will be invoked (39998 * 3)

times

if $text1 is the 2 byte string. That's extremely inefficient. I don't
think I've ever seen error suppression abused so badly to prevent
writing an extra line or 2 using isset().

Cheers,
Rob.

I agree with what you said fully; however, even though that's the case,
and it indeed could be written a lot faster and cleaner, it would not
pose a problem on most systems. That was the point I tried to make ;)

Oh absolutely, 40k is tiny :) Just never seen error suppression used for
such mundane processing. Now if we up it to 2 chars and 5 megs :) With a
custom user space error handler in the background... ugh.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

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





--- End Message ---
--- Begin Message --- I saw a function in the php manual the other day which displays the difference as a percentage, for instance two strings,

foo
foos

would be maybe 90% match, not sure thats what you mean though, you can always do a str_replace like so,


$string1 = 'foo';
$string2 = 'foos';


$string = (str_replace("$string1", "", $string2));

echo "$string";


The difference being one letter in this case, the letter 's', whether that would work for what your after im not sure because it would depend on string1 containg string in the same order but not work for random characters.




jenny mathew wrote:
so,what what should i conclude .it is not possible to compare two texts and hight the difference at this moment.
thanks.
Yours ,
Jenny

On 6/19/05, Robert Cummings <[EMAIL PROTECTED]> wrote:
On Sun, 2005-06-19 at 12:33, M. Sokolewicz wrote:

Robert Cummings wrote:

On Sun, 2005-06-19 at 09:22, M. Sokolewicz wrote:


jenny mathew wrote:


Untested, very crude:

<?php
$maxlen = max(strlen($text1), strlen($text2));
for ($i = 0; $i < $maxlen; $i++){
if (@$text1[$i] == @$text2[$i]) echo @$text1[$i];
else @echo "<font color=red>$text1[$i]|$text2[$i]</font>";
}
?>

donot you think you program will just bring the server to its foot

,if the

text message encountered is very large of order of 40 KB or
larger.is <http://larger.is><http://larger.is>there any other

efficient method.

40KB isn't large... now, when you're talking about hundreds of MBs of
text, then it gets large :) 40KB, with that method, is nothing...


It's a bit of a dirty hack though. If I compare a 2 character text
against a 40k text, the error handler will be invoked (39998 * 3)

times

if $text1 is the 2 byte string. That's extremely inefficient. I don't
think I've ever seen error suppression abused so badly to prevent
writing an extra line or 2 using isset().

Cheers,
Rob.

I agree with what you said fully; however, even though that's the case,
and it indeed could be written a lot faster and cleaner, it would not
pose a problem on most systems. That was the point I tried to make ;)

Oh absolutely, 40k is tiny :) Just never seen error suppression used for
such mundane processing. Now if we up it to 2 chars and 5 megs :) With a
custom user space error handler in the background... ugh.

Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

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





--- End Message ---
--- Begin Message ---
The original message was included as attachment


--- End Message ---
--- Begin Message ---
Hi i have changed the re-complile php openssl but now its giving me 
connection refused error.
 Warning: fsockopen()
[function.fsockopen<https://192.168.0.85/voip/function.fsockopen>]:
unable to connect to ssl://192.168.65.20:443 (Connection refused) in *
/www/htdocs/voip/api_class.php* on line *323*

Now I really wonder what could be the issue
 dhaval
 On 17/06/05, JamesBenson <[EMAIL PROTECTED]> wrote: 
> 
> You pointed the configure line to the source files and not the installed
> version of openssl, you should compile and install openssl first, 
> change...
> 
> --with-openssl-dir=/usr/local­/src/webserver/openssl-0.9.7d
> 
> to...
> 
> --with-openssl-dir=/usr/local­
> 
> Or wherever you installed openssl, /usr/local is default, it will then
> find all openssl files in /usr/local/lib and wherever else it needs but
> openssl needs to be compiled installed then linked by PHP from an
> installed version and NOT the origanal source files.
> 
> James
> 
> 
> choksi wrote:
> > Hello All
> > I am running PHP5.0.2 over apache 1.3.29 and openssl-0.9.7d on a Debian
> > Php Configure command './configure' '--with-apxs=/www/bin/apxs'
> > '--with-openssl-dir=/usr/local­/src/webserver/openssl-0.9.7d/­'
> > '--enable-trans-sid' '--disable-libxml'
> >
> > Registered PHP Streams : php, file, http, ftp
> > Registered Stream Socket Transports : tcp, udp, unix, udg
> > allow_url_fopen : On On
> >
> > Now when i try to open a https url via it gives me this error
> >
> > [Wed Jun 15 19:03:36 2005] [error] PHP Warning: fsockopen() [<a
> > href='function.fsockopen'>func­tion.fsockopen</a>]: unable to connect to
> > ssl:// 192.168.0.10:443 <http://192.168.0.10:443><
> http://www.google.com/url?sa=D&q=http://www.testcall.com:443>(Unable
> > to find the socket transport
> > &quot;ssl&quot; - did you forget to enable it when you configured PHP?)
> > in /www/htdocs/testcon.php on line 2
> >
> > I am trying to fix this from last few days but not successful can some
> > please help me its very urgent.
> > Do I need to register ssl and https as registered php streams? and if
> > so how do i register them.
> >
> > Thankyou
> > Regards
> > Dhaval Choksi
> >
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
Rgds
Choksi

--- End Message ---
--- Begin Message ---
I tryed this simple PHP script that uses SimpleXML control:
<?php
   $users = simplexml_load_file('baza.xml');
     echo $users -> name;
?>

and i got:

Fatal error: Cannot clone object of class SimpleXMLElement due to
'zend.ze1_compatibility_mode' in /mnt/storage/users/w/i/p/wipe/formular.php
on line 381


i tryed the same code on 3 other servers including my localhost and it works
(the versions where PHP 5.04 and on the server with the problem it's 5.03) i
searched google
but i didn't got the answer...

http://wipe.host.sk
http://bihnet.org/Cruonit/wipe/

--- End Message ---
--- Begin Message ---
I tryed this simple PHP script that uses SimpleXML control:
<?php
   $users = simplexml_load_file('baza.xml');
     echo $users -> name;
?>

and i got:

Fatal error: Cannot clone object of class SimpleXMLElement due to
'zend.ze1_compatibility_mode' in /mnt/storage/users/w/i/p/wipe/formular.php
on line 381


i tryed the same code on 3 other servers including my localhost and it works
(the versions where PHP 5.04 and on the server with the problem it's 5.03) i
searched google
but i didn't got the answer...

http://wipe.host.sk
http://bihnet.org/Cruonit/wipe/

--- End Message ---
--- Begin Message ---
I tryed this simple PHP script that uses SimpleXML control:
<?php
   $users = simplexml_load_file('baza.xml');
     echo $users -> name;
?>

and i got:

Fatal error: Cannot clone object of class SimpleXMLElement due to
'zend.ze1_compatibility_mode' in /mnt/storage/users/w/i/p/wipe/formular.php
on line 381


i tryed the same code on 3 other servers including my localhost and it works
(the versions where PHP 5.04 and on the server with the problem it's 5.03) i
searched google
but i didn't got the answer...

http://wipe.host.sk
http://bihnet.org/Cruonit/wipe/

--- End Message ---
--- Begin Message ---
On Mon, Jun 20, 2005 at 10:48:41AM +0200, Cruonit wrote:
> I tryed this simple PHP script that uses SimpleXML control:
<snip>

In future, please don't post the same thing to the list three times,
there really is no point. If your post isn't showing up, at least have
the patience to wait a few minutes before re-sending if you think it
hasn't got through.

Paul

-- 
Rogue Tory
http://www.roguetory.org.uk

--- End Message ---
--- Begin Message ---
Cruonit wrote:
I tryed this simple PHP script that uses SimpleXML control:
<?php
   $users = simplexml_load_file('baza.xml');
     echo $users -> name;
?>

and i got:

Fatal error: Cannot clone object of class SimpleXMLElement due to
'zend.ze1_compatibility_mode' in /mnt/storage/users/w/i/p/wipe/formular.php
on line 381


a, zend.ze1_compatibility_mode is a php.ini setting - it needs to off in your 
case.
b, your test script is 3 lines ... which begs the question of where the other
378 lines are? are you maybe using auto_prepend to include stuff automatically?




i tryed the same code on 3 other servers including my localhost and it works
(the versions where PHP 5.04 and on the server with the problem it's 5.03) i
searched google
but i didn't got the answer...

http://wipe.host.sk
http://bihnet.org/Cruonit/wipe/


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

I got the following message.

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 69505726
bytes)

I read on several forums to increase the size of the memory limit in php.ini.

As you can wee which as already be done cause 134217728>69505726. But I still get the message.

I'll like to understand and find how to do.

The aim of this script is to get a big file (69MB) and to encrypt (using mcrypt). then to send it
by ftp.

Thanks for your helps

david

--- End Message ---
--- Begin Message --- Well, why not first check for existance of the file then check if its able to write to the new location, do something like,

if(!file_exists('/my/file/name')) {
echo 'File does not exist';
}
if(!is_writable('/my/new/file/name')) {
echo 'Destination dir is not writable';
}


then finally check if the actual file was renamed or not,

what else would you need to check for?






Mister Jack wrote:
Hi,

I would like to know precisely what rename do in case of error. any
link for that ?
I do a : @rename($old, $new), what happens if I run out of space ? is
the rename just an alias for C function library ?
thanks

--- End Message ---
--- Begin Message ---
Ive never seen this happen with an image map.



Dont this work?





<MAP Name="mymap">
<AREA Shape="rect" Coords="25,180,125,280"
         Href="http://www.example.com";>
</MAP>

<IMG Src="/images/imagemap.gif" Width="500" Height="300"
        Alt="Image Map" Usemap="#mymap">








bruce wrote:
hi...

i've got a problem where i'm trying to play with imagemaps. i created a test
image map, but when i select inside the image map, i 'see' the "?x,y" from
the imagemap, appended to the url in the browser address bar... i get
http://foo.com?3,5 etc...

is there a way to prevent this from occuring??

i'd like to be able to select the imagemap, get the coordinate, and not have
the x,y mouse coordinate show up in the address bar...

i thought i could use an onClick, and go to a javascript function, but i
couldn't figure out how to get the mouse coordinates within the jscript
function.

if i slammed all this inside a frame, would that prevent the url-"x,y"
information from being displayed??

my sample code is below...

thanks

-bruce
[EMAIL PROTECTED]


----------------------------------------------------------------------------
---
[EMAIL PROTECTED] site]# cat map.php
<?
  /*
     test for image maps...
  */
?>
<?
 $_self = $_SERVER['PHP_SELF'];
?>

<html>
<body>
<script language="javascript" type="text/javascript">
<!--

function foo1(q)
{
//   str = window.location.search
//   document.write("fff "+q+"<br>");
// location.href="map.php";
// return true;
}
function foo(e)
{
//q = q+1;
 mX = event.clientX;
 mY = event.clientY;
//   str = window.location.search
   document.write("fff "+mX+" y= "+mY+"<br>");
 location.href="map.php";
 return true;
}
// -->
</script>

<!--
<center><a href="<?=$_self;?>"><img
-->

<center>
<!--
<a href="<?=$_self;?>" onclick ="alert(self.location.search); return false">
-->
<a href="ff.php" onclick="">
<img src="imagemap.gif" ISMAP></a></center>
<p>
<script language="javascript" type="text/javascript">
<!--

str = location.search
 if(str)
 {
   document.write("fff "+str+"<br>");
   //location.href="map.php";
 }

// -->
</script>


</body>
</html>

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

I'm having a problem with a file upload. The following works on one server I 
use : -

---------------------------------------------------------------------------
function add_me(){
global $filename;
global $maxFileSize;
global $yourdirectory;

// put this in a file that is called by your webpage with a form
// use the form file input type and call it 'file'

   $maxFileSize =  204800;
   $filename = $_FILES['file']['tmp_name'];
echo "f is ".$filename;

   if (file_exists($filename))
   {
    // open the file
       $handle = fopen($filename, "r");

    // 1. read the file in line by line
       while (!feof($handle))
    {
      $buffer = fgets($handle, 4096);

     // if you were reading a text file you can
     // do any operations on each line as you go here
       }


    // 2. otherwise just read the whole file
    // in one go, e.g. for an image.
     $buffer = fgets($handle, 4096);

    // then you can write to the database or
    // do whatever with it here

    // close the file
       fclose($handle);
   }


$uploaddir = '/home/folder1/htdocs/folder2/'.myfolder.'/';
echo "<BR>YYYYYYYYYYY ".$uploaddir;

$uploadfile2 = $_FILES['file']['tmp_name'];
$uploadfile2 = preg_replace("/\/tmp\//", "", $uploadfile2);

$uploadfile = $uploaddir . $uploadfile2 .".gif";


//$$uploadfile2 =~ s/\/[a-zA-Z]\///g;

//print "<pre>";
if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadfile)) {
   print "File is valid, and was successfully uploaded. ";
} else {
   print "Possible file upload attack!  Here's some debugging info:\n";
}
//print "</pre>$uploadfile";

chmod($uploadfile,0777);

----------------------------------------------------------

But when I use this same code on a different server, it doesn't work as 
there seem to be no $_FILES['file']['tmp_name'].
Is $_FILES['file']['tmp_name'] something configured by the server (I'm using 
Apache on a Linux system), or something default within PHP itself?


Han.

--- End Message ---
--- Begin Message ---
Andy Pieters wrote:
Hi all

I am in the process of creating an installer for my php application.

During the test proces, it does this:

isdir(root)?>create dir root
 ok?>chmod 0777
isdir(root/child)?>create dir root/child
 ok?>chmod 0777
isdir(root/child/grandchild)?>create dir root/child/grandchild
 ok?>chmod 0777

The script fails on the grandchild part:

when you are testing your script does 'child' already exist?
does the chmod(777) actually change the perms?
what dirs exists before you start the test? (and what are the
perms?) ... try doing an 'ls -Rt' on the 'root' dir.

stat failed for /root/child/grandchild (errno=13 - Permission denied)
when I try to force the hand and create it anyway:
mkdir() failed (Permission denied)

The files/directories are owned by the 'nobody' user... the same as the apache&php user.

Anybody know how to remedy this problem?

With kind regards


Andy


--- End Message ---

Reply via email to