php-general Digest 7 Nov 2005 20:05:18 -0000 Issue 3781

Topics (messages 225224 through 225251):

Re: Template style question
        225224 by: Angelo Zanetti

Re: Creating PDF from a Image
        225225 by: Pranav Negandhi
        225230 by: Manoj Kr. Sheoran
        225231 by: Pranav Negandhi
        225235 by: Manoj Kr. Sheoran
        225240 by: Jens Schulze
        225243 by: Manoj Kr. Sheoran

Re: italic, bold and underline with GD ?
        225226 by: Norbert Wenzel
        225227 by: Norbert Wenzel

Re: Making functions available from another script
        225228 by: Norbert Wenzel
        225229 by: Norbert Wenzel
        225232 by: Richard Leclair
        225233 by: Norbert Wenzel
        225234 by: Arno Kuhl
        225238 by: Richard Leclair

Catch the   WMV first frame picture  in PHP script?
        225236 by: ±i ®p»Ê

Re: Mcrypt 3DES encrypt/decrypt Help
        225237 by: Andrew Brampton

Re: No forums?
        225239 by: Finner, Doug
        225241 by: Jay Blanchard

Re: PHP 5.1 release ?
        225242 by: Ford, Mike

off
        225244 by: Freebird

OFF, do not open
        225245 by: Freebird

form question??
        225246 by: bruce
        225247 by: Stephen Leaf

FileExists?
        225248 by: Gustav Wiberg
        225249 by: Jochem Maas
        225250 by: Jay Blanchard
        225251 by: Gustav Wiberg

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


Torgny Bjers wrote:
Petr Smith wrote:


Smarty sucks. Mixing presentation and logic is never good idea. I know
Smarty is very popular, but big popularity doesn't always mean quality.

Back to original question: If you decided to reinvent the wheel,
please don't reinvent square wheel without tire.

Mixing presentation and logic is bad. You should have no sqls, loops,
ifs or any other logic things in templates. Templates should be
editable by any stupid guy, anyone who knows just css/html. No sql, no
php, no other language.

Back to original idea to parse table. Do not copy bad ideas from other
templating engines. Again - reinvent a better wheel or use some from
1000s of existing libraries. Download some existing libraries, think
about good and bad things, make it better, make it different!
Otherwise we will end with 1000+1 stupid, same, useless templating
libraries.



You don't need to mix presentation and logic with Smarty. If you create
your custom tags with Smarty and use these instead of having the inline
"Smarty PHP" code, you'll have separated them just fine. Then if the end
user wants to use PHP inline, fine, either let them, or don't. Either
way, Smarty is about the fastest and most versatile engine in the PEAR
library, as far as I know. I'd rather use that, than build something
custom from scratch. And, in combination with Tidy and Cache_Lite,
you'll get a very fast and precise rendering engine...

Just my $0.02.

I agree with Petr!! Smarty is very good and the designer has to learn a few smarty tags and Walla! you've got your templates working.
--- End Message ---
--- Begin Message --- There doesn't seem to be any function to add an image to an FDF document, but since an FDF is just a PDF file, you might be able to create a hack using a PDF generation library. I've used FPDF for generating PDF's in the past.

http://www.fpdf.org

Regards,
Pranav
www.concept-i.co.in

Manoj Kr. Sheoran wrote:
Hi All, To create fdf with text info is very simple but I am wondering how to convert a PNG image into pdf file?
Any suggestion?

Regards,
Manoj

--- End Message ---
--- Begin Message ---
Dear Pranav,
Thanks!
I would like to do something like this:
ABC.PNG --> (CONVERT USING ANY PHP LIBRARY)->ABC.PDF

abc.pdf should be Press optimized pdf.  Press optimized is the somewhat high
level of pdf format.
Your suggestions are hightly appreciated.

Thanks &Regards,
Manoj


----- Original Message ----- 
From: "Pranav Negandhi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 07, 2005 1:55 PM
Subject: Re: [PHP] Creating PDF from a Image


> There doesn't seem to be any function to add an image to an FDF
> document, but since an FDF is just a PDF file, you might be able to
> create a hack using a PDF generation library. I've used FPDF for
> generating PDF's in the past.
>
> http://www.fpdf.org
>
> Regards,
> Pranav
> www.concept-i.co.in
>
> Manoj Kr. Sheoran wrote:
> > Hi All,
> > To create  fdf with text info is very simple but I am wondering how to
convert a PNG image into pdf file?
> >
> > Any suggestion?
> >
> > Regards,
> > Manoj
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
You're sure to find a working example on the fpdf site, that uses images.

Check here http://www.fpdf.org/en/tutorial/index.php

If you have the resources, PDFLib is a commercial component that makes your work a lot easier.

http://www.pdflib.com/

Regards,
Pranav
www.concept-i.co.in

Manoj Kr. Sheoran wrote:
Dear Pranav,
Thanks!
I would like to do something like this:
ABC.PNG --> (CONVERT USING ANY PHP LIBRARY)->ABC.PDF

abc.pdf should be Press optimized pdf.  Press optimized is the somewhat high
level of pdf format.
Your suggestions are hightly appreciated.

Thanks &Regards,
Manoj


----- Original Message ----- From: "Pranav Negandhi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 07, 2005 1:55 PM
Subject: Re: [PHP] Creating PDF from a Image



There doesn't seem to be any function to add an image to an FDF
document, but since an FDF is just a PDF file, you might be able to
create a hack using a PDF generation library. I've used FPDF for
generating PDF's in the past.

http://www.fpdf.org

Regards,
Pranav
www.concept-i.co.in

Manoj Kr. Sheoran wrote:

Hi All,
To create  fdf with text info is very simple but I am wondering how to

convert a PNG image into pdf file?

Any suggestion?

Regards,
Manoj

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





--- End Message ---
--- Begin Message ---
Hi Pranav,
Thanks for reply and it really helped me a lot.
Now I have one more issue: -
PNG doesn't support CMYK color scheme and that is supported by JPEG so I
need to convert it to JPEG and then JPEG back to Press optimized pdf.

I 've only PNG as input. Is there any method that can help me to convert PNG
to JPEG and then create PDF to that.

Thanks..

Regards,
Manoj

----- Original Message ----- 
From: "Pranav Negandhi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 07, 2005 2:48 PM
Subject: Re: [PHP] Creating PDF from a Image


> You're sure to find a working example on the fpdf site, that uses images.
>
> Check here http://www.fpdf.org/en/tutorial/index.php
>
> If you have the resources, PDFLib is a commercial component that makes
> your work a lot easier.
>
> http://www.pdflib.com/
>
> Regards,
> Pranav
> www.concept-i.co.in
>
> Manoj Kr. Sheoran wrote:
> > Dear Pranav,
> > Thanks!
> > I would like to do something like this:
> > ABC.PNG --> (CONVERT USING ANY PHP LIBRARY)->ABC.PDF
> >
> > abc.pdf should be Press optimized pdf.  Press optimized is the somewhat
high
> > level of pdf format.
> > Your suggestions are hightly appreciated.
> >
> > Thanks &Regards,
> > Manoj
> >
> >
> > ----- Original Message ----- 
> > From: "Pranav Negandhi" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Monday, November 07, 2005 1:55 PM
> > Subject: Re: [PHP] Creating PDF from a Image
> >
> >
> >
> >>There doesn't seem to be any function to add an image to an FDF
> >>document, but since an FDF is just a PDF file, you might be able to
> >>create a hack using a PDF generation library. I've used FPDF for
> >>generating PDF's in the past.
> >>
> >>http://www.fpdf.org
> >>
> >>Regards,
> >>Pranav
> >>www.concept-i.co.in
> >>
> >>Manoj Kr. Sheoran wrote:
> >>
> >>>Hi All,
> >>>To create  fdf with text info is very simple but I am wondering how to
> >
> > convert a PNG image into pdf file?
> >
> >>>Any suggestion?
> >>>
> >>>Regards,
> >>>Manoj
> >>
> >>-- 
> >>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

--- End Message ---
--- Begin Message ---
Manoj Kr. Sheoran schrieb:

> I 've only PNG as input. Is there any method that can help me to convert PNG
> to JPEG and then create PDF to that.

PNG and press-ready PDF isn't anything that fits together very well from
the view of a prepress professional, but your way would be ImageMagick
(http://www.imagemagick.org), which should be able to convert from PNG
to PDF (with the help of Ghostscript).

Jens

--- End Message ---
--- Begin Message ---
Hi, Jens!
Thanks!.
PNG doen't support CMYK color scheme that's why I want to convert it in JPG
first and then I want to create pdf file from that PJG file. I created pdf
file from PJG using fpdf but no idea that how to I convert PNG to jpg file
(not using any third part tool only uing php).

Secondly,  My motive is to create Press optimized pdf file rather than
simple pdf file.

Thanks for help and looking for suggestion.

Regards,
Manoj


----- Original Message ----- 
From: "Jens Schulze" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 07, 2005 8:14 PM
Subject: Re: [PHP] Creating PDF from a Image


> Manoj Kr. Sheoran schrieb:
>
> > I 've only PNG as input. Is there any method that can help me to convert
PNG
> > to JPEG and then create PDF to that.
>
> PNG and press-ready PDF isn't anything that fits together very well from
> the view of a prepress professional, but your way would be ImageMagick
> (http://www.imagemagick.org), which should be able to convert from PNG
> to PDF (with the help of Ghostscript).
>
> Jens
>
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
David wrote:
Can we use some function with GD to make text italic, bold and/or underline?

http://php.net/imagettftext

I see we can change size and font, but not style

it's not possible in PHP?

Thanks in advance
David

I'm not familiar with GD, but as every good font has different versions for bold, italic and so on, you might use those versions with separate font files.

And since underlining is just a simple line (don't know how this works in GD, I've done this in FPDF) I would just draw a line from the beginning of the word to the end ... if it is possible in GD to get the current "cursor" position before and after inserting text.
--- End Message ---
--- Begin Message ---
David wrote:
Can we use some function with GD to make text italic, bold and/or underline?

http://php.net/imagettftext

I see we can change size and font, but not style

it's not possible in PHP?

Thanks in advance
David

I'm not familiar with GD, but as every good font has different versions for bold, italic and so on, you might use those versions with separate font files.

And since underlining is just a simple line (don't know how this works in GD, I've done this in FPDF) I would just draw a line from the beginning of the word to the end ... if it is possible in GD to get the current "cursor" position before and after inserting text.
--- End Message ---
--- Begin Message ---
Richard Leclair wrote:
Hi PHP-ers,

Here's an easy one:
Q: How can I make a function available from within another php script?

Eg. B.php contains:

<?php include ".../fns.php" ?>

Which has a function fn($x);

Later on, I want to include this function in B.php somewhere.

In short:  B.php wants to use fn($x) found in A.php.

Regards,
Richie !

I'm not quite sure if I did get your question right, but you answered the question yourself.

include("anyfile.php"); does nothing more then "copy" the code of anyfile.php to the file, in which it is called. anyfile.php is interpreted as HTML, so you should have your <?php brackets around the document.

A.php-----------
function foo($bar) {
        //do sth
}

B.php-----------
include[_once]("A.php");

$x = "anything you like";
$whatever = foo($x);


this works if A and B are in exactly the same directory, otherwise you should change the path for the include call.

Did I get your question right?

--- End Message ---
--- Begin Message ---
Richard Leclair wrote:
Hi PHP-ers,

Here's an easy one:
Q: How can I make a function available from within another php script?

Eg. B.php contains:

<?php include ".../fns.php" ?>

Which has a function fn($x);

Later on, I want to include this function in B.php somewhere.

In short:  B.php wants to use fn($x) found in A.php.

Regards,
Richie !

I'm not quite sure if I did get your question right, but you answered the question yourself.

include("anyfile.php"); does nothing more then "copy" the code of anyfile.php to the file, in which it is called. anyfile.php is interpreted as HTML, so you should have your <?php brackets around the document.

A.php-----------
function foo($bar) {
        //do sth
}

B.php-----------
include[_once]("A.php");

$x = "anything you like";
$whatever = foo($x);


this works if A and B are in exactly the same directory, otherwise you should change the path for the include call.

Did I get your question right?

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

Thanks for your reply.  Yeah, you were almost there - it wasn't quite what I
had in mind.  I probably should have elaborated on this one.

I'm looking at building up a library of handy functions that can be included
in a current script.

Only problem is:
(let's just say for clarity that lib.php <==> A.php; same)..

If I declare the functions in lib.php, then B.php can include lib.php but
cannot execute any functions within B.php (that were declared in lib.php).
it keeps coming up as "function undeclared".

Any more ideas/thoughts?  Or have I not gone about this correctly?

Regards,
Richie !


> -----Original Message-----
> From: Norbert Wenzel [mailto:[EMAIL PROTECTED]
> Sent: Monday, 7 November 2005 5:13 pm
> To: [email protected]; Richard Leclair
> Cc: [email protected]
> Subject: [PHP] Re: Making functions available from another script
> 
> Richard Leclair wrote:
> > Hi PHP-ers,
> >
> > Here's an easy one:
> > Q: How can I make a function available from within another php script?
> >
> > Eg. B.php contains:
> >
> > <?php include ".../fns.php" ?>
> >
> > Which has a function fn($x);
> >
> > Later on, I want to include this function in B.php somewhere.
> >
> > In short:  B.php wants to use fn($x) found in A.php.
> >
> > Regards,
> > Richie !
> 
> I'm not quite sure if I did get your question right, but you answered
> the question yourself.
> 
> include("anyfile.php"); does nothing more then "copy" the code of
> anyfile.php to the file, in which it is called. anyfile.php is
> interpreted as HTML, so you should have your <?php brackets around the
> document.
> 
> A.php-----------
> function foo($bar) {
>       //do sth
> }
> 
> B.php-----------
> include[_once]("A.php");
> 
> $x = "anything you like";
> $whatever = foo($x);
> 
> 
> this works if A and B are in exactly the same directory, otherwise you
> should change the path for the include call.
> 
> Did I get your question right?
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Richard Leclair wrote:
Hi Norbert,

Thanks for your reply.  Yeah, you were almost there - it wasn't quite what I
had in mind.  I probably should have elaborated on this one.

I'm looking at building up a library of handy functions that can be included
in a current script.

Only problem is:
(let's just say for clarity that lib.php <==> A.php; same)..

If I declare the functions in lib.php, then B.php can include lib.php but
cannot execute any functions within B.php (that were declared in lib.php).
it keeps coming up as "function undeclared".

Any more ideas/thoughts?  Or have I not gone about this correctly?

Maybe post your lib.php and B.php, but from your description I have no idea what might cause this problem.

For testing maybe change your lib.php to sth like this

---lib.php--------------------
<code>included lib.php</code>
<?php
        echo('lib.php works');

        //let your code follow here

?>

Norbert

--- End Message ---
--- Begin Message ---
If it was working properly the function would be callable. Your include is
probably not working - change it to "require" and see if you get an error.
Using "include" doesn't give you an error if the include file is not found.

Arno
 ________________________
 DotContent
 Professional Content Management Solutions
 www.dotcontent.net


-----Original Message-----
From: Richard Leclair [mailto:[EMAIL PROTECTED]
Sent: 07 November 2005 11:33
To: 'Norbert Wenzel'
Cc: [email protected]
Subject: RE: [PHP] Re: Making functions available from another script


Hi Norbert,

Thanks for your reply.  Yeah, you were almost there - it wasn't quite what I
had in mind.  I probably should have elaborated on this one.

I'm looking at building up a library of handy functions that can be included
in a current script.

Only problem is:
(let's just say for clarity that lib.php <==> A.php; same)..

If I declare the functions in lib.php, then B.php can include lib.php but
cannot execute any functions within B.php (that were declared in lib.php).
it keeps coming up as "function undeclared".

Any more ideas/thoughts?  Or have I not gone about this correctly?

Regards,
Richie !


> -----Original Message-----
> From: Norbert Wenzel [mailto:[EMAIL PROTECTED]
> Sent: Monday, 7 November 2005 5:13 pm
> To: [email protected]; Richard Leclair
> Cc: [email protected]
> Subject: [PHP] Re: Making functions available from another script
>
> Richard Leclair wrote:
> > Hi PHP-ers,
> >
> > Here's an easy one:
> > Q: How can I make a function available from within another php script?
> >
> > Eg. B.php contains:
> >
> > <?php include ".../fns.php" ?>
> >
> > Which has a function fn($x);
> >
> > Later on, I want to include this function in B.php somewhere.
> >
> > In short:  B.php wants to use fn($x) found in A.php.
> >
> > Regards,
> > Richie !
>
> I'm not quite sure if I did get your question right, but you answered
> the question yourself.
>
> include("anyfile.php"); does nothing more then "copy" the code of
> anyfile.php to the file, in which it is called. anyfile.php is
> interpreted as HTML, so you should have your <?php brackets around the
> document.
>
> A.php-----------
> function foo($bar) {
>       //do sth
> }
>
> B.php-----------
> include[_once]("A.php");
>
> $x = "anything you like";
> $whatever = foo($x);
>
>
> this works if A and B are in exactly the same directory, otherwise you
> should change the path for the include call.
>
> Did I get your question right?
>
> --
> 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

--- End Message ---
--- Begin Message ---
DOH!!  Okay, I've sorted out the [my] problem...

Instead of just doing the include relatively, I tried including it via the
full URL, ie. <?php include("http://$_SERVER[HTTP_HOST]/lib.php";); ?>

I guess it just includes output of the result of this typical HTTP parse.
By just doing <?php include("./lib.php"); ?>, everything works fine.
(Providing of course that the two files exist in the same directory.)

-------------------------------------------------------
If you're interested, this is what I used to test it with:

lib.php:
--------
<?php
function doit($s)   { return "done: $s\n"; }
function listem($s) { print "1 $s, 2 ". $s. "s, lots of ".$s."s.\n"; }
?>

A.php:
------
<?php include "http://$_SERVER[HTTP_HOST]/lib.php"; ?>
<HTML>
<BODY>
<H1>Something basic</H1>

<H2>Let's do stuff:</H2>
<?php
$todo = doit("put out the garbage.");
$todo .= doit("pay the mower guy.");
$todo .= doit("finish that letter.");
$todo .= doit("take a break.");
print "<PRE>\n$todo</PRE>\n";
?>

</BODY>
</HTML>
-------------------------------------------------------

Original included produced an undefined call to function doit().

Regards,
Richie !


> -----Original Message-----
> From: Arno Kuhl [mailto:[EMAIL PROTECTED]
> Sent: Monday, 7 November 2005 5:58 pm
> To: [email protected]
> Subject: RE: [PHP] Re: Making functions available from another script
> 
> If it was working properly the function would be callable. Your include is
> probably not working - change it to "require" and see if you get an error.
> Using "include" doesn't give you an error if the include file is not
> found.
> 
> Arno
>  ________________________
>  DotContent
>  Professional Content Management Solutions
>  www.dotcontent.net
> 
> 
> -----Original Message-----
> From: Richard Leclair [mailto:[EMAIL PROTECTED]
> Sent: 07 November 2005 11:33
> To: 'Norbert Wenzel'
> Cc: [email protected]
> Subject: RE: [PHP] Re: Making functions available from another script
> 
> 
> Hi Norbert,
> 
> Thanks for your reply.  Yeah, you were almost there - it wasn't quite what
> I
> had in mind.  I probably should have elaborated on this one.
> 
> I'm looking at building up a library of handy functions that can be
> included
> in a current script.
> 
> Only problem is:
> (let's just say for clarity that lib.php <==> A.php; same)..
> 
> If I declare the functions in lib.php, then B.php can include lib.php but
> cannot execute any functions within B.php (that were declared in lib.php).
> it keeps coming up as "function undeclared".
> 
> Any more ideas/thoughts?  Or have I not gone about this correctly?
> 
> Regards,
> Richie !
> 
> 
> > -----Original Message-----
> > From: Norbert Wenzel [mailto:[EMAIL PROTECTED]
> > Sent: Monday, 7 November 2005 5:13 pm
> > To: [email protected]; Richard Leclair
> > Cc: [email protected]
> > Subject: [PHP] Re: Making functions available from another script
> >
> > Richard Leclair wrote:
> > > Hi PHP-ers,
> > >
> > > Here's an easy one:
> > > Q: How can I make a function available from within another php script?
> > >
> > > Eg. B.php contains:
> > >
> > > <?php include ".../fns.php" ?>
> > >
> > > Which has a function fn($x);
> > >
> > > Later on, I want to include this function in B.php somewhere.
> > >
> > > In short:  B.php wants to use fn($x) found in A.php.
> > >
> > > Regards,
> > > Richie !
> >
> > I'm not quite sure if I did get your question right, but you answered
> > the question yourself.
> >
> > include("anyfile.php"); does nothing more then "copy" the code of
> > anyfile.php to the file, in which it is called. anyfile.php is
> > interpreted as HTML, so you should have your <?php brackets around the
> > document.
> >
> > A.php-----------
> > function foo($bar) {
> >     //do sth
> > }
> >
> > B.php-----------
> > include[_once]("A.php");
> >
> > $x = "anything you like";
> > $whatever = foo($x);
> >
> >
> > this works if A and B are in exactly the same directory, otherwise you
> > should change the path for the include call.
> >
> > Did I get your question right?
> >
> > --
> > 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
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 

--- End Message ---
--- Begin Message ---
Hello:
 
I'm try to design WMV movie upload system im my school.
 
when teachers upload the wmv movie to the web ,
 I hope I can grab the first frame picture of wmv 
and save it to a jpeg file.
 
Dose any one do that before ?  Is is difficult to implement in PHP ?
 
(I'm in the Linux with Apache & PHP & MySQL)
Thanks for any helps.
 
 
-----------------------------------
Fongming from Taiwan.
------------------------------------


___________________________________________________  郔陔唳 Yahoo!✽藻撈�r籵�� 7.0 
betaㄛ轎愐鋒繚����¦斕湖ㄐ  http://messenger.yahoo.com.tw/beta.html

--- End Message ---
--- Begin Message --- I've never used the mcrypt functions, but from a quick read of the documentation I think you are using a 384 bit key!... Each letter in your key string is a 8bit ASCII character, and since you have 48 chars, you have 8*48 bits.

The documentation says:
" Key is the key with which the data will be encrypted. If it's smaller that the required keysize, it is padded with '\0'. It is better not to use ASCII strings for keys. It is recommended to use the mhash functions to create a key from a string. "
and gives the example:
$key = "This is a very secret key";

In that example the key is 25 bytes long, therefore 200 bits long, and then padded with \0s.

If you want your key to represent the hex of the key then I believe you must use pack(), or one of the user comments on the bin2hex() help page (namely the hexbin() function).


Hope this helps
Andrew

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, November 07, 2005 4:56 AM
Subject: [PHP] Mcrypt 3DES encrypt/decrypt Help


Hi all:
I wan't to use php_mcrpyt to encrypt data,but have a problem in it !

Hint:
Warning: mcrypt_encrypt(): Size of key is too large for this algorithm

Algorithm : 3DES
Key: 48bit

<?php
// Designate string to be encrypted
$string =3D "Applied Cryptography, by Bruce Schneier, is a wonderful
cryptography reference.";

// Encryption/decryption key
$key =3D "C770634F437346D7FC8FA22F9287849E741A33438EEDEAAD";

// Encryption Algorithm
$cipher_alg =3D MCRYPT_3DES;

// Create the initialization vector for added security.
$iv =3D mcrypt_create_iv(mcrypt_get_iv_size($cipher_alg,
MCRYPT_MODE_ECB), MCRYPT_RAND);

// Output original string
print "Original string: $string ";

// Encrypt $string
$encrypted_string =3D mcrypt_encrypt($cipher_alg, $key, $string,
MCRYPT_MODE_CBC, $iv);

// Convert to hexadecimal and output to browser
print "Encrypted string: ".bin2hex($encrypted_string)." ";
$decrypted_string =3D mcrypt_decrypt($cipher_alg, $key,
$encrypted_string, MCRYPT_MODE_CBC, $iv);

print "Decrypted string: $decrypted_string";
?>

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

--- End Message ---
--- Begin Message ---
Wow, go away for a few days and holy war breaks out...cool!

Why not one system that supports both without extra work?  The model I'm
thinking of is Google or Yahoo groups(*).  You can access any 'forum'
via a web browser, search, post, reply, etc AND/OR you can subscribe to
any forum and get messages sent to you via email (individual or digest
format).

At work, I sit behind a firewall and web access involves a multi-stop
PITA process so listerservers work well for me there.  At home, forum
access is easier since I can go to the forum site, decide what I want to
read and/or respond to without cluttering up my email client.

Doug

(*) - I am NOT suggesting this forum be configured like Yahoo, the
search function absolutely sucks and I'm not a real fan of the layout,
but the concept of a forum that's a list that's a forum...is what I
like.  For what it's worth, Yahoo has not PHP groups I can find but
there are 33 over at Google with 100 - 1000 members.
_______________________________________________________________________
This e-mail message has been sent by Kollsman, Inc. and is for the use
of the intended recipients only. The message may contain privileged
or confidential information. If you are not the intended recipient
you are hereby notified that any use, distribution or copying of
this communication is strictly prohibited, and you are requested to
delete the e-mail and any attachments and notify the sender immediately.

--- End Message ---
--- Begin Message ---
[snip]
Currently, the universe is the way it is and, many believe, it works just
fine. Why should we do anything at all?
[/snip]

Because we have no control over the existance and operation of the universe.
If we did we would have changed it already. Our profound lack of
understanding of the operation of the universe, even with leaders such as
Bohr, Einstein, Feynman, and others prevent us from being able to exert any
control.

There are several PHP forums out there, just none on php.net. Bandwidth
might be a consideration. Administrative workload might be another (you have
noticed that there really isn't a list mod here -- although I was nominated
for the position last week) and the workload for a forum could be several
orders of magnitude higher, which I know from past experience.

The thing that offended some, Roman, was your attitude in the post, as if
you did not know that already. There are several good PHP based boards out
there and the lack of one on php.net does not indicate any distaste for
forums, and from the absence of a forum we cannot deduce anything at all
(proper logic applied) any more than we can deduce something from your not
owning a television set. The possibilities are too open ended.

Furthermore, if you knew all of the potential replies (which you did not,
even though you claimed to) why even open your e-mail editor (which you did)
which, based on the discourse, we could assume that you have a distaste for?

This thread is useless at this point to PHP and helping people solve their
PHP issues. May we end it here?

--- End Message ---
--- Begin Message ---
On 07 November 2005 00:51, Dan Rossi wrote:

> Hi there just wondering when there may be a php 5.1 release ? I just
> went into the downloads on the php site and the link to RC1 has been
> removed ??

Current Release candidate is 5.1.0RC4,so I guess RC1 was removed as too out of 
date.  Last I saw, target release date was end of this week.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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

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

--- End Message ---
--- Begin Message ---
hi...

a while ago, i saw an app that allowed the user to create a form, based on
various fields, and to setup/create the database schema to create the form.
the app provided the user with predefined fields, as well as allowed the
user to define their own fields in order to create the form.

unfortunately, i can't seem to find this app, or any other app that would
allow me to do this. can anybody point me towards an app that could/would do
this?

thanks

-bruce
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
I wrote a xsl stylesheet to do this.
takes the xml and whips it up, into a standard layout.

Don't believe I mentioned this but I might have at some point.

Register example:
<formData formTitle="Register" action="/" method="post">
        <caption>Thank you for Registering!</caption>
        <fields>
                <field type="hidden"   var="register"              
default="yes"/>
                <field type="text"     title="Login name"          var="name"   
      
required="yes" len="50" maxlength="50"/>
                <field type="password" title="Password"            
var="passwd"       
required="yes" len="50"/>
                <field type="text"     title="E-Mail"              var="email"  
      
required="no"  len="50"/>
                <field type="checkbox" title="Show Email"          var="Show 
Email"   
required="no"  default="yes"/>
                <field type="submit"   title="Register" />
        </fields>
</formData>

On Monday 07 November 2005 12:24 pm, bruce wrote:
> hi...
>
> a while ago, i saw an app that allowed the user to create a form, based on
> various fields, and to setup/create the database schema to create the form.
> the app provided the user with predefined fields, as well as allowed the
> user to define their own fields in order to create the form.
>
> unfortunately, i can't seem to find this app, or any other app that would
> allow me to do this. can anybody point me towards an app that could/would
> do this?
>
> thanks
>
> -bruce
> [EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
Hi there!

File_exists doesn't seem to work with URLs that point to another domain. What to use?

$x = fopen(http://www.stammis.com/getstart.php);
if file_exists($x) ....
....
????

/G
http://www.varupiraten.se/

--- End Message ---
--- Begin Message ---
Gustav Wiberg wrote:
Hi there!

File_exists doesn't seem to work with URLs that point to another domain. What to use?

$x = fopen(http://www.stammis.com/getstart.php);
if file_exists($x) ....

what errors are you getting?
what is $x?

....
???

/G
http://www.varupiraten.se/



--- End Message ---
--- Begin Message ---
[snip]
File_exists doesn't seem to work with URLs that point to another domain. 
What to use?

$x = fopen(http://www.stammis.com/getstart.php);
if file_exists($x) ....
....
????
[/snip]

What version of PHP are you using. With anything less than PHP5 you cannot
use file_exists on anything other than the file system PHP is local to.

All versions of PHP. Explicitly using file:// since PHP 4.3.0

/path/to/file.ext

relative/path/to/file.ext

fileInCwd.ext

C:/path/to/winfile.ext

C:\path\to\winfile.ext

\\smbserver\share\path\to\winfile.ext

file:///path/to/file.ext

file:// is the default wrapper used with PHP and represents the local
filesystem. When a relative path is specified (a path which does not begin
with /, \, \\, or a windows drive letter) the path provided will be applied
against the current working directory. In many cases this is the directory
in which the script resides unless it has been changed. Using the CLI sapi,
this defaults to the directory from which the script was called. 

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

----- Original Message ----- From: "Jay Blanchard" <[EMAIL PROTECTED]> To: "'Gustav Wiberg'" <[EMAIL PROTECTED]>; "PHP General" <[email protected]>
Sent: Monday, November 07, 2005 9:02 PM
Subject: RE: [PHP] FileExists?


[snip]
File_exists doesn't seem to work with URLs that point to another domain.
What to use?

$x = fopen(http://www.stammis.com/getstart.php);
if file_exists($x) ....
....
????
[/snip]

What version of PHP are you using. With anything less than PHP5 you cannot
use file_exists on anything other than the file system PHP is local to.

All versions of PHP. Explicitly using file:// since PHP 4.3.0

/path/to/file.ext

relative/path/to/file.ext

fileInCwd.ext

C:/path/to/winfile.ext

C:\path\to\winfile.ext

\\smbserver\share\path\to\winfile.ext

file:///path/to/file.ext

file:// is the default wrapper used with PHP and represents the local
filesystem. When a relative path is specified (a path which does not begin
with /, \, \\, or a windows drive letter) the path provided will be applied
against the current working directory. In many cases this is the directory
in which the script resides unless it has been changed. Using the CLI sapi,
this defaults to the directory from which the script was called.

Hi

I'm using PHP 4.3.0.

Thanx! :-)

/G
http://www.varupiraten.se/

--- End Message ---

Reply via email to