If you have an HTML form select field xyz with possible values
apple, banana, and cucumber, anyone can easily set xyz to an
arbitrary value.
To prevent this, I create a hidden field code[xyz] with value:
base64_encode(mcrypt_ecb(
MCRYPT_RIJNDAEL_256,$salt,apple,banana,cucumber,MCRYPT_ENCRYPT));
I thought this code:
$enc=mcrypt_ecb(MCRYPT_RIJNDAEL_256,salt123,encrypt_me,MCRYPT_ENCRYPT);
$dec=mcrypt_ecb(MCRYPT_RIJNDAEL_256,salt123,$enc,MCRYPT_DECRYPT);
echo $dec;
would yield encrypt_me. The actual result is
encrypt_me.. (bunch of extra dots).
Why, and how do I fix
Many programming languages (including Perl, Ruby, and PHP) support hashes:
$color['apple'] = 'red';
$color['ruby'] = 'red';
$type['apple'] = 'fruit';
$type['ruby'] = 'gem';
This quickly lets me find the color or type of a given item.
In this sense, color() and type() are like mathematical
I'm migrating a website from one server to another, and my file paths
and dbs have changed.
For example /a/b/c/foo.txt on the old machine is at /x/y/z/foo.txt on
the new machine. The MySQL db foo on the old machine is bar on the
new machine.
Can I intercept fopen() and mysql_connect() so that
I'm trying to implement what I think is called a virtual method: my
abstract parent class ParentClass defines a method xxx that calls
method yyy, but yyy is defined only in ParentClass's children.
I can't get this to work (PHP5.0.4). Sample code:
=== start sample code ===
abstract class
If I define a function like this:
function foo ($x, $y, $z) {}
and then call: foo(1,2,bar);
is there a function I can call inside foo() that yields this hash:
{x = 1, y = 2, z = bar}
In other words, gives me the values *and names* of the arguments to foo?
func_get_args just yields the
I'm trying to write a sendmail proxy in PHP: people would connect to
my proxy running on port 25 (via xinetd), and the proxy would connect
to sendmail (tweaked to run on port 26).
Currently, the proxy is 100% transparent, but I plan to tweak it to
intercept sendmail's replies and substitute its
7 matches
Mail list logo