This may be easy but I cannot seem to get it.. Heres all of the code:
function logRequest($currIP){
include("include/opendb.php");
$gets = $_SERVER['QUERY_STRING'];
$posts = http_build_query($_POST);
$ref = $_SERVER['HTTP_REFERER'];
$agent = $_SERVER['HTTP_USER_AGENT'];
$date = date('Y-m-d H:i:s');
$rlookup = $_SERVER['REMOTE_HOST'];
$requestType = $_SERVER['REQUEST_METHOD'];
$languageset = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
$key = "GSICHECKPOINT1";
$combinedVars = array("combinded" ,$date, $currIP, $ref, $agent, $rlookup, $requestType, $languageset, $gets, $posts);
$array[0] = $encryptID = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($key), $combinedVars, MCRYPT_MODE_CBC, md5(md5($key))));
$array[1] = $decryptID = rtrim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, md5($key), base64_decode($encryptID), MCRYPT_MODE_CBC, md5(md5($key))), "\0");
$query = "INSERT INTO loadAttempts (date, IP, ref, useragent, dnslookup, requestType, language, gets, posts) VALUES ('$date', '$currIP', '$ref', '$agent', '$rlookup','$requestType', '$languageset', '$gets', '$posts')";
$result = mysql_query($query);
return $array;
}
I want to return both the $encryptID and $decryptID from the function, so I put them into an array. (was this wrong?)
Then I am trying to submit these returned values into another function using this code:
if(in_array($_SERVER['REMOTE_ADDR'], $blockIP)){
// Log attempt to get here.
list($encryptID, $decryptID) = logRequest($currIP);
// Send user to blockpage.
blockPage($encryptID, $decryptID);
}else{
blah blah blah
My question is, when I am pulling these returned values, the blockPage displayed "Array" for the $decryptID and I don't know where I messed up pulling these values out of the function. How do I show each item inside of the $decrpytID array when its already out of the creator function?
Thank you!