[PHP] mcrypt

2002-07-30 Thread Purushotham Komaravolu

Hello, 
  I am getting some odd errors trying to get an encrypt/decrypt process to 
  work. Looking at the manual examples and some other literature, I have tried 
  the two approaches listed below. For each, I get a sometimes-works, 
  sometimes fails result. The manual entry has a string of user notes with 
  problem like mine, but I still have problems. 



  Server API Apache 



  mcrypt 
mcrypt support enabled 
version 2.4.x 
Supported ciphers twofish rijndael-128 rijndael-192 rijndael-256 
  saferplus rc2 xtea serpent safer-sk64 safer-sk128 cast-256 loki97 gost 
  threeway cast-128 des tripledes enigma arcfour panama wake 
Supported modes ofb cfb nofb cbc ecb stream 


  --] 



  The first attempt used the following code: 


  --> 
  input:$inputencrypted:$encrypted_datadecrypted:$decrypted_da 
  ta"; 
  ?> 
  --] 


  This resulted, at first, in "key: this is a secret key 
  input:Let us meet at 9 o'clock at the secret place. 
  encrypted:\ºþêTÏ'áz(v¹FýaõFËU³æç SäÇÚÖzßù5Qì<±_T-:Í 
  decrypted:Let us meet at 9 o'clock at the secret place." 


  BUT after I refreshed/reloaded a couple of times, I got this: "Warning: 
  mcrypt_generic_init: Memory allocation error in 
  /home/pndrdrm001/www/administrator/crypt.php on line 64 


  Warning: 1 is not a valid MCrypt resource in 
  /home/pndrdrm001/www/administrator/crypt.php on line 65 


  Warning: 1 is not a valid MCrypt resource in 
  /home/pndrdrm001/www/administrator/crypt.php on line 66 


  Warning: 1 is not a valid MCrypt resource in 
  /home/pndrdrm001/www/administrator/crypt.php on line 67 
  key: this is a secret key 
  input:Let us meet at 9 o'clock at the secret place. 
  encrypted: 
  decrypted: " 


  There were no changes to the code. 



  The second try used the following: 


  In file 1, the functions: 
  --> 
   
  --] 
  and in file 2, the main page: 
  --> 
  input:$inputencrypted:$encrypteddecrypted:$decrypted" 
  ; 



  ?> 
  --] 


  This resulted in "key: key 
  input:test 
  encrypted: &foUÝø§ª~RM¡°Kz à¼O¼¿rw"x@nÉ 
  decrypted:test " the first time, but then I got "Fatal error: generic_init 
  failed in /home/pndrdrm001/www/administrator/cryption.php on line 9" on the 
  second refresh. 



  Is there a missing call to free resources, or something? What can be done? 


  Thanks! 
  Regards,

  Puru

 




Re: [PHP] mcrypt

2002-07-30 Thread Purushotham Komaravolu

Hi,
 Thanks for the prompt answer. But I am still getting the same error.

/
original: meet at secret place
encrypted: d40d72f1b224b9bf86a7dbc52402c1d02a5cf90adb9050f0

Warning: mcrypt_generic_init: Memory allocation error in
/mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h
tml/time/cancelsubscription/new.php on line 29

Warning: mdecrypt_generic(): 2 is not a valid MCrypt resource in
/mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h
tml/time/cancelsubscription/new.php on line 30

Warning: mcrypt_generic_end(): 2 is not a valid MCrypt resource in
/mount/marsellus/gwolfe/puruclient/staging/vhosts/partnersdev.sec.yaga.com/h
tml/time/cancelsubscription/new.php on line 31
decrypted:


///


Regards,

Purushotham Komaravolu
Software Engineer
Yaga, Inc. - "advanced payment services"
Direct: 415-901-7343
Fax: 415-901-1586
http://www.yaga.com



- Original Message -
From: "Tech Support" <[EMAIL PROTECTED]>
To: "Purushotham Komaravolu" <[EMAIL PROTECTED]>
Sent: Tuesday, July 30, 2002 11:34 AM
Subject: Re: [PHP] mcrypt


> Rather than tease you with hints I'll give you some working code ;-)
>
> Documentation for practical usage of mcrypt is weak. I agree.
>
>  // crypto.inc
> $key = "secret key crap";
>
> function hex2bin($data)
> {
> $len = strlen($data);
> return pack("H" . $len, $data);
> }
>
> function encrypt($string, $key)
> {
>  // version 2.4.x of lib mcrypt
>  $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
>  $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
>  mcrypt_generic_init ($td, $key, $iv);
>  $crypted = mcrypt_generic ($td, $string);
>  mcrypt_generic_end ($td);
>  return bin2hex($crypted);
> }
>
> function decrypt($string, $key)
> {
>  //version 2.4.x of lib mcrypt
>  $string = hex2bin($string);
>  $td = mcrypt_module_open (MCRYPT_TripleDES, "", MCRYPT_MODE_ECB, "");
>  $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
>  mcrypt_generic_init ($td, $key, $iv);
>  $decrypted = mdecrypt_generic ($td, $string);
>  mcrypt_generic_end ($td);
>  return trim($decrypted);
> }
> ?>
>
>
> usage:
>  include ("path/to/crypto.inc");
> $secret = "meet at secret place";
> $encrypted = encrypt($secret, $key);
> print "original: " . $secret . "";
> print "encrypted: " . $encrypted . "";
> $decrypted = decrypt($encrypted, $key);
> print "decrypted: " . $decrypted . "";
> ?>
>
> Note: if you are encrypting really secret crap like credit card numbers or
> something of that nature then NEVER include the key anywhere in your code.
> Make a form where you have to type it in or something in order to display
> the results.
>
>
> Jim Grill
> Support
> Web-1 Hosting
> http://www.web-1hosting.net
> - Original Message -
> From: "Purushotham Komaravolu" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Tuesday, July 30, 2002 12:52 PM
> Subject: [PHP] mcrypt
>
>
> Hello,
>   I am getting some odd errors trying to get an encrypt/decrypt
> process to
>   work. Looking at the manual examples and some other literature, I
have
> tried
>   the two approaches listed below. For each, I get a sometimes-works,
>   sometimes fails result. The manual entry has a string of user notes
> with
>   problem like mine, but I still have problems.
>
>
>
>   Server API Apache
>
>
>
>   mcrypt
> mcrypt support enabled
> version 2.4.x
> Supported ciphers twofish rijndael-128 rijndael-192
rijndael-256
>   saferplus rc2 xtea serpent safer-sk64 safer-sk128 cast-256 loki97
gost
>   threeway cast-128 des tripledes enigma arcfour panama wake
> Supported modes ofb cfb nofb cbc ecb stream
>
>
>   --]
>
>
>
>   The first attempt used the following code:
>
>
>   -->
>  $key = "this is a secret key";
>   $input = "Let us meet at 9 o'clock at the secret place.";
>
>
>   $td = mcrypt_module_open ('tripledes', '', 'ecb', '');
>   $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size ($td),
> MCRYPT_RAND);
>   mcrypt_generic_init ($td, $key, $iv);
>   $encrypted_data = mcrypt_generic ($td, $input);
&

[PHP] server to server post

2002-08-02 Thread Purushotham Komaravolu

Hi all,
I am new to php, can anybody pls help me out with my query?
 How to do a server to server post in php, without client knowing about it.
Thanks
Puru



[PHP] server to server post

2002-08-02 Thread Purushotham Komaravolu



Hi all,
I am new to php, can anybody pls help me out with my query?
 How to do a server to server post in php, without client knowing about it.
Thanks
Puru



[PHP] static not working as expected

2002-06-18 Thread Purushotham Komaravolu

counter;
print "\n";
}
}


class SingletonCounter {
static $m_instance = NULL;  // throwing error here

function Instance()
{
if (self::$m_instance == NULL) {
self::$m_instance = new Counter();
}
return self::$m_instance;
}
}

SingletonCounter::Instance()->increment_and_print();
SingletonCounter::Instance()->increment_and_print();
SingletonCounter::Instance()->increment_and_print();

?>


is throwing the following error
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or 
`'}'' in /singleton.php on line 15






[PHP] Re: [PHP-DEV] static not working as expected

2002-06-18 Thread Purushotham Komaravolu

Thanks for your prompt answer.If that's the case then, how do I define a
singleton class?
Regards,
Puru

- Original Message -
From: "Markus Fischer" <[EMAIL PROTECTED]>
To: "Purushotham Komaravolu" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 10:58 AM
Subject: Re: [PHP-DEV] static not working as expected


> 'statis' is ONLY used inside functions. You need the 'var'
> keyword to define class property. This is true for ZE1, I
> can't tell if ZE2 has static class properties, anyone else?
>
> - Markus
>
> On Tue, Jun 18, 2002 at 10:42:43AM -0700, Purushotham Komaravolu wrote :
> >  >
> > class Counter {
> > var $counter = 0;
> >
> > function increment_and_print()
> > {
> > print ++$this->counter;
> > print "\n";
> > }
> > }
> >
> >
> > class SingletonCounter {
> > static $m_instance = NULL;  // throwing error here
> >
> > function Instance()
> > {
> > if (self::$m_instance == NULL) {
> > self::$m_instance = new Counter();
> > }
> > return self::$m_instance;
> > }
> > }
> >
> > SingletonCounter::Instance()->increment_and_print();
> > SingletonCounter::Instance()->increment_and_print();
> > SingletonCounter::Instance()->increment_and_print();
> >
> > ?>
> >
> >
> > is throwing the following error
> > Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or
`T_VAR' or `'}'' in /singleton.php on line 15
>
> --
> PHP Development 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




Re: [PHP] synchronize functions

2002-06-18 Thread Purushotham Komaravolu

something similar to the synchronization of functions in java. Onle one
thread should be able to access that method. I guess you can use semaphores.
Even I am trying to find out how to do it in any other fashion.
Thanks in advance,

regards,
Puru
- Original Message -
From: "Analysis & Solutions" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Tuesday, June 18, 2002 1:36 PM
Subject: Re: [PHP] synchronize functions


> Hi Micheael:
>
> On Tue, Jun 18, 2002 at 06:48:18PM +0200, [EMAIL PROTECTED] wrote:
> >
> > Any idea, how to synchronize functions in php???
>
> What do you mean?
>
> --Dan
>
> --
>PHP classes that make web design easier
> SQL Solution  |   Layout Solution   |  Form Solution
> sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
>
> --
> 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




Re: [PHP] include() question...

2002-06-20 Thread Purushotham Komaravolu

use header
ob_start()
$temp = "website.php?var=".$var;
header ("Location: $temp");


Puru
- Original Message - 
From: "Phil Schwarzmann" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 20, 2002 4:31 PM
Subject: [PHP] include() question...


> Okay, let's say I want to send a user to a certain webpage...
> 
> usually I would use...
> 
> include("website.php");
> 
> but, if i want to send a user to a website along with a variable like...
> 
> $temp = "website.php?var=".$var;
> include($temp);
> 
> ...this doesn't work.  
> 
> any suggestions??
> 
> THANKS!!
> 

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




[PHP] Application level logging module

2002-06-21 Thread Purushotham Komaravolu

Hi all,
Did anyone work on application level logging module ? Please let me know the 
correct architecture, since I am not able to create a singleton per webserver.
Thanks
Regards,
Puru



[PHP] singleton feature

2002-06-24 Thread Purushotham Komaravolu


Hi ,
  I have a small suggestion. I guess it is a good feature to
have a provision to have a Singleton class per webserver instance. This is
especially useful for maintain user defined connection pools, loggers etc.
Thanks
Regards,
Puru




[PHP] Re: [PHP-DEV] singleton feature

2002-06-24 Thread Purushotham Komaravolu

Singleton means only one instance.. i.e. instance of a class per
webserver... all application scripts should talk only to that same instance
irrespective of the request.
p

- Original Message -
From: "Alexander Skwar" <[EMAIL PROTECTED]>
To: "Purushotham Komaravolu" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, June 24, 2002 2:53 PM
Subject: Re: [PHP-DEV] singleton feature


So sprach Purushotham Komaravolu am 2002-06-24 um 11:39:36 -0700 :
>
> Hi ,
>   I have a small suggestion. I guess it is a good feature to
> have a provision to have a Singleton class per webserver instance. This is
> especially useful for maintain user defined connection pools, loggers etc.

Uhm, what's a "Singleton class"?

Alexander Skwar
--
How to quote: http://learn.to/quote (german) http://quote.6x.to (english)
Homepage: http://www.iso-top.de  |Jabber: [EMAIL PROTECTED]
   iso-top.de - Die günstige Art an Linux Distributionen zu kommen
   Uptime: 1 day 11 hours 5 minutes

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




Re: [PHP] PHP with online cedit card processing

2002-06-28 Thread Purushotham Komaravolu

have  look at www.yaga.com


- Original Message - 
From: "Analysis & Solutions" <[EMAIL PROTECTED]>
To: "PHP List" <[EMAIL PROTECTED]>
Sent: Friday, June 28, 2002 10:12 PM
Subject: Re: [PHP] PHP with online cedit card processing


> Howdy Boys and Girls:
> 
> On Fri, Jun 28, 2002 at 03:26:01PM -0400, Mark McCulligh wrote:
> >
> > I like Versign but the cost is very high.  
> 
> I use Verisign through Wells Fargo.  Signing up through WF gets a 
> reduced rate.  $45/mo, $0.16/trans (incl auth fee).  Discount rate 
> fluctuates depending on the average charge during the month.
> 
> There was a better deal when I was doing the research, but they changed
> it when I signed up.  Kind of lame.  But, it works.
> 
> --Dan
> 
> -- 
>PHP classes that make web design easier
> SQL Solution  |   Layout Solution   |  Form Solution
> sqlsolution.info  | layoutsolution.info |  formsolution.info
>  T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
>  4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409
> 
> -- 
> 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