thanks for the reply.
i will try that out thanks.
but i have been testing this code i have .
i notice i set the sessions fine but in my if else statement that is nested into a foreach statement the else statement is being executed and thats why it wasnt working. i commented the else statement out and it works fine. but when i delete the file from the directory the session will is still set.
Heres my code. both the if and the else runs making all the sessions not set at all.
in session.php:
/**
* Check the download link
*
**/
function checkDownloadLink($resumeid, $user) {
//get the filename from the directory.
$files = $this->getFiles("resumes/docs");
foreach ($files as $file){
if($user == $this->get_usersname($file[name]) && $resumeid == $this->get_usersresumeid($file[name])){
//set the session to show the download link
$_SESSION['download'.$resumeid] = 1;
//testing purposes
echo $_SESSION['download'.$resumeid];
}
//unset if the user or id isnt in the filename.
//else{
// unset($_SESSION['download'.$resumeid]);
// }
}
}
i have more code if you need to see the other functions but it works fine i am just having a problem where i am unsetting the session if the if statement didnt go through.
and the echo statement works. meaning when there is one file it only echos 1 one time. if there are two files containg the user and id the echo spits out two 1's. even when i have the else statement not commented.
Thanks again.