A PHP utility function

Completado Publicado Jul 30, 2011 Pagado a la entrega
Completado Pagado a la entrega

garbleAndForward ($_POST, $destination)

This function will receive a typical $_POST array (from the web server) and a URL to forward the data to. You can use cUrl to forward the data, or just open a socket and send it if you prefer.

A static array called garbleRules will determine what to do with each of the fields in the $_POST array. The options are:

- remove => Just don't forward this to the destination

- garble-email => The value is an email address. It needs to be replaced with a different one (rules follow)

- garble-string => The value is an string. It needs to be replaced with a different one (rules follow)

All other fields NOT found in the configuration array are to be forwarded verbatim to the destination URL.

Rules for email addresses:

There will be a directory called /var/email_conversion/

When an email address that has never been processed before is requested for replacement, you generate a random string, and create a file called

/var/email_conversion/original_email (such as /var/email_conversion/name@[login to view URL])

that file will contain exactly one line that is the random replacement create before.

If the email address had already been processed, you just return the contents of that file, so each email address gets always the same replacement.

To generate the replacement string:

- signs are to be left where they are

- numbers are replaced by numbers

- uppercase letters are replaced by uppercase letters

- lowercase letters are replaced by lowercase letters

- the TLD part of the domain is not changed

For example, for this email address

MyEmail965@[login to view URL]

a valid transformation would be

XaJxaoe128@[login to view URL]

Rules for strings:

The first and last characters are left intact. The rest are transformed as follows:

- signs are to be left where they are

- All others are shuffled (moved in order), for example

Xabcdefg-hijklmZ

could be replaced by

Xfhicema-dbkljgZ

*

You also need to provide some unit tests, for example create some test $_POST arrays (hardcoded), and pass them to your function, to make sure they are transformed OK.

PHP

Nº del proyecto: #3477044

Sobre el proyecto

11 propuestas Proyecto remoto Activo Aug 1, 2011

Adjudicado a:

progwriter

See private message.

$51 USD en 1 día
(564 comentarios)
7.6

11 freelancers están ofertando un promedio de $76 por este trabajo

s17

See private message.

$76.5 USD en 1 día
(334 comentarios)
6.5
toinnisfreesl

See private message.

$42.5 USD en 1 día
(65 comentarios)
5.8
paulhutchnz

See private message.

$85 USD en 1 día
(68 comentarios)
5.1
whiteshadow

See private message.

$68 USD en 1 día
(18 comentarios)
4.6
freelancebritvw

See private message.

$84.99 USD en 1 día
(10 comentarios)
3.4
friendlytec

See private message.

$182.75 USD en 1 día
(3 comentarios)
3.3
OlegD

See private message.

$34 USD en 1 día
(10 comentarios)
2.8
UFS

See private message.

$84.15 USD en 1 día
(11 comentarios)
3.8
malaimovw

See private message.

$42.5 USD en 1 día
(0 comentarios)
0.0
alienaffili

See private message.

$85 USD en 1 día
(0 comentarios)
0.0