php-general Digest 26 Jun 2008 15:00:38 -0000 Issue 5535

Topics (messages 275971 through 275992):

Re: exec() Error
        275971 by: Per Jessen
        275975 by: Wei, Alice J.
        275977 by: Boyd, Todd M.
        275978 by: Per Jessen

Re: PHP4 vs PHP5 Memcache compatibility issue
        275972 by: Richard Heyes

Re: escape character in query string
        275973 by: Thiago Melo de Paula

a download limitation script that defies logic!
        275974 by: szalinski
        275980 by: Daniel Brown
        275984 by: szalinski

Re: Monitor a WP website
        275976 by: tedd
        275979 by: Daniel Brown

Re: ImageTTFText leaves Black in letters
        275981 by: tedd

Inspiration for a Tombstone.
        275982 by: tedd
        275983 by: Daniel Brown
        275985 by: Dan Shirah
        275986 by: Colin Guthrie
        275987 by: Aschwin Wesselius
        275988 by: Boyd, Todd M.
        275989 by: Daniel Brown
        275990 by: Eric Butera
        275991 by: Jay Blanchard

iconv() problem
        275992 by: Stefano Noffke

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 ---
Boyd, Todd M. wrote:

>> 
>> Well, "http://www.mysite.com/calculate.php"; is not an executable. 
>> Try this instead:
>> 
>> exec("php <path>/calculate.php");
> 
> I still don't think this is how exec() should be used when executing
> remote PHP scripts via HTTP, since the web server is not going to give
> you the underlying code simply because you're calling the URL from PHP
> and not your web browser. User-Agent tags do not a secure connection
> make.

That's not what Alice asked for though.  She did mention that a remote
call would be made somewhere, but her question was:

>Has anyone tried using exec() successfully in PHP to execute files from
>PHP or other programming languages? For example, C, Python, or Perl. 

And that works just fine using exec(). 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Hi, Todd:

   It looks like I have some other errors in my Perl code, and I got it fixed, 
switched the permission to 755, and made attempts to call it using cURL through 
my working PHP script.

   Here is the code:

// create a new cURL resource
$ch = curl_init();

// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "http://192.168.10.63/total.cgi";);
curl_setopt($ch, CURLOPT_HEADER, false);

// grab URL and pass it to the browser
curl_exec($ch);

// close cURL resource, and free up system resources
curl_close($ch);

This time, I do not get the "script" output from the script in total.cgi, but I 
got

Forbidden
You don't have permission to access /total.cgi on this server.

I have switched the permission to both scripts at both servers. Is there 
something wrong I have done here?

Thanks again for your help.

Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]
________________________________________
From: Boyd, Todd M. [EMAIL PROTECTED]
Sent: Wednesday, June 25, 2008 5:07 PM
To: Wei, Alice J.; [EMAIL PROTECTED]
Subject: RE: Re: [PHP] exec() Error

> -----Original Message-----
> From: Wei, Alice J. [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 25, 2008 3:31 PM
> To: Boyd, Todd M.; Per Jessen; [EMAIL PROTECTED]
> Subject: RE: Re: [PHP] exec() Error

---8<--- snip

> > Well, "http://www.mysite.com/calculate.php"; is not an executable.
> Try
> > this instead:
> >
> > exec("php <path>/calculate.php");
>
> I still don't think this is how exec() should be used when executing
> remote PHP scripts via HTTP, since the web server is not going to give
> you the underlying code simply because you're calling the URL from PHP
> and not your web browser. User-Agent tags do not a secure connection
> make.
>
> Perhaps doing a wget and directing it to /dev/null (if you're on *nix)
> would be appropriate to invoke a remote script and pass it parameters.
> Hell, even wget to standard output if you want, and use that as your
> "result code." It's basically doing what cURL does, but outside of the
> PHP script itself.
>
> Anyway, I digress. My point is that exec("php
> http://mysite.com/script.php";) will fail, since it will be reading the
> remote script's OUTPUT, and not the remote script's SOURCE CODE.
>
>    I dont' know how come his code works either. I figured that exec()
> is not going to get me anywhere when I have it stored remotely.
>    I am now using cURL instead of using exec(), since it is doing a
lot
> closer to what I initiated. I am not sure if I should have a new
thread
> for this, but I found that things start to get a little weird when I
> tried to do cURL with Perl files inside. The PHP only brings me back
> Perl code and not the processed content. Is this something I should
not
> be doing with cURL? It seems to do quite a bit of powerful processing
> when I wrote everything in PHP and have it stored remotely.

Alice,

If it's returning the code instead of the processed content, then it
means that the webserver which houses the Perl script is not
executing/parsing it. You should check with the administrator of the
remote webserver to see if they have a Perl module installed, and if it
is configured properly for your web app.

HTH,


Todd Boyd
Web Programmer




--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Per Jessen [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 26, 2008 1:11 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Re: [PHP] exec() Error
> 
> Boyd, Todd M. wrote:
> 
> >>
> >> Well, "http://www.mysite.com/calculate.php"; is not an executable.
> >> Try this instead:
> >>
> >> exec("php <path>/calculate.php");
> >
> > I still don't think this is how exec() should be used when executing
> > remote PHP scripts via HTTP, since the web server is not going to
> give
> > you the underlying code simply because you're calling the URL from
> PHP
> > and not your web browser. User-Agent tags do not a secure connection
> > make.
> 
> That's not what Alice asked for though.  She did mention that a remote
> call would be made somewhere, but her question was:
> 
> >Has anyone tried using exec() successfully in PHP to execute files
> from
> >PHP or other programming languages? For example, C, Python, or Perl.
> 
> And that works just fine using exec().

Well... if she was trying to execute *LOCAL* PHP code from within a PHP script 
that was already running (which she was not), why would you suggest that she 
use exec() instead of include()?

I think the issue has been obfuscated. Nevertheless, she's on the right track 
to making her program do what she wants to.

Win-win.


Todd Boyd
Web Programmer




--- End Message ---
--- Begin Message ---
Boyd, Todd M. wrote:

>> >PHP or other programming languages? For example, C, Python, or Perl.
>> 
>> And that works just fine using exec().
> 
> Well... if she was trying to execute *LOCAL* PHP code from within a
> PHP script that was already running (which she was not), why would you
> suggest that she use exec() instead of include()?

If she'd only asked about PHP, include() would be the answer, but she
also included C and Perl in the options. 

> I think the issue has been obfuscated. Nevertheless, she's on the
> right track to making her program do what she wants to.

Yup. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Bob Fisher wrote:
I am running a hybrid environment.

Box A: PHP 4.3.9

Box B: PHP 5.1.6

Box C: Memcached 1.2.2

When I set a key in memcache(Box C) from Box A, I am unable to read
it from Box B and vice versa.

I did not see any such issues mentioned in the PHP documentation.

Has anyone seen something similar? Does anyone know how to get over this?

There's some nice RPC code (well I think it's nice anyhoo) on my website:

http://www.phpguru.org/downloads/RPC_for_PHP5/

It's for PHP5 but you might be able to adapt (if you even need to) to work with PHP4.

--
Richard Heyes

        Employ me:
http://www.phpguru.org/cv

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

use the urlencode function to "escape" the special characters.
After, use urldecode to get the string back to normal.

Regards,

Thiago Melo de Paula

On Sun, Jun 22, 2008 at 11:34 PM, joaquinbordado <[EMAIL PROTECTED]>
wrote:

>
> would someone happen to know the escape character for query string?
>
> here is my querysting my.php?message=Hello%PHP%0AHow%was%your%day?
>
>
> the output should be
>
> Hello PHP
>      How was your day?
>
> --
> View this message in context:
> http://www.nabble.com/escape-character-in-query-string-tp18061596p18061596.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I thought I'd take the time to make a download limitation script, but even
though the idea of this script is 'simple', it 'simply' refuses to work
entirely properly.

Basically I setup a real quick timelimit, $time_limit should mean 'within
the last 20 seconds'. What I am looking for is the following:

a user requests a link via the script, i've got all that part right. what we
do first is check to see if there is info in the db about the user who is
identified by their ip. if so, use it to calculate stuff, if not, download
the file, record their ip and update the download counter by 1.

what i want to happen is only allow a certain ip to download a max of 2
files per give time period.

the problem is the script 'works' as expected if i replace

------------------------------------------------
else
                {
                        mysql_query("UPDATE ip_limit SET downloads = 0 WHERE
userip = '$userip'");
                        //$dl = true;
                }
------------------------------------------------
with
------------------------------------------------
else
                {
                        mysql_query("UPDATE ip_limit SET downloads = 0 WHERE
userip = '$userip'");
                        echo "we updated the db successfully!";
                }
------------------------------------------------
.
But if i replace the echo "we updated the db successfully!"; with $dl =
true, (because I want there to be a download right after this reset, rather
than just a notice of a download-record-reset), then all i get is 1
download, then timeout, then 1 download, recurring.

This just defies the laws of logic, or i am insane. Here is the code snippet
that deals with the limitations (followed by the download script in "if
($dl)" - for any brave soul out there. Feel free to rewrite or suggest code
changes, i'm all ears!

------------------------------------------------
$dl_limit_perday = 2;
$time_limit = time() - 20;
 
db_connect($dbhost, $dbname, $dbuser, $dbpass);
 
$dl_limit_perday = 2;
$time_limit = time() - 20;
 
$get_ip_info = mysql_query("SELECT UNIX_TIMESTAMP(last_access),downloads
FROM ip_limit WHERE userip = '$userip'");
$ip_info = mysql_fetch_array($get_ip_info);
$last_access = $ip_info['UNIX_TIMESTAMP(last_access)'];
$downloads = $ip_info['downloads'];
$time_to_wait = $last_access - $time_limit;
$has_hit_dl_limit = ($downloads >= $dl_limit_perday) ? true : false;
$has_hit_timeout_limit = ($last_access > $time_limit) ? true : false;
 
// if($num_dl > 3) { if($time_limit > $blah) { reset_downloads(); 
process_download(); } else { echo "GTFO" } } else { process_download(); }
        
        if($has_hit_dl_limit)
        {
                if($has_hit_timeout_limit)
                {
                        $dl = false;
                        print('<h1>Too many downloads today!<br />');
                        print "Time limit: {$time_limit}<br />Last time
accessed: {$last_access}<br />";
                        print "Time to wait = $time_to_wait seconds</h1>";
                        exit;
                }
                else
                {
                        mysql_query("UPDATE ip_limit SET downloads = 0 WHERE
userip = '$userip'");
                        //$dl = true;
                }
        }
        else
        {
                $dl = true;
        }
 
if ($dl)
{
        mysql_query("REPLACE INTO ip_limit (userip,last_access,downloads)
VALUES ('$userip', NOW(), '$downloads'+1)");
        download_the_file();
}
else
{
        exit, etc
}
------------------------------------------------
-- 
View this message in context: 
http://www.nabble.com/a-download-limitation-script-that-defies-logic%21-tp18132754p18132754.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
On Thu, Jun 26, 2008 at 8:38 AM, szalinski <[EMAIL PROTECTED]> wrote:
>
> I thought I'd take the time to make a download limitation script, but even
> though the idea of this script is 'simple', it 'simply' refuses to work
> entirely properly.
[snip!]


    You do realize that the code in this block below is only accessed
if $downloads is greater than or equal to $dl_limit_perday, correct?

>        if($has_hit_dl_limit)
>        {
>                if($has_hit_timeout_limit)
>                {
>                        $dl = false;
>                        print('<h1>Too many downloads today!<br />');
>                        print "Time limit: {$time_limit}<br />Last time
> accessed: {$last_access}<br />";
>                        print "Time to wait = $time_to_wait seconds</h1>";
>                        exit;
>                }
>                else
>                {
>                        mysql_query("UPDATE ip_limit SET downloads = 0 WHERE
> userip = '$userip'");
>                        //$dl = true;
>                }
>        }
>        else
>        {
>                $dl = true;
>        }


    As a result, only when it meets that condition does it set $dl to
TRUE for the next block.

> if ($dl)
> {
>        mysql_query("REPLACE INTO ip_limit (userip,last_access,downloads)
> VALUES ('$userip', NOW(), '$downloads'+1)");
>        download_the_file();
> }
> else
> {
>        exit, etc
> }


-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

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

Daniel Brown-5 wrote:
> 
> On Thu, Jun 26, 2008 at 8:38 AM, szalinski <[EMAIL PROTECTED]>
> wrote:
>>
>> I thought I'd take the time to make a download limitation script, but
>> even
>> though the idea of this script is 'simple', it 'simply' refuses to work
>> entirely properly.
> [snip!]
> 
> 
>     You do realize that the code in this block below is only accessed
> if $downloads is greater than or equal to $dl_limit_perday, correct?
> 
>>        if($has_hit_dl_limit)
>>        {
>>                if($has_hit_timeout_limit)
>>                {
>>                        $dl = false;
>>                        print('<h1>Too many downloads today!<br />');
>>                        print "Time limit: {$time_limit}<br />Last time
>> accessed: {$last_access}<br />";
>>                        print "Time to wait = $time_to_wait seconds</h1>";
>>                        exit;
>>                }
>>                else
>>                {
>>                        mysql_query("UPDATE ip_limit SET downloads = 0
>> WHERE
>> userip = '$userip'");
>>                        //$dl = true;
>>                }
>>        }
>>        else
>>        {
>>                $dl = true;
>>        }
> 
> 
>     As a result, only when it meets that condition does it set $dl to
> TRUE for the next block.
> 
>> if ($dl)
>> {
>>        mysql_query("REPLACE INTO ip_limit (userip,last_access,downloads)
>> VALUES ('$userip', NOW(), '$downloads'+1)");
>>        download_the_file();
>> }
>> else
>> {
>>        exit, etc
>> }
> 
> 
> -- 
> </Daniel P. Brown>
> Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
> $59.99/mo. with no contract!
> Dedicated servers, VPS, and hosting from $2.50/mo.
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 

Yep, I realise it - that's exactly the bahaviour I expect...if the user has
hit the download limit, then the script uses the inner
if($has_hit_timeout_limit) stament (relating to the timeout), and keeps
doing so on each request until the timeout is over (since download value is
still over the limit for each request) - until at which point the inner if()
statement should reset the downloads to 0, and then download the file, and
increment the downloads column up by one again.
but for some reason, if i try to put $dl = true after the UPDATE (in the
inner if($has_hit_timeout_limit) statement), the download works, but the
UPDATE never happens, so i get an ever-increasing value for 'downloads' in
the db, and only 1 download, then timer, then 1 download, then timer, etc.

it really is bizarre! :(

-- 
View this message in context: 
http://www.nabble.com/a-download-limitation-script-that-defies-logic%21-tp18132754p18135426.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
At 4:28 PM -0500 6/24/08, Boyd, Todd M. wrote:
 > -----Original Message-----
 From: tedd [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, June 24, 2008 4:22 PM
 To: php php
 Subject: Re: [PHP] Monitor a WP website

---8<--- big snip

 It's not rocket science -- but occasionally my solutions leave
craters.

Haha! Yes! I'm going to use this (with your permission, of course).

Todd Boyd
Web Programmer

Todd:

Sure, go ahead -- it's one of my favorite sayings.

Woody Allen used to say that he never wrote his clever remarks, but rather they just popped out. With me it takes a bit more effort -- I spend a significant amount of time trying to be clever for if I actually was, I wouldn't need to waste the time.

In any event, I think my best saying was:

"I've learned something new every day of my life, and I'm getting damned tried of it."

You see, I'm assembling a list of my wit for posterity and hope to pick one out for my tombstone. I told my wife that should I die before current expectations are finished, she could use:

"Always on the edge of greatness"

I think that does a good job of summing up my contribution.  :-)

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Thu, Jun 26, 2008 at 9:27 AM, tedd <[EMAIL PROTECTED]> wrote:
>
> You see, I'm assembling a list of my wit for posterity and hope to pick one
> out for my tombstone.

    Whereas mine will say something like </cruelWorld> or </Dan> or
something of the like.

    Perhaps even:

<?php
    function dan($dateOfDeath) {
        return "Daniel P. Brown: 01-01-1970 - ".$dateOfDeath";
    }
    die(dan('00-00-0000'));
?>

    With the actual dates in place, of course.  ;-P

    I should go back through the Brainteaser thread from Spring 2007
and see what other kinds of geek-wit there were.  Inspiration for a
Tombstone.  Sounds like an artistic piece.  ;-P

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
At 5:27 PM -0400 6/24/08, Stephen Pynenburg wrote:
Hi all,
I'm using imagettftext, and my script works perfectly, except that on these
TTF fonts that I'm using, in any letter with a hole in the middle (letters
like a, R, O) the hole is coloured black, not transparent. Is this a PHP
thing, or do I need to edit my fonts somehow?

Thanks,
Stephen

Stephen:

This is the way I do it and I don't have any black holes.

http://webbytedd.com/b/rotate-text/

The code is there.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
Hi gang:

For a break in our normal serious thinking, I suggested tombstone wit of:

"Always on the edge of greatness"

Dan offered:

</cruelWorld> or </Dan> or

<?php
    function dan($dateOfDeath) {
        return "Daniel P. Brown: 01-01-1970 - ".$dateOfDeath";
    }
    die(dan('00-00-0000'));
?>

What would you like on your Tombstone? (<-- that's actually a trademarked saying)

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--- End Message ---
--- Begin Message ---
On Thu, Jun 26, 2008 at 10:31 AM, tedd <[EMAIL PROTECTED]> wrote:
>
> What would you like on your Tombstone? (<-- that's actually a trademarked
> saying)

    "What do you want on your Tombstone?"

    "Pepperoni and sausage!"

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
<?php
if ($you_can_read_this = "Yes") {
  echo "STOP STANDING ON ME!";
}
?>


On 6/26/08, tedd <[EMAIL PROTECTED]> wrote:
>
> Hi gang:
>
> For a break in our normal serious thinking, I suggested tombstone wit of:
>
> "Always on the edge of greatness"
>
> Dan offered:
>
> </cruelWorld> or </Dan> or
>
> <?php
>    function dan($dateOfDeath) {
>        return "Daniel P. Brown: 01-01-1970 - ".$dateOfDeath";
>    }
>    die(dan('00-00-0000'));
> ?>
>
> What would you like on your Tombstone? (<-- that's actually a trademarked
> saying)
>
> Cheers,
>
> tedd
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Dan Shirah wrote:
<?php
if ($you_can_read_this = "Yes") {
  echo "STOP STANDING ON ME!";
}
?>

I would put:
"He put his constants first in if() statements until the end of his days".

Or

"He always preferred syntax errors to annoying logical bugs.".

:p

Col.


--- End Message ---
--- Begin Message ---
tedd wrote:
Hi gang:

For a break in our normal serious thinking, I suggested tombstone wit of:

"Always on the edge of greatness"

Dan offered:

</cruelWorld> or </Dan> or

<?php
    function dan($dateOfDeath) {
        return "Daniel P. Brown: 01-01-1970 - ".$dateOfDeath";
    }
    die(dan('00-00-0000'));
?>

What would you like on your Tombstone? (<-- that's actually a trademarked saying)
Hi,

There are plenty of things that cross my mind about this:

A simple end of script tag:

?>

But that is really vague of course.

Another would be:

function life(&$user) {
while($user->days_on_earth !== COUNTED) {

      $user->do_stuff();
   }

   $user->disconnect();
}

Endless things possible with programming metaphors.


--

Aschwin Wesselius

/'What you would like to be done to you, do that to the other....'/

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: tedd [mailto:[EMAIL PROTECTED]
> Sent: Thursday, June 26, 2008 9:31 AM
> To: php php
> Subject: [PHP] Inspiration for a Tombstone.
> 
> Hi gang:
> 
> For a break in our normal serious thinking, I suggested tombstone wit
> of:
> 
> "Always on the edge of greatness"
> 
> Dan offered:
> 
> </cruelWorld> or </Dan> or
> 
> <?php
>      function dan($dateOfDeath) {
>          return "Daniel P. Brown: 01-01-1970 - ".$dateOfDeath";
>      }
>      die(dan('00-00-0000'));
> ?>
> 
> What would you like on your Tombstone? (<-- that's actually a
> trademarked saying)

Tombstone Pizza, Pierre!

So... is this like the opposite of a "Hello world" program? Perhaps a
"Goodbye world" program? :) I want something like "Download complete" or
"Buffering" on mine.


Todd Boyd
Web Programmer




--- End Message ---
--- Begin Message ---
On Thu, Jun 26, 2008 at 10:37 AM, Dan Shirah <[EMAIL PROTECTED]> wrote:
> <?php
> if ($you_can_read_this = "Yes") {
>  echo "STOP STANDING ON ME!";
> }
> ?>

    That will always evaluate to TRUE because you're setting the
variable in your if() condition.

-- 
</Daniel P. Brown>
Dedicated Servers - Intel 2.4GHz w/2TB bandwidth/mo. starting at just
$59.99/mo. with no contract!
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
On Thu, Jun 26, 2008 at 10:31 AM, tedd <[EMAIL PROTECTED]> wrote:
> Hi gang:
>
> For a break in our normal serious thinking, I suggested tombstone wit of:
>
> "Always on the edge of greatness"
>
> Dan offered:
>
> </cruelWorld> or </Dan> or
>
> <?php
>    function dan($dateOfDeath) {
>        return "Daniel P. Brown: 01-01-1970 - ".$dateOfDeath";
>    }
>    die(dan('00-00-0000'));
> ?>
>
> What would you like on your Tombstone? (<-- that's actually a trademarked
> saying)
>
> Cheers,
>
> tedd
> --
> -------
> http://sperling.com  http://ancientstones.com  http://earthstones.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


echo "Fatal error: Maximum execution time of {$duration} seconds exceeded";

--- End Message ---
--- Begin Message ---
[snip]
<?php
if ($you_can_read_this = "Yes") {
  echo "STOP STANDING ON ME!";
}
?>
[/snip]

<?php

switch($status_jay){

   case 'alive':
      stream_set_timeout ($jay , '1576800000');
   break;

   case 'vegetable':
      pull_plug(TRUE);
   break;

   case 'dead':
      oven_set_hot(TRUE);
      oven_insert($jay, '7200');
      ashes_remove($jay);
      ashes_spread($jay, 'Crescent City', CELEBRATE);
   break;

}

?>

No tombstone required.

--- End Message ---
--- Begin Message ---
Greetings,

I have a problem with iconv(), and I need help solving it.

Here is the background:

I have a Web page with a Form that saves data to a MySQL database. I need to retrieve the data from the database and create a PDF document with FPDF.

The Web Page, the database, and the browser are all set to UTF-8, so I have to convert the data from the database to ISO-8859-1 in order to have FPDF show it correctly. I am using iconv() to convert the data.

It works like a charm for the data acquired with text boxes, but it does not parse the data acquired from textareas correctly.

For example:

I have an text input (<input type="text" />) and a textarea (<textarea></textarea>). I type the string "sometextàèìòùésomeothertext" on both the input fields and save it into the database through POST.

If I retrieve the data and show it on a web page, it shows correctly. I then create the PDF with FPDF parsing the data with the following instructions:

iconv("UTF-8", "ISO-8859-1", $inputText)
iconv("UTF-8", "ISO-8859-1//TRANSLIT", $textarea) or iconv("UTF-8", "ISO-8859-1", $textarea)

The PDF shows the first record correctly, while the second only shows "sometext"

If I use
iconv("UTF-8", "ISO-8859-1//IGNORE", $textarea)
the PDF shows "sometextsomeothertext" skipping all the special chars.


Why is the textarea behaving differently than the text input? Is there a way to fix this?

I would really appreciate any help, thank you.

Stefano

--- End Message ---

Reply via email to