help in a php code

Completed Posted Mar 27, 2015 Paid on delivery
Completed

Hi

I'm not good in php I need someone to help me in an auth file,

I've a link protected with a header("HTTP/1.0 200 OK") [url removed, login to view] I'm using:

===================================

$get = print_r($_GET, true);

$token = $_GET["token"];

if(!$token || !strlen($token)) {

header('HTTP/1.0 403 Forbidden');

error_log("No token provided", 4);

die();

}

$tokens = array();

$contents = explode("\n", file_get_contents("[url removed, login to view]"));

foreach($contents as $line) {

if(strlen($line) > 3) {

$parts = explode(":", $line);

$tokens[$parts[1]] = $parts[0];

}

}

if($tokens[$token]) {

header("HTTP/1.0 200 OK");

header("X-UserId: ".$tokens[$token]."\r\n");

header("X-Unique: true\r\n"); // Turn this on to protect from multiscreen

} else {

header('HTTP/1.0 403 Forbidden');

}

===================================

and [url removed, login to view]:

==================================

user1:fKg5sw0Dhy

==================================

the problem is my token fKg5sw0Dhy is visible, so I want to edit my php file to hide my token with a combination of md5, expiration after xx seconds and user ip. something like:

=========================

date_default_timezone_set('UTC');

$ip = $_SERVER['REMOTE_ADDR'] = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER["REMOTE_ADDR"];;

$mysecretkey = "fKg5sw0Dhy";

$expiry = strtotime("+50 seconds");

$b64 = base64_encode(md5($mysecretkey.$expiry.$ip,true));

$b64u = rtrim(str_replace(array('+','/'),array('-','_'),$b64),'=');

echo "[url removed, login to view]$b64u\n";

=========================

it's a 5min's task for any php coder, I'll consider the lower bid

PHP

Project ID: #7385193

About the project

7 proposals Remote project Active Mar 31, 2015

Awarded to:

usamae

A proposal has not yet been provided

$11 USD / hour
(13 Reviews)
4.1

7 freelancers are bidding on average $8/hour for this job

Meagan26

php expert please message me so we can get started and have it done i am just doing it for the review so please message me and we can discuss price u want to pay Hello, I have read through your project and I am i More

$8 USD / hour
(77 Reviews)
6.0
prashushinde9

========Please Don't award this project to us without discussing this project in detail============ Hi, I (Myself a senior PHP, ASP.NET programmer using C# and VB) have a team having experience of more than 10 years i More

$15 USD / hour
(25 Reviews)
5.9
Carlosipss

Since I have worked possible solution for keeping it up Puedo brindar la solución del problema tengo experiencia con php sobre todo orientado al servidor El tiempo que oferto lo puedo cumplir perfectamente . salud More

$5 USD / hour
(1 Review)
2.0
gomatt101

I can help you now with what you need. start a chat with me and i will do it as soon as you like me to start..

$2 USD / hour
(1 Review)
1.5