RE: [PHP] Is it a mysql AND/OR php BUG???

2001-09-12 Thread Mark Roedel

> -Original Message-
> From: Augusto Cesar Castoldi [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, September 12, 2001 9:46 AM
> To: Schill, Johannes
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Is it a mysql AND/OR php BUG???
> 
> 
> the function isn't decoding right.
> 
> > > function decode($decode_str, $pass_str)
> > > {
> > >   $encode_str = addslashes($encode_str);
> > >   $sql="select decode(\"$decode_str\",
> > > \"$pass_str\")";
> > >   echo htmlspecialchars($sql)."";
> > >   $data = mysql_query($sql) or die ("Erro crypt
> > 2.");
> > >   $row = mysql_fetch_row($data);
> > >   return $row[0];
> > > }

Should you maybe be using $decode_str instead of $encode_str in the
first line of this function?


---
Mark Roedel |  "Blessed is he who has learned to laugh
Systems Programmer  |   at himself, for he shall never cease
LeTourneau University   |   to be entertained."
Longview, Texas, USA|   -- John Powell 

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Is it a mysql AND/OR php BUG???

2001-09-12 Thread Augusto Cesar Castoldi

the function isn't decoding right.

regards,

Augusto


 --- "Schill, Johannes" <[EMAIL PROTECTED]>
escreveu: > Please include your error message.
> 
> /Johannes
> 
> - Original Message -
> From: "Augusto Cesar Castoldi"
> <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 12, 2001 4:10 PM
> Subject: [PHP] Is it a mysql AND/OR php BUG???
> 
> 
> > Please, look this little script, and what he
> prints.
> > Am I doing something wrong or I "found" a bug??
> >
> > thanks a lot.
> >
> >  > function encode($encode_str, $pass_str)
> > {
> >   $encode_str = addslashes($encode_str);
> >   $sql = "select encode(\"$encode_str\",
> > \"$pass_str\")";
> >   echo htmlspecialchars($sql)."";
> >   $data = mysql_query($sql) or die ("Erro crypt
> 1.");
> >   $row = mysql_fetch_row($data);
> >   return $row[0];
> > }
> > function decode($decode_str, $pass_str)
> > {
> >   $encode_str = addslashes($encode_str);
> >   $sql="select decode(\"$decode_str\",
> > \"$pass_str\")";
> >   echo htmlspecialchars($sql)."";
> >   $data = mysql_query($sql) or die ("Erro crypt
> 2.");
> >   $row = mysql_fetch_row($data);
> >   return $row[0];
> > }
> >
> >
> > //$string = "as\"df asd <>>asd > asd  reaais
> R\$200.00
> > fa''< < > >  \"\" \$sdljh;"; // WORK
> >   $string = "as\"df asd <>> asd > asd  reaais
> > R\$200.00 fa''< < > >  \"\" \$sdljh"; // DON'T
> WORK
> >
> > $key = "12345679";
> > echo "1 -
> >
>
string=".htmlspecialchars($string)."chave=$key";
> > $string = encode($string, $key);
> > echo "2 -
> >
>
string_encoded=".htmlspecialchars($string)."chave=$key";
> > $string = decode($string, $key);
> > echo "3 -
> >
>
string_decoded=".htmlspecialchars($string)."chave=$key";
> > ?>
> >
> >
>

> ___
> > Yahoo! GeoCities
> > Tenha seu lugar na Web. Construa hoje mesmo sua
> home page no Yahoo!
> GeoCities. É fácil e grátis!
> > http://br.geocities.yahoo.com/
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
>  

___
Yahoo! GeoCities
Tenha seu lugar na Web. Construa hoje mesmo sua home page no Yahoo! GeoCities. É fácil 
e grátis!
http://br.geocities.yahoo.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]