php-general Digest 3 Jan 2006 17:45:50 -0000 Issue 3885

Topics (messages 228103 through 228123):

Re: Upload with process meter
        228103 by: Mattias Segerdahl
        228105 by: Michael Hulse

MySQL update killed my login...
        228104 by: William Stokes
        228106 by: M
        228107 by: William Stokes

Re: Strange Right-Shift Problem
        228108 by: Jochem Maas

Re: fread problem
        228109 by: Mario de Frutos Dieguez

forms
        228110 by: Mark
        228111 by: Jay Blanchard
        228112 by: Silvio Porcellana [tradeOver]

Re: A curl question
        228113 by: ray.hauge.americanstudentloan.com
        228117 by: tedd

Problems requesting page
        228114 by: PHP Superman
        228118 by: M

Re: watermark png on jpg
        228115 by: tedd
        228116 by: Libit

Any Senior PHP/MySQL Developers in the Los Angeles area?
        228119 by: Beau Gould

are these db stats normal?
        228120 by: James Tu

Re: PHPMailer inserting unwanted spaces
        228121 by: René Fournier
        228123 by: Manuel Lemos

LAMP Jobs Yahoo Group
        228122 by: Beau Gould

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

There is no native support in php for this today. That said, it's not
impossible to do. There are two different approaches you can take. The easy
one, is to use PDoru's patch at http://pdoru.from.ro/

The second one, which I experimented with the other week, is to set the
wrong enctype, receive the file yourself and use a dhtml technique to keep
track off the upload.
http://se.php.net/manual/sv/function.apache-request-headers.php gives you
the content-length to start with, all you need to do, is to work with the
raw post data yourself. You could even use curl to locally post it into
$_FILES once you've received it.

What I'm saying is, it's possible, but it's really ugly.

-----Ursprungligt meddelande-----
Från: Martin Zvarík [mailto:[EMAIL PROTECTED] 
Skickat: den 2 januari 2006 22:30
Till: php-general@lists.php.net
Ämne: [PHP] Upload with process meter

Hi,

is it possible to upload a file and see the process of uploading (before 
the file is uploaded, there is something showing from 0% to 100%) using 
PHP and Javascript ? I saw some applications in Perl and mostly in JAVA, 
but I also found out something about some extension for PHP, but i think 
it wasn't complete at that time.

Thanks for sharing your knowledge about this... :)

Martin

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

--- End Message ---
--- Begin Message ---
On Jan 2, 2006, at 1:30 PM, Martin Zvarík wrote:
is it possible to upload a file and see the process of uploading (before the file is uploaded, there is something showing from 0% to 100%) using PHP and Javascript ?

My main dig with using PHP[0] is that (AFAIK) there is no good way to give the user some feedback in terms of percentage uploaded.

I would suggest that you look-into AJAX[1] and/or Flash8[2]. F8 now has file upload capabilities - and both will allow for you to give the user feedback, letting them know (among other things) how long they have to wait. I am personally very impressed by F8, the example I give[2][3] is pretty darn cool!

(Read the comments also:)
[0] http://us2.php.net/manual/en/features.file-upload.php
[0] http://us2.php.net/manual/en/function.is-uploaded-file.php
[0] http://us2.php.net/manual/en/function.move-uploaded-file.php
(Just did a google search, these were the first I found.:)
[1] http://encodable.com/tech/ajaxupload/
[1] http://www.devpro.it/upload_progress/
[2] http://www.tink.ws/blog/filereference-example/
[3] http://snipurl.com/l8n5

Hth,
Micky

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

My ISP updated their MySQL DB to 5.0.18 and that killed my login procedure 
which was OK yesterday. Any ideas how to start to debug this?

The login updates 2 fields in users table row where username and password 
macthes. This is the code:


if (!$query = mysql_query("update tbl_users set sess_id='$sess_id', 
sess_id_start='$date'
where md5(usr_name)='$usr_name' and password=PASSWORD('$password') 
",$connection))
{
header("Location: http://www.domain.net/loginscreen.php";);
exit;
}
else
{
Do Login and stuff...

This worked until today. I called the ISP and they confirmed that there was 
a database update yesterday.

-Will

--- End Message ---
--- Begin Message --- It seems the upgrade was from Mysql 4.0. PASSWORD() function changed between 4.0 and 4.1, it uses longer hashes now. You can still use OLD_PASSWORD() function instead.

William Stokes wrote:
Hello,

My ISP updated their MySQL DB to 5.0.18 and that killed my login procedure which was OK yesterday. Any ideas how to start to debug this?

The login updates 2 fields in users table row where username and password macthes. This is the code:


if (!$query = mysql_query("update tbl_users set sess_id='$sess_id', sess_id_start='$date' where md5(usr_name)='$usr_name' and password=PASSWORD('$password') ",$connection))
{
header("Location: http://www.domain.net/loginscreen.php";);
exit;
}
else
{
Do Login and stuff...

This worked until today. I called the ISP and they confirmed that there was a database update yesterday.

-Will


--- End Message ---
--- Begin Message ---
Thanks!

-W

"M" <[EMAIL PROTECTED]> kirjoitti 
viestissä:[EMAIL PROTECTED]
> It seems the upgrade was from Mysql 4.0. PASSWORD() function changed 
> between 4.0 and 4.1, it uses longer hashes now. You can still use 
> OLD_PASSWORD() function instead.
>
> William Stokes wrote:
>> Hello,
>>
>> My ISP updated their MySQL DB to 5.0.18 and that killed my login 
>> procedure which was OK yesterday. Any ideas how to start to debug this?
>>
>> The login updates 2 fields in users table row where username and password 
>> macthes. This is the code:
>>
>>
>> if (!$query = mysql_query("update tbl_users set sess_id='$sess_id', 
>> sess_id_start='$date'
>> where md5(usr_name)='$usr_name' and password=PASSWORD('$password') 
>> ",$connection))
>> {
>> header("Location: http://www.domain.net/loginscreen.php";);
>> exit;
>> }
>> else
>> {
>> Do Login and stuff...
>>
>> This worked until today. I called the ISP and they confirmed that there 
>> was a database update yesterday.
>>
>> -Will
>> 

--- End Message ---
--- Begin Message ---
Curt Zirzow wrote:
On Fri, Dec 30, 2005 at 12:34:35PM -0600, Richard Lynch wrote:

On Thu, December 29, 2005 5:37 pm, Michael Gross wrote:


...


If you can determine the number of bits on your system, you could use
a different number from 11 on the two systems to get the answer you
want.

if (is_32_bit_machine()){
 $y = $x >> 11;
}
else{
 $y = $x >> 43; //11 + 32 (guess)
}

One hack for detecting 32-bit machine might be this:


Isn't php suppose to handle all this?  This seems odd to me.

I don't see how php can 'handle' people assuming that integers will
always be 32bits - the php code in the encryption algorythm is flawed
because it assumes that all integers are 32bits and doesn't platform
wordsize (terminology?) into account - how can php know that this was
not the intention?



Curt.

--- End Message ---
--- Begin Message ---
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yes, sorry i forget send some example code. Here is:


$xml_parser = xml_parser_create();
// usa case-folding para que estemos seguros de encontrar la etiqueta
// en $map_array
xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, true);
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "rb"))) {
   die("could not open XML input");
}

while ($data = fread($fp, 12288)) {
   if (!xml_parse($xml_parser, $data, feof($fp))) {
       die(sprintf("XML error: %s at line %d",
                   xml_error_string(xml_get_error_code($xml_parser)),
                   xml_get_current_line_number($xml_parser)));
   }
}       

If i put fread($fp, 8192) i obtain the same text and if a put 4096 it
cut before.
- --
**********************************************************************
                FUNDACIÓN CARTIF

  MARIO DE FRUTOS DIEGUEZ - Email: [EMAIL PROTECTED]
 División de Ingeniería del Software y Comunicaciones

   Parque Tecnológico de Boecillo, Parcela 205
   47151 - Boecillo (Valladolid)         España
  Tel.   (34) 983.54.88.21 Fax    (34) 983.54.65.21
**********************************************************************
Este mensaje se dirige exclusivamente a su destinatario y puede contener
información CONFIDENCIAL sometida a secreto profesional o cuya
divulgación esté prohibida en virtud de la legislación vigente. Si ha
recibido este mensaje por error, le rogamos que nos lo comunique
inmediatamente por esta misma vía y proceda a su destrucción.

Nótese que el correo electrónico via Internet no permite asegurar ni la
confidencialidad de los mensajes que se transmiten ni la correcta
recepción de los mismos. En el caso de que el destinatario de este
mensaje no consintiera la utilización del correo electrónico vía
Internet, rogamos lo ponga en nuestro conocimiento de manera inmediata.
***********************************************************************
This message is intended exclusively for its addressee and may contain
information that is CONFIDENTIAL and protected by a professional
privilege or whose disclosure is prohibited by law. If this message has
been received in error, please immediately notify us via e-mail and
delete it.

Please note that Internet e-mail neither guarantees the confidentiality
nor the proper receipt of the messages sent. If the addressee of this
message does not consent to the use of Internet e-mail, please
communicate it to us immediately.
************************************************************************
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDunbvbPPtxT8v/3wRAjBwAJ4kHE0cdyrvruFE3LlSGXMKFri5fwCfU7ii
machwamViid/Hr8lXPrv8e8=
=xyJI
-----END PGP SIGNATURE-----

--- End Message ---
--- Begin Message ---
Hi can any one show me how make another form appear below another once the
1st form has been submitted.

ie:

name:
address:
country:
SUBMIT

then this form appears below after the submit button is clicked

blah:
blah:
blah:
SUBMIT

--- End Message ---
--- Begin Message ---
[snip]
Hi can any one show me how make another form appear below another once the
1st form has been submitted.
[/snip]

post to PHP_SELF and test for population of original form parts

if('' != $_POST['name'] etc.){
   echo all of the other form parts;
}

--- End Message ---
--- Begin Message ---
Mark wrote:
> Hi can any one show me how make another form appear below another once the
> 1st form has been submitted.
> 

[not really a PHP solution...]

You can do like this: the 'SUBMIT' button of the first form only makes
visible the (hidden) DIV where the second form is, and only *that*
'SUBMIT' button actually submits the form.

CSS reference: http://www.w3schools.com/css/css_reference.asp

HTH, cheers
Silvio

-- 
tradeOver | http://www.tradeover.net
...ready to become the King of the World?

--- End Message ---
--- Begin Message ---
I haven't tried it, so I don't know if -d doesn't work with -u, but if
that is the case, you could change your URL to this:

curl -d "what=what" http://user:[EMAIL PROTECTED]/myApp.php

or try this:

curl -u userID:password -d "what=what" --url
"http://www.mydomain.com/myApp.php";

HTH

Ray
> -------- Original Message --------
> Subject: RE: [PHP] A curl question
> From: tedd <[EMAIL PROTECTED]>
> Date: Mon, January 02, 2006 5:50 pm
> To: php-general@lists.php.net
> 
> Ray:
> 
> >I would suggest using the -d (or --data) flag.  That allows you to send
> >POST data.
> >
> >example:
> >
> >exec(curl -d "name=Rafael%20Sagula&phone=3320780"
> >http://www.where.com/guest.php)
> 
> Yes, I understand -d -- is there a way to use that AND to provide 
> userID and password?
> 
> Thanks.
> 
> tedd
> 
> >
> >For more information, check the man page for cURL and search for POST
> >within that document.  Or check out the PHP Manual for the appropriate
> >CURL syntax with LibCURL
> >
> >http://us3.php.net/manual/en/function.curl-init.php
> >
> >I have a script that uses the exec statement (was inherited from the
> >last guy) and I'd be interested to know if libCURL makes the script
> >wait on that line until CURL returns the result.  Sometimes when
> >getting data from a really slow site, scripts will take a lot longer
> >than expected (10-15 minutes).  I would assume that both ways would
> >have the same effect, but efficiency is always king ;)
> >
> >HTH
> >
> >Ray
> >
> >>  -------- Original Message --------
> >>  Subject: [PHP] A curl question
> >>  From: tedd <[EMAIL PROTECTED]>
> >>  Date: Mon, January 02, 2006 9:07 am
> >>  To: php-general@lists.php.net
> >>
> >>  Hi:
> >>
> >>  I've asked this question on the [EMAIL PROTECTED] list, but
> >>  replies were few and didn't address the problem. Whereas, I've seen
> >>  considerable discussion of curl on this list, so here goes.
> >>
> >>  I am writing a client-side application that uses curl commands to
> >>  communicate with a php application.
> >>
> >>  At present I can send the php application logon, password, and 
> >>variables via:
> >>
> >>  curl -u userID:password --url http://mydomain.com/myApp.php?what=what
> >>
> >>  That works!
> >>
> >>  However, I would like to send the variables hidden instead of
> >>  attached to the url. So, what would the curl command be?
> >>
> >>  Many thanks for any suggestions or solutions.
> >>
> >>  tedd
> >>
> >>  --
> >> 
> >>--------------------------------------------------------------------------------
> >>  http://sperling.com/
> >>
> >>  --
> >>  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
> 
> 
> -- 
> --------------------------------------------------------------------------------
> http://sperling.com/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
I haven't tried it, so I don't know if -d doesn't work with -u, but if
that is the case, you could change your URL to this:

curl -d "what=what" http://user:[EMAIL PROTECTED]/myApp.php

Ray:

Bingo -- that worked !

Now I can send data to a password protected folder without having to expose the data by adding it to the end of the url. This is mondo cool.

One step closer to world domination.

Many thanks.

tedd

--
--------------------------------------------------------------------------------
http://sperling.com/

--- End Message ---
--- Begin Message ---
Hey everyone, i'm on a windows box with PHP 5 on Apache 2 and I have a
strange problem. When i try to access a page it seems to be blank, before it
always worked but now it sudenly stopped. I am not a big computer techy but
i cleared IE's cache and it still doesen't work.


Source Code in IE for requested Page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=windows-1252"></HEAD>
<BODY></BODY></HTML>




Code in requested page:


<?php
require_once("Include.php");
Init(1);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<?php
Init(2);
?>
<title>Register for an account</title>
</head>
<body>
<?php
Init(3);
?>
<form action="RegisterP.php" name="Register" method="post">
Username: <input type="text" name="Username" />
<br />
Password: <input type="password" name="Password" />
<br />
Confirm your password: <input type="password" name="PasswordCheck">
<br />
E-mail Address: <input type="text" name="EMail" />
<br />

<input type="submit" value="Submit">

</form>



<?php
Init(4);
?>
</body>
</html>

--- End Message ---
--- Begin Message ---
PHP Superman wrote:
Hey everyone, i'm on a windows box with PHP 5 on Apache 2 and I have a
strange problem. When i try to access a page it seems to be blank, before it
always worked but now it sudenly stopped. I am not a big computer techy but
i cleared IE's cache and it still doesen't work.

you should turn display_errors on on your development box. Turn it on, or check your logs, if you log php errors



Source Code in IE for requested Page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html;
charset=windows-1252"></HEAD>
<BODY></BODY></HTML>




Code in requested page:


<?php
require_once("Include.php");
Init(1);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<?php
Init(2);
?>
<title>Register for an account</title>
</head>
<body>
<?php
Init(3);
?>
<form action="RegisterP.php" name="Register" method="post">
Username: <input type="text" name="Username" />
<br />
Password: <input type="password" name="Password" />
<br />
Confirm your password: <input type="password" name="PasswordCheck">
<br />
E-mail Address: <input type="text" name="EMail" />
<br />

<input type="submit" value="Submit">

</form>



<?php
Init(4);
?>
</body>
</html>


--- End Message ---
--- Begin Message ---
I have png image with transparent background, and 1 jpg file.
I use imageCopyMerge to paste the png image on the jpg image.

the result image contain no transparent background mean the png file have white background when its suppose to be transparent

what is the simple and best way to make this work.

tanks in advance. :)

Libit:

I was working on the same thing. The following is a solution -- but, simple and best are relative.

This was taken from "PHP Graphics Handbook" by Kent et al.

<?
$original=imagecreatefromjpeg("apollo.jpg");
$watermark=imagecreatefrompng("xssportstransparent.png");

$osx=imagesx($original);
$osy=imagesy($original);
$wsx=imagesx($watermark);
$wsy=imagesy($watermark);

imagecopy($original, $watermark, ($osx-$wsx)/2, ($osy-$wsy)/2, 0, 0, $wsx, $wsy);

imagepng($original, "apollo_trans.png");

?>
<html>
<body>
<table>
<tr><td align=center>Orignal Image</td><td align=center>Watermark</td><td align=center>Orignal Image with Watermark</td></tr> <tr><td><img src="apollo.jpg"></td><td><img src="xssportstransparent.png"></td><td><img src="apollo_trans.png"></td></tr>
</table>
</body>
</html>

Demo at:

http://xn--ovg.com/watermark

HTH's

tedd

--
--------------------------------------------------------------------------------
http://sperling.com/

--- End Message ---
--- Begin Message ---
tedd wrote:
I have png image with transparent background, and 1 jpg file.
I use imageCopyMerge to paste the png image on the jpg image.

the result image contain no transparent background mean the png file have white background when its suppose to be transparent

what is the simple and best way to make this work.

tanks in advance. :)

Libit:

I was working on the same thing. The following is a solution -- but, simple and best are relative.

This was taken from "PHP Graphics Handbook" by Kent et al.

<?
$original=imagecreatefromjpeg("apollo.jpg");
$watermark=imagecreatefrompng("xssportstransparent.png");

$osx=imagesx($original);
$osy=imagesy($original);
$wsx=imagesx($watermark);
$wsy=imagesy($watermark);

imagecopy($original, $watermark, ($osx-$wsx)/2, ($osy-$wsy)/2, 0, 0, $wsx, $wsy);

imagepng($original, "apollo_trans.png");

?>
<html>
<body>
<table>
<tr><td align=center>Orignal Image</td><td align=center>Watermark</td><td align=center>Orignal Image with Watermark</td></tr> <tr><td><img src="apollo.jpg"></td><td><img src="xssportstransparent.png"></td><td><img src="apollo_trans.png"></td></tr>
</table>
</body>
</html>

Demo at:

http://xn--ovg.com/watermark

HTH's

tedd



thank you tedd , my original code is pretty the same.
and I solved the problem using function called
imagecopyresampled()
the function keep the transparent background of the png file.

from some sources on the net I read the its may be related to some miss support in png 24bit. but I didn't get too much to it.

thanks again for taking the time to write and help me.

I think this is on solution for this problem I found it the easy one.

ah , one more thing, in my code I save the result image as an Jpg file.

--- End Message ---
--- Begin Message ---
Any Senior PHP/MySQL Developers in the Los Angeles area looking for work? If 
so, send me your resume.  I've got multiple clients.  70-100k range.

Thank you,
Beau Gould 

www.superiorss.com 
[EMAIL PROTECTED] 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.11/219 - Release Date: 1/2/2006
 

--- End Message ---
--- Begin Message ---
I used phpMyAdmin to look at the stats for this mysql server.

http://www.2-bit-toys.com/db_info/server_status.html

What concerns me mainly are the stats at the top-right...'Failed attempts' and 'Aborted.'
When would these situations occur?  Is it normal to see these?

I'm using PHP's mysql_pconnect for all my scripts. Could this be causing the failed/aborted attempts? What is not clear is if mysql_pconnect will open another connection if the current one is being used.


-James

--- End Message ---
--- Begin Message --- Actually, I can send the example messages but here is another description of the same problem. (So PHPMailer is inserting line breaks, not spaces—or something is...)

http://sourceforge.net/tracker/index.php? func=detail&aid=1267539&group_id=26031&atid=385708


On 30-Dec-05, at 5:37 AM, Lam Cheuk Hin wrote:

Can You Write The Strings/Text?

On 12/30/05, René Fournier <[EMAIL PROTECTED]> wrote:

Has anyone encountered this? I am composing an HTML email with
PHPMailer, and for some reason PHPMailer is inserted spaces
periodically, which breaks the formatting. I've looked through the
docs, but can only find a setting for Word Wrap (which is set to 0).

...Rene

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




--
lch2003

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

on 01/03/2006 03:37 PM René Fournier said the following:
Actually, I can send the example messages but here is another description of the same problem. (So PHPMailer is inserting line breaks, not spaces—or something is...)

http://sourceforge.net/tracker/index.php? func=detail&aid=1267539&group_id=26031&atid=385708

This sounds like wrong body encoding problem.

You may also want to try this other MIME e-mail message composing and sending class. It has been working well for many years to send HTML messages even with embedded images. Try the test_html_mail_message.php example and see if it works for you:

http://www.phpclasses.org/mimemessage


--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

--- End Message ---
--- Begin Message ---
LAMP Jobs Yahoo Group
http://groups.yahoo.com/group/LAMPjobs
This group is moderated and is spam-free. 


Open Source Jobs Yahoo Group
http://groups.yahoo.com/group/opensourcejobs
This group is moderated and is spam-free. 


Python, Zope, and Plone Jobs 
http://groups.yahoo.com/group/pythonzopejobs
This group is moderated and is spam-free.

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.11/219 - Release Date: 1/2/2006
 

--- End Message ---

Reply via email to