
I need some PHP help
- or -
Post a project like this4276
£25(approx. $34)
- Posted:
- Proposals: 4
- Remote
- #461258
- Completed
Description
Experience Level: Intermediate
Estimated project duration: 1 day or less
General information for the website: Offers Platform
Num. of web pages/modules: 1
Description of every page/module: I have been provided with these instructions and have shown what I've managed to do so far - but am getting stuck due to my basic php ability, so any help greatly appreciated! Thank you in advance!:
The instructions:
First you need to concatenate the current date/time and your campaign identifier together in a pipe separated string. The current date/time (17/03/2014 11:05:31 in this worked example) must be in the format dd/MM/yyyy and your campaign identifier is always 1234 which gives you the following string:
17/03/2014 11:05:31|1234
This string is then encrypted using the encryption key 1234567890123456 with the following encryption function (I have changed the key for security):
<?php
function Encrypt($key, $text)
{
$text = utf8_encode ($text);
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
$iv = $key;
$ks = 256;
$key = $key;
$text_add = strlen($text)%16;
for($i=$text_add; $i<16; $i++)
{
$text .= chr(16-$text_add);
}
mcrypt_generic_init($td, $key, $iv);
$encrypted = mcrypt_generic($td, $text);
mcrypt_generic_deinit($td);
$hexencrypted = bin2hex($encrypted);
$text_add = 32 - strlen($hexencrypted)%32;
if($text_add != 32)
{
for($i=0; $i
This function should return the following encrypted string:
1234567890123456789012345678901234567890123456789012345678901234 (I have changed for security)
This data then needs to be posted to the url https://www.highstreetsaving.co.uk/OPAGU/FLXHS/Login within a field named CT.
For example:
As the datestamp expires the link you will need to pass the current date/time to actually gain access to the site.
Here is what I have managed to do so far - but my very basic knowledge of php means I'm getting stuck, so any help greatly appreciated!
using this to test the string is correct
function Encrypt($key, $text)
{
$text = utf8_encode ($text);
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
$iv = $key;
$ks = 256;
$key = $key;
$text_add = strlen($text)%16;
for($i=$text_add; $i<16; $i++)
{
$text .= chr(16-$text_add);
}
mcrypt_generic_init($td, $key, $iv);
$encrypted = mcrypt_generic($td, $text);
mcrypt_generic_deinit($td);
$hexencrypted = bin2hex($encrypted);
$text_add = 32 - strlen($hexencrypted)%32;
if($text_add != 32)
{
for($i=0; $i
<input type="hidden" id="CT" name="CT" value="
Description of requirements/features: I need to make this code work
CMS and Admin requirements: shouldn't be any
Extra notes: Please ask any questions, but hopefully this is very straightforward
Num. of web pages/modules: 1
Description of every page/module: I have been provided with these instructions and have shown what I've managed to do so far - but am getting stuck due to my basic php ability, so any help greatly appreciated! Thank you in advance!:
The instructions:
First you need to concatenate the current date/time and your campaign identifier together in a pipe separated string. The current date/time (17/03/2014 11:05:31 in this worked example) must be in the format dd/MM/yyyy and your campaign identifier is always 1234 which gives you the following string:
17/03/2014 11:05:31|1234
This string is then encrypted using the encryption key 1234567890123456 with the following encryption function (I have changed the key for security):
<?php
function Encrypt($key, $text)
{
$text = utf8_encode ($text);
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
$iv = $key;
$ks = 256;
$key = $key;
$text_add = strlen($text)%16;
for($i=$text_add; $i<16; $i++)
{
$text .= chr(16-$text_add);
}
mcrypt_generic_init($td, $key, $iv);
$encrypted = mcrypt_generic($td, $text);
mcrypt_generic_deinit($td);
$hexencrypted = bin2hex($encrypted);
$text_add = 32 - strlen($hexencrypted)%32;
if($text_add != 32)
{
for($i=0; $i
This function should return the following encrypted string:
1234567890123456789012345678901234567890123456789012345678901234 (I have changed for security)
This data then needs to be posted to the url https://www.highstreetsaving.co.uk/OPAGU/FLXHS/Login within a field named CT.
For example:
As the datestamp expires the link you will need to pass the current date/time to actually gain access to the site.
Here is what I have managed to do so far - but my very basic knowledge of php means I'm getting stuck, so any help greatly appreciated!
using this to test the string is correct
function Encrypt($key, $text)
{
$text = utf8_encode ($text);
$td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_CBC, '');
$iv = $key;
$ks = 256;
$key = $key;
$text_add = strlen($text)%16;
for($i=$text_add; $i<16; $i++)
{
$text .= chr(16-$text_add);
}
mcrypt_generic_init($td, $key, $iv);
$encrypted = mcrypt_generic($td, $text);
mcrypt_generic_deinit($td);
$hexencrypted = bin2hex($encrypted);
$text_add = 32 - strlen($hexencrypted)%32;
if($text_add != 32)
{
for($i=0; $i
<input type="hidden" id="CT" name="CT" value="
Description of requirements/features: I need to make this code work
CMS and Admin requirements: shouldn't be any
Extra notes: Please ask any questions, but hopefully this is very straightforward
Paraag A.
100% (22)Projects Completed
27
Freelancers worked with
26
Projects awarded
61%
Last project
12 Nov 2014
United Kingdom
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies