php-general Digest 6 Aug 2007 16:53:05 -0000 Issue 4946

Topics (messages 260224 through 260240):

Re: Creating watermarks
        260224 by: Christian Hänsel

Re: About MySQL Tables
        260225 by: Chris Aitken

passthru
        260226 by: Payne
        260228 by: Richard Heyes
        260229 by: Payne
        260230 by: Colin Guthrie
        260232 by: Richard Heyes
        260233 by: POLONKAI Gergely

Re: Adding to time having a timestamp
        260227 by: Richard Heyes

Error Handling question
        260231 by: debussy007
        260237 by: brian

Check if var has a date (timestamp or regular)
        260234 by: OOzy Pal
        260235 by: brian

compose html body with variables
        260236 by: Matt
        260238 by: Edward Kay
        260240 by: Matt

Can anyone point me toward some useful resources?
        260239 by: greg patmore

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 --- "zerof" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]
Tom Ray [Lists] escreveu:
I've been learning how to use PHP with the GD Library and I've managed to learn quite a bit. I can upload, resize, create thumbnails and I'm even able to create "security code" images for forms. My question is how do I create a Watermark on the image? I want something transparent but still visible enough to see the copyright and the website. I want to put it in the center of the image. I would use a non-water marked image and when it's called on (depending on viewing size) I want the water mark to be added.

How would one go about doing that?
---------------
http://www.educar.pro.br/en/a/gdlib/index.php?pn=76&tr=97

http://www.educar.pro.br/en/a/gdlib/index.php?pn=23&tr=97

http://www.educar.pro.br/en/a/gdlib/index.php?pn=81&tr=97

--
zerof
http://www.educar.pro.br/
Apache - PHP - MySQL - Boolean Logics - Project Management
---------------------------------------------------------- You must hear, always, one second opinion! In all cases.
----------------------------------------------------------
Let the people know if this info was useful for you!
----------------------------------------------------------

Hi

I'm using a half-transparent png to overlay the original image. You can see it here: http://www.auto-deppe.de/index.php?module=fzg_detail&fzg_nr=77

The overlays do not show in the thumbnails, nor do they appear on the printout pages for resellers. Click on an image (preferrably one with a darker bottom left part) to see the watermark appear. This is simple GD with a transparent png overlay :o)

All the best!

Chris

--
-------------------------------------
My baby's first words will be
"Hello World"

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Kelvin Park [mailto:[EMAIL PROTECTED]
>
> I have two tables that share product codes to relate data.
> One table is called IMAGE, and another one is called the PRODUCT.
> There are more than one image for every product, for example product
> code 1122 will have 3 images and 4938 will have 5 images within the
> IMAGE table. Since all my product information is stored in PRODUCT table
> except for the image file names (e.g. 1122_1.jpg, 1122_2.jpg or
> 4938_1.gif), I have to build the following query: SELECT * FROM PRODUCT,
> IMAGE WHERE PRODUCT.productcode = IMAGE.productcode. However, this
> causes a little problem. When I print out all the product information
> with its images, more than one copy of a product is printed out (because
> of multiple images for each product). I'm still looking for a way to
> build a query string so that I could have only one image displayed per
> product (so that a user can click on the product to view more images).
>

You could use a Group By to limit each PRODUCT 

SELECT * from PRODUCT, IMAGE where PRODUCT.productcode = IMAGE.produtcode
group by PRODUCT.productcode

You could do it via 2 selects (ie, the first query simply lists all items in
PRODUCT, then within this loop, a second query lists all entries in IMAGES
which have the productcode, with a "limit 1" in the query.

Personally, I'd go with the Group By option, and be clever with your ORDER
so the correct image gets selected.



Regards
 
Chris Aitken
The Web Hub Designer and Programmer
Phone : 02 4648 0808
Mobile : 0411 132 075
 
-------------------------------------------------
 
Making The Web Work........ The Web Hub
http://www.thewebhub.com.au/
[EMAIL PROTECTED]
 
-------------------------------------------------
Confidentiality Statement:  
This message is intended only for the use of the Addressee and may contain 
information that is PRIVILEDGED and CONFIDENTIAL.  If you are not the 
intended recipient, dissemination of this communication is prohibited.  
If you have received this communication in error, please erase all 
copies of the message and its attachments and notify us immediately

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

Does anyone know way to passthru man pages so they don't show the ascii formating?

Payne

--- End Message ---
--- Begin Message ---
Does anyone know way to passthru man pages so they don't show the ascii formating?

You could:

1) Replace all newlines (ASCII 10) with a <br> tag. htmlspecialchars()
   will do this for you.
2) Use a <pre> tag within which newlines are preserved
3) Use preg_replace to replace non-printable characters (Can't remember
   how exactly, but everything you need is in the manual - you will want
   to strip everything from ASCII 1 - ASCII 32. IIRC.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
Does anyone know way to passthru man pages so they don't show the ascii formating?

You could:

1) Replace all newlines (ASCII 10) with a <br> tag. htmlspecialchars()
   will do this for you.
2) Use a <pre> tag within which newlines are preserved
3) Use preg_replace to replace non-printable characters (Can't remember
   how exactly, but everything you need is in the manual - you will want
   to strip everything from ASCII 1 - ASCII 32. IIRC.

Thanks, I will give that a shot.

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
>> Does anyone know way to passthru man pages so they don't show the
>> ascii formating?
> 
> You could:
> 
> 1) Replace all newlines (ASCII 10) with a <br> tag. htmlspecialchars()
>    will do this for you.

Does it? I thought it only replaced entities. \n is not a "special char"
in html lingo in that you can include them happily in a document and it
is still syntactically correct!

I believe you want the nl2br() function instead here.

> 2) Use a <pre> tag within which newlines are preserved
> 3) Use preg_replace to replace non-printable characters (Can't remember
>    how exactly, but everything you need is in the manual - you will want
>    to strip everything from ASCII 1 - ASCII 32. IIRC.
> 

I think it would be more to do with the special characters for making
things bold and overwriting etc. rather than new lines specifically but
I think you're 3rd point should work (without thinking about it too much :))

Col

--- End Message ---
--- Begin Message ---
Does anyone know way to passthru man pages so they don't show the
ascii formating?
You could:

1) Replace all newlines (ASCII 10) with a <br> tag. htmlspecialchars()
   will do this for you.

Does it? I thought it only replaced entities. \n is not a "special char"
in html lingo in that you can include them happily in a document and it
is still syntactically correct!

I believe you want the nl2br() function instead here.

Ah yes. My bad.

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

--- End Message ---
--- Begin Message ---
Why don't you just use the man2html script?

2007. 08. 6, hétfő keltezéssel 05.14-kor Payne ezt írta:

> Hi,
> 
> Does anyone know way to passthru man pages so they don't show the ascii 
> formating?
> 
> Payne
> 

--- End Message ---
--- Begin Message ---
How can I add a day to a date if I have a timestamp. Here is my line:

list($d,$m,$y,$dayname,$monthname,$am)=explode(' ',date('d m Y D M a',
$timestamp));

Simply add 86400 (number of seconds in a day).

--
Richard Heyes
+44 (0)844 801 1072
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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

I am new to PHP and need some help for error handling.

I read in the docs that i can handle the errors this way in my PhP:

set_error_handler('errorHandler');
function errorHandler($errnum,$errmsg,$file,$lineno){
    [...]
}

But does that mean that I have to copy paste this code in all my Php pages
or is there a better way ?

Thank you.
-- 
View this message in context: 
http://www.nabble.com/Error-Handling-question-tf4223141.html#a12013437
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
debussy007 wrote:
Hi,

I am new to PHP and need some help for error handling.

I read in the docs that i can handle the errors this way in my PhP:

set_error_handler('errorHandler');
function errorHandler($errnum,$errmsg,$file,$lineno){
    [...]
}

But does that mean that I have to copy paste this code in all my Php pages
or is there a better way ?


You could use auto_prepend_file:

http://www.php.net/manual/en/ini.core.php#ini.auto-prepend-file

brian

--- End Message ---
--- Begin Message ---
How can I check an inputed date if it is a valid date and if it is in
the form of a timestamp or regular date such as (22-07-2007 or
22/07/2007)

-- 
OOzy
Ubuntu-Feisty

--- End Message ---
--- Begin Message ---
OOzy Pal wrote:
How can I check an inputed date if it is a valid date and if it is in
the form of a timestamp or regular date such as (22-07-2007 or
22/07/2007)


You could first check if the variable consists only of numbers. If so, it's likely a timestamp. If $var does consist of something other than digits, pass it to strtotime() first.



$arr_date = (
        ctype_digit($var)
        ? getDate($var)
        : getDate(strtotime($var))
        );

Finally, check that the date is legitimate:

if (checkdate($arr_date['mon'], $arr_date['mday'], $arr_date['year']))
{
        ...
}

brian

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

I'm trying to compose the body of an html email to use with the mail() function. I'm running into problem because I'm not sure how to quote the multi-line body. Here is what I have:

$body = "
echo "Hello, here is your quote from Freight Services.<br /><br />";
              echo "Shipping from: <tab> $origin to $destination<br />";
               echo "<br>";
               echo "Shipping subtotal $" . number_format($subtotal,2);
               echo "<br>";
               echo "<br>";
               echo "Freight charges $" . number_format($freightCharges,2);
               echo "<br>";
               echo "Fuel surcharge $" . number_format($fuelSurcharge,2);
               echo "<br>";
echo "Pickup and delivery $" . number_format($pickupDelivery,2);
               echo "<br>";
               echo "<br>";
echo "Miscellaneus costs (e.g. liftgates, etc.) below $" . number_format($miscCost,2);
               echo "<br>";
               echo "<br>";
               if ($liftgatePickup == "50"){
                       echo "Adding liftgate on pickup $50.00";
                       echo "<br>";
               }
               if ($liftgateDelivery == "50"){
                       echo "Adding liftgate on delivery $50.00";
                       echo "<br>";
               }
               if ($spectimeDelivery == "35"){
                       echo "Adding cost of specific-time delivery $35.00";
                       echo "<br>";
               }
               if ($conventionDelivery == "35"){
                       echo "Adding cost of convention delivery $35.00";
                       echo "<br>";
               }
               if ($dreyageWait != 0){
                       echo "Adding cost for wait $" . $dreyageWait;
                       echo "<br>";
               }
               if ($insideDelivery == "25"){
                       echo "Adding cost for inside delivery $25.00";
                       echo "<br>";
               }
               if ($notifyClient == "10"){
                       echo "Adding cost for client notification $10.00";
                       echo "<br>";
               }
               echo "Total cost is $" . number_format($totalcost,2);
               echo "<br /><br />";

               echo "<a href=\"www.foo.net\">foo Services</a>";


              $subject = "Online Freight Quote";

mail($email, $subject, $body, "From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: [EMAIL PROTECTED]: PHP 4.x\r\nMIME-Version: 1.0\r\nContent-Type: text/html; charset=iso-8859-1\r\n");

If anyone could assist me I'd appreciate it very much,

Matt

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Matt [mailto:[EMAIL PROTECTED]
> Sent: 06 August 2007 15:38
> To: [EMAIL PROTECTED]
> Subject: [PHP] compose html body with variables
>
>
> Hello,
>
> I'm trying to compose the body of an html email to use with the mail()
> function.  I'm running into problem because I'm not sure how to quote
> the multi-line body.  Here is what I have:
>
> $body = "
>                echo "Hello, here is your quote from Freight Services.<br
> /><br />";
>                echo "Shipping from: <tab> $origin to $destination<br />";
>                 echo "<br>";
>                 echo "Shipping subtotal $" . number_format($subtotal,2);
>                 echo "<br>";
>                 echo "<br>";
>                 echo "Freight charges $" .
> number_format($freightCharges,2);
>                 echo "<br>";
>                 echo "Fuel surcharge $" . number_format($fuelSurcharge,2);
>                 echo "<br>";
>                 echo "Pickup and delivery $" .
> number_format($pickupDelivery,2);
>                 echo "<br>";
>                 echo "<br>";
>                 echo "Miscellaneus costs (e.g. liftgates, etc.) below $"
> . number_format($miscCost,2);
>                 echo "<br>";
>                 echo "<br>";
>                 if ($liftgatePickup == "50"){
>                         echo "Adding liftgate on pickup $50.00";
>                         echo "<br>";
>                 }
>                 if ($liftgateDelivery == "50"){
>                         echo "Adding liftgate on delivery $50.00";
>                         echo "<br>";
>                 }
>                 if ($spectimeDelivery == "35"){
>                         echo "Adding cost of specific-time
> delivery $35.00";
>                         echo "<br>";
>                 }
>                 if ($conventionDelivery == "35"){
>                         echo "Adding cost of convention delivery $35.00";
>                         echo "<br>";
>                 }
>                 if ($dreyageWait != 0){
>                         echo "Adding cost for wait $" . $dreyageWait;
>                         echo "<br>";
>                 }
>                 if ($insideDelivery == "25"){
>                         echo "Adding cost for inside delivery $25.00";
>                         echo "<br>";
>                 }
>                 if ($notifyClient == "10"){
>                         echo "Adding cost for client notification $10.00";
>                         echo "<br>";
>                 }
>                 echo "Total cost is $" . number_format($totalcost,2);
>                 echo "<br /><br />";
>
>                 echo "<a href=\"www.foo.net\">foo Services</a>";
>
>
>                $subject = "Online Freight Quote";
>
>                mail($email, $subject, $body, "From:
> [EMAIL PROTECTED]: [EMAIL PROTECTED]:
> [EMAIL PROTECTED]: PHP 4.x\r\nMIME-Version: 1.0\r\nContent-Type:
> text/html; charset=iso-8859-1\r\n");
>
> If anyone could assist me I'd appreciate it very much,
>
> Matt
>

Hi Matt,

The problem here is that you're using echo statements, which output
directly. Instead you need to build a string containing this output, for
example:

$body = "Hello, here is your quote from Freight Services.<br /><br />";
$body .= "Shipping from: <tab> $origin to $destination<br />";

etc.

Note the use of the .= operator. This is the same as saying $body =
$body.'whatever';

At the end, $body will then contain the HTML body of your email which you
pass to the mail function.

Hope this helps,
Edward

--- End Message ---
--- Begin Message ---
Edward Kay wrote:
-----Original Message-----
From: Matt [mailto:[EMAIL PROTECTED]
Sent: 06 August 2007 15:38
To: [EMAIL PROTECTED]
Subject: [PHP] compose html body with variables


Hello,

I'm trying to compose the body of an html email to use with the mail()
function.  I'm running into problem because I'm not sure how to quote
the multi-line body.  Here is what I have:

$body = "
               echo "Hello, here is your quote from Freight Services.<br
/><br />";
               echo "Shipping from: <tab> $origin to $destination<br />";
                echo "<br>";
                echo "Shipping subtotal $" . number_format($subtotal,2);
                echo "<br>";
                echo "<br>";
                echo "Freight charges $" .
number_format($freightCharges,2);
                echo "<br>";
                echo "Fuel surcharge $" . number_format($fuelSurcharge,2);
                echo "<br>";
                echo "Pickup and delivery $" .
number_format($pickupDelivery,2);
                echo "<br>";
                echo "<br>";
                echo "Miscellaneus costs (e.g. liftgates, etc.) below $"
. number_format($miscCost,2);
                echo "<br>";
                echo "<br>";
                if ($liftgatePickup == "50"){
                        echo "Adding liftgate on pickup $50.00";
                        echo "<br>";
                }
                if ($liftgateDelivery == "50"){
                        echo "Adding liftgate on delivery $50.00";
                        echo "<br>";
                }
                if ($spectimeDelivery == "35"){
                        echo "Adding cost of specific-time
delivery $35.00";
                        echo "<br>";
                }
                if ($conventionDelivery == "35"){
                        echo "Adding cost of convention delivery $35.00";
                        echo "<br>";
                }
                if ($dreyageWait != 0){
                        echo "Adding cost for wait $" . $dreyageWait;
                        echo "<br>";
                }
                if ($insideDelivery == "25"){
                        echo "Adding cost for inside delivery $25.00";
                        echo "<br>";
                }
                if ($notifyClient == "10"){
                        echo "Adding cost for client notification $10.00";
                        echo "<br>";
                }
                echo "Total cost is $" . number_format($totalcost,2);
                echo "<br /><br />";

                echo "<a href=\"www.foo.net\">foo Services</a>";


               $subject = "Online Freight Quote";

               mail($email, $subject, $body, "From:
[EMAIL PROTECTED]: [EMAIL PROTECTED]:
[EMAIL PROTECTED]: PHP 4.x\r\nMIME-Version: 1.0\r\nContent-Type:
text/html; charset=iso-8859-1\r\n");

If anyone could assist me I'd appreciate it very much,

Matt


Hi Matt,

The problem here is that you're using echo statements, which output
directly. Instead you need to build a string containing this output, for
example:

$body = "Hello, here is your quote from Freight Services.<br /><br />";
$body .= "Shipping from: <tab> $origin to $destination<br />";

etc.

Note the use of the .= operator. This is the same as saying $body =
$body.'whatever';

At the end, $body will then contain the HTML body of your email which you
pass to the mail function.

Hope this helps,
Edward

Very good! Thank you so much Edward.  That worked perfectly.

Matt

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

 

I was wondering if anyone could point me toward some good resources
regarding suggestions on handling user preferences over a cluster in a
heavy traffic website.

 

Online resources are preferable:-), but thanks for any help you could
give.

 

Regards,

Greg

 


--- End Message ---

Reply via email to